mirror of
https://review.haiku-os.org/buildtools
synced 2026-02-03 23:43:13 +01:00
jam: Fix isspace/isalnum/tolower/... usage
The value passed in must be representable as an unsigned char or equal to the value of the macro EOF. NetBSD 11+ is actually enforcing this. Change-Id: I9a7eada7c0c1ae206aa6810027a2b02742b72934 Reviewed-on: https://review.haiku-os.org/c/buildtools/+/10127 Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
committed by
Adrien Destugues
parent
7ab022f6e6
commit
13c7a4265a
@@ -154,12 +154,12 @@ execcmd(
|
||||
|
||||
/* Trim leading, ending white space */
|
||||
|
||||
while( isspace( *string ) )
|
||||
while( isspace( (unsigned char)*string ) )
|
||||
++string;
|
||||
|
||||
p = strchr( string, '\n' );
|
||||
|
||||
while( p && isspace( *p ) )
|
||||
while( p && isspace( (unsigned char)*p ) )
|
||||
++p;
|
||||
|
||||
/* If multi line, or too long, or JAMSHELL is set, write to bat file. */
|
||||
|
||||
@@ -538,11 +538,11 @@ var_edit_shift(
|
||||
if( edits->upshift )
|
||||
{
|
||||
for( ; *out; ++out )
|
||||
*out = toupper( *out );
|
||||
*out = toupper( (unsigned char)*out );
|
||||
}
|
||||
else if( edits->downshift )
|
||||
{
|
||||
for( ; *out; ++out )
|
||||
*out = tolower( *out );
|
||||
*out = tolower( (unsigned char)*out );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ getoptions(
|
||||
{
|
||||
char *arg;
|
||||
|
||||
if( argv[i][0] != '-' || !isalpha( argv[i][1] ) )
|
||||
if( argv[i][0] != '-' || !isalpha( (unsigned char)argv[i][1] ) )
|
||||
break;
|
||||
|
||||
if( !optc-- )
|
||||
|
||||
@@ -917,16 +917,16 @@ regmatch( char *prog )
|
||||
break;
|
||||
case WORDA:
|
||||
/* Must be looking at a letter, digit, or _ */
|
||||
if ((!isalnum(*reginput)) && *reginput != '_')
|
||||
if ((!isalnum((unsigned char)*reginput)) && *reginput != '_')
|
||||
return(0);
|
||||
/* Prev must be BOL or nonword */
|
||||
if (reginput > regbol &&
|
||||
(isalnum(reginput[-1]) || reginput[-1] == '_'))
|
||||
(isalnum((unsigned char)reginput[-1]) || reginput[-1] == '_'))
|
||||
return(0);
|
||||
break;
|
||||
case WORDZ:
|
||||
/* Must be looking at non letter, digit, or _ */
|
||||
if (isalnum(*reginput) || *reginput == '_')
|
||||
if (isalnum((unsigned char)*reginput) || *reginput == '_')
|
||||
return(0);
|
||||
/* We don't care what the previous char was */
|
||||
break;
|
||||
|
||||
@@ -287,7 +287,7 @@ yylex()
|
||||
{
|
||||
/* Skip past white space */
|
||||
|
||||
while( c != EOF && isspace( c ) )
|
||||
while( c != EOF && isspace( (unsigned char)c ) )
|
||||
c = yychar();
|
||||
|
||||
/* Not a comment? Swallow up comment line. */
|
||||
@@ -315,7 +315,7 @@ yylex()
|
||||
while(
|
||||
c != EOF &&
|
||||
b < buf + sizeof( buf ) &&
|
||||
( inquote || !isspace( c ) ) )
|
||||
( inquote || !isspace( (unsigned char)c ) ) )
|
||||
{
|
||||
if( c == '"' )
|
||||
{
|
||||
@@ -369,7 +369,8 @@ yylex()
|
||||
*b = 0;
|
||||
yylval.type = ARG;
|
||||
|
||||
if( !notkeyword && !( isalpha( *buf ) && scanmode == SCAN_PUNCT ) )
|
||||
if( !notkeyword &&
|
||||
!( isalpha( (unsigned char)*buf ) && scanmode == SCAN_PUNCT ) )
|
||||
{
|
||||
for( k = keywords; k->word; k++ )
|
||||
if( *buf == *k->word && !strcmp( k->word, buf ) )
|
||||
|
||||
@@ -72,7 +72,7 @@ timestamp(
|
||||
char path[ MAXJPATH ];
|
||||
char *p = path;
|
||||
|
||||
do *p++ = tolower( *target );
|
||||
do *p++ = tolower( (unsigned char)*target );
|
||||
while( *target++ );
|
||||
|
||||
target = path;
|
||||
@@ -175,7 +175,7 @@ time_enter(
|
||||
char path[ MAXJPATH ];
|
||||
char *p = path;
|
||||
|
||||
do *p++ = tolower( *target );
|
||||
do *p++ = tolower( (unsigned char)*target );
|
||||
while( *target++ );
|
||||
|
||||
target = path;
|
||||
|
||||
@@ -152,7 +152,7 @@ var_string(
|
||||
|
||||
/* Copy white space */
|
||||
|
||||
while( isspace( *in ) )
|
||||
while( isspace( (unsigned char)*in ) )
|
||||
{
|
||||
if( out >= oute )
|
||||
return -1;
|
||||
@@ -164,7 +164,7 @@ var_string(
|
||||
|
||||
/* Copy non-white space, watching for variables */
|
||||
|
||||
while( *in && !isspace( *in ) )
|
||||
while( *in && !isspace( (unsigned char)*in ) )
|
||||
{
|
||||
if( out >= oute )
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user