Merge branch 'master' of ssh://gitweb/git/desktop/standalone-updater

This commit is contained in:
Robert Knight 2011-08-24 11:25:40 +01:00
commit d922fc3f7a
7 changed files with 16 additions and 8 deletions

View file

@ -3,6 +3,10 @@ add_subdirectory(tests)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
if (UNIX)
add_definitions(-Wall -Werror)
endif()
include(UsePkgConfig) include(UsePkgConfig)
pkgconfig(gtk+-2.0 GTK2_INCLUDE_DIR GTK2_LINK_DIR GTK2_LINK_FLAGS GTK2_CFLAGS) pkgconfig(gtk+-2.0 GTK2_INCLUDE_DIR GTK2_LINK_DIR GTK2_LINK_FLAGS GTK2_CFLAGS)

View file

@ -45,7 +45,7 @@ int ProcessUtils::runSync(const std::string& executable,
int ProcessUtils::runSyncUnix(const std::string& executable, int ProcessUtils::runSyncUnix(const std::string& executable,
const std::list<std::string>& args) const std::list<std::string>& args)
{ {
int pid = runAsyncUnix(executable,args); PLATFORM_PID pid = runAsyncUnix(executable,args);
int status = 0; int status = 0;
waitpid(pid,&status,0); waitpid(pid,&status,0);
return status; return status;
@ -124,7 +124,7 @@ void ProcessUtils::runElevatedLinux(const std::string& executable,
sudos.push_back("gksudo"); sudos.push_back("gksudo");
sudos.push_back("gksu"); sudos.push_back("gksu");
for (int i=0; i < sudos.size(); i++) for (unsigned int i=0; i < sudos.size(); i++)
{ {
const std::string& sudoBinary = sudos.at(i); const std::string& sudoBinary = sudos.at(i);
@ -280,7 +280,7 @@ void ProcessUtils::runElevatedWindows(const std::string& executable,
{ {
std::string arg = *iter; std::string arg = *iter;
if (arg.at(0) != '"' && arg.at(arg.size()-1) != '"') if (!arg.empty() && arg.at(0) != '"' && arg.at(arg.size()-1) != '"')
{ {
arg.insert(0,"\""); arg.insert(0,"\"");
arg.append("\""); arg.append("\"");
@ -312,7 +312,7 @@ void ProcessUtils::runElevatedWindows(const std::string& executable,
#endif #endif
#ifdef PLATFORM_UNIX #ifdef PLATFORM_UNIX
int ProcessUtils::runAsyncUnix(const std::string& executable, PLATFORM_PID ProcessUtils::runAsyncUnix(const std::string& executable,
const std::list<std::string>& args) const std::list<std::string>& args)
{ {
pid_t child = fork(); pid_t child = fork();
@ -339,6 +339,7 @@ int ProcessUtils::runAsyncUnix(const std::string& executable,
{ {
LOG(Info,"Started child process " + intToStr(child)); LOG(Info,"Started child process " + intToStr(child));
} }
return child;
} }
#endif #endif

View file

@ -31,7 +31,7 @@ class ProcessUtils
static void runElevatedWindows(const std::string& executable, static void runElevatedWindows(const std::string& executable,
const std::list<std::string>& args); const std::list<std::string>& args);
static int runAsyncUnix(const std::string& executable, static PLATFORM_PID runAsyncUnix(const std::string& executable,
const std::list<std::string>& args); const std::list<std::string>& args);
static void runAsyncWindows(const std::string& executable, static void runAsyncWindows(const std::string& executable,
const std::list<std::string>& args); const std::list<std::string>& args);

View file

@ -108,6 +108,7 @@ void UpdateDialogGtk::updateError(const std::string& errorMessage)
bool UpdateDialogGtk::updateRetryCancel(const std::string& message) bool UpdateDialogGtk::updateRetryCancel(const std::string& message)
{ {
// TODO // TODO
return false;
} }
void UpdateDialogGtk::updateProgress(int percentage) void UpdateDialogGtk::updateProgress(int percentage)

View file

@ -7,8 +7,8 @@
UpdateInstaller::UpdateInstaller() UpdateInstaller::UpdateInstaller()
: m_mode(Setup) : m_mode(Setup)
, m_script(0)
, m_waitPid(0) , m_waitPid(0)
, m_script(0)
, m_observer(0) , m_observer(0)
{ {
} }
@ -269,7 +269,6 @@ void UpdateInstaller::removeBackups()
std::map<std::string,std::string>::const_iterator iter = m_backups.begin(); std::map<std::string,std::string>::const_iterator iter = m_backups.begin();
for (;iter != m_backups.end();iter++) for (;iter != m_backups.end();iter++)
{ {
const std::string& installedFile = iter->first;
const std::string& backupFile = iter->second; const std::string& backupFile = iter->second;
FileOps::removeFile(backupFile.c_str()); FileOps::removeFile(backupFile.c_str());
} }

View file

@ -43,7 +43,7 @@ UpdateInstaller::Mode stringToMode(const std::string& modeStr)
void UpdaterOptions::parseOldFormatArg(const std::string& arg, std::string* key, std::string* value) void UpdaterOptions::parseOldFormatArg(const std::string& arg, std::string* key, std::string* value)
{ {
int pos = arg.find('='); unsigned int pos = arg.find('=');
if (pos != std::string::npos) if (pos != std::string::npos)
{ {
*key = arg.substr(0,pos); *key = arg.substr(0,pos);

View file

@ -3,6 +3,9 @@
#include "TestUtils.h" #include "TestUtils.h"
#include "UpdaterOptions.h" #include "UpdaterOptions.h"
#include <string.h>
#include <stdlib.h>
void TestUpdaterOptions::testOldFormatArgs() void TestUpdaterOptions::testOldFormatArgs()
{ {
const int argc = 6; const int argc = 6;