mirror of
https://github.com/boostorg/build.git
synced 2026-02-14 00:32:11 +00:00
Support building as both 32 and 64 bit address model.
This commit is contained in:
@@ -55,7 +55,7 @@ for:
|
||||
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
|
||||
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> NO WARNINGS"
|
||||
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
|
||||
src\engine\b2.exe --debug-configuration b2 warnings-as-errors=on toolset=%TEST_TOOLSET%
|
||||
src\engine\b2.exe --debug-configuration b2 warnings-as-errors=on variant=debug,release address-model=32,64 toolset=%TEST_TOOLSET%
|
||||
- cmd: |
|
||||
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
|
||||
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> BOOTSTRAP"
|
||||
|
||||
@@ -164,7 +164,7 @@ stages:
|
||||
set -e
|
||||
CXX_PATH=`which ${CXX}`
|
||||
echo "using ${TEST_TOOLSET} : : ${CXX_PATH} ;" > ${HOME}/user-config.jam
|
||||
./src/engine/b2 b2 warnings-as-errors=on toolset=${TEST_TOOLSET}
|
||||
./src/engine/b2 b2 warnings-as-errors=on variant=debug,release address-model=32,64 toolset=${TEST_TOOLSET}
|
||||
displayName: "No Warnings"
|
||||
- bash: |
|
||||
set -e
|
||||
@@ -210,7 +210,7 @@ stages:
|
||||
$env:HOME = $env:HOMEDRIVE + $env:HOMEPATH
|
||||
$env:path += ';' + $env:CXX_PATH
|
||||
echo "using" $env:TEST_TOOLSET ":" ":" $env:CXX ";" > $env:HOME/user-config.jam
|
||||
./src/engine/b2.exe --debug-configuration b2 warnings-as-errors=on toolset=$env:TEST_TOOLSET
|
||||
./src/engine/b2.exe --debug-configuration b2 warnings-as-errors=on variant=debug,release toolset=$env:TEST_TOOLSET
|
||||
displayName: "No Warnings"
|
||||
- powershell: |
|
||||
$env:HOME = $env:HOMEDRIVE + $env:HOMEPATH
|
||||
@@ -311,7 +311,7 @@ stages:
|
||||
set -e
|
||||
CXX_PATH=`which ${CXX}`
|
||||
echo "using ${TEST_TOOLSET} : : ${CXX_PATH} ;" > ${HOME}/user-config.jam
|
||||
./src/engine/b2 b2 warnings-as-errors=on toolset=${TEST_TOOLSET}
|
||||
./src/engine/b2 b2 warnings-as-errors=on variant=debug,release address-model=32,64 toolset=${TEST_TOOLSET}
|
||||
displayName: "No Warnings"
|
||||
- bash: |
|
||||
set -e
|
||||
|
||||
@@ -911,7 +911,7 @@ LIST * glob_recursive( char const * pattern )
|
||||
{
|
||||
OBJECT * p;
|
||||
path->f_dir.ptr = object_str( list_item( iter ) );
|
||||
path->f_dir.len = strlen( object_str( list_item( iter ) ) );
|
||||
path->f_dir.len = int32_t(strlen( object_str( list_item( iter ) ) ));
|
||||
path_build( path, file_string );
|
||||
|
||||
p = object_new( file_string->value );
|
||||
@@ -1749,14 +1749,14 @@ LIST * builtin_pad( FRAME * frame, int flags )
|
||||
OBJECT * string = list_front( lol_get( frame->args, 0 ) );
|
||||
char const * width_s = object_str( list_front( lol_get( frame->args, 1 ) ) );
|
||||
|
||||
int current = strlen( object_str( string ) );
|
||||
int desired = atoi( width_s );
|
||||
int32_t current = int32_t(strlen( object_str( string ) ));
|
||||
int32_t desired = atoi( width_s );
|
||||
if ( current >= desired )
|
||||
return list_new( object_copy( string ) );
|
||||
else
|
||||
{
|
||||
char * buffer = (char *)BJAM_MALLOC( desired + 1 );
|
||||
int i;
|
||||
int32_t i;
|
||||
LIST * result;
|
||||
|
||||
strcpy( buffer, object_str( string ) );
|
||||
@@ -1886,7 +1886,7 @@ LIST *builtin_readlink( FRAME * frame, int flags )
|
||||
#else
|
||||
char static_buf[256];
|
||||
char * buf = static_buf;
|
||||
size_t bufsize = 256;
|
||||
int32_t bufsize = 256;
|
||||
LIST * result = 0;
|
||||
while (1) {
|
||||
ssize_t len = readlink( path, buf, bufsize );
|
||||
@@ -1894,7 +1894,7 @@ LIST *builtin_readlink( FRAME * frame, int flags )
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if ( size_t(len) < bufsize )
|
||||
else if ( int32_t(len) < bufsize )
|
||||
{
|
||||
buf[ len ] = '\0';
|
||||
result = list_new( object_new( buf ) );
|
||||
@@ -2400,7 +2400,7 @@ LIST * builtin_shell( FRAME * frame, int flags )
|
||||
LIST * command = lol_get( frame->args, 0 );
|
||||
LIST * result = L0;
|
||||
string s;
|
||||
int ret;
|
||||
int32_t ret;
|
||||
char buffer[ 1024 ];
|
||||
FILE * p = NULL;
|
||||
int exit_status = -1;
|
||||
@@ -2435,7 +2435,7 @@ LIST * builtin_shell( FRAME * frame, int flags )
|
||||
|
||||
string_new( &s );
|
||||
|
||||
while ( ( ret = fread( buffer, sizeof( char ), sizeof( buffer ) - 1, p ) ) >
|
||||
while ( ( ret = int32_t(fread( buffer, sizeof( char ), sizeof( buffer ) - 1, p )) ) >
|
||||
0 )
|
||||
{
|
||||
buffer[ ret ] = 0;
|
||||
|
||||
@@ -31,4 +31,21 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Correct missing types in some earlier compilers..
|
||||
|
||||
#include <stdint.h>
|
||||
#ifndef INT32_MIN
|
||||
|
||||
// VS 2013 is barely C++11/C99. And opts to not provide specific sized int types.
|
||||
// Provide a generic implementation of the sizes we use.
|
||||
#if UINT_MAX == 0xffffffff
|
||||
typedef int int32_t;
|
||||
#elif (USHRT_MAX == 0xffffffff)
|
||||
typedef short int32_t;
|
||||
#elif ULONG_MAX == 0xffffffff
|
||||
typedef long int32_t;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -73,7 +73,7 @@ void profile_enter( OBJECT * rulename, profile_frame * frame )
|
||||
}
|
||||
|
||||
|
||||
void profile_memory( long mem )
|
||||
void profile_memory( size_t mem )
|
||||
{
|
||||
if ( DEBUG_PROFILE )
|
||||
if ( profile_stack && profile_stack->info )
|
||||
|
||||
@@ -45,7 +45,7 @@ typedef struct profile_frame
|
||||
|
||||
profile_frame * profile_init( OBJECT * rulename, profile_frame * );
|
||||
void profile_enter( OBJECT * rulename, profile_frame * );
|
||||
void profile_memory( long mem );
|
||||
void profile_memory( size_t mem );
|
||||
void profile_exit( profile_frame * );
|
||||
void profile_dump();
|
||||
double profile_clock();
|
||||
|
||||
@@ -160,14 +160,16 @@ static LIST * debug_list_read( FILE * in )
|
||||
{
|
||||
int len;
|
||||
int i;
|
||||
int ch;
|
||||
LIST * result = L0;
|
||||
fscanf( in, "%d", &len );
|
||||
ch = fgetc( in );
|
||||
assert( ch == '\n' );
|
||||
for ( i = 0; i < len; ++i )
|
||||
int ret = fscanf( in, "%d", &len );
|
||||
if (ret == 1)
|
||||
{
|
||||
result = list_push_back( result, debug_object_read( in ) );
|
||||
int ch = fgetc( in );
|
||||
if (ch > 0) assert( ch == '\n' );
|
||||
for ( i = 0; i < len; ++i )
|
||||
{
|
||||
result = list_push_back( result, debug_object_read( in ) );
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -328,7 +330,7 @@ static OBJECT * make_absolute_path( OBJECT * filename )
|
||||
const char * root = object_str( cwd() );
|
||||
path_parse( object_str( filename ), path1 );
|
||||
path1->f_root.ptr = root;
|
||||
path1->f_root.len = strlen( root );
|
||||
path1->f_root.len = int32_t(strlen( root ));
|
||||
string_new( buf );
|
||||
path_build( path1, buf );
|
||||
result = object_new( buf->value );
|
||||
@@ -580,7 +582,7 @@ static int debug_add_breakpoint( const char * name )
|
||||
long line = strtoul( ptr + 1, &end, 10 );
|
||||
if ( line > 0 && line <= INT_MAX && end != ptr + 1 && *end == 0 )
|
||||
{
|
||||
OBJECT * file = object_new_range( file_ptr, ptr - file_ptr );
|
||||
OBJECT * file = object_new_range( file_ptr, int32_t(ptr - file_ptr) );
|
||||
return add_line_breakpoint( file, line );
|
||||
}
|
||||
else
|
||||
@@ -615,7 +617,7 @@ static int get_breakpoint_by_name( const char * name )
|
||||
long line = strtoul( ptr + 1, &end, 10 );
|
||||
if ( line > 0 && line <= INT_MAX && end != ptr + 1 && *end == 0 )
|
||||
{
|
||||
OBJECT * file = object_new_range( file_ptr, ptr - file_ptr );
|
||||
OBJECT * file = object_new_range( file_ptr, int32_t(ptr - file_ptr) );
|
||||
result = handle_line_breakpoint( file, line );
|
||||
object_free( file );
|
||||
}
|
||||
@@ -772,7 +774,7 @@ static int get_module_filename( string * out )
|
||||
DWORD result;
|
||||
string_reserve( out, 256 + 1 );
|
||||
string_truncate( out, 256 );
|
||||
while( ( result = GetModuleFileNameA( NULL, out->value, out->size ) ) == out->size )
|
||||
while( ( result = GetModuleFileNameA( NULL, out->value, DWORD(out->size) ) ) == DWORD(out->size) )
|
||||
{
|
||||
string_reserve( out, out->size * 2 + 1);
|
||||
string_truncate( out, out->size * 2 );
|
||||
@@ -2690,7 +2692,7 @@ static int process_command( char * line )
|
||||
*iter++ = '\0';
|
||||
}
|
||||
}
|
||||
result = run_command( current - buffer, (const char **)buffer );
|
||||
result = run_command( int(current - buffer), (const char **)buffer );
|
||||
free( (void *)buffer );
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -41,9 +41,9 @@ static int intr;
|
||||
*/
|
||||
|
||||
void argv_from_shell( char const * * argv, LIST * shell, char const * command,
|
||||
int const slot )
|
||||
int32_t const slot )
|
||||
{
|
||||
static char jobno[ 4 ];
|
||||
static char jobno[ 12 ];
|
||||
|
||||
int i;
|
||||
int gotpercent = 0;
|
||||
@@ -74,12 +74,12 @@ void argv_from_shell( char const * * argv, LIST * shell, char const * command,
|
||||
/* Returns whether the given command string contains lines longer than the given
|
||||
* maximum.
|
||||
*/
|
||||
int check_cmd_for_too_long_lines( char const * command, size_t max,
|
||||
int * const error_length, int * const error_max_length )
|
||||
int check_cmd_for_too_long_lines( char const * command, int32_t max,
|
||||
int32_t * const error_length, int32_t * const error_max_length )
|
||||
{
|
||||
while ( *command )
|
||||
{
|
||||
size_t const l = strcspn( command, "\n" );
|
||||
int32_t const l = int32_t(strcspn( command, "\n" ));
|
||||
if ( l > max )
|
||||
{
|
||||
*error_length = l;
|
||||
|
||||
@@ -54,8 +54,8 @@ int exec_check
|
||||
(
|
||||
string const * command,
|
||||
LIST * * pShell,
|
||||
int * error_length,
|
||||
int * error_max_length
|
||||
int32_t * error_length,
|
||||
int32_t * error_max_length
|
||||
);
|
||||
|
||||
/* exec_check() return codes. */
|
||||
@@ -91,7 +91,7 @@ void exec_wait();
|
||||
* given shell list.
|
||||
*/
|
||||
void argv_from_shell( char const * * argv, LIST * shell, char const * command,
|
||||
int const slot );
|
||||
int32_t const slot );
|
||||
|
||||
/* Interrupt routine bumping the internal interrupt counter. Needs to be
|
||||
* registered by platform specific exec*.c modules.
|
||||
@@ -109,7 +109,7 @@ int is_raw_command_request( LIST * shell );
|
||||
/* Utility worker for exec_check() checking whether all the given command lines
|
||||
* are under the specified length limit.
|
||||
*/
|
||||
int check_cmd_for_too_long_lines( char const * command, size_t max,
|
||||
int * const error_length, int * const error_max_length );
|
||||
int check_cmd_for_too_long_lines( char const * command, int32_t max,
|
||||
int32_t * const error_length, int32_t * const error_max_length );
|
||||
|
||||
#endif
|
||||
|
||||
@@ -69,9 +69,9 @@
|
||||
|
||||
|
||||
/* get the maximum shell command line length according to the OS */
|
||||
static int maxline();
|
||||
static int32_t maxline();
|
||||
/* valid raw command string length */
|
||||
static long raw_command_length( char const * command );
|
||||
static int32_t raw_command_length( char const * command );
|
||||
/* add two 64-bit unsigned numbers, h1l1 and h2l2 */
|
||||
static FILETIME add_64(
|
||||
unsigned long h1, unsigned long l1,
|
||||
@@ -87,33 +87,33 @@ static double running_time( HANDLE const );
|
||||
/* terminate the given process, after terminating all its children first */
|
||||
static void kill_process_tree( DWORD const procesdId, HANDLE const );
|
||||
/* waits for a command to complete or time out */
|
||||
static int try_wait( int const timeoutMillis );
|
||||
static int32_t try_wait( int32_t const timeoutMillis );
|
||||
/* reads any pending output for running commands */
|
||||
static void read_output();
|
||||
/* checks if a command ran out of time, and kills it */
|
||||
static int try_kill_one();
|
||||
static int32_t try_kill_one();
|
||||
/* is the first process a parent (direct or indirect) to the second one */
|
||||
static int is_parent_child( DWORD const parent, DWORD const child );
|
||||
static int32_t is_parent_child( DWORD const parent, DWORD const child );
|
||||
/* */
|
||||
static void close_alert( PROCESS_INFORMATION const * const );
|
||||
/* close any alerts hanging around */
|
||||
static void close_alerts();
|
||||
/* prepare a command file to be executed using an external shell */
|
||||
static char const * prepare_command_file( string const * command, int slot );
|
||||
static char const * prepare_command_file( string const * command, int32_t slot );
|
||||
/* invoke the actual external process using the given command line */
|
||||
static void invoke_cmd( char const * const command, int const slot );
|
||||
static void invoke_cmd( char const * const command, int32_t const slot );
|
||||
/* find a free slot in the running commands table */
|
||||
static int get_free_cmdtab_slot();
|
||||
static int32_t get_free_cmdtab_slot();
|
||||
/* put together the final command string we are to run */
|
||||
static void string_new_from_argv( string * result, char const * const * argv );
|
||||
/* frees and renews the given string */
|
||||
static void string_renew( string * const );
|
||||
/* reports the last failed Windows API related error message */
|
||||
static void reportWindowsError( char const * const apiName, int slot );
|
||||
static void reportWindowsError( char const * const apiName, int32_t slot );
|
||||
/* closes a Windows HANDLE and resets its variable to 0. */
|
||||
static void closeWinHandle( HANDLE * const handle );
|
||||
/* Adds the job index to the list of currently active jobs. */
|
||||
static void register_wait( int job_id );
|
||||
static void register_wait( int32_t job_id );
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
@@ -132,7 +132,7 @@ static void register_wait( int job_id );
|
||||
#define EXECCMD_PIPE_READ 0
|
||||
#define EXECCMD_PIPE_WRITE 1
|
||||
|
||||
static int intr_installed;
|
||||
static int32_t intr_installed;
|
||||
|
||||
|
||||
/* The list of commands we run. */
|
||||
@@ -154,7 +154,7 @@ static struct _cmdtab_t
|
||||
|
||||
HANDLE wait_handle;
|
||||
|
||||
int flags;
|
||||
int32_t flags;
|
||||
|
||||
/* Function called when the command completes. */
|
||||
ExecCmdCallback func;
|
||||
@@ -162,14 +162,14 @@ static struct _cmdtab_t
|
||||
/* Opaque data passed back to the 'func' callback. */
|
||||
void * closure;
|
||||
} * cmdtab = NULL;
|
||||
static int cmdtab_size = 0;
|
||||
static int32_t cmdtab_size = 0;
|
||||
|
||||
/* A thread-safe single element queue. Used by the worker threads
|
||||
* to signal the main thread that a process is completed.
|
||||
*/
|
||||
struct
|
||||
{
|
||||
int job_index;
|
||||
int32_t job_index;
|
||||
HANDLE read_okay;
|
||||
HANDLE write_okay;
|
||||
} process_queue;
|
||||
@@ -185,7 +185,7 @@ void execnt_unit_test()
|
||||
* Use a table instead.
|
||||
*/
|
||||
{
|
||||
typedef struct test { const char * command; int result; } test;
|
||||
typedef struct test { const char * command; int32_t result; } test;
|
||||
test tests[] = {
|
||||
{ "", 0 },
|
||||
{ " ", 0 },
|
||||
@@ -218,9 +218,9 @@ void execnt_unit_test()
|
||||
}
|
||||
|
||||
{
|
||||
int const length = maxline() + 9;
|
||||
char * const cmd = (char *)BJAM_MALLOC_ATOMIC( length + 1 );
|
||||
memset( cmd, 'x', length );
|
||||
int32_t const length = maxline() + 9;
|
||||
char * const cmd = (char *)BJAM_MALLOC_ATOMIC( size_t(length) + 1 );
|
||||
memset( cmd, 'x', size_t(length) );
|
||||
cmd[ length ] = 0;
|
||||
assert( raw_command_length( cmd ) == length );
|
||||
BJAM_FREE( cmd );
|
||||
@@ -266,12 +266,12 @@ void exec_done( void )
|
||||
* exec_check() - preprocess and validate the command
|
||||
*/
|
||||
|
||||
int exec_check
|
||||
int32_t exec_check
|
||||
(
|
||||
string const * command,
|
||||
LIST * * pShell,
|
||||
int * error_length,
|
||||
int * error_max_length
|
||||
int32_t * error_length,
|
||||
int32_t * error_max_length
|
||||
)
|
||||
{
|
||||
/* Default shell does nothing when triggered with an empty or a
|
||||
@@ -290,7 +290,7 @@ int exec_check
|
||||
/* Check prerequisites for executing raw commands. */
|
||||
if ( is_raw_command_request( *pShell ) )
|
||||
{
|
||||
long const raw_cmd_length = raw_command_length( command->value );
|
||||
int32_t const raw_cmd_length = raw_command_length( command->value );
|
||||
if ( raw_cmd_length < 0 )
|
||||
{
|
||||
/* Invalid characters detected - fallback to default shell. */
|
||||
@@ -333,14 +333,14 @@ int exec_check
|
||||
void exec_cmd
|
||||
(
|
||||
string const * cmd_orig,
|
||||
int flags,
|
||||
int32_t flags,
|
||||
ExecCmdCallback func,
|
||||
void * closure,
|
||||
LIST * shell
|
||||
)
|
||||
{
|
||||
int const slot = get_free_cmdtab_slot();
|
||||
int const is_raw_cmd = is_raw_command_request( shell );
|
||||
int32_t const slot = get_free_cmdtab_slot();
|
||||
int32_t const is_raw_cmd = is_raw_command_request( shell );
|
||||
string cmd_local[ 1 ];
|
||||
|
||||
/* Initialize default shell - anything more than /Q/C is non-portable. */
|
||||
@@ -380,7 +380,7 @@ void exec_cmd
|
||||
end = p;
|
||||
string_new( cmd_local );
|
||||
string_append_range( cmd_local, start, end );
|
||||
assert( long(cmd_local->size) == raw_command_length( cmd_orig->value ) );
|
||||
assert( int32_t(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
|
||||
@@ -424,8 +424,8 @@ void exec_cmd
|
||||
|
||||
void exec_wait()
|
||||
{
|
||||
int i = -1;
|
||||
int exit_reason; /* reason why a command completed */
|
||||
int32_t i = -1;
|
||||
int32_t exit_reason; /* reason why a command completed */
|
||||
|
||||
/* Wait for a command to complete, while snarfing up any output. */
|
||||
while ( 1 )
|
||||
@@ -447,7 +447,7 @@ void exec_wait()
|
||||
{
|
||||
DWORD exit_code;
|
||||
timing_info time;
|
||||
int rstat;
|
||||
int32_t rstat;
|
||||
|
||||
/* The time data for the command. */
|
||||
record_times( cmdtab[ i ].pi.hProcess, &time );
|
||||
@@ -494,7 +494,7 @@ void exec_wait()
|
||||
* process in our running commands table.
|
||||
*/
|
||||
|
||||
static void invoke_cmd( char const * const command, int const slot )
|
||||
static void invoke_cmd( char const * const command, int32_t const slot )
|
||||
{
|
||||
SECURITY_ATTRIBUTES sa = { sizeof( SECURITY_ATTRIBUTES ), 0, 0 };
|
||||
SECURITY_DESCRIPTOR sd;
|
||||
@@ -577,16 +577,16 @@ static void invoke_cmd( char const * const command, int const slot )
|
||||
* http://support.microsoft.com/default.aspx?scid=kb;en-us;830473
|
||||
*/
|
||||
|
||||
static int raw_maxline()
|
||||
static int32_t raw_maxline()
|
||||
{
|
||||
if ( IsWindowsVersionOrGreater(5,0,0) == TRUE ) return 8191; /* XP */
|
||||
if ( IsWindowsVersionOrGreater(4,0,0) == TRUE ) return 2047; /* NT 4.x */
|
||||
return 996; /* NT 3.5.1 */
|
||||
}
|
||||
|
||||
static int maxline()
|
||||
static int32_t maxline()
|
||||
{
|
||||
static int result;
|
||||
static int32_t result;
|
||||
if ( !result ) result = raw_maxline();
|
||||
return result;
|
||||
}
|
||||
@@ -632,7 +632,7 @@ static void string_renew( string * const s )
|
||||
* affect the executed command).
|
||||
*/
|
||||
|
||||
static long raw_command_length( char const * command )
|
||||
static int32_t raw_command_length( char const * command )
|
||||
{
|
||||
char const * p;
|
||||
char const * escape = 0;
|
||||
@@ -688,7 +688,7 @@ static long raw_command_length( char const * command )
|
||||
while ( *p );
|
||||
|
||||
/* Return the number of characters the command will occupy. */
|
||||
return ( newline ? newline : p ) - command;
|
||||
return int32_t(( newline ? newline : p ) - command);
|
||||
}
|
||||
|
||||
|
||||
@@ -771,7 +771,7 @@ static void read_pipe
|
||||
(
|
||||
HANDLE in, /* the pipe to read from */
|
||||
string * out,
|
||||
int forwarding_mode
|
||||
int32_t forwarding_mode
|
||||
)
|
||||
{
|
||||
DWORD bytesInBuffer = 0;
|
||||
@@ -820,7 +820,7 @@ static void read_pipe
|
||||
|
||||
static void read_output()
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for ( i = 0; i < globs.jobs; ++i )
|
||||
if ( cmdtab[ i ].pi.hProcess )
|
||||
{
|
||||
@@ -839,17 +839,17 @@ static void CALLBACK try_wait_callback( void * data, BOOLEAN is_timeout )
|
||||
{
|
||||
struct _cmdtab_t * slot = ( struct _cmdtab_t * )data;
|
||||
WaitForSingleObject( process_queue.write_okay, INFINITE );
|
||||
process_queue.job_index = slot - cmdtab;
|
||||
process_queue.job_index = int32_t(slot - cmdtab);
|
||||
assert( !is_timeout );
|
||||
SetEvent( process_queue.read_okay );
|
||||
/* Okay. Non-blocking. */
|
||||
UnregisterWait( slot->wait_handle );
|
||||
}
|
||||
|
||||
static int try_wait_impl( DWORD timeout )
|
||||
static int32_t try_wait_impl( DWORD timeout )
|
||||
{
|
||||
int job_index;
|
||||
int res = WaitForSingleObject( process_queue.read_okay, timeout );
|
||||
int32_t job_index;
|
||||
int32_t res = WaitForSingleObject( process_queue.read_okay, timeout );
|
||||
if ( res != WAIT_OBJECT_0 )
|
||||
return -1;
|
||||
job_index = process_queue.job_index;
|
||||
@@ -857,7 +857,7 @@ static int try_wait_impl( DWORD timeout )
|
||||
return job_index;
|
||||
}
|
||||
|
||||
static void register_wait( int job_id )
|
||||
static void register_wait( int32_t job_id )
|
||||
{
|
||||
if ( globs.jobs > MAXIMUM_WAIT_OBJECTS )
|
||||
{
|
||||
@@ -874,13 +874,13 @@ static void register_wait( int job_id )
|
||||
* cmdtab array, or -1.
|
||||
*/
|
||||
|
||||
static int try_wait( int const timeoutMillis )
|
||||
static int32_t try_wait( int32_t const timeoutMillis )
|
||||
{
|
||||
if ( globs.jobs <= MAXIMUM_WAIT_OBJECTS )
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
HANDLE active_handles[ MAXIMUM_WAIT_OBJECTS ];
|
||||
int job_ids[ MAXIMUM_WAIT_OBJECTS ];
|
||||
int32_t job_ids[ MAXIMUM_WAIT_OBJECTS ];
|
||||
DWORD num_handles = 0;
|
||||
DWORD wait_api_result;
|
||||
for ( i = 0; i < globs.jobs; ++i )
|
||||
@@ -910,12 +910,12 @@ static int try_wait( int const timeoutMillis )
|
||||
}
|
||||
|
||||
|
||||
static int try_kill_one()
|
||||
static int32_t try_kill_one()
|
||||
{
|
||||
/* Only need to check if a timeout was specified with the -l option. */
|
||||
if ( globs.timeout > 0 )
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for ( i = 0; i < globs.jobs; ++i )
|
||||
if ( cmdtab[ i ].pi.hProcess )
|
||||
{
|
||||
@@ -946,7 +946,7 @@ static void close_alerts()
|
||||
*/
|
||||
if ( ( (float)clock() / (float)( CLOCKS_PER_SEC * 5 ) ) < ( 1.0 / 5.0 ) )
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for ( i = 0; i < globs.jobs; ++i )
|
||||
if ( cmdtab[ i ].pi.hProcess )
|
||||
close_alert( &cmdtab[ i ].pi );
|
||||
@@ -1034,7 +1034,7 @@ static double creation_time( HANDLE const process )
|
||||
* process is System (first argument is ignored).
|
||||
*/
|
||||
|
||||
static int is_parent_child( DWORD const parent, DWORD const child )
|
||||
static int32_t is_parent_child( DWORD const parent, DWORD const child )
|
||||
{
|
||||
HANDLE process_snapshot_h = INVALID_HANDLE_VALUE;
|
||||
|
||||
@@ -1202,7 +1202,7 @@ static void close_alert( PROCESS_INFORMATION const * const pi )
|
||||
* function.
|
||||
*/
|
||||
|
||||
static FILE * open_command_file( int const slot )
|
||||
static FILE * open_command_file( int32_t const slot )
|
||||
{
|
||||
string * const command_file = cmdtab[ slot ].command_file;
|
||||
|
||||
@@ -1234,13 +1234,13 @@ static FILE * open_command_file( int const slot )
|
||||
{
|
||||
char * const index1 = command_file->value + command_file->size - 6;
|
||||
char * const index2 = index1 + 1;
|
||||
int waits_remaining;
|
||||
int32_t waits_remaining;
|
||||
assert( command_file->value < index1 );
|
||||
assert( index2 + 1 < command_file->value + command_file->size );
|
||||
assert( index2[ 1 ] == '.' );
|
||||
for ( waits_remaining = 3; ; --waits_remaining )
|
||||
{
|
||||
int index;
|
||||
int32_t index;
|
||||
for ( index = 0; index != 20; ++index )
|
||||
{
|
||||
FILE * f;
|
||||
@@ -1262,7 +1262,7 @@ static FILE * open_command_file( int const slot )
|
||||
* Prepare a command file to be executed using an external shell.
|
||||
*/
|
||||
|
||||
static char const * prepare_command_file( string const * command, int slot )
|
||||
static char const * prepare_command_file( string const * command, int32_t slot )
|
||||
{
|
||||
FILE * const f = open_command_file( slot );
|
||||
if ( !f )
|
||||
@@ -1280,9 +1280,9 @@ static char const * prepare_command_file( string const * command, int slot )
|
||||
* Find a free slot in the running commands table.
|
||||
*/
|
||||
|
||||
static int get_free_cmdtab_slot()
|
||||
static int32_t get_free_cmdtab_slot()
|
||||
{
|
||||
int slot;
|
||||
int32_t slot;
|
||||
for ( slot = 0; slot < globs.jobs; ++slot )
|
||||
if ( !cmdtab[ slot ].pi.hProcess )
|
||||
return slot;
|
||||
@@ -1314,7 +1314,7 @@ static void string_new_from_argv( string * result, char const * const * argv )
|
||||
* Reports the last failed Windows API related error message.
|
||||
*/
|
||||
|
||||
static void reportWindowsError( char const * const apiName, int slot )
|
||||
static void reportWindowsError( char const * const apiName, int32_t slot )
|
||||
{
|
||||
char * errorMessage;
|
||||
char buf[24];
|
||||
|
||||
@@ -140,8 +140,8 @@ int exec_check
|
||||
(
|
||||
string const * command,
|
||||
LIST * * pShell,
|
||||
int * error_length,
|
||||
int * error_max_length
|
||||
int32_t * error_length,
|
||||
int32_t * error_max_length
|
||||
)
|
||||
{
|
||||
int const is_raw_cmd = is_raw_command_request( *pShell );
|
||||
|
||||
@@ -75,8 +75,8 @@ int exec_check
|
||||
(
|
||||
string const * command,
|
||||
LIST * * pShell,
|
||||
int * error_length,
|
||||
int * error_max_length
|
||||
int32_t * error_length,
|
||||
int32_t * error_max_length
|
||||
)
|
||||
{
|
||||
int const is_raw_cmd = 1;
|
||||
|
||||
@@ -62,13 +62,13 @@ int file_collect_dir_content_( file_info_t * const d )
|
||||
string pathspec[ 1 ];
|
||||
string pathname[ 1 ];
|
||||
LIST * files = L0;
|
||||
int d_length;
|
||||
int32_t d_length;
|
||||
|
||||
assert( d );
|
||||
assert( d->is_dir );
|
||||
assert( list_empty( d->files ) );
|
||||
|
||||
d_length = strlen( object_str( d->name ) );
|
||||
d_length = int32_t(strlen( object_str( d->name ) ));
|
||||
|
||||
memset( (char *)&f, '\0', sizeof( f ) );
|
||||
f.f_dir.ptr = object_str( d->name );
|
||||
@@ -112,7 +112,7 @@ int file_collect_dir_content_( file_info_t * const d )
|
||||
OBJECT * pathname_obj;
|
||||
|
||||
f.f_base.ptr = finfo.cFileName;
|
||||
f.f_base.len = strlen( finfo.cFileName );
|
||||
f.f_base.len = int32_t(strlen( finfo.cFileName ));
|
||||
|
||||
string_truncate( pathname, 0 );
|
||||
path_build( &f, pathname );
|
||||
@@ -276,7 +276,7 @@ void file_query_( file_info_t * const info )
|
||||
|
||||
if ( ( dir = strrchr( pathstr, '\\' ) ) )
|
||||
{
|
||||
parent = object_new_range( pathstr, dir - pathstr );
|
||||
parent = object_new_range( pathstr, int32_t(dir - pathstr) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -307,7 +307,7 @@ int file_collect_archive_content_( file_archive_info_t * const archive )
|
||||
char * src;
|
||||
char * dest;
|
||||
|
||||
size_t ar_hdr_name_size = sizeof( ar_hdr.ar_name ); // Workaround for sizeof strncpy warning.
|
||||
int32_t ar_hdr_name_size = sizeof( ar_hdr.ar_name ); // Workaround for sizeof strncpy warning.
|
||||
strncpy( lar_name, ar_hdr.ar_name, ar_hdr_name_size );
|
||||
|
||||
sscanf( ar_hdr.ar_date, "%ld", &lar_date );
|
||||
|
||||
@@ -229,7 +229,7 @@ file_cvttime(
|
||||
unsigned int *curtime,
|
||||
time_t *unixtime )
|
||||
{
|
||||
static const size_t divisor = 10000000;
|
||||
static const int32_t divisor = 10000000;
|
||||
static unsigned int bastim[2] = { 0x4BEB4000, 0x007C9567 }; /* 1/1/1970 */
|
||||
int delta[2], remainder;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,18 +22,18 @@ void stack_push( STACK * s, LIST * l );
|
||||
LIST * stack_pop( STACK * s );
|
||||
|
||||
FUNCTION * function_compile( PARSE * parse );
|
||||
FUNCTION * function_builtin( LIST * ( * func )( FRAME * frame, int flags ), int flags, const char * * args );
|
||||
FUNCTION * function_builtin( LIST * ( * func )( FRAME * frame, int32_t flags ), int32_t flags, const char * * args );
|
||||
void function_refer( FUNCTION * );
|
||||
void function_free( FUNCTION * );
|
||||
OBJECT * function_rulename( FUNCTION * );
|
||||
void function_set_rulename( FUNCTION *, OBJECT * );
|
||||
void function_location( FUNCTION *, OBJECT * *, int * );
|
||||
void function_location( FUNCTION *, OBJECT * *, int32_t * );
|
||||
LIST * function_run( FUNCTION * function, FRAME * frame, STACK * s );
|
||||
|
||||
FUNCTION * function_compile_actions( const char * actions, OBJECT * file, int line );
|
||||
FUNCTION * function_compile_actions( const char * actions, OBJECT * file, int32_t line );
|
||||
void function_run_actions( FUNCTION * function, FRAME * frame, STACK * s, string * out );
|
||||
|
||||
FUNCTION * function_bind_variables( FUNCTION * f, module_t * module, int * counter );
|
||||
FUNCTION * function_bind_variables( FUNCTION * f, module_t * module, int32_t * counter );
|
||||
FUNCTION * function_unbind_variables( FUNCTION * f );
|
||||
|
||||
LIST * function_get_variables( FUNCTION * f );
|
||||
|
||||
@@ -45,12 +45,12 @@ struct hash
|
||||
*/
|
||||
struct
|
||||
{
|
||||
int nel;
|
||||
int32_t nel;
|
||||
ITEM * * base;
|
||||
} tab;
|
||||
|
||||
int bloat; /* tab.nel / items.nel */
|
||||
int inel; /* initial number of elements */
|
||||
int32_t bloat; /* tab.nel / items.nel */
|
||||
int32_t inel; /* initial number of elements */
|
||||
|
||||
/*
|
||||
* the array of records, maintained by these routines - essentially a
|
||||
@@ -58,16 +58,16 @@ struct hash
|
||||
*/
|
||||
struct
|
||||
{
|
||||
int more; /* how many more ITEMs fit in lists[ list ] */
|
||||
int32_t more; /* how many more ITEMs fit in lists[ list ] */
|
||||
ITEM * free; /* free list of items */
|
||||
char * next; /* where to put more ITEMs in lists[ list ] */
|
||||
int size; /* sizeof( ITEM ) + aligned datalen */
|
||||
int nel; /* total ITEMs held by all lists[] */
|
||||
int list; /* index into lists[] */
|
||||
int32_t size; /* sizeof( ITEM ) + aligned datalen */
|
||||
int32_t nel; /* total ITEMs held by all lists[] */
|
||||
int32_t list; /* index into lists[] */
|
||||
|
||||
struct
|
||||
{
|
||||
int nel; /* total ITEMs held by this list */
|
||||
int32_t nel; /* total ITEMs held by this list */
|
||||
char * base; /* base of ITEMs array */
|
||||
} lists[ MAX_LISTS ];
|
||||
} items;
|
||||
@@ -78,7 +78,7 @@ struct hash
|
||||
static void hashrehash( struct hash * );
|
||||
static void hashstat( struct hash * );
|
||||
|
||||
static unsigned int hash_keyval( OBJECT * key )
|
||||
static uint32_t hash_keyval( OBJECT * key )
|
||||
{
|
||||
return object_hash( key );
|
||||
}
|
||||
@@ -96,7 +96,7 @@ static unsigned int hash_keyval( OBJECT * key )
|
||||
* hashinit() - initialize a hash table, returning a handle
|
||||
*/
|
||||
|
||||
struct hash * hashinit( int datalen, char const * name )
|
||||
struct hash * hashinit( int32_t datalen, char const * name )
|
||||
{
|
||||
struct hash * hp = (struct hash *)BJAM_MALLOC( sizeof( *hp ) );
|
||||
|
||||
@@ -123,7 +123,7 @@ struct hash * hashinit( int datalen, char const * name )
|
||||
* bucket or to 0 if our item is the first item in its bucket.
|
||||
*/
|
||||
|
||||
static ITEM * hash_search( struct hash * hp, unsigned int keyval,
|
||||
static ITEM * hash_search( struct hash * hp, uint32_t keyval,
|
||||
OBJECT * keydata, ITEM * * previous )
|
||||
{
|
||||
ITEM * i = *hash_bucket( hp, keyval );
|
||||
@@ -146,10 +146,10 @@ static ITEM * hash_search( struct hash * hp, unsigned int keyval,
|
||||
* hash_insert() - insert a record in the table or return the existing one
|
||||
*/
|
||||
|
||||
HASHDATA * hash_insert( struct hash * hp, OBJECT * key, int * found )
|
||||
HASHDATA * hash_insert( struct hash * hp, OBJECT * key, int32_t * found )
|
||||
{
|
||||
ITEM * i;
|
||||
unsigned int keyval = hash_keyval( key );
|
||||
uint32_t keyval = hash_keyval( key );
|
||||
|
||||
#ifdef HASH_DEBUG_PROFILE
|
||||
profile_frame prof[ 1 ];
|
||||
@@ -201,7 +201,7 @@ HASHDATA * hash_insert( struct hash * hp, OBJECT * key, int * found )
|
||||
HASHDATA * hash_find( struct hash * hp, OBJECT * key )
|
||||
{
|
||||
ITEM * i;
|
||||
unsigned int keyval = hash_keyval( key );
|
||||
uint32_t keyval = hash_keyval( key );
|
||||
|
||||
#ifdef HASH_DEBUG_PROFILE
|
||||
profile_frame prof[ 1 ];
|
||||
@@ -235,7 +235,7 @@ HASHDATA * hash_find( struct hash * hp, OBJECT * key )
|
||||
|
||||
static void hashrehash( struct hash * hp )
|
||||
{
|
||||
int i = ++hp->items.list;
|
||||
int32_t i = ++hp->items.list;
|
||||
hp->items.more = i ? 2 * hp->items.nel : hp->inel;
|
||||
hp->items.next = (char *)BJAM_MALLOC( hp->items.more * hp->items.size );
|
||||
hp->items.free = 0;
|
||||
@@ -254,7 +254,7 @@ static void hashrehash( struct hash * hp )
|
||||
|
||||
for ( i = 0; i < hp->items.list; ++i )
|
||||
{
|
||||
int nel = hp->items.lists[ i ].nel;
|
||||
int32_t nel = hp->items.lists[ i ].nel;
|
||||
char * next = hp->items.lists[ i ].base;
|
||||
|
||||
for ( ; nel--; next += hp->items.size )
|
||||
@@ -277,11 +277,11 @@ static void hashrehash( struct hash * hp )
|
||||
void hashenumerate( struct hash * hp, void (* f)( void *, void * ), void * data
|
||||
)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for ( i = 0; i <= hp->items.list; ++i )
|
||||
{
|
||||
char * next = hp->items.lists[ i ].base;
|
||||
int nel = hp->items.lists[ i ].nel;
|
||||
int32_t nel = hp->items.lists[ i ].nel;
|
||||
if ( i == hp->items.list )
|
||||
nel -= hp->items.more;
|
||||
|
||||
@@ -301,7 +301,7 @@ void hashenumerate( struct hash * hp, void (* f)( void *, void * ), void * data
|
||||
|
||||
void hash_free( struct hash * hp )
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
if ( !hp )
|
||||
return;
|
||||
if ( hp->tab.base )
|
||||
|
||||
@@ -28,7 +28,7 @@ typedef struct hashdata HASHDATA;
|
||||
* datalen - item size
|
||||
* name - used for debugging
|
||||
*/
|
||||
struct hash * hashinit( int datalen, char const * name );
|
||||
struct hash * hashinit( int32_t datalen, char const * name );
|
||||
|
||||
/*
|
||||
* hash_free() - free a hash table, given its handle
|
||||
@@ -57,7 +57,7 @@ void hashenumerate( struct hash *, void (* f)( void *, void * ), void * data );
|
||||
* - if the key is present then *found == 1 and the result is a pointer to the
|
||||
* existing record.
|
||||
*/
|
||||
HASHDATA * hash_insert( struct hash *, OBJECT * key, int * found );
|
||||
HASHDATA * hash_insert( struct hash *, OBJECT * key, int32_t * found );
|
||||
|
||||
/*
|
||||
* hash_find() - find a record in the table or NULL if none exists
|
||||
|
||||
@@ -743,7 +743,7 @@ char * executable_path( char const * argv0 )
|
||||
{
|
||||
int mib[ 4 ] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
|
||||
char buf[ 1024 ];
|
||||
size_t size = sizeof( buf );
|
||||
int32_t size = sizeof( buf );
|
||||
sysctl( mib, 4, buf, &size, NULL, 0 );
|
||||
return ( !size || size == sizeof( buf ) ) ? NULL : strndup( buf, size );
|
||||
}
|
||||
|
||||
@@ -26,12 +26,12 @@ static void assert_invariants( string * self )
|
||||
}
|
||||
|
||||
assert( self->size < self->capacity );
|
||||
assert( ( self->capacity <= sizeof( self->opt ) ) == ( self->value == self->opt ) );
|
||||
assert( ( self->capacity <= int32_t(sizeof( self->opt )) ) == ( self->value == self->opt ) );
|
||||
assert( self->value[ self->size ] == 0 );
|
||||
/* String objects modified manually after construction to contain embedded
|
||||
* '\0' characters are considered structurally valid.
|
||||
*/
|
||||
assert( strlen( self->value ) <= self->size );
|
||||
assert( strlen( self->value ) <= size_t(self->size) );
|
||||
|
||||
for ( i = 0; i < 4; ++i )
|
||||
{
|
||||
@@ -67,20 +67,20 @@ void string_free( string * s )
|
||||
}
|
||||
|
||||
|
||||
static void string_reserve_internal( string * self, size_t capacity )
|
||||
static void string_reserve_internal( string * self, int32_t capacity )
|
||||
{
|
||||
if ( self->value == self->opt )
|
||||
{
|
||||
self->value = (char *)BJAM_MALLOC_ATOMIC( capacity +
|
||||
self->value = (char *)BJAM_MALLOC_ATOMIC( size_t(capacity) +
|
||||
JAM_STRING_MAGIC_SIZE );
|
||||
self->value[ 0 ] = 0;
|
||||
size_t opt_size = sizeof(self->opt); // Workaround sizeof in strncat warning.
|
||||
strncat( self->value, self->opt, opt_size );
|
||||
assert( strlen( self->value ) <= self->capacity && "Regression test" );
|
||||
assert( strlen( self->value ) <= size_t(self->capacity) && "Regression test" );
|
||||
}
|
||||
else
|
||||
{
|
||||
self->value = (char *)BJAM_REALLOC( self->value, capacity +
|
||||
self->value = (char *)BJAM_REALLOC( self->value, size_t(capacity) +
|
||||
JAM_STRING_MAGIC_SIZE );
|
||||
}
|
||||
#ifndef NDEBUG
|
||||
@@ -90,7 +90,7 @@ static void string_reserve_internal( string * self, size_t capacity )
|
||||
}
|
||||
|
||||
|
||||
void string_reserve( string * self, size_t capacity )
|
||||
void string_reserve( string * self, int32_t capacity )
|
||||
{
|
||||
assert_invariants( self );
|
||||
if ( capacity <= self->capacity )
|
||||
@@ -100,12 +100,12 @@ void string_reserve( string * self, size_t capacity )
|
||||
}
|
||||
|
||||
|
||||
static void maybe_reserve( string * self, size_t new_size )
|
||||
static void maybe_reserve( string * self, int32_t new_size )
|
||||
{
|
||||
size_t capacity = self->capacity;
|
||||
int32_t capacity = self->capacity;
|
||||
if ( capacity <= new_size )
|
||||
{
|
||||
size_t new_capacity = capacity;
|
||||
int32_t new_capacity = capacity;
|
||||
while ( new_capacity <= new_size )
|
||||
new_capacity <<= 1;
|
||||
string_reserve_internal( self, new_capacity );
|
||||
@@ -115,13 +115,13 @@ static void maybe_reserve( string * self, size_t new_size )
|
||||
|
||||
void string_append( string * self, char const * rhs )
|
||||
{
|
||||
size_t rhs_size = strlen( rhs );
|
||||
size_t new_size = self->size + rhs_size;
|
||||
int32_t rhs_size = int32_t(strlen( rhs ));
|
||||
int32_t new_size = self->size + rhs_size;
|
||||
assert_invariants( self );
|
||||
|
||||
maybe_reserve( self, new_size );
|
||||
|
||||
memcpy( self->value + self->size, rhs, rhs_size + 1 );
|
||||
memcpy( self->value + self->size, rhs, size_t(rhs_size) + 1 );
|
||||
self->size = new_size;
|
||||
|
||||
assert_invariants( self );
|
||||
@@ -130,14 +130,14 @@ void string_append( string * self, char const * rhs )
|
||||
|
||||
void string_append_range( string * self, char const * start, char const * finish )
|
||||
{
|
||||
size_t rhs_size = finish - start;
|
||||
size_t new_size = self->size + rhs_size;
|
||||
int32_t rhs_size = int32_t(finish - start);
|
||||
int32_t new_size = self->size + rhs_size;
|
||||
assert_invariants( self );
|
||||
|
||||
maybe_reserve( self, new_size );
|
||||
|
||||
if ( start != finish )
|
||||
memcpy( self->value + self->size, start, rhs_size );
|
||||
memcpy( self->value + self->size, start, size_t(rhs_size) );
|
||||
self->size = new_size;
|
||||
self->value[ new_size ] = 0;
|
||||
|
||||
@@ -151,7 +151,7 @@ void string_copy( string * s, char const * rhs )
|
||||
string_append( s, rhs );
|
||||
}
|
||||
|
||||
void string_truncate( string * self, size_t n )
|
||||
void string_truncate( string * self, int32_t n )
|
||||
{
|
||||
assert_invariants( self );
|
||||
assert( n <= self->capacity );
|
||||
@@ -198,9 +198,9 @@ void string_unit_test()
|
||||
for ( i = 0; i < limit; ++i )
|
||||
{
|
||||
string_push_back( s, (char)( i + 1 ) );
|
||||
assert( s->size == i + 1 );
|
||||
assert( s->size == int32_t(i + 1) );
|
||||
}
|
||||
assert( s->size == limit );
|
||||
assert( s->size == int32_t(limit) );
|
||||
assert( s->value != s->opt );
|
||||
for ( i = 0; i < limit; ++i )
|
||||
assert( s->value[ i ] == (char)( i + 1 ) );
|
||||
@@ -212,7 +212,7 @@ void string_unit_test()
|
||||
string copy[ 1 ];
|
||||
string_copy( copy, original );
|
||||
assert( !strcmp( copy->value, original ) );
|
||||
assert( copy->size == strlen( original ) );
|
||||
assert( copy->size == int32_t(strlen( original )) );
|
||||
string_free( copy );
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
typedef struct string
|
||||
{
|
||||
char * value;
|
||||
unsigned long size;
|
||||
unsigned long capacity;
|
||||
int32_t size;
|
||||
int32_t capacity;
|
||||
char opt[ 32 ];
|
||||
#ifndef NDEBUG
|
||||
char magic[ 4 ];
|
||||
@@ -28,8 +28,8 @@ void string_free( string * );
|
||||
void string_append( string *, char const * );
|
||||
void string_append_range( string *, char const *, char const * );
|
||||
void string_push_back( string * s, char x );
|
||||
void string_reserve( string *, size_t );
|
||||
void string_truncate( string *, size_t );
|
||||
void string_reserve( string *, int32_t );
|
||||
void string_truncate( string *, int32_t );
|
||||
void string_pop_back( string * );
|
||||
char string_back( string * );
|
||||
void string_rtrim( string * );
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* A Bison parser, made by GNU Bison 3.6.2. */
|
||||
/* A Bison parser, made by GNU Bison 3.6.4. */
|
||||
|
||||
/* Bison implementation for Yacc-like parsers in C
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#define YYBISON 1
|
||||
|
||||
/* Bison version. */
|
||||
#define YYBISON_VERSION "3.6.2"
|
||||
#define YYBISON_VERSION "3.6.4"
|
||||
|
||||
/* Skeleton name. */
|
||||
#define YYSKELETON_NAME "yacc.c"
|
||||
@@ -764,7 +764,7 @@ static const yytype_int8 yytranslate[] =
|
||||
};
|
||||
|
||||
#if YYDEBUG
|
||||
/* YYRLINEYYN -- Source line where rule number YYN was defined. */
|
||||
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
|
||||
static const yytype_int16 yyrline[] =
|
||||
{
|
||||
0, 145, 145, 147, 158, 160, 164, 166, 168, 168,
|
||||
@@ -846,7 +846,7 @@ static const yytype_int16 yytoknum[] =
|
||||
#define yytable_value_is_error(Yyn) \
|
||||
0
|
||||
|
||||
/* YYPACTSTATE-NUM -- Index in YYTABLE of the portion describing
|
||||
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
|
||||
STATE-NUM. */
|
||||
static const yytype_int16 yypact[] =
|
||||
{
|
||||
@@ -873,7 +873,7 @@ static const yytype_int16 yypact[] =
|
||||
-119, 115, -119, -119, -119, 140, -119
|
||||
};
|
||||
|
||||
/* YYDEFACTSTATE-NUM -- Default reduction number in state STATE-NUM.
|
||||
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
|
||||
Performed when YYTABLE does not specify something else to do. Zero
|
||||
means the default is an error. */
|
||||
static const yytype_int8 yydefact[] =
|
||||
@@ -901,7 +901,7 @@ static const yytype_int8 yydefact[] =
|
||||
60, 0, 19, 95, 37, 11, 96
|
||||
};
|
||||
|
||||
/* YYPGOTONTERM-NUM. */
|
||||
/* YYPGOTO[NTERM-NUM]. */
|
||||
static const yytype_int16 yypgoto[] =
|
||||
{
|
||||
-119, -119, -118, 25, -119, -119, 96, -119, -119, -119,
|
||||
@@ -913,7 +913,7 @@ static const yytype_int16 yypgoto[] =
|
||||
-119, -119, -119, -119, -119, -119, -119, -119
|
||||
};
|
||||
|
||||
/* YYDEFGOTONTERM-NUM. */
|
||||
/* YYDEFGOTO[NTERM-NUM]. */
|
||||
static const yytype_int16 yydefgoto[] =
|
||||
{
|
||||
-1, 17, 38, 39, 31, 168, 40, 109, 140, 175,
|
||||
@@ -925,7 +925,7 @@ static const yytype_int16 yydefgoto[] =
|
||||
53, 84, 149, 148, 23, 61, 87, 121
|
||||
};
|
||||
|
||||
/* YYTABLEYYPACT[STATE-NUM] -- What to do in state STATE-NUM. If
|
||||
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
|
||||
positive, shift that token. If negative, reduce the rule whose
|
||||
number is the opposite. If YYTABLE_NINF, syntax error. */
|
||||
static const yytype_int16 yytable[] =
|
||||
@@ -986,7 +986,7 @@ static const yytype_int16 yycheck[] =
|
||||
14, 15, 16
|
||||
};
|
||||
|
||||
/* YYSTOSSTATE-NUM -- The (internal number of the) accessing
|
||||
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
|
||||
symbol of state STATE-NUM. */
|
||||
static const yytype_int8 yystos[] =
|
||||
{
|
||||
@@ -1013,7 +1013,7 @@ static const yytype_int8 yystos[] =
|
||||
48, 53, 63, 10, 48, 105, 53
|
||||
};
|
||||
|
||||
/* YYR1YYN -- Symbol number of symbol that rule YYN derives. */
|
||||
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
|
||||
static const yytype_int8 yyr1[] =
|
||||
{
|
||||
0, 51, 52, 52, 53, 53, 54, 54, 55, 56,
|
||||
@@ -1031,7 +1031,7 @@ static const yytype_int8 yyr1[] =
|
||||
118, 117
|
||||
};
|
||||
|
||||
/* YYR2YYN -- Number of symbols on the right hand side of rule YYN. */
|
||||
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
|
||||
static const yytype_int8 yyr2[] =
|
||||
{
|
||||
0, 2, 0, 1, 1, 1, 1, 2, 0, 0,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* A Bison parser, made by GNU Bison 3.6.2. */
|
||||
/* A Bison parser, made by GNU Bison 3.6.4. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
|
||||
@@ -16,30 +16,30 @@
|
||||
|
||||
static LIST * freelist[ 32 ]; /* junkpile for list_dealloc() */
|
||||
|
||||
static unsigned get_bucket( unsigned size )
|
||||
static int32_t get_bucket( int32_t size )
|
||||
{
|
||||
unsigned bucket = 0;
|
||||
while ( size > ( 1u << bucket ) ) ++bucket;
|
||||
int32_t bucket = 0;
|
||||
while ( size > ( int32_t(1) << bucket ) ) ++bucket;
|
||||
return bucket;
|
||||
}
|
||||
|
||||
static LIST * list_alloc( unsigned const size )
|
||||
static LIST * list_alloc( int32_t size )
|
||||
{
|
||||
unsigned const bucket = get_bucket( size );
|
||||
int32_t bucket = get_bucket( size );
|
||||
if ( freelist[ bucket ] )
|
||||
{
|
||||
LIST * result = freelist[ bucket ];
|
||||
freelist[ bucket ] = result->impl.next;
|
||||
return result;
|
||||
}
|
||||
return (LIST *)BJAM_MALLOC( sizeof( LIST ) + ( 1u << bucket ) *
|
||||
return (LIST *)BJAM_MALLOC( sizeof( LIST ) + ( size_t( 1 ) << bucket ) *
|
||||
sizeof( OBJECT * ) );
|
||||
}
|
||||
|
||||
static void list_dealloc( LIST * l )
|
||||
{
|
||||
unsigned size = list_length( l );
|
||||
unsigned bucket;
|
||||
int32_t size = list_length( l );
|
||||
int32_t bucket;
|
||||
LIST * node = l;
|
||||
|
||||
if ( size == 0 ) return;
|
||||
@@ -64,13 +64,13 @@ LIST * list_append( LIST * l, LIST * nl )
|
||||
return nl;
|
||||
if ( !list_empty( nl ) )
|
||||
{
|
||||
unsigned int const l_size = list_length( l );
|
||||
int const nl_size = list_length( nl );
|
||||
int const size = l_size + nl_size;
|
||||
unsigned const bucket = get_bucket( size );
|
||||
int32_t l_size = list_length( l );
|
||||
int32_t nl_size = list_length( nl );
|
||||
int32_t size = l_size + nl_size;
|
||||
int32_t bucket = get_bucket( size );
|
||||
|
||||
/* Do we need to reallocate? */
|
||||
if ( l_size <= ( 1u << ( bucket - 1 ) ) )
|
||||
if ( l_size <= ( int32_t(1) << ( bucket - 1 ) ) )
|
||||
{
|
||||
LIST * result = list_alloc( size );
|
||||
memcpy( list_begin( result ), list_begin( l ), l_size * sizeof(
|
||||
@@ -111,7 +111,7 @@ LIST * list_new( OBJECT * value )
|
||||
|
||||
LIST * list_push_back( LIST * head, OBJECT * value )
|
||||
{
|
||||
unsigned int size = list_length( head );
|
||||
int32_t size = list_length( head );
|
||||
|
||||
if ( DEBUG_LISTS )
|
||||
out_printf( "list > %s <\n", object_str( value ) );
|
||||
@@ -142,8 +142,8 @@ LIST * list_push_back( LIST * head, OBJECT * value )
|
||||
|
||||
LIST * list_copy( LIST * l )
|
||||
{
|
||||
int size = list_length( l );
|
||||
int i;
|
||||
int32_t size = list_length( l );
|
||||
int32_t i;
|
||||
LIST * result;
|
||||
|
||||
if ( size == 0 ) return L0;
|
||||
@@ -162,7 +162,7 @@ LIST * list_copy_range( LIST * l, LISTITER first, LISTITER last )
|
||||
return L0;
|
||||
else
|
||||
{
|
||||
int size = last - first;
|
||||
int32_t size = int32_t( last - first );
|
||||
LIST * result = list_alloc( size );
|
||||
LISTITER dest = list_begin( result );
|
||||
result->impl.size = size;
|
||||
@@ -177,17 +177,17 @@ LIST * list_copy_range( LIST * l, LISTITER first, LISTITER last )
|
||||
* list_sublist() - copy a subset of a list of strings.
|
||||
*/
|
||||
|
||||
LIST * list_sublist( LIST * l, int start, int count )
|
||||
LIST * list_sublist( LIST * l, int32_t start, int32_t count )
|
||||
{
|
||||
int end = start + count;
|
||||
int size = list_length( l );
|
||||
int32_t end = start + count;
|
||||
int32_t size = list_length( l );
|
||||
if ( start >= size ) return L0;
|
||||
if ( end > size ) end = size;
|
||||
return list_copy_range( l, list_begin( l ) + start, list_begin( l ) + end );
|
||||
}
|
||||
|
||||
|
||||
static int str_ptr_compare( void const * va, void const * vb )
|
||||
static int32_t str_ptr_compare( void const * va, void const * vb )
|
||||
{
|
||||
OBJECT * a = *( (OBJECT * *)va );
|
||||
OBJECT * b = *( (OBJECT * *)vb );
|
||||
@@ -197,7 +197,7 @@ static int str_ptr_compare( void const * va, void const * vb )
|
||||
|
||||
LIST * list_sort( LIST * l )
|
||||
{
|
||||
int len;
|
||||
int32_t len;
|
||||
LIST * result;
|
||||
|
||||
if ( !l )
|
||||
@@ -235,7 +235,7 @@ void list_free( LIST * head )
|
||||
|
||||
LIST * list_pop_front( LIST * l )
|
||||
{
|
||||
unsigned size = list_length( l );
|
||||
int32_t size = list_length( l );
|
||||
assert( size );
|
||||
--size;
|
||||
object_free( list_front( l ) );
|
||||
@@ -263,11 +263,11 @@ LIST * list_pop_front( LIST * l )
|
||||
|
||||
LIST * list_reverse( LIST * l )
|
||||
{
|
||||
int size = list_length( l );
|
||||
int32_t size = list_length( l );
|
||||
if ( size == 0 ) return L0;
|
||||
{
|
||||
LIST * const result = list_alloc( size );
|
||||
int i;
|
||||
int32_t i;
|
||||
result->impl.size = size;
|
||||
for ( i = 0; i < size; ++i )
|
||||
list_begin( result )[ i ] = object_copy( list_begin( l )[ size - i -
|
||||
@@ -276,9 +276,9 @@ LIST * list_reverse( LIST * l )
|
||||
}
|
||||
}
|
||||
|
||||
int list_cmp( LIST * t, LIST * s )
|
||||
int32_t list_cmp( LIST * t, LIST * s )
|
||||
{
|
||||
int status = 0;
|
||||
int32_t status = 0;
|
||||
LISTITER t_it = list_begin( t );
|
||||
LISTITER const t_end = list_end( t );
|
||||
LISTITER s_it = list_begin( s );
|
||||
@@ -298,7 +298,7 @@ int list_cmp( LIST * t, LIST * s )
|
||||
return status;
|
||||
}
|
||||
|
||||
int list_is_sublist( LIST * sub, LIST * l )
|
||||
int32_t list_is_sublist( LIST * sub, LIST * l )
|
||||
{
|
||||
LISTITER iter = list_begin( sub );
|
||||
LISTITER const end = list_end( sub );
|
||||
@@ -329,13 +329,13 @@ void list_print( LIST * l )
|
||||
* list_length() - return the number of items in the list
|
||||
*/
|
||||
|
||||
int list_length( LIST * l )
|
||||
int32_t list_length( LIST * l )
|
||||
{
|
||||
return l ? l->impl.size : 0;
|
||||
}
|
||||
|
||||
|
||||
int list_in( LIST * l, OBJECT * value )
|
||||
int32_t list_in( LIST * l, OBJECT * value )
|
||||
{
|
||||
LISTITER iter = list_begin( l );
|
||||
LISTITER end = list_end( l );
|
||||
@@ -365,8 +365,7 @@ LIST * list_unique( LIST * sorted_list )
|
||||
|
||||
void list_done()
|
||||
{
|
||||
unsigned int i;
|
||||
for ( i = 0; i < sizeof( freelist ) / sizeof( freelist[ 0 ] ); ++i )
|
||||
for ( int32_t i = 0; i < int32_t(sizeof( freelist ) / sizeof( freelist[ 0 ] )); ++i )
|
||||
{
|
||||
LIST * l = freelist[ i ];
|
||||
while ( l )
|
||||
@@ -406,7 +405,7 @@ void lol_add( LOL * lol, LIST * l )
|
||||
|
||||
void lol_free( LOL * lol )
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for ( i = 0; i < lol->count; ++i )
|
||||
list_free( lol->list[ i ] );
|
||||
lol->count = 0;
|
||||
@@ -417,7 +416,7 @@ void lol_free( LOL * lol )
|
||||
* lol_get() - return one of the LISTs in the LOL.
|
||||
*/
|
||||
|
||||
LIST * lol_get( LOL * lol, int i )
|
||||
LIST * lol_get( LOL * lol, int32_t i )
|
||||
{
|
||||
return i < lol->count ? lol->list[ i ] : L0;
|
||||
}
|
||||
@@ -429,7 +428,7 @@ LIST * lol_get( LOL * lol, int i )
|
||||
|
||||
void lol_print( LOL * lol )
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for ( i = 0; i < lol->count; ++i )
|
||||
{
|
||||
if ( i )
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
typedef struct _list {
|
||||
union {
|
||||
int size;
|
||||
int32_t size;
|
||||
struct _list * next;
|
||||
OBJECT * align;
|
||||
} impl;
|
||||
@@ -68,7 +68,7 @@ typedef OBJECT * * LISTITER;
|
||||
|
||||
#define LOL_MAX 19
|
||||
typedef struct _lol {
|
||||
int count;
|
||||
int32_t count;
|
||||
LIST * list[ LOL_MAX ];
|
||||
} LOL;
|
||||
|
||||
@@ -79,15 +79,15 @@ LIST * list_copy_range( LIST * destination, LISTITER first, LISTITER last );
|
||||
void list_free( LIST * head );
|
||||
LIST * list_push_back( LIST * head, OBJECT * value );
|
||||
void list_print( LIST * );
|
||||
int list_length( LIST * );
|
||||
LIST * list_sublist( LIST *, int start, int count );
|
||||
int32_t list_length( LIST * );
|
||||
LIST * list_sublist( LIST *, int32_t start, int32_t count );
|
||||
LIST * list_pop_front( LIST * );
|
||||
LIST * list_sort( LIST * );
|
||||
LIST * list_unique( LIST * sorted_list );
|
||||
int list_in( LIST *, OBJECT * value );
|
||||
int32_t list_in( LIST *, OBJECT * value );
|
||||
LIST * list_reverse( LIST * );
|
||||
int list_cmp( LIST * lhs, LIST * rhs );
|
||||
int list_is_sublist( LIST * sub, LIST * l );
|
||||
int32_t list_cmp( LIST * lhs, LIST * rhs );
|
||||
int32_t list_is_sublist( LIST * sub, LIST * l );
|
||||
void list_done();
|
||||
|
||||
LISTITER list_begin( LIST * );
|
||||
@@ -159,7 +159,7 @@ namespace b2 { namespace jam {
|
||||
inline iterator begin() { return iterator(list_begin(list_obj)); }
|
||||
inline iterator end() { return iterator(list_end(list_obj)); }
|
||||
inline bool empty() const { return list_empty(list_obj) || length() == 0; }
|
||||
inline int length() const { return list_length(list_obj); }
|
||||
inline int32_t length() const { return list_length(list_obj); }
|
||||
inline list &append(const list &other)
|
||||
{
|
||||
list_obj = list_append(list_obj, list_copy(other.list_obj));
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
static TARGETS * make0sort( TARGETS * c );
|
||||
|
||||
#ifdef OPT_GRAPH_DEBUG_EXT
|
||||
static void dependGraphOutput( TARGET * t, int depth );
|
||||
static void dependGraphOutput( TARGET * t, int32_t depth );
|
||||
#endif
|
||||
|
||||
static char const * target_fate[] =
|
||||
@@ -91,10 +91,10 @@ static char const * target_bind[] =
|
||||
* make() - make a target, given its name.
|
||||
*/
|
||||
|
||||
int make( LIST * targets, int anyhow )
|
||||
int32_t make( LIST * targets, int32_t anyhow )
|
||||
{
|
||||
COUNTS counts[ 1 ];
|
||||
int status = 0; /* 1 if anything fails */
|
||||
int32_t status = 0; /* 1 if anything fails */
|
||||
|
||||
#ifdef OPT_HEADER_CACHE_EXT
|
||||
hcache_init();
|
||||
@@ -188,7 +188,7 @@ static void update_dependants( TARGET * t )
|
||||
if ( DEBUG_FATE )
|
||||
{
|
||||
out_printf( "fate change %s from %s to %s (as dependent of %s)\n",
|
||||
object_str( p->name ), target_fate[ (int) fate0 ], target_fate[ (int) p->fate ], object_str( t->name ) );
|
||||
object_str( p->name ), target_fate[ (int32_t) fate0 ], target_fate[ (int32_t) p->fate ], object_str( t->name ) );
|
||||
}
|
||||
|
||||
/* If we are done visiting it, go back and make sure its dependants
|
||||
@@ -219,7 +219,7 @@ static void force_rebuilds( TARGET * t )
|
||||
{
|
||||
if ( DEBUG_FATE )
|
||||
out_printf( "fate change %s from %s to %s (by rebuild)\n",
|
||||
object_str( r->name ), target_fate[ (int) r->fate ], target_fate[ T_FATE_REBUILD ] );
|
||||
object_str( r->name ), target_fate[ (int32_t) r->fate ], target_fate[ T_FATE_REBUILD ] );
|
||||
|
||||
/* Force rebuild it. */
|
||||
r->fate = T_FATE_REBUILD;
|
||||
@@ -231,9 +231,9 @@ static void force_rebuilds( TARGET * t )
|
||||
}
|
||||
|
||||
|
||||
int make0rescan( TARGET * t, TARGET * rescanning )
|
||||
int32_t make0rescan( TARGET * t, TARGET * rescanning )
|
||||
{
|
||||
int result = 0;
|
||||
int32_t result = 0;
|
||||
TARGETS * c;
|
||||
|
||||
/* Check whether we have already found a cycle. */
|
||||
@@ -281,9 +281,9 @@ void make0
|
||||
(
|
||||
TARGET * t,
|
||||
TARGET * p, /* parent */
|
||||
int depth, /* for display purposes */
|
||||
int32_t depth, /* for display purposes */
|
||||
COUNTS * counts, /* for reporting */
|
||||
int anyhow,
|
||||
int32_t anyhow,
|
||||
TARGET * rescanning
|
||||
) /* forcibly touch all (real) targets */
|
||||
{
|
||||
@@ -293,13 +293,13 @@ void make0
|
||||
timestamp last;
|
||||
timestamp leaf;
|
||||
timestamp hlast;
|
||||
int fate;
|
||||
int32_t fate;
|
||||
char const * flag = "";
|
||||
SETTINGS * s;
|
||||
|
||||
#ifdef OPT_GRAPH_DEBUG_EXT
|
||||
int savedFate;
|
||||
int oldTimeStamp;
|
||||
int32_t savedFate;
|
||||
int32_t oldTimeStamp;
|
||||
#endif
|
||||
|
||||
if ( DEBUG_MAKEPROG )
|
||||
@@ -392,7 +392,7 @@ void make0
|
||||
case T_BIND_MISSING:
|
||||
case T_BIND_PARENTS:
|
||||
out_printf( "time\t--\t%s%s: %s\n", spaces( depth ),
|
||||
object_str( t->name ), target_bind[ (int)t->binding ] );
|
||||
object_str( t->name ), target_bind[ (int32_t)t->binding ] );
|
||||
break;
|
||||
|
||||
case T_BIND_EXISTS:
|
||||
@@ -409,7 +409,7 @@ void make0
|
||||
/* Step 3a: Recursively make0() dependencies. */
|
||||
for ( c = t->depends; c; c = c->next )
|
||||
{
|
||||
int const internal = t->flags & T_FLAG_INTERNAL;
|
||||
int32_t const internal = t->flags & T_FLAG_INTERNAL;
|
||||
|
||||
/* Warn about circular deps, except for includes, which include each
|
||||
* other alot.
|
||||
@@ -453,7 +453,7 @@ void make0
|
||||
|
||||
/* Step 3d: Detect cycles. */
|
||||
{
|
||||
int cycle_depth = depth;
|
||||
int32_t cycle_depth = depth;
|
||||
for ( c = t->depends; c; c = c->next )
|
||||
{
|
||||
TARGET * scc_root = target_scc( c->target );
|
||||
@@ -512,8 +512,8 @@ void make0
|
||||
if ( DEBUG_FATE )
|
||||
if ( fate < c->target->fate )
|
||||
out_printf( "fate change %s from %s to %s by dependency %s\n",
|
||||
object_str( t->name ), target_fate[ (int)fate ],
|
||||
target_fate[ (int)c->target->fate ], object_str(
|
||||
object_str( t->name ), target_fate[ (int32_t)fate ],
|
||||
target_fate[ (int32_t)c->target->fate ], object_str(
|
||||
c->target->name ) );
|
||||
#endif
|
||||
}
|
||||
@@ -760,7 +760,7 @@ void make0
|
||||
flag = "*";
|
||||
|
||||
if ( DEBUG_MAKEPROG )
|
||||
out_printf( "made%s\t%s\t%s%s\n", flag, target_fate[ (int)t->fate ],
|
||||
out_printf( "made%s\t%s\t%s%s\n", flag, target_fate[ (int32_t)t->fate ],
|
||||
spaces( depth ), object_str( t->name ) );
|
||||
}
|
||||
|
||||
@@ -783,7 +783,7 @@ static char const * target_name( TARGET * t )
|
||||
* dependGraphOutput() - output the DG after make0 has run.
|
||||
*/
|
||||
|
||||
static void dependGraphOutput( TARGET * t, int depth )
|
||||
static void dependGraphOutput( TARGET * t, int32_t depth )
|
||||
{
|
||||
TARGETS * c;
|
||||
|
||||
@@ -864,7 +864,7 @@ static void dependGraphOutput( TARGET * t, int depth )
|
||||
for ( c = t->depends; c; c = c->next )
|
||||
{
|
||||
out_printf( " %s : Depends on %s (%s)", spaces( depth ),
|
||||
target_name( c->target ), target_fate[ (int)c->target->fate ] );
|
||||
target_name( c->target ), target_fate[ (int32_t)c->target->fate ] );
|
||||
if ( !timestamp_cmp( &c->target->time, &t->time ) )
|
||||
out_printf( " (max time)");
|
||||
out_printf( "\n" );
|
||||
|
||||
@@ -16,20 +16,20 @@
|
||||
#include "object.h"
|
||||
#include "rules.h"
|
||||
|
||||
int make( LIST * targets, int anyhow );
|
||||
int make1( LIST * t );
|
||||
int32_t make( LIST * targets, int32_t anyhow );
|
||||
int32_t make1( LIST * t );
|
||||
|
||||
typedef struct {
|
||||
int temp;
|
||||
int updating;
|
||||
int cantfind;
|
||||
int cantmake;
|
||||
int targets;
|
||||
int made;
|
||||
int32_t temp;
|
||||
int32_t updating;
|
||||
int32_t cantfind;
|
||||
int32_t cantmake;
|
||||
int32_t targets;
|
||||
int32_t made;
|
||||
} COUNTS ;
|
||||
|
||||
|
||||
void make0( TARGET * t, TARGET * p, int depth, COUNTS * counts, int anyhow,
|
||||
void make0( TARGET * t, TARGET * p, int32_t depth, COUNTS * counts, int32_t anyhow,
|
||||
TARGET * rescanning );
|
||||
|
||||
|
||||
|
||||
@@ -59,24 +59,24 @@
|
||||
#endif
|
||||
|
||||
static CMD * make1cmds ( TARGET * );
|
||||
static LIST * make1list ( LIST *, TARGETS *, int flags );
|
||||
static LIST * make1list ( LIST *, TARGETS *, int32_t flags );
|
||||
static SETTINGS * make1settings ( struct module_t *, LIST * vars );
|
||||
static void make1bind ( TARGET * );
|
||||
static void push_cmds( CMDLIST * cmds, int status );
|
||||
static int cmd_sem_lock( TARGET * t );
|
||||
static void push_cmds( CMDLIST * cmds, int32_t status );
|
||||
static int32_t cmd_sem_lock( TARGET * t );
|
||||
static void cmd_sem_unlock( TARGET * t );
|
||||
|
||||
static int targets_contains( TARGETS * l, TARGET * t );
|
||||
static int targets_equal( TARGETS * l1, TARGETS * l2 );
|
||||
static int32_t targets_contains( TARGETS * l, TARGET * t );
|
||||
static int32_t targets_equal( TARGETS * l1, TARGETS * l2 );
|
||||
|
||||
/* Ugly static - it is too hard to carry it through the callbacks. */
|
||||
|
||||
static struct
|
||||
{
|
||||
int failed;
|
||||
int skipped;
|
||||
int total;
|
||||
int made;
|
||||
int32_t failed;
|
||||
int32_t skipped;
|
||||
int32_t total;
|
||||
int32_t made;
|
||||
} counts[ 1 ];
|
||||
|
||||
/* Target state. */
|
||||
@@ -90,16 +90,16 @@ struct _state
|
||||
state * prev; /* previous state on stack */
|
||||
TARGET * t; /* current target */
|
||||
TARGET * parent; /* parent argument necessary for MAKE1A */
|
||||
int curstate; /* current state */
|
||||
int32_t curstate; /* current state */
|
||||
};
|
||||
|
||||
static void make1a( state * const );
|
||||
static void make1b( state * const );
|
||||
static void make1c( state const * const );
|
||||
|
||||
static void make1c_closure( void * const closure, int status,
|
||||
static void make1c_closure( void * const closure, int32_t status,
|
||||
timing_info const * const, char const * const cmd_stdout,
|
||||
char const * const cmd_stderr, int const cmd_exit_reason );
|
||||
char const * const cmd_stderr, int32_t const cmd_exit_reason );
|
||||
|
||||
typedef struct _stack
|
||||
{
|
||||
@@ -111,7 +111,7 @@ static stack state_stack = { NULL };
|
||||
static state * state_freelist = NULL;
|
||||
|
||||
/* Currently running command counter. */
|
||||
static int cmdsrunning;
|
||||
static int32_t cmdsrunning;
|
||||
|
||||
|
||||
static state * alloc_state()
|
||||
@@ -163,7 +163,7 @@ static void pop_state( stack * const pStack )
|
||||
|
||||
|
||||
static state * push_state( stack * const pStack, TARGET * const t,
|
||||
TARGET * const parent, int const curstate )
|
||||
TARGET * const parent, int32_t const curstate )
|
||||
{
|
||||
state * const pState = alloc_state();
|
||||
pState->t = t;
|
||||
@@ -194,13 +194,13 @@ static void push_stack_on_stack( stack * const pDest, stack * const pSrc )
|
||||
* make1() - execute commands to update a list of targets and all of their dependencies
|
||||
*/
|
||||
|
||||
static int intr = 0;
|
||||
static int quit = 0;
|
||||
static int32_t intr = 0;
|
||||
static int32_t quit = 0;
|
||||
|
||||
int make1( LIST * targets )
|
||||
int32_t make1( LIST * targets )
|
||||
{
|
||||
state * pState;
|
||||
int status = 0;
|
||||
int32_t status = 0;
|
||||
|
||||
memset( (char *)counts, 0, sizeof( *counts ) );
|
||||
|
||||
@@ -512,7 +512,7 @@ static void make1c( state const * const pState )
|
||||
{
|
||||
TARGET * const t = pState->t;
|
||||
CMD * const cmd = (CMD *)t->cmds;
|
||||
int exec_flags = 0;
|
||||
int32_t exec_flags = 0;
|
||||
|
||||
if ( cmd )
|
||||
{
|
||||
@@ -786,7 +786,7 @@ static void call_timing_rule( TARGET * target, timing_info const * const time )
|
||||
static void call_action_rule
|
||||
(
|
||||
TARGET * target,
|
||||
int status,
|
||||
int32_t status,
|
||||
timing_info const * time,
|
||||
char const * executed_command,
|
||||
char const * command_output
|
||||
@@ -869,11 +869,11 @@ static void call_action_rule
|
||||
static void make1c_closure
|
||||
(
|
||||
void * const closure,
|
||||
int status_orig,
|
||||
int32_t status_orig,
|
||||
timing_info const * const time,
|
||||
char const * const cmd_stdout,
|
||||
char const * const cmd_stderr,
|
||||
int const cmd_exit_reason
|
||||
int32_t const cmd_exit_reason
|
||||
)
|
||||
{
|
||||
TARGET * const t = (TARGET *)closure;
|
||||
@@ -984,7 +984,7 @@ static void make1c_closure
|
||||
}
|
||||
|
||||
/* push the next MAKE1C state after a command is run. */
|
||||
static void push_cmds( CMDLIST * cmds, int status )
|
||||
static void push_cmds( CMDLIST * cmds, int32_t status )
|
||||
{
|
||||
CMDLIST * cmd_iter;
|
||||
for( cmd_iter = cmds; cmd_iter; cmd_iter = cmd_iter->next )
|
||||
@@ -1065,12 +1065,12 @@ static void swap_settings
|
||||
static CMD * make1cmds( TARGET * t )
|
||||
{
|
||||
CMD * cmds = 0;
|
||||
CMD * last_cmd;
|
||||
CMD * last_cmd = 0;
|
||||
LIST * shell = L0;
|
||||
module_t * settings_module = 0;
|
||||
TARGET * settings_target = 0;
|
||||
ACTIONS * a0;
|
||||
int const running_flag = globs.noexec ? A_RUNNING_NOEXEC : A_RUNNING;
|
||||
ACTIONS * a0 = 0;
|
||||
int32_t const running_flag = globs.noexec ? A_RUNNING_NOEXEC : A_RUNNING;
|
||||
|
||||
/* Step through actions.
|
||||
*/
|
||||
@@ -1168,21 +1168,21 @@ static CMD * make1cmds( TARGET * t )
|
||||
* Note that we loop through at least once, for sourceless actions.
|
||||
*/
|
||||
{
|
||||
int const length = list_length( ns );
|
||||
int start = 0;
|
||||
int chunk = length;
|
||||
int cmd_count = 0;
|
||||
int32_t const length = list_length( ns );
|
||||
int32_t start = 0;
|
||||
int32_t chunk = length;
|
||||
int32_t cmd_count = 0;
|
||||
TARGETS * semaphores = NULL;
|
||||
TARGETS * targets_iter;
|
||||
int unique_targets;
|
||||
int32_t unique_targets;
|
||||
do
|
||||
{
|
||||
CMD * cmd;
|
||||
int cmd_check_result;
|
||||
int cmd_error_length;
|
||||
int cmd_error_max_length;
|
||||
int retry = 0;
|
||||
int accept_command = 0;
|
||||
int32_t cmd_check_result;
|
||||
int32_t cmd_error_length;
|
||||
int32_t cmd_error_max_length;
|
||||
int32_t retry = 0;
|
||||
int32_t accept_command = 0;
|
||||
|
||||
/* Build cmd: cmd_new() takes ownership of its lists. */
|
||||
cmd = cmd_new( rule, list_copy( nt ), list_sublist( ns, start,
|
||||
@@ -1219,9 +1219,10 @@ static CMD * make1cmds( TARGET * t )
|
||||
: "contains a line that is too long";
|
||||
assert( cmd_check_result == EXEC_CHECK_TOO_LONG ||
|
||||
cmd_check_result == EXEC_CHECK_LINE_TOO_LONG );
|
||||
out_printf( "%s action %s (%d, max %d):\n", object_str(
|
||||
rule->name ), error_message, cmd_error_length,
|
||||
cmd_error_max_length );
|
||||
out_printf(
|
||||
"%s action %s (%d, max %d):\n",
|
||||
object_str( rule->name ), error_message,
|
||||
cmd_error_length, cmd_error_max_length );
|
||||
|
||||
/* Tell the user what did not fit. */
|
||||
out_puts( cmd->buf->value );
|
||||
@@ -1314,7 +1315,7 @@ static CMD * make1cmds( TARGET * t )
|
||||
* make1list() - turn a list of targets into a LIST, for $(<) and $(>)
|
||||
*/
|
||||
|
||||
static LIST * make1list( LIST * l, TARGETS * targets, int flags )
|
||||
static LIST * make1list( LIST * l, TARGETS * targets, int32_t flags )
|
||||
{
|
||||
for ( ; targets; targets = targets->next )
|
||||
{
|
||||
@@ -1417,7 +1418,7 @@ static void make1bind( TARGET * t )
|
||||
}
|
||||
|
||||
|
||||
static int targets_contains( TARGETS * l, TARGET * t )
|
||||
static int32_t targets_contains( TARGETS * l, TARGET * t )
|
||||
{
|
||||
for ( ; l; l = l->next )
|
||||
{
|
||||
@@ -1429,7 +1430,7 @@ static int targets_contains( TARGETS * l, TARGET * t )
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int targets_equal( TARGETS * l1, TARGETS * l2 )
|
||||
static int32_t targets_equal( TARGETS * l1, TARGETS * l2 )
|
||||
{
|
||||
for ( ; l1 && l2; l1 = l1->next, l2 = l2->next )
|
||||
{
|
||||
@@ -1442,7 +1443,7 @@ static int targets_equal( TARGETS * l1, TARGETS * l2 )
|
||||
|
||||
#ifdef OPT_SEMAPHORE
|
||||
|
||||
static int cmd_sem_lock( TARGET * t )
|
||||
static int32_t cmd_sem_lock( TARGET * t )
|
||||
{
|
||||
CMD * cmd = (CMD *)t->cmds;
|
||||
TARGETS * iter;
|
||||
|
||||
@@ -320,25 +320,25 @@ md5_init(md5_state_t *pms)
|
||||
}
|
||||
|
||||
void
|
||||
md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
|
||||
md5_append(md5_state_t *pms, const md5_byte_t *data, size_t nbytes)
|
||||
{
|
||||
const md5_byte_t *p = data;
|
||||
int left = nbytes;
|
||||
int offset = (pms->count[0] >> 3) & 63;
|
||||
size_t left = nbytes;
|
||||
size_t offset = (pms->count[0] >> 3) & 63;
|
||||
md5_word_t nbits = (md5_word_t)(nbytes << 3);
|
||||
|
||||
if (nbytes <= 0)
|
||||
return;
|
||||
|
||||
/* Update the message length. */
|
||||
pms->count[1] += nbytes >> 29;
|
||||
pms->count[1] += md5_word_t(nbytes >> 29);
|
||||
pms->count[0] += nbits;
|
||||
if (pms->count[0] < nbits)
|
||||
pms->count[1]++;
|
||||
|
||||
/* Process an initial partial block. */
|
||||
if (offset) {
|
||||
int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
|
||||
size_t copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
|
||||
|
||||
memcpy(pms->buf + offset, p, copy);
|
||||
if (offset + copy < 64)
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
#ifndef md5_INCLUDED
|
||||
# define md5_INCLUDED
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/*
|
||||
* This package supports both compile-time and run-time determination of CPU
|
||||
* byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be
|
||||
@@ -71,7 +73,7 @@ typedef struct md5_state_s {
|
||||
} md5_state_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
@@ -79,7 +81,7 @@ extern "C"
|
||||
void md5_init(md5_state_t *pms);
|
||||
|
||||
/* Append a string to the message. */
|
||||
void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes);
|
||||
void md5_append(md5_state_t *pms, const md5_byte_t *data, size_t nbytes);
|
||||
|
||||
/* Finish the message and return the digest. */
|
||||
void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
/* Use quite klugy approach: when we add order dependency from 'a' to 'b', just
|
||||
* append 'b' to of value of variable 'a'.
|
||||
*/
|
||||
LIST * add_pair( FRAME * frame, int flags )
|
||||
LIST * add_pair( FRAME * frame, int32_t flags )
|
||||
{
|
||||
LIST * arg = lol_get( frame->args, 0 );
|
||||
LISTITER iter = list_begin( arg );
|
||||
@@ -29,9 +29,9 @@ LIST * add_pair( FRAME * frame, int flags )
|
||||
/* Given a list and a value, returns position of that value in the list, or -1
|
||||
* if not found.
|
||||
*/
|
||||
int list_index( LIST * list, OBJECT * value )
|
||||
int32_t list_index( LIST * list, OBJECT * value )
|
||||
{
|
||||
int result = 0;
|
||||
int32_t result = 0;
|
||||
LISTITER iter = list_begin( list );
|
||||
LISTITER const end = list_end( list );
|
||||
for ( ; iter != end; iter = list_next( iter ), ++result )
|
||||
@@ -47,15 +47,15 @@ enum colors { white, gray, black };
|
||||
* vertices which were not yet visited. After that, 'current_vertex' is added to
|
||||
* '*result_ptr'.
|
||||
*/
|
||||
void do_ts( int * * graph, int current_vertex, int * colors, int * * result_ptr
|
||||
void do_ts( int32_t * * graph, int32_t current_vertex, int32_t * colors, int32_t * * result_ptr
|
||||
)
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
colors[ current_vertex ] = gray;
|
||||
for ( i = 0; graph[ current_vertex ][ i ] != -1; ++i )
|
||||
{
|
||||
int adjacent_vertex = graph[ current_vertex ][ i ];
|
||||
int32_t adjacent_vertex = graph[ current_vertex ][ i ];
|
||||
if ( colors[ adjacent_vertex ] == white )
|
||||
do_ts( graph, adjacent_vertex, colors, result_ptr );
|
||||
/* The vertex is either black, in which case we do not have to do
|
||||
@@ -70,10 +70,10 @@ void do_ts( int * * graph, int current_vertex, int * colors, int * * result_ptr
|
||||
}
|
||||
|
||||
|
||||
void topological_sort( int * * graph, int num_vertices, int * result )
|
||||
static void topological_sort( int32_t * * graph, int32_t num_vertices, int32_t * result )
|
||||
{
|
||||
int i;
|
||||
int * colors = ( int * )BJAM_CALLOC( num_vertices, sizeof( int ) );
|
||||
int32_t i;
|
||||
int32_t * colors = ( int32_t * )BJAM_CALLOC( num_vertices, sizeof( int32_t ) );
|
||||
for ( i = 0; i < num_vertices; ++i )
|
||||
colors[ i ] = white;
|
||||
|
||||
@@ -85,34 +85,34 @@ void topological_sort( int * * graph, int num_vertices, int * result )
|
||||
}
|
||||
|
||||
|
||||
LIST * order( FRAME * frame, int flags )
|
||||
LIST * order( FRAME * frame, int32_t flags )
|
||||
{
|
||||
LIST * arg = lol_get( frame->args, 0 );
|
||||
LIST * result = L0;
|
||||
int src;
|
||||
int32_t src;
|
||||
LISTITER iter = list_begin( arg );
|
||||
LISTITER const end = list_end( arg );
|
||||
|
||||
/* We need to create a graph of order dependencies between the passed
|
||||
* objects. We assume there are no duplicates passed to 'add_pair'.
|
||||
*/
|
||||
int length = list_length( arg );
|
||||
int * * graph = ( int * * )BJAM_CALLOC( length, sizeof( int * ) );
|
||||
int * order = ( int * )BJAM_MALLOC( ( length + 1 ) * sizeof( int ) );
|
||||
int32_t length = list_length( arg );
|
||||
int32_t * * graph = ( int32_t * * )BJAM_CALLOC( length, sizeof( int32_t * ) );
|
||||
int32_t * order = ( int32_t * )BJAM_MALLOC( ( length + 1 ) * sizeof( int32_t ) );
|
||||
|
||||
for ( src = 0; iter != end; iter = list_next( iter ), ++src )
|
||||
{
|
||||
/* For all objects this one depends upon, add elements to 'graph'. */
|
||||
LIST * dependencies = var_get( frame->module, list_item( iter ) );
|
||||
int index = 0;
|
||||
int32_t index = 0;
|
||||
LISTITER dep_iter = list_begin( dependencies );
|
||||
LISTITER const dep_end = list_end( dependencies );
|
||||
|
||||
graph[ src ] = ( int * )BJAM_CALLOC( list_length( dependencies ) + 1,
|
||||
sizeof( int ) );
|
||||
graph[ src ] = ( int32_t * )BJAM_CALLOC( list_length( dependencies ) + 1,
|
||||
sizeof( int32_t ) );
|
||||
for ( ; dep_iter != dep_end; dep_iter = list_next( dep_iter ) )
|
||||
{
|
||||
int const dst = list_index( arg, list_item( dep_iter ) );
|
||||
int32_t const dst = list_index( arg, list_item( dep_iter ) );
|
||||
if ( dst != -1 )
|
||||
graph[ src ][ index++ ] = dst;
|
||||
}
|
||||
@@ -122,10 +122,10 @@ LIST * order( FRAME * frame, int flags )
|
||||
topological_sort( graph, length, order );
|
||||
|
||||
{
|
||||
int index = length - 1;
|
||||
int32_t index = length - 1;
|
||||
for ( ; index >= 0; --index )
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
LISTITER iter = list_begin( arg );
|
||||
for ( i = 0; i < order[ index ]; ++i, iter = list_next( iter ) );
|
||||
result = list_push_back( result, object_copy( list_item( iter ) ) );
|
||||
@@ -134,7 +134,7 @@ LIST * order( FRAME * frame, int flags )
|
||||
|
||||
/* Clean up */
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
for ( i = 0; i < length; ++i )
|
||||
BJAM_FREE( graph[ i ] );
|
||||
BJAM_FREE( graph );
|
||||
|
||||
@@ -26,8 +26,8 @@ struct ps_map_entry
|
||||
struct ps_map
|
||||
{
|
||||
struct ps_map_entry * * table;
|
||||
size_t table_size;
|
||||
size_t num_elems;
|
||||
int32_t table_size;
|
||||
int32_t num_elems;
|
||||
};
|
||||
|
||||
static unsigned list_hash(LIST * key)
|
||||
@@ -63,10 +63,10 @@ static int list_equal( LIST * lhs, LIST * rhs )
|
||||
|
||||
static void ps_map_init( struct ps_map * map )
|
||||
{
|
||||
size_t i;
|
||||
int32_t i;
|
||||
map->table_size = 2;
|
||||
map->num_elems = 0;
|
||||
map->table = (struct ps_map_entry * *)BJAM_MALLOC( map->table_size * sizeof( struct ps_map_entry * ) );
|
||||
map->table = (struct ps_map_entry * *)BJAM_MALLOC( size_t(map->table_size) * sizeof( struct ps_map_entry * ) );
|
||||
for ( i = 0; i < map->table_size; ++i )
|
||||
{
|
||||
map->table[ i ] = NULL;
|
||||
@@ -75,7 +75,7 @@ static void ps_map_init( struct ps_map * map )
|
||||
|
||||
static void ps_map_destroy( struct ps_map * map )
|
||||
{
|
||||
size_t i;
|
||||
int32_t i;
|
||||
for ( i = 0; i < map->table_size; ++i )
|
||||
{
|
||||
struct ps_map_entry * pos;
|
||||
@@ -93,8 +93,8 @@ static void ps_map_destroy( struct ps_map * map )
|
||||
static void ps_map_rehash( struct ps_map * map )
|
||||
{
|
||||
struct ps_map old = *map;
|
||||
size_t i;
|
||||
map->table = (struct ps_map_entry * *)BJAM_MALLOC( map->table_size * 2 * sizeof( struct ps_map_entry * ) );
|
||||
int32_t i;
|
||||
map->table = (struct ps_map_entry * *)BJAM_MALLOC( size_t(map->table_size) * 2 * sizeof( struct ps_map_entry * ) );
|
||||
map->table_size *= 2;
|
||||
for ( i = 0; i < map->table_size; ++i )
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ LIST * regex_split( FRAME * frame, int flags )
|
||||
prev = pos = object_str( s );
|
||||
while ( regexec( re, pos ) )
|
||||
{
|
||||
result = list_push_back( result, object_new_range( prev, re->startp[ 0 ] - prev ) );
|
||||
result = list_push_back( result, object_new_range( prev, int32_t(re->startp[ 0 ] - prev) ) );
|
||||
prev = re->endp[ 0 ];
|
||||
/* Handle empty matches */
|
||||
if ( *pos == '\0' )
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
|
||||
void declare_native_rule( char const * module, char const * rule,
|
||||
char const * * args, LIST * (*f)( FRAME *, int ), int version )
|
||||
char const * * args, LIST * (*f)( FRAME *, int32_t ), int32_t version )
|
||||
{
|
||||
OBJECT * const module_obj = module ? object_new( module ) : 0 ;
|
||||
module_t * m = bindmodule( module_obj );
|
||||
@@ -23,7 +23,7 @@ void declare_native_rule( char const * module, char const * rule,
|
||||
|
||||
{
|
||||
OBJECT * const name = object_new( rule );
|
||||
int found;
|
||||
int32_t found;
|
||||
native_rule_t * const np = (native_rule_t *)hash_insert(
|
||||
m->native_rules, name, &found );
|
||||
np->name = name;
|
||||
|
||||
@@ -25,11 +25,11 @@ typedef struct native_rule_t
|
||||
*
|
||||
* Versions are numbered from 1.
|
||||
*/
|
||||
int version;
|
||||
int32_t version;
|
||||
} native_rule_t;
|
||||
/* MSVC debugger gets confused unless the native_rule_t typedef is provided. */
|
||||
|
||||
void declare_native_rule( char const * module, char const * rule,
|
||||
char const * * args, LIST * (*f)( FRAME *, int ), int version );
|
||||
char const * * args, LIST * (*f)( FRAME *, int32_t ), int32_t version );
|
||||
|
||||
#endif
|
||||
|
||||
@@ -55,15 +55,15 @@ struct hash_item
|
||||
|
||||
typedef struct string_set
|
||||
{
|
||||
unsigned int num;
|
||||
unsigned int size;
|
||||
int32_t num;
|
||||
int32_t size;
|
||||
struct hash_item * * data;
|
||||
} string_set;
|
||||
|
||||
static string_set strhash;
|
||||
static int strtotal = 0;
|
||||
static int strcount_in = 0;
|
||||
static int strcount_out = 0;
|
||||
static int32_t strtotal = 0;
|
||||
static int32_t strcount_in = 0;
|
||||
static int32_t strcount_out = 0;
|
||||
|
||||
|
||||
/*
|
||||
@@ -89,13 +89,13 @@ static char * storage_finish = 0;
|
||||
* allocate() - Allocate n bytes of immortal string storage.
|
||||
*/
|
||||
|
||||
static char * allocate( size_t n )
|
||||
static char * allocate( int32_t n )
|
||||
{
|
||||
#ifdef BJAM_NEWSTR_NO_ALLOCATE
|
||||
return (char *)BJAM_MALLOC( n );
|
||||
#else
|
||||
/* See if we can grab storage from an existing block. */
|
||||
size_t remaining = storage_finish - storage_start;
|
||||
int32_t remaining = int32_t(storage_finish - storage_start);
|
||||
n = ( ( n + ALLOC_ALIGNMENT - 1 ) / ALLOC_ALIGNMENT ) * ALLOC_ALIGNMENT;
|
||||
if ( remaining >= n )
|
||||
{
|
||||
@@ -106,13 +106,13 @@ static char * allocate( size_t n )
|
||||
else /* Must allocate a new block. */
|
||||
{
|
||||
strblock * new_block;
|
||||
size_t nalloc = n;
|
||||
int32_t nalloc = n;
|
||||
if ( nalloc < STRING_BLOCK )
|
||||
nalloc = STRING_BLOCK;
|
||||
|
||||
/* Allocate a new block and link into the chain. */
|
||||
new_block = (strblock *)BJAM_MALLOC( offsetof( strblock, data[ 0 ] ) +
|
||||
nalloc * sizeof( new_block->data[ 0 ] ) );
|
||||
size_t(nalloc) * sizeof( new_block->data[ 0 ] ) );
|
||||
if ( new_block == 0 )
|
||||
return 0;
|
||||
new_block->next = strblock_chain;
|
||||
@@ -130,7 +130,7 @@ static char * allocate( size_t n )
|
||||
}
|
||||
|
||||
|
||||
static unsigned int hash_keyval( char const * key, int const size )
|
||||
static unsigned int hash_keyval( char const * key, int32_t size )
|
||||
{
|
||||
unsigned int const magic = 2147059363;
|
||||
unsigned int hash = 0;
|
||||
@@ -171,14 +171,13 @@ static void string_set_done( string_set * set )
|
||||
|
||||
static void string_set_resize( string_set * set )
|
||||
{
|
||||
unsigned i;
|
||||
string_set new_set;
|
||||
new_set.num = set->num * 2;
|
||||
new_set.size = set->size;
|
||||
new_set.data = (struct hash_item * *)BJAM_MALLOC( sizeof( struct hash_item *
|
||||
) * new_set.num );
|
||||
memset( new_set.data, 0, sizeof( struct hash_item * ) * new_set.num );
|
||||
for ( i = 0; i < set->num; ++i )
|
||||
for ( int32_t i = 0; i < set->num; ++i )
|
||||
{
|
||||
while ( set->data[ i ] )
|
||||
{
|
||||
@@ -195,7 +194,7 @@ static void string_set_resize( string_set * set )
|
||||
|
||||
|
||||
static char const * string_set_insert( string_set * set, char const * string,
|
||||
int const size )
|
||||
int32_t const size )
|
||||
{
|
||||
unsigned hash = hash_keyval( string, size );
|
||||
unsigned pos = hash % set->num;
|
||||
@@ -230,25 +229,11 @@ static char const * string_set_insert( string_set * set, char const * string,
|
||||
}
|
||||
|
||||
|
||||
static struct hash_item * object_get_item( OBJECT * obj )
|
||||
{
|
||||
return (struct hash_item *)( (char *)obj - offsetof( struct hash_item, data
|
||||
) );
|
||||
}
|
||||
|
||||
|
||||
static void object_validate( OBJECT * obj )
|
||||
{
|
||||
assert( obj );
|
||||
assert( object_get_item( obj )->header.magic == OBJECT_MAGIC );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* object_new_range() - create an object from a string of given length
|
||||
*/
|
||||
|
||||
OBJECT * object_new_range( char const * const string, int const size )
|
||||
OBJECT * object_new_range( char const * const string, int32_t size )
|
||||
{
|
||||
++strcount_in;
|
||||
|
||||
@@ -278,12 +263,26 @@ OBJECT * object_new_range( char const * const string, int const size )
|
||||
|
||||
OBJECT * object_new( char const * const string )
|
||||
{
|
||||
return object_new_range( string, strlen( string ) );
|
||||
return object_new_range( string, int32_t(strlen( string )) );
|
||||
}
|
||||
|
||||
|
||||
#ifndef object_copy
|
||||
|
||||
static struct hash_item * object_get_item( OBJECT * obj )
|
||||
{
|
||||
return (struct hash_item *)( (char *)obj - offsetof( struct hash_item, data
|
||||
) );
|
||||
}
|
||||
|
||||
|
||||
static void object_validate( OBJECT * obj )
|
||||
{
|
||||
assert( obj );
|
||||
assert( object_get_item( obj )->header.magic == OBJECT_MAGIC );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* object_copy() - return a copy of an object
|
||||
*/
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
typedef struct _object OBJECT;
|
||||
|
||||
OBJECT * object_new( char const * const );
|
||||
OBJECT * object_new_range( char const * const, int const size );
|
||||
OBJECT * object_new_range( char const * const, int32_t size );
|
||||
void object_done( void );
|
||||
|
||||
#if defined(NDEBUG) && !defined(BJAM_NO_MEM_CACHE)
|
||||
|
||||
@@ -94,11 +94,11 @@ void path_get_temp_path_( string * buffer )
|
||||
* - path_key_cache path/key mapping cache object already initialized
|
||||
*/
|
||||
|
||||
static int canonicWindowsPath( char const * const path, int const path_length,
|
||||
static int canonicWindowsPath( char const * const path, int32_t path_length,
|
||||
string * const out )
|
||||
{
|
||||
char const * last_element;
|
||||
unsigned long saved_size;
|
||||
int32_t saved_size;
|
||||
char const * p;
|
||||
int missing_parent;
|
||||
|
||||
@@ -138,7 +138,7 @@ static int canonicWindowsPath( char const * const path, int const path_length,
|
||||
if ( p >= path )
|
||||
{
|
||||
char const * const dir = path;
|
||||
int const dir_length = p - path;
|
||||
const int32_t dir_length = int32_t(p - path);
|
||||
OBJECT * const dir_obj = object_new_range( dir, dir_length );
|
||||
int found;
|
||||
path_key_entry * const result = (path_key_entry *)hash_insert(
|
||||
@@ -170,7 +170,7 @@ static int canonicWindowsPath( char const * const path, int const path_length,
|
||||
if ( !missing_parent )
|
||||
{
|
||||
char const * const n = last_element;
|
||||
int const n_length = path + path_length - n;
|
||||
int32_t n_length = int32_t(path + path_length - n);
|
||||
if ( !( n_length == 1 && n[ 0 ] == '.' )
|
||||
&& !( n_length == 2 && n[ 0 ] == '.' && n[ 1 ] == '.' ) )
|
||||
{
|
||||
@@ -239,7 +239,7 @@ static path_key_entry * path_key( OBJECT * const path,
|
||||
if ( !found )
|
||||
{
|
||||
OBJECT * normalized;
|
||||
int normalized_size;
|
||||
int32_t normalized_size;
|
||||
path_key_entry * nresult;
|
||||
result->path = path;
|
||||
{
|
||||
@@ -394,8 +394,8 @@ OBJECT * path_as_key( OBJECT * path )
|
||||
static void free_path_key_entry( void * xentry, void * const data )
|
||||
{
|
||||
path_key_entry * const entry = (path_key_entry *)xentry;
|
||||
object_free( entry->path );
|
||||
object_free( entry->key );
|
||||
if (entry->path) object_free( entry->path );
|
||||
if (entry->key) object_free( entry->key );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ void path_parse( char const * file, PATHNAME * f )
|
||||
if ( ( file[ 0 ] == '<' ) && ( p = strchr( file, '>' ) ) )
|
||||
{
|
||||
f->f_grist.ptr = file;
|
||||
f->f_grist.len = p - file;
|
||||
f->f_grist.len = int32_t(p - file);
|
||||
file = p + 1;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ void path_parse( char const * file, PATHNAME * f )
|
||||
if ( p )
|
||||
{
|
||||
f->f_dir.ptr = file;
|
||||
f->f_dir.len = p - file;
|
||||
f->f_dir.len = int32_t(p - file);
|
||||
|
||||
/* Special case for / - dirname is /, not "" */
|
||||
if ( !f->f_dir.len )
|
||||
@@ -104,7 +104,7 @@ void path_parse( char const * file, PATHNAME * f )
|
||||
if ( ( p = strchr( file, '(' ) ) && ( end[ -1 ] == ')' ) )
|
||||
{
|
||||
f->f_member.ptr = p + 1;
|
||||
f->f_member.len = end - p - 2;
|
||||
f->f_member.len = int32_t(end - p - 2);
|
||||
end = p;
|
||||
}
|
||||
|
||||
@@ -115,13 +115,13 @@ void path_parse( char const * file, PATHNAME * f )
|
||||
if ( p )
|
||||
{
|
||||
f->f_suffix.ptr = p;
|
||||
f->f_suffix.len = end - p;
|
||||
f->f_suffix.len = int32_t(end - p);
|
||||
end = p;
|
||||
}
|
||||
|
||||
/* Leaves base. */
|
||||
f->f_base.ptr = file;
|
||||
f->f_base.len = end - file;
|
||||
f->f_base.len = int32_t(end - file);
|
||||
}
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ std::string b2::paths::normalize(const std::string &p)
|
||||
// want this function to obtain a canonic representation.
|
||||
std::replace(result.begin(), result.end(), '\\', '/');
|
||||
|
||||
size_t ellipsis = 0;
|
||||
int32_t ellipsis = 0;
|
||||
for (auto end_pos = result.length(); end_pos > 0; )
|
||||
{
|
||||
auto path_pos = result.rfind('/', end_pos-1);
|
||||
|
||||
@@ -38,7 +38,7 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
typedef struct _pathpart
|
||||
{
|
||||
char const * ptr;
|
||||
int len;
|
||||
int32_t len;
|
||||
} PATHPART;
|
||||
|
||||
typedef struct _pathname
|
||||
|
||||
@@ -154,9 +154,9 @@
|
||||
* Utility definitions.
|
||||
*/
|
||||
#ifndef CHARBITS
|
||||
#define UCHARAT(p) ((int)*(const unsigned char *)(p))
|
||||
#define UCHARAT(p) ((int32_t)*(const unsigned char *)(p))
|
||||
#else
|
||||
#define UCHARAT(p) ((int)*(p)&CHARBITS)
|
||||
#define UCHARAT(p) ((int32_t)*(p)&CHARBITS)
|
||||
#endif
|
||||
|
||||
#define FAIL(m) { regerror(m); return(NULL); }
|
||||
@@ -173,11 +173,11 @@
|
||||
/*
|
||||
* Global work variables for regcomp().
|
||||
*/
|
||||
static char *regparse; /* Input-scan pointer. */
|
||||
static int regnpar; /* () count. */
|
||||
static char *regparse; /* Input-scan pointer. */
|
||||
static int32_t regnpar; /* () count. */
|
||||
static char regdummy;
|
||||
static char *regcode; /* Code-emit pointer; ®dummy = don't. */
|
||||
static long regsize; /* Code size. */
|
||||
static char *regcode; /* Code-emit pointer; ®dummy = don't. */
|
||||
static int32_t regsize; /* Code size. */
|
||||
|
||||
/*
|
||||
* Forward declarations for regcomp()'s friends.
|
||||
@@ -185,18 +185,18 @@ static long regsize; /* Code size. */
|
||||
#ifndef STATIC
|
||||
#define STATIC static
|
||||
#endif
|
||||
STATIC char *reg( int paren, int *flagp );
|
||||
STATIC char *regbranch( int *flagp );
|
||||
STATIC char *regpiece( int *flagp );
|
||||
STATIC char *regatom( int *flagp );
|
||||
STATIC char *regnode( int op );
|
||||
STATIC char *reg( int32_t paren, int32_t *flagp );
|
||||
STATIC char *regbranch( int32_t *flagp );
|
||||
STATIC char *regpiece( int32_t *flagp );
|
||||
STATIC char *regatom( int32_t *flagp );
|
||||
STATIC char *regnode( int32_t op );
|
||||
STATIC char *regnext( char *p );
|
||||
STATIC void regc( int b );
|
||||
STATIC void regc( int32_t b );
|
||||
STATIC void reginsert( char op, char *opnd );
|
||||
STATIC void regtail( char *p, char *val );
|
||||
STATIC void regoptail( char *p, char *val );
|
||||
#ifdef STRCSPN
|
||||
STATIC int strcspn();
|
||||
STATIC int32_t strcspn();
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -220,8 +220,8 @@ regcomp( const char *exp )
|
||||
regexp *r;
|
||||
char *scan;
|
||||
char *longest;
|
||||
unsigned len;
|
||||
int flags;
|
||||
int32_t len;
|
||||
int32_t flags;
|
||||
|
||||
if (exp == NULL)
|
||||
FAIL("NULL argument");
|
||||
@@ -232,7 +232,7 @@ regcomp( const char *exp )
|
||||
#endif
|
||||
regparse = (char *)exp;
|
||||
regnpar = 1;
|
||||
regsize = 0L;
|
||||
regsize = 0;
|
||||
regcode = ®dummy;
|
||||
regc(MAGIC);
|
||||
if (reg(0, &flags) == NULL)
|
||||
@@ -243,7 +243,7 @@ regcomp( const char *exp )
|
||||
FAIL("regexp too big");
|
||||
|
||||
/* Allocate space. */
|
||||
r = (regexp *)BJAM_MALLOC(sizeof(regexp) + (unsigned)regsize);
|
||||
r = (regexp *)BJAM_MALLOC(sizeof(regexp) + regsize);
|
||||
if (r == NULL)
|
||||
FAIL("out of space");
|
||||
|
||||
@@ -282,9 +282,9 @@ regcomp( const char *exp )
|
||||
longest = NULL;
|
||||
len = 0;
|
||||
for (; scan != NULL; scan = regnext(scan))
|
||||
if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) {
|
||||
if (OP(scan) == EXACTLY && static_cast<int32_t>(strlen(OPERAND(scan))) >= len) {
|
||||
longest = OPERAND(scan);
|
||||
len = strlen(OPERAND(scan));
|
||||
len = static_cast<int32_t>(strlen(OPERAND(scan)));
|
||||
}
|
||||
r->regmust = longest;
|
||||
r->regmlen = len;
|
||||
@@ -305,14 +305,14 @@ regcomp( const char *exp )
|
||||
*/
|
||||
static char *
|
||||
reg(
|
||||
int paren, /* Parenthesized? */
|
||||
int *flagp )
|
||||
int32_t paren, /* Parenthesized? */
|
||||
int32_t *flagp )
|
||||
{
|
||||
char *ret;
|
||||
char *br;
|
||||
char *ender;
|
||||
int parno = 0;
|
||||
int flags;
|
||||
int32_t parno = 0;
|
||||
int32_t flags;
|
||||
|
||||
*flagp = HASWIDTH; /* Tentatively. */
|
||||
|
||||
@@ -376,12 +376,12 @@ reg(
|
||||
* Implements the concatenation operator.
|
||||
*/
|
||||
static char *
|
||||
regbranch( int *flagp )
|
||||
regbranch( int32_t *flagp )
|
||||
{
|
||||
char *ret;
|
||||
char *chain;
|
||||
char *latest;
|
||||
int flags;
|
||||
int32_t flags;
|
||||
|
||||
*flagp = WORST; /* Tentatively. */
|
||||
|
||||
@@ -415,12 +415,12 @@ regbranch( int *flagp )
|
||||
* endmarker role is not redundant.
|
||||
*/
|
||||
static char *
|
||||
regpiece( int *flagp )
|
||||
regpiece( int32_t *flagp )
|
||||
{
|
||||
char *ret;
|
||||
char op;
|
||||
char *next;
|
||||
int flags;
|
||||
int32_t flags;
|
||||
|
||||
ret = regatom(&flags);
|
||||
if (ret == NULL)
|
||||
@@ -478,10 +478,10 @@ regpiece( int *flagp )
|
||||
* separate node; the code is simpler that way and it's not worth fixing.
|
||||
*/
|
||||
static char *
|
||||
regatom( int *flagp )
|
||||
regatom( int32_t *flagp )
|
||||
{
|
||||
char *ret;
|
||||
int flags;
|
||||
int32_t flags;
|
||||
|
||||
*flagp = WORST; /* Tentatively. */
|
||||
|
||||
@@ -498,8 +498,8 @@ regatom( int *flagp )
|
||||
*flagp |= HASWIDTH|SIMPLE;
|
||||
break;
|
||||
case '[': {
|
||||
int classr;
|
||||
int classend;
|
||||
int32_t classr;
|
||||
int32_t classend;
|
||||
|
||||
if (*regparse == '^') { /* Complement of range. */
|
||||
ret = regnode(ANYBUT);
|
||||
@@ -655,7 +655,7 @@ regatom( int *flagp )
|
||||
- regnode - emit a node
|
||||
*/
|
||||
static char * /* Location. */
|
||||
regnode( int op )
|
||||
regnode( int32_t op )
|
||||
{
|
||||
char *ret;
|
||||
char *ptr;
|
||||
@@ -679,7 +679,7 @@ regnode( int op )
|
||||
- regc - emit (if appropriate) a byte of code
|
||||
*/
|
||||
static void
|
||||
regc( int b )
|
||||
regc( int32_t b )
|
||||
{
|
||||
if (regcode != ®dummy)
|
||||
*regcode++ = b;
|
||||
@@ -728,7 +728,7 @@ regtail(
|
||||
{
|
||||
char *scan;
|
||||
char *temp;
|
||||
int offset;
|
||||
size_t offset;
|
||||
|
||||
if (p == ®dummy)
|
||||
return;
|
||||
@@ -780,12 +780,12 @@ static const char **regendp; /* Ditto for endp. */
|
||||
/*
|
||||
* Forwards.
|
||||
*/
|
||||
STATIC int regtry( regexp *prog, const char *string );
|
||||
STATIC int regmatch( char *prog );
|
||||
STATIC int regrepeat( char *p );
|
||||
STATIC int32_t regtry( regexp *prog, const char *string );
|
||||
STATIC int32_t regmatch( char *prog );
|
||||
STATIC int32_t regrepeat( char *p );
|
||||
|
||||
#ifdef DEBUG
|
||||
int regnarrate = 0;
|
||||
int32_t regnarrate = 0;
|
||||
void regdump();
|
||||
STATIC char *regprop();
|
||||
#endif
|
||||
@@ -793,7 +793,7 @@ STATIC char *regprop();
|
||||
/*
|
||||
- regexec - match a regexp against a string
|
||||
*/
|
||||
int
|
||||
int32_t
|
||||
regexec(
|
||||
regexp *prog,
|
||||
const char *string )
|
||||
@@ -858,12 +858,12 @@ regexec(
|
||||
* regtry() - try match at specific point.
|
||||
*/
|
||||
|
||||
static int /* 0 failure, 1 success */
|
||||
static int32_t /* 0 failure, 1 success */
|
||||
regtry(
|
||||
regexp *prog,
|
||||
const char *string )
|
||||
{
|
||||
int i;
|
||||
int32_t i;
|
||||
const char * * sp;
|
||||
const char * * ep;
|
||||
|
||||
@@ -899,7 +899,7 @@ regtry(
|
||||
* whether the rest of the match failed) by a loop instead of by recursion.
|
||||
*/
|
||||
|
||||
static int /* 0 failure, 1 success */
|
||||
static int32_t /* 0 failure, 1 success */
|
||||
regmatch( char * prog )
|
||||
{
|
||||
char * scan; /* Current node. */
|
||||
@@ -947,7 +947,7 @@ regmatch( char * prog )
|
||||
reginput++;
|
||||
break;
|
||||
case EXACTLY: {
|
||||
int len;
|
||||
size_t len;
|
||||
char *opnd;
|
||||
|
||||
opnd = OPERAND(scan);
|
||||
@@ -983,7 +983,7 @@ regmatch( char * prog )
|
||||
case OPEN+7:
|
||||
case OPEN+8:
|
||||
case OPEN+9: {
|
||||
int no;
|
||||
int32_t no;
|
||||
const char *save;
|
||||
|
||||
no = OP(scan) - OPEN;
|
||||
@@ -1011,7 +1011,7 @@ regmatch( char * prog )
|
||||
case CLOSE+7:
|
||||
case CLOSE+8:
|
||||
case CLOSE+9: {
|
||||
int no;
|
||||
int32_t no;
|
||||
const char *save;
|
||||
|
||||
no = OP(scan) - CLOSE;
|
||||
@@ -1051,9 +1051,9 @@ regmatch( char * prog )
|
||||
case STAR:
|
||||
case PLUS: {
|
||||
char nextch;
|
||||
int no;
|
||||
int32_t no;
|
||||
const char *save;
|
||||
int min;
|
||||
int32_t min;
|
||||
|
||||
/*
|
||||
* Lookahead to avoid useless match attempts
|
||||
@@ -1100,10 +1100,10 @@ regmatch( char * prog )
|
||||
/*
|
||||
- regrepeat - repeatedly match something simple, report how many
|
||||
*/
|
||||
static int
|
||||
static int32_t
|
||||
regrepeat( char *p )
|
||||
{
|
||||
int count = 0;
|
||||
int32_t count = 0;
|
||||
const char *scan;
|
||||
char *opnd;
|
||||
|
||||
@@ -1111,7 +1111,7 @@ regrepeat( char *p )
|
||||
opnd = OPERAND(p);
|
||||
switch (OP(p)) {
|
||||
case ANY:
|
||||
count = strlen(scan);
|
||||
count = int32_t(strlen(scan));
|
||||
scan += count;
|
||||
break;
|
||||
case EXACTLY:
|
||||
@@ -1148,7 +1148,7 @@ regrepeat( char *p )
|
||||
static char *
|
||||
regnext( char *p )
|
||||
{
|
||||
int offset;
|
||||
int32_t offset;
|
||||
|
||||
if (p == ®dummy)
|
||||
return(NULL);
|
||||
@@ -1309,14 +1309,14 @@ regprop( char *op )
|
||||
* of characters not from s2
|
||||
*/
|
||||
|
||||
static int
|
||||
static int32_t
|
||||
strcspn(
|
||||
char *s1,
|
||||
char *s2 )
|
||||
{
|
||||
char *scan1;
|
||||
char *scan2;
|
||||
int count;
|
||||
int32_t count;
|
||||
|
||||
count = 0;
|
||||
for (scan1 = s1; *scan1 != '\0'; scan1++) {
|
||||
|
||||
@@ -16,13 +16,13 @@ typedef struct regexp {
|
||||
char regstart; /* Internal use only. */
|
||||
char reganch; /* Internal use only. */
|
||||
char * regmust; /* Internal use only. */
|
||||
int regmlen; /* Internal use only. */
|
||||
int32_t regmlen; /* Internal use only. */
|
||||
char program[ 1 ]; /* Unwarranted chumminess with compiler. */
|
||||
} regexp;
|
||||
|
||||
|
||||
regexp * regcomp( char const * exp );
|
||||
int regexec( regexp * prog, char const * string );
|
||||
int32_t regexec( regexp * prog, char const * string );
|
||||
void regerror( char const * s );
|
||||
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ void set_explicit_binding( OBJECT * target, OBJECT * locate )
|
||||
|
||||
/* Root the target path at the given location. */
|
||||
f->f_root.ptr = object_str( locate );
|
||||
f->f_root.len = strlen( object_str( locate ) );
|
||||
f->f_root.len = int32_t(strlen( object_str( locate ) ));
|
||||
|
||||
path_build( f, buf );
|
||||
boundname = object_new( buf->value );
|
||||
@@ -164,7 +164,7 @@ OBJECT * search( OBJECT * target, timestamp * const time,
|
||||
{
|
||||
OBJECT * key;
|
||||
f->f_root.ptr = object_str( list_front( varlist ) );
|
||||
f->f_root.len = strlen( object_str( list_front( varlist ) ) );
|
||||
f->f_root.len = int32_t(strlen( object_str( list_front( varlist ) ) ));
|
||||
|
||||
path_build( f, buf );
|
||||
|
||||
@@ -189,7 +189,7 @@ OBJECT * search( OBJECT * target, timestamp * const time,
|
||||
OBJECT * test_path;
|
||||
|
||||
f->f_root.ptr = object_str( list_item( iter ) );
|
||||
f->f_root.len = strlen( object_str( list_item( iter ) ) );
|
||||
f->f_root.len = int32_t(strlen( object_str( list_item( iter ) ) ));
|
||||
|
||||
string_truncate( buf, 0 );
|
||||
path_build( f, buf );
|
||||
|
||||
@@ -90,7 +90,7 @@ void var_defines( struct module_t * module, const char * const * e, int preproce
|
||||
)
|
||||
{
|
||||
LIST * l = L0;
|
||||
size_t const len = strlen( val + 1 );
|
||||
int32_t const len = int32_t(strlen( val + 1 ));
|
||||
int const quoted = ( val[ 1 ] == '"' ) && ( val[ len ] == '"' ) &&
|
||||
( len > 1 );
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ static HKEY get_key(char const** path)
|
||||
|
||||
for (p = dlRootKeys; p->name; ++p)
|
||||
{
|
||||
int n = strlen(p->name);
|
||||
size_t n = strlen(p->name);
|
||||
if (!strncmp(*path,p->name,n))
|
||||
{
|
||||
if ((*path)[n] == '\\' || (*path)[n] == 0)
|
||||
@@ -81,14 +81,14 @@ LIST * builtin_system_registry( FRAME * frame, int flags )
|
||||
|
||||
case REG_EXPAND_SZ:
|
||||
{
|
||||
unsigned long len;
|
||||
DWORD len;
|
||||
string expanded[1];
|
||||
string_new(expanded);
|
||||
|
||||
while (
|
||||
(len = ExpandEnvironmentStringsA(
|
||||
(LPCSTR)data, expanded->value, expanded->capacity))
|
||||
> expanded->capacity
|
||||
(LPCSTR)data, expanded->value, (DWORD)expanded->capacity))
|
||||
> DWORD(expanded->capacity)
|
||||
)
|
||||
string_reserve(expanded, len);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user