mirror of https://github.com/BOINC/boinc.git
- 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 svn path=/trunk/boinc/; revision=12985
This commit is contained in:
parent
7b74befedc
commit
e1a0c552e2
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#endif
|
||||
|
||||
#include "str_util.h"
|
||||
#include "util.h"
|
||||
#include "filesys.h"
|
||||
#include "parse.h"
|
||||
#include "file_names.h"
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
41
lib/util.C
41
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$";
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<const char*> files;
|
||||
|
|
|
@ -563,7 +563,6 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description=""
|
||||
CommandLine=""
|
||||
/>
|
||||
</Configuration>
|
||||
|
@ -675,7 +674,6 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description=""
|
||||
CommandLine=""
|
||||
/>
|
||||
</Configuration>
|
||||
|
|
Loading…
Reference in New Issue