wmail: white-space fixes.

This commit is contained in:
Jeremy Sowden 2019-06-07 09:52:10 +01:00 committed by Carlos R. Mafra
parent b78df8ed42
commit 71c126d20e
2 changed files with 50 additions and 43 deletions

View file

@ -393,7 +393,8 @@ static bool ReadString( const char *from, unsigned int line, char **to )
case 'r': *to_c = '\r'; break;
case 't': *to_c = '\t'; break;
case '"': *to_c = '"'; break;
default: {
default:
{
int value, i;
for( i = 0, value = 0; i < 3; ++i ) {
if( c+i == NULL || *(c+i) < '0' || *(c+i) > '9' )
@ -401,7 +402,8 @@ static bool ReadString( const char *from, unsigned int line, char **to )
value = value * 10 + *(c+i) - '0';
}
if( value == 0 )
WARNING( "cfg-file(%i): '\\0' in string or unknown escape sequence found\n", line );
WARNING( "cfg-file(%i): '\\0' in string or unknown escape sequence found\n",
line );
else {
*to_c = (char)value;
c += i-1;
@ -464,15 +466,18 @@ static bool ReadInt( const char *from, unsigned int line, int *to )
return false;
}
}
} else for( ; *from != '\0' && !IsWhiteSpace( from ); ++from ) {
} else
for( ; *from != '\0' && !IsWhiteSpace( from ); ++from ) {
if( value > (INT_MAX - 9) / 10 ) {
WARNING( "cfg-file(%i): decimal-number too large: \">%i\"\n", line, INT_MAX );
WARNING( "cfg-file(%i): decimal-number too large: \">%i\"\n",
line, INT_MAX );
return false;
}
if( *from >= '0' && *from <= '9' )
value = value * 10 + *from - '0';
else {
WARNING( "cfg-file(%i): invalid decimal-digit: \"%c\"\n", line, *from );
WARNING( "cfg-file(%i): invalid decimal-digit: \"%c\"\n",
line, *from );
return false;
}
}

View file

@ -493,13 +493,15 @@ static void DetermineState( void )
static void ReadChecksumFile( void )
{
FILE *f = fopen( config.checksumFileName, "rb" );
if( f != NULL ) while( !feof( f )) {
if( f != NULL )
while( !feof( f )) {
unsigned long checksum;
if( fread( &checksum, sizeof(long), 1, f ) != 1 )
continue;
MarkName( checksum );
} else
}
else
return;
fclose( f );