From 0fc0f80c3098e1e29603a3543465dded3d35806e Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 11 Nov 2013 10:42:03 -0800 Subject: [PATCH] Fix win compile warnings. Let's shoot for zero warnings, OK? --- client/app.cpp | 2 +- client/sysmon_win.cpp | 2 +- lib/diagnostics.cpp | 2 +- lib/diagnostics.h | 2 +- lib/proc_control.cpp | 9 ++++++--- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/client/app.cpp b/client/app.cpp index 1be4c6ed38..276d10a552 100644 --- a/client/app.cpp +++ b/client/app.cpp @@ -1028,7 +1028,7 @@ void* throttler(void*) { // Initialize diagnostics framework for this thread // - diagnostics_thread_init(BOINC_DIAG_DEFAULTS); + diagnostics_thread_init(); while (1) { client_mutex.lock(); diff --git a/client/sysmon_win.cpp b/client/sysmon_win.cpp index b1fc763de2..491f051a25 100644 --- a/client/sysmon_win.cpp +++ b/client/sysmon_win.cpp @@ -188,7 +188,7 @@ static DWORD WINAPI WindowsMonitorSystemPowerThread( LPVOID ) { // Initialize diagnostics framework for this thread // - diagnostics_thread_init(BOINC_DIAG_DEFAULTS); + diagnostics_thread_init(); wc.style = CS_GLOBALCLASS; wc.lpfnWndProc = (WNDPROC)WindowsMonitorSystemPowerWndProc; diff --git a/lib/diagnostics.cpp b/lib/diagnostics.cpp index 904a93df70..0801bf8dab 100644 --- a/lib/diagnostics.cpp +++ b/lib/diagnostics.cpp @@ -420,7 +420,7 @@ int diagnostics_init( return BOINC_SUCCESS; } -int diagnostics_thread_init( int _flags ) { +int diagnostics_thread_init() { // Install unhandled exception filters and signal traps. if (BOINC_SUCCESS != boinc_install_signal_handlers()) { return ERR_SIGNAL_OP; diff --git a/lib/diagnostics.h b/lib/diagnostics.h index 679199f91f..b67fa8aa59 100644 --- a/lib/diagnostics.h +++ b/lib/diagnostics.h @@ -80,7 +80,7 @@ extern int boinc_finish_diag(); extern int diagnostics_init( int flags, const char* stdout_prefix, const char* stderr_prefix ); -extern int diagnostics_thread_init( int flags ); +extern int diagnostics_thread_init(); extern int diagnostics_finish(); extern int diagnostics_is_initialized(); extern int diagnostics_is_flag_set(int flags); diff --git a/lib/proc_control.cpp b/lib/proc_control.cpp index 08715f1271..8ef877556a 100644 --- a/lib/proc_control.cpp +++ b/lib/proc_control.cpp @@ -94,6 +94,8 @@ int suspend_or_resume_threads( ) { HANDLE threads, thread; THREADENTRY32 te = {0}; + int retval = 0; + DWORD n; #ifdef DEBUG fprintf(stderr, "start: check_exempt %d %s\n", check_exempt, precision_time_to_string(dtime())); @@ -129,16 +131,17 @@ int suspend_or_resume_threads( if (!in_vector(te.th32OwnerProcessID, pids)) continue; thread = OpenThread(THREAD_SUSPEND_RESUME, FALSE, te.th32ThreadID); if (resume) { - DWORD n = ResumeThread(thread); + n = ResumeThread(thread); #ifdef DEBUG fprintf(stderr, "ResumeThread returns %d\n", n); #endif } else { - DWORD n = SuspendThread(thread); + n = SuspendThread(thread); #ifdef DEBUG fprintf(stderr, "SuspendThread returns %d\n", n); #endif } + if (n == -1) retval = -1; CloseHandle(thread); } while (Thread32Next(threads, &te)); @@ -146,7 +149,7 @@ int suspend_or_resume_threads( #ifdef DEBUG fprintf(stderr, "end: %s\n", precision_time_to_string(dtime())); #endif - return 0; + return retval; } #else