mirror of https://github.com/BOINC/boinc.git
Fix some compile warnings on Win (VS 2022).
Remove outdated stuff (e.g. VS has snprintf() now). I'd like to have a clean build (no warnings) on both VS and gcc. Currently VS has a bunch of printf code warnings in diagnostics.cpp, diagnostics_win.cpp, and stackwalker_win.cpp. These should be easy to fix. gcc has a bunch of sprintf buffer-size warnings, not easy to fix. There are lots of warnings in zip (to be fixed with vcpkg?) and in old graphics code.
This commit is contained in:
parent
b8b95c34c9
commit
6f4b8e5d43
|
@ -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<int> pids;
|
||||
|
|
|
@ -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")) {
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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__
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue