diff --git a/api/boinc_api.cpp b/api/boinc_api.cpp index 19835f2fdd..bb4a1d2925 100644 --- a/api/boinc_api.cpp +++ b/api/boinc_api.cpp @@ -1023,13 +1023,15 @@ int boinc_wu_cpu_time(double& cpu_t) { // Suspend this job. // Can be called from either timer or worker thread. // -static int suspend_activities(bool called_from_worker) { #ifdef VERBOSE +static int suspend_activities(bool called_from_worker) { char log_buf[256]; fprintf(stderr, "%s suspend_activities() called from %s\n", boinc_msg_prefix(log_buf, sizeof(log_buf)), called_from_worker?"worker thread":"timer thread" ); +#else +static int suspend_activities(bool) { #endif #ifdef _WIN32 static vector pids; diff --git a/client/client_types.cpp b/client/client_types.cpp index 2977ef7863..af1ab5a225 100644 --- a/client/client_types.cpp +++ b/client/client_types.cpp @@ -402,13 +402,13 @@ int FILE_INFO::parse(XML_PARSER& xp) { retval = pfxp->parse(xp); #ifdef SIM delete pfxp; - continue; -#endif +#else if (!retval) { pers_file_xfer = pfxp; } else { delete pfxp; } +#endif continue; } if (xp.match_tag("file_xfer")) { diff --git a/client/hostinfo_win.cpp b/client/hostinfo_win.cpp index d4551f9034..7e5daa20b4 100644 --- a/client/hostinfo_win.cpp +++ b/client/hostinfo_win.cpp @@ -472,7 +472,7 @@ int get_os_information( } - snprintf_s( szVersion, sizeof(szVersion), ", (%.2u.%.2u.%.4u.%.2u)", + snprintf( szVersion, sizeof(szVersion), ", (%.2u.%.2u.%.4u.%.2u)", osvi.dwMajorVersion, osvi.dwMinorVersion, (osvi.dwBuildNumber & 0xFFFF), 0 ); diff --git a/lib/boinc_stdio.h b/lib/boinc_stdio.h index 77b8aefadd..0bde4272a7 100644 --- a/lib/boinc_stdio.h +++ b/lib/boinc_stdio.h @@ -75,8 +75,12 @@ namespace boinc { inline int fileno(FILE *f) { #ifdef _USING_FCGI_ return FCGI_fileno(f); +#else +#ifdef _WIN32 + return ::_fileno(f); #else return ::fileno(f); +#endif #endif } diff --git a/lib/boinc_win.h b/lib/boinc_win.h index 0bde22a49e..e9a3f3ddc3 100644 --- a/lib/boinc_win.h +++ b/lib/boinc_win.h @@ -27,7 +27,7 @@ #ifdef _MSC_VER #pragma warning(disable: 4996) // deprecated function names -#pragma warning(disable: 4127) // constant conditional expression +//#pragma warning(disable: 4127) // constant conditional expression #pragma warning(disable: 4244) // conversion from int to char #define chdir _chdir #define finite _finite @@ -38,10 +38,6 @@ #define stricmp _stricmp #define strtime _strtime #define unlink _unlink -#define snprintf_s _snprintf_s -#if _MSC_VER < 1900 -#define snprintf _snprintf -#endif #endif #ifdef __MINGW32__ diff --git a/lib/str_replace.h b/lib/str_replace.h index d3b39b2785..21aecd71f4 100644 --- a/lib/str_replace.h +++ b/lib/str_replace.h @@ -1,6 +1,6 @@ // This file is part of BOINC. // http://boinc.berkeley.edu -// Copyright (C) 2008 University of California +// Copyright (C) 2023 University of California // // BOINC is free software; you can redistribute it and/or modify it // under the terms of the GNU Lesser General Public License @@ -56,11 +56,4 @@ inline int strcasecmp(const char* s1, const char* s2) { } #endif -#ifdef _WIN32 -#define snprintf _snprintf - // Yucky! _snprintf() is not the same as snprintf(); - // it doesn't null-terminate if buffer is too small. - // This is a workaround until we switch to VS2015, which has sprintf() -#endif - #endif