2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 12:22:17 +00:00

Remove some warnings on NT/Windows.

This commit is contained in:
Rene Rivera
2020-02-26 14:36:54 -06:00
parent 66869d10e5
commit 520ebfd0bf
6 changed files with 28 additions and 28 deletions

View File

@@ -1952,7 +1952,7 @@ LIST *builtin_readlink( FRAME * frame, int flags )
int length = buf.reparse.SymbolicLinkReparseBuffer.SubstituteNameLength / 2;
char cbuf[MAX_PATH + 1];
int numchars = WideCharToMultiByte( CP_ACP, 0, buf.reparse.SymbolicLinkReparseBuffer.PathBuffer + index, length, cbuf, sizeof(cbuf), NULL, NULL );
if( numchars >= sizeof(cbuf) )
if( numchars >= int(sizeof(cbuf)) )
{
return 0;
}
@@ -1966,7 +1966,7 @@ LIST *builtin_readlink( FRAME * frame, int flags )
char cbuf[MAX_PATH + 1];
const char * result;
int numchars = WideCharToMultiByte( CP_ACP, 0, buf.reparse.MountPointReparseBuffer.PathBuffer + index, length, cbuf, sizeof(cbuf), NULL, NULL );
if( numchars >= sizeof(cbuf) )
if( numchars >= int(sizeof(cbuf)) )
{
return 0;
}
@@ -2690,7 +2690,6 @@ LIST * builtin_glob_archive( FRAME * frame, int flags )
{
LIST * const l = lol_get( frame->args, 0 );
LIST * const r1 = lol_get( frame->args, 1 );
LIST * const r2 = lol_get( frame->args, 2 );
LIST * const r3 = lol_get( frame->args, 3 );
LISTITER iter;
@@ -2705,7 +2704,7 @@ LIST * builtin_glob_archive( FRAME * frame, int flags )
# if defined( OS_NT ) || defined( OS_CYGWIN ) || defined( OS_VMS )
l; /* Always case-insensitive. */
# else
r2;
lol_get( frame->args, 2 ); // r2
# endif
if ( globbing.case_insensitive )

View File

@@ -891,18 +891,20 @@ static void debug_parent_child_exited( int pid, int exit_code )
}
}
static void debug_parent_child_signalled( int pid, int sigid )
#if !NT
static void debug_parent_child_signalled( int pid, int id )
{
if ( debug_interface == DEBUG_INTERFACE_CONSOLE )
{
printf( "Child %d exited on signal %d\n", child_pid, sigid );
printf( "Child %d exited on signal %d\n", child_pid, id );
}
else if ( debug_interface == DEBUG_INTERFACE_MI )
{
const char * name = "unknown";
const char * meaning = "unknown";
switch( sigid )
switch( id )
{
case SIGINT: name = "SIGINT"; meaning = "Interrupt"; break;
}
@@ -914,6 +916,8 @@ static void debug_parent_child_signalled( int pid, int sigid )
}
}
#endif
static void debug_parent_on_breakpoint( void )
{
FRAME_INFO base;
@@ -1055,8 +1059,6 @@ void debug_init_handles( const char * in, const char * out )
static void init_parent_handles( HANDLE out, HANDLE in )
{
int read_fd, write_fd;
command_child = _fdopen( _open_osfhandle( (intptr_t)in, _O_RDONLY ), "r" );
command_output = _fdopen( _open_osfhandle( (intptr_t)out, _O_WRONLY ), "w" );
}
@@ -1107,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%08x\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%08x\n", GetLastError());
CloseHandle( pipe1[ 0 ] );
CloseHandle( pipe1[ 1 ] );
return;

View File

@@ -174,7 +174,7 @@ void execnt_unit_test()
* Use a table instead.
*/
{
typedef struct test { char * command; int result; } test;
typedef struct test { const char * command; int result; } test;
test tests[] = {
{ "", 0 },
{ " ", 0 },
@@ -279,7 +279,7 @@ int exec_check
/* Check prerequisites for executing raw commands. */
if ( is_raw_command_request( *pShell ) )
{
int const raw_cmd_length = raw_command_length( command->value );
long const raw_cmd_length = raw_command_length( command->value );
if ( raw_cmd_length < 0 )
{
/* Invalid characters detected - fallback to default shell. */
@@ -342,6 +342,7 @@ void exec_cmd
shell = default_shell;
if ( DEBUG_EXECCMD )
{
if ( is_raw_cmd )
out_printf( "Executing raw command directly\n" );
else
@@ -350,6 +351,7 @@ void exec_cmd
list_print( shell );
out_printf( "\n" );
}
}
/* If we are running a raw command directly - trim its leading whitespaces
* as well as any trailing all-whitespace lines but keep any trailing
@@ -367,7 +369,7 @@ void exec_cmd
end = p;
string_new( cmd_local );
string_append_range( cmd_local, start, end );
assert( cmd_local->size == raw_command_length( cmd_orig->value ) );
assert( long(cmd_local->size) == raw_command_length( cmd_orig->value ) );
}
/* If we are not running a raw command directly, prepare a command file to
* be executed using an external shell and the actual command string using
@@ -767,7 +769,7 @@ static void read_pipe
{
DWORD bytesInBuffer = 0;
DWORD bytesAvailable = 0;
int i;
DWORD i;
for (;;)
{
@@ -840,7 +842,6 @@ static void CALLBACK try_wait_callback( void * data, BOOLEAN is_timeout )
static int try_wait_impl( DWORD timeout )
{
int job_index;
int timed_out;
int res = WaitForSingleObject( process_queue.read_okay, timeout );
if ( res != WAIT_OBJECT_0 )
return -1;
@@ -853,7 +854,6 @@ static void register_wait( int job_id )
{
if ( globs.jobs > MAXIMUM_WAIT_OBJECTS )
{
HANDLE ignore;
RegisterWaitForSingleObject( &cmdtab[ job_id ].wait_handle,
cmdtab[ job_id ].pi.hProcess,
&try_wait_callback, &cmdtab[ job_id ], INFINITE,
@@ -1201,7 +1201,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%d-%02d-##.bat", tmpdir->value, procID, slot );
"%s\\jam%ul-%02d-##.bat", tmpdir->value, procID, slot );
}
/* For some reason opening a command file can fail intermittently. But doing
@@ -1314,7 +1314,7 @@ static void reportWindowsError( char const * const apiName, int slot )
(LPSTR)&errorMessage, /* __out LPTSTR lpBuffer */
0, /* __in DWORD nSize */
0 ); /* __in_opt va_list * Arguments */
/* Build a message as if the process had written to stderr. */
if ( globs.pipe_action )
err_buf = cmdtab[ slot ].buffer_err;
@@ -1322,7 +1322,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, "%d", errorCode );
sprintf( buf, "%ul", errorCode );
string_append( err_buf, buf );
if ( !apiResult )
@@ -1347,7 +1347,7 @@ static void reportWindowsError( char const * const apiName, int slot )
(*cmdtab[ slot ].func)( cmdtab[ slot ].closure, EXEC_CMD_FAIL, &time,
cmdtab[ slot ].buffer_out->value, cmdtab[ slot ].buffer_err->value,
EXIT_OK );
/* Clean up any handles that were opened. */
closeWinHandle( &cmdtab[ slot ].pi.hProcess );
closeWinHandle( &cmdtab[ slot ].pi.hThread );

View File

@@ -372,7 +372,6 @@ void file_archscan( char const * arch, scanback func, void * closure )
for ( ; iter != end ; iter = filelist_next( iter ) )
{
file_info_t * member_file = filelist_item( iter );
LIST * symbols = member_file->files;
/* Construct member path: 'archive-path(member-name)'
*/
@@ -481,13 +480,13 @@ int file_collect_archive_content_( file_archive_info_t * const archive )
/* strip leading directory names, an NT specialty */
{
char * c;
if ( c = strrchr( name, '/' ) )
if ( (c = strrchr( name, '/' )) != nullptr )
name = c + 1;
if ( c = strrchr( name, '\\' ) )
if ( (c = strrchr( name, '\\' )) != nullptr )
name = c + 1;
}
sprintf( buf, "%.*s", endname - name, name );
sprintf( buf, "%.*s", int(endname - name), name );
if ( strcmp( buf, "") != 0 )
{

View File

@@ -130,7 +130,7 @@ static int canonicWindowsPath( char const * const path, int const path_length,
/* Special case '\' && 'D:\' - include trailing '\'. */
if ( p == path ||
p == path + 2 && path[ 1 ] == ':' )
(p == path + 2 && path[ 1 ] == ':') )
++p;
missing_parent = 0;

View File

@@ -81,7 +81,7 @@ LIST * builtin_system_registry( FRAME * frame, int flags )
case REG_EXPAND_SZ:
{
long len;
unsigned long len;
string expanded[1];
string_new(expanded);
@@ -112,7 +112,7 @@ LIST * builtin_system_registry( FRAME * frame, int flags )
case REG_DWORD:
{
char buf[100];
sprintf( buf, "%u", *(PDWORD)data );
sprintf( buf, "%lu", *(PDWORD)data );
result = list_push_back( result, object_new(buf) );
}
break;