diff --git a/checkin_notes b/checkin_notes index 8b97cfc8ea..bbe64ef940 100755 --- a/checkin_notes +++ b/checkin_notes @@ -6552,3 +6552,19 @@ David 22 June 2007 parse.C,h str_util.C,h util.C,h + +David 22 June 2007 + - compile fixes for Win + + client/ + acct_setup.C + cs_prefs.C + cs_trickle.C + lib/ + filesys.C + str_util.C,h + util.C,h + tools/ + updater.C + win_build/ + sim.vcproj diff --git a/client/acct_setup.C b/client/acct_setup.C index 34b8ad6a42..8b34be21fe 100644 --- a/client/acct_setup.C +++ b/client/acct_setup.C @@ -30,6 +30,7 @@ #include "parse.h" #include "filesys.h" #include "str_util.h" +#include "util.h" #include "client_msgs.h" #include "acct_setup.h" diff --git a/client/cs_prefs.C b/client/cs_prefs.C index 74fea5dd46..d56c9b2789 100644 --- a/client/cs_prefs.C +++ b/client/cs_prefs.C @@ -36,6 +36,7 @@ #endif #include "str_util.h" +#include "util.h" #include "filesys.h" #include "parse.h" #include "file_names.h" diff --git a/client/cs_trickle.C b/client/cs_trickle.C index 4d6301b97e..770fc50189 100644 --- a/client/cs_trickle.C +++ b/client/cs_trickle.C @@ -28,6 +28,7 @@ #include "file_names.h" #include "filesys.h" #include "parse.h" +#include "util.h" #include "str_util.h" #include "client_state.h" diff --git a/lib/filesys.C b/lib/filesys.C index d27c72b3e2..5509c285da 100755 --- a/lib/filesys.C +++ b/lib/filesys.C @@ -528,8 +528,8 @@ int boinc_rmdir(const char* name) { #endif } -int remove_project_owned_file_or_dir(const char* path) { #ifdef SANDBOX +int remove_project_owned_file_or_dir(const char* path) { char cmd[1024]; if (g_use_sandbox) { @@ -544,6 +544,7 @@ int remove_project_owned_file_or_dir(const char* path) { } } #endif +int remove_project_owned_file_or_dir(const char*) { return ERR_UNLINK; } diff --git a/lib/str_util.C b/lib/str_util.C index 7a301ad2a4..2627be28b9 100755 --- a/lib/str_util.C +++ b/lib/str_util.C @@ -713,44 +713,6 @@ const char* rpc_reason_string(int reason) { } } -// read file (at most max_len chars, if nonzero) into malloc'd buf -// -int read_file_malloc(const char* path, char*& buf, int max_len) { - FILE* f; - int retval, isize; - double size; - - retval = file_size(path, size); - if (retval) return retval; - - f = fopen(path, "r"); - if (!f) return ERR_FOPEN; - - if (max_len && size > max_len) { - size = max_len; - } - isize = (int) size; - buf = (char*)malloc(isize+1); - int n = fread(buf, 1, isize, f); - buf[n] = 0; - fclose(f); - return 0; -} - -// read file (at most max_len chars, if nonzero) into string -// -int read_file_string(const char* path, string& result, int max_len) { - result.erase(); - int retval; - char* buf; - - retval = read_file_malloc(path, buf, max_len); - if (retval) return retval; - result = buf; - free(buf); - return 0; -} - #ifdef WIN32 // get message for last error diff --git a/lib/str_util.h b/lib/str_util.h index c073615ebc..58c0cd7e35 100755 --- a/lib/str_util.h +++ b/lib/str_util.h @@ -58,8 +58,6 @@ extern void canonicalize_master_url(std::string&); extern char* time_to_string(double); extern char* precision_time_to_string(double); extern std::string timediff_format(double); -extern int read_file_malloc(const char* path, char*&, int max_len=0); -extern int read_file_string(const char* path, std::string&, int max_len=0); inline bool ends_with(std::string const& s, std::string const& suffix) { return diff --git a/lib/util.C b/lib/util.C index 40f34f1538..91f69aeab9 100755 --- a/lib/util.C +++ b/lib/util.C @@ -400,8 +400,8 @@ int get_exit_status(int pid) { } #endif -static int get_client_mutex(const char* dir) { #ifdef _WIN32 +static int get_client_mutex(const char*) { char buf[MAX_PATH] = ""; // Global mutex on Win2k and later @@ -416,6 +416,7 @@ static int get_client_mutex(const char* dir) { return ERR_ALREADY_RUNNING; } #else +static int get_client_mutex(const char* dir) { char path[1024]; static FILE_LOCK file_lock; @@ -467,4 +468,42 @@ void boinc_crash() { #endif } +// read file (at most max_len chars, if nonzero) into malloc'd buf +// +int read_file_malloc(const char* path, char*& buf, int max_len) { + FILE* f; + int retval, isize; + double size; + + retval = file_size(path, size); + if (retval) return retval; + + f = fopen(path, "r"); + if (!f) return ERR_FOPEN; + + if (max_len && size > max_len) { + size = max_len; + } + isize = (int) size; + buf = (char*)malloc(isize+1); + size_t n = fread(buf, 1, isize, f); + buf[n] = 0; + fclose(f); + return 0; +} + +// read file (at most max_len chars, if nonzero) into string +// +int read_file_string(const char* path, string& result, int max_len) { + result.erase(); + int retval; + char* buf; + + retval = read_file_malloc(path, buf, max_len); + if (retval) return retval; + result = buf; + free(buf); + return 0; +} + const char *BOINC_RCSID_ab65c90e1e = "$Id$"; diff --git a/lib/util.h b/lib/util.h index a5482ff2f6..1258596ade 100755 --- a/lib/util.h +++ b/lib/util.h @@ -99,5 +99,7 @@ extern int get_exit_status(int); extern int wait_client_mutex(const char* dir, double timeout); extern void boinc_crash(); +extern int read_file_malloc(const char* path, char*&, int max_len=0); +extern int read_file_string(const char* path, std::string&, int max_len=0); #endif diff --git a/tools/updater.C b/tools/updater.C index a800c154fa..c46b59139c 100644 --- a/tools/updater.C +++ b/tools/updater.C @@ -115,7 +115,6 @@ int main(int argc, char** argv) { bool run_as_service = false; bool run_manager = false; char* argv2[10]; - char path[1024]; char cur_dir[1024]; bool new_version_installed = false; vector files; diff --git a/win_build/sim.vcproj b/win_build/sim.vcproj index ed1542fa86..809c532a3d 100644 --- a/win_build/sim.vcproj +++ b/win_build/sim.vcproj @@ -563,7 +563,6 @@ /> @@ -675,7 +674,6 @@ />