mirror of
https://github.com/etlegacy/Update-Installer.git
synced 2025-02-17 00:41:11 +00:00
Build the updater with -Wconversion and fix several issues encountered in the process
This commit is contained in:
parent
4897f2f8ed
commit
3b1452cefe
6 changed files with 12 additions and 9 deletions
|
@ -4,7 +4,7 @@ add_subdirectory(tests)
|
|||
find_package(Threads REQUIRED)
|
||||
|
||||
if (UNIX)
|
||||
add_definitions(-Wall -Werror)
|
||||
add_definitions(-Wall -Werror -Wconversion)
|
||||
endif()
|
||||
|
||||
include(UsePkgConfig)
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
#include <sstream>
|
||||
#include <stdlib.h>
|
||||
|
||||
inline std::string intToStr(int i)
|
||||
template <class T>
|
||||
inline std::string intToStr(T i)
|
||||
{
|
||||
std::stringstream stream;
|
||||
stream << i;
|
||||
|
|
|
@ -13,7 +13,7 @@ UpdateInstaller::UpdateInstaller()
|
|||
{
|
||||
}
|
||||
|
||||
void UpdateInstaller::setWaitPid(long long pid)
|
||||
void UpdateInstaller::setWaitPid(PLATFORM_PID pid)
|
||||
{
|
||||
m_waitPid = pid;
|
||||
}
|
||||
|
@ -228,7 +228,8 @@ void UpdateInstaller::installFiles()
|
|||
++filesInstalled;
|
||||
if (m_observer)
|
||||
{
|
||||
m_observer->updateProgress(static_cast<float>(filesInstalled) / m_script->filesToInstall().size() * 100);
|
||||
double percentage = filesInstalled / (m_script->filesToInstall().size() * 100.0);
|
||||
m_observer->updateProgress(static_cast<int>(percentage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "Platform.h"
|
||||
#include "UpdateScript.h"
|
||||
|
||||
#include <list>
|
||||
|
@ -24,7 +25,7 @@ class UpdateInstaller
|
|||
void setBackupDir(const std::string& path);
|
||||
void setMode(Mode mode);
|
||||
void setScript(UpdateScript* script);
|
||||
void setWaitPid(long long pid);
|
||||
void setWaitPid(PLATFORM_PID pid);
|
||||
|
||||
void setObserver(UpdateObserver* observer);
|
||||
|
||||
|
@ -49,7 +50,7 @@ class UpdateInstaller
|
|||
std::string m_installDir;
|
||||
std::string m_packageDir;
|
||||
std::string m_backupDir;
|
||||
long long m_waitPid;
|
||||
PLATFORM_PID m_waitPid;
|
||||
UpdateScript* m_script;
|
||||
UpdateObserver* m_observer;
|
||||
std::map<std::string,std::string> m_backups;
|
||||
|
|
|
@ -78,7 +78,7 @@ void UpdaterOptions::parseOldFormatArgs(int argc, char** argv)
|
|||
}
|
||||
else if (key == "PID")
|
||||
{
|
||||
waitPid = atoll(value.c_str());
|
||||
waitPid = static_cast<PLATFORM_PID>(atoll(value.c_str()));
|
||||
}
|
||||
else if (key == "--main")
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ void UpdaterOptions::parse(int argc, char** argv)
|
|||
}
|
||||
if (parser.getValue("wait"))
|
||||
{
|
||||
waitPid = atoll(parser.getValue("wait"));
|
||||
waitPid = static_cast<PLATFORM_PID>(atoll(parser.getValue("wait")));
|
||||
}
|
||||
|
||||
if (installDir.empty())
|
||||
|
|
|
@ -13,7 +13,7 @@ class UpdaterOptions
|
|||
std::string installDir;
|
||||
std::string packageDir;
|
||||
std::string scriptPath;
|
||||
long long waitPid;
|
||||
PLATFORM_PID waitPid;
|
||||
std::string logFile;
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue