From 4077c4fe41026f8a40b048bda853de1935d13bad Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Wed, 26 Feb 2020 16:25:43 -0600 Subject: [PATCH] More Windows build warning removal. --- src/engine/debugger.cpp | 4 ++-- src/engine/execnt.cpp | 13 +++++-------- src/engine/timestamp.cpp | 5 +++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/engine/debugger.cpp b/src/engine/debugger.cpp index f3642ca31..54343a036 100644 --- a/src/engine/debugger.cpp +++ b/src/engine/debugger.cpp @@ -1109,12 +1109,12 @@ static void debug_start_child( int argc, const char * * argv ) assert( debug_state == DEBUG_NO_CHILD ); if ( ! CreatePipe( &pipe1[ 0 ], &pipe1[ 1 ], &sa, 0 ) ) { - printf("internal error: CreatePipe:1: 0x%08x\n", GetLastError()); + printf("internal error: CreatePipe:1: 0x%08lx\n", GetLastError()); return; } if ( ! CreatePipe( &pipe2[ 0 ], &pipe2[ 1 ], &sa, 0 ) ) { - printf("internal error: CreatePipe:2: 0x%08x\n", GetLastError()); + printf("internal error: CreatePipe:2: 0x%08lx\n", GetLastError()); CloseHandle( pipe1[ 0 ] ); CloseHandle( pipe1[ 1 ] ); return; diff --git a/src/engine/execnt.cpp b/src/engine/execnt.cpp index 5852fd1b8..44921740c 100644 --- a/src/engine/execnt.cpp +++ b/src/engine/execnt.cpp @@ -55,6 +55,7 @@ #include #include #include +#include /* get the maximum shell command line length according to the OS */ @@ -568,12 +569,8 @@ static void invoke_cmd( char const * const command, int const slot ) static int raw_maxline() { - OSVERSIONINFO os_info; - os_info.dwOSVersionInfoSize = sizeof( os_info ); - GetVersionEx( &os_info ); - - if ( os_info.dwMajorVersion >= 5 ) return 8191; /* XP */ - if ( os_info.dwMajorVersion == 4 ) return 2047; /* NT 4.x */ + if ( IsWindowsVersionOrGreater(5,0,0) ) return 8191; /* XP */ + if ( IsWindowsVersionOrGreater(4,0,0) ) return 2047; /* NT 4.x */ return 996; /* NT 3.5.1 */ } @@ -1201,7 +1198,7 @@ static FILE * open_command_file( int const slot ) string_new( command_file ); string_reserve( command_file, tmpdir->size + 64 ); command_file->size = sprintf( command_file->value, - "%s\\jam%ul-%02d-##.bat", tmpdir->value, procID, slot ); + "%s\\jam%lu-%02d-##.bat", tmpdir->value, procID, slot ); } /* For some reason opening a command file can fail intermittently. But doing @@ -1322,7 +1319,7 @@ static void reportWindowsError( char const * const apiName, int slot ) err_buf = cmdtab[ slot ].buffer_out; string_append( err_buf, apiName ); string_append( err_buf, "() Windows API failed: " ); - sprintf( buf, "%ul", errorCode ); + sprintf( buf, "%lu", errorCode ); string_append( err_buf, buf ); if ( !apiResult ) diff --git a/src/engine/timestamp.cpp b/src/engine/timestamp.cpp index af9779fa5..67090ca55 100644 --- a/src/engine/timestamp.cpp +++ b/src/engine/timestamp.cpp @@ -96,9 +96,10 @@ void timestamp_clear( timestamp * const time ) int timestamp_cmp( timestamp const * const lhs, timestamp const * const rhs ) { - return lhs->secs == rhs->secs + return int( + lhs->secs == rhs->secs ? lhs->nsecs - rhs->nsecs - : lhs->secs - rhs->secs; + : lhs->secs - rhs->secs ); }