i3.c
-----------------
i3.c: In function ‘I3_chanlist’:
i3.c:6912:45: warning: the address of ‘filter’ will always evaluate as ‘true’
find
if( !all && !channel->local_name && ( !filter || filter[0] == '\0' ) )
change it to
if( !all && !channel->local_name && ( filter == NULL || filter[0] == '\0' ) )
i3.c: In function ‘I3_chanlist’:
i3.c:6921:16: warning: the address of ‘filter’ will always evaluate as ‘true’
find
if( !all && filter && filter[0] != '\0' && i3str_prefix( filter, channel->I3_name )
&& i3str_prefix( filter, channel->host_mud ) )
continue;
change it to
if( !all && filter != NULL && filter[0] != '\0' && i3str_prefix( filter, channel->I3_name )
&& i3str_prefix( filter, channel->host_mud ) )
continue;
i3.c: In function ‘I3_setup_channel’:
i3.c:6961:8: warning: the address of ‘localname’ will always evaluate as ‘true’
find
if( !localname || localname[0] == '\0' )
change it to
if( localname == NULL || localname[0] == '\0' )
i3.c: In function ‘I3_chan_who’:
i3.c:7109:8: warning: the address of ‘channel_name’ will always evaluate as ‘true’
find
if( !channel_name || channel_name[0] == '\0' || !argument || argument[0] == '\0' )
change it to
if( channel_name == NULL || channel_name[0] == '\0' || !argument || argument[0] == '\0' )
i3.c: In function ‘I3_deny_channel’:
i3.c:7207:8: warning: the address of ‘vic_name’ will always evaluate as ‘true’
find
if( !vic_name || vic_name[0] == '\0' || !argument || argument[0] == '\0' )
change it to
if( vic_name == NULL || vic_name[0] == '\0' || !argument || argument[0] == '\0' )
i3.c: In function ‘I3_chanlayout’:
i3.c:7385:8: warning: the address of ‘arg1’ will always evaluate as ‘true’
i3.c:7390:8: warning: the address of ‘arg2’ will always evaluate as ‘true’
find
if( !arg1 || arg1[0] == '\0' )
{
I3_chanlayout( ch, "" );
return;
}
if( !arg2 || arg2[0] == '\0' )
{
I3_chanlayout( ch, "" );
return;
}
change it to
if( arg1 == NULL || arg1[0] == '\0' )
{
I3_chanlayout( ch, "" );
return;
}
if( arg2 == NULL || arg2[0] == '\0' )
{
I3_chanlayout( ch, "" );
return;
}
i3.c: In function ‘I3_admin_channel’:
i3.c:7622:8: warning: the address of ‘arg1’ will always evaluate as ‘true’
i3.c:7634:8: warning: the address of ‘arg2’ will always evaluate as ‘true’
find
if( !arg1 || arg1[0] == '\0' )
{
I3_admin_channel( ch, "" );
return;
}
if( !( channel = find_I3_channel_by_localname( arg1 ) ) )
{
i3_to_char( "No such channel with that name here.\n\r", ch );
return;
}
if( !arg2 || arg2[0] == '\0' )
{
I3_admin_channel( ch, "" );
return;
}
change it to
if( arg1 == NULL || arg1[0] == '\0' )
{
I3_admin_channel( ch, "" );
return;
}
if( !( channel = find_I3_channel_by_localname( arg1 ) ) )
{
i3_to_char( "No such channel with that name here.\n\r", ch );
return;
}
if( arg2 == NULL || arg2[0] == '\0' )
{
I3_admin_channel( ch, "" );
return;
}
i3.c: In function ‘I3_addchan’:
i3.c:7728:44: warning: the address of ‘arg’ will always evaluate as ‘true’
i3.c:7728:70: warning: the address of ‘arg2’ will always evaluate as ‘true’
find
if( !argument || argument[0] == '\0' || !arg || arg[0] == '\0' || !arg2 || arg2[0] == '\0' )
change it to
if( !argument || argument[0] == '\0' || arg == NULL || arg[0] == '\0' || arg2 == NULL || arg2[0] == '\0' )
i3.c: In function ‘I3_setconfig’:
i3.c:7835:8: warning: the address of ‘arg’ will always evaluate as ‘true’
find
if( !arg || arg[0] == '\0' )
change it to
if( arg == NULL || arg[0] == '\0' )
i3.c: In function ‘I3_permset’:
i3.c:8052:8: warning: the address of ‘arg’ will always evaluate as ‘true’
find
if( !arg || arg[0] == '\0' )
change it to
if( arg == NULL || arg[0] == '\0' )
i3.c: In function ‘I3_router’:
i3.c:8351:11: warning: the address of ‘rtname’ will always evaluate as ‘true’
i3.c:8351:43: warning: the address of ‘rtip’ will always evaluate as ‘true’
find
if( !rtname || rtname[0] == '\0' || !rtip || rtip[0] == '\0' || !argument || argument[0] == '\0' )
change it to
if( rtname == NULL || rtname[0] == '\0' || rtip == NULL || rtip[0] == '\0' || !argument || argument[0] == '\0' )
i3.c: In function ‘i3_hedit’:
i3.c:8478:8: warning: the address of ‘name’ will always evaluate as ‘true’
i3.c:8478:36: warning: the address of ‘cmd’ will always evaluate as ‘true’
find
if( !name || name[0] == '\0' || !cmd || cmd[0] == '\0' || !argument || argument[0] == '\0' )
change it to
if( name == NULL || name[0] == '\0' || cmd == NULL || cmd[0] == '\0' || !argument || argument[0] == '\0' )
i3.c: In function ‘i3_cedit’:
i3.c:8594:8: warning: the address of ‘name’ will always evaluate as ‘true’
i3.c:8594:36: warning: the address of ‘option’ will always evaluate as ‘true’
find
if( !name || name[0] == '\0' || !option || option[0] == '\0' )
change it to
if( name == NULL || name[0] == '\0' || option == NULL || option[0] == '\0' )
i3.c: In function ‘I3_send_social’:
i3.c:9112:8: warning: the address of ‘socbuf_o’ will always evaluate as ‘true’
i3.c:9115:10: warning: the address of ‘socbuf_o’ will always evaluate as ‘true’
i3.c:9115:49: warning: the address of ‘socbuf_t’ will always evaluate as ‘true’
find
if( socbuf_o && socbuf_o[0] != '\0' )
snprintf( socbuf_t, LGST, "%s", I3_find_social( ch, arg1, person, mud, TRUE ) );
if( ( socbuf_o && socbuf_o[0] != '\0' ) && ( socbuf_t && socbuf_t[0] != '\0' ) )
change it to
if( socbuf_o != NULL && socbuf_o[0] != '\0' )
snprintf( socbuf_t, LGST, "%s", I3_find_social( ch, arg1, person, mud, TRUE ) );
if( ( socbuf_o != NULL && socbuf_o[0] != '\0' ) && ( socbuf_t != NULL && socbuf_t[0] != '\0' ) )
Thats all the warnings for i3.c that have to do with always evaluate as 'true' or 'false' and similar ones in other files will be handled in similar ways.
i3.c: In function ‘I3_getarg’:
i3.c:570:4: warning: array subscript has type ‘char’
i3.c:574:7: warning: array subscript has type ‘char’
i3.c:577:7: warning: array subscript has type ‘char’
i3.c:580:4: warning: array subscript has type ‘char’
i3.c:583:4: warning: array subscript has type ‘char’
find
while( *argument && isspace( *argument ) )
argument++;
if( arg )
while( *argument && !isspace( *argument ) && len < length - 1 )
*arg++ = *argument++, len++;
else
while( *argument && !isspace( *argument ) )
argument++;
while( *argument && !isspace( *argument ) )
argument++;
while( *argument && isspace( *argument ) )
argument++;
change it to
while( *argument && isspace( (int)*argument ) )
argument++;
if( arg )
while( *argument && !isspace( (int)*argument ) && len < length - 1 )
*arg++ = *argument++, len++;
else
while( *argument && !isspace( (int)*argument ) )
argument++;
while( *argument && !isspace( (int)*argument ) )
argument++;
while( *argument && isspace( (int)*argument ) )
argument++;
i3.c: In function ‘i3capitalize’:
i3.c:659:7: warning: array subscript has type ‘char’
i3.c:661:4: warning: array subscript has type ‘char’
find
for( i = 0; str[i] != '\0'; i++ )
strcap[i] = tolower( str[i] );
strcap[i] = '\0';
strcap[0] = toupper( strcap[0] );
change it to
for( i = 0; str[i] != '\0'; i++ )
strcap[i] = tolower( (int)str[i] );
strcap[i] = '\0';
strcap[0] = toupper( (int)strcap[0] );
i3.c: In function ‘i3exists_player’:
i3.c:684:4: warning: array subscript has type ‘char’
find
snprintf( buf, 256, "%s%c/%s", PLAYER_DIR, tolower( name[0] ), i3capitalize( name ) );
change it to
snprintf( buf, 256, "%s%c/%s", PLAYER_DIR, tolower( (int)name[0] ), i3capitalize( name ) );
i3.c: In function ‘i3fread_number’:
i3.c:1068:4: warning: array subscript has type ‘char’
find
while( isspace( c ) );
change it to
while( isspace( (int)c ) );
i3.c: In function ‘i3fread_number’:
i3.c:1083:4: warning: array subscript has type ‘char’
find
if( !isdigit( c ) )
change it to
if( !isdigit( (int)c ) )
i3.c: In function ‘i3fread_number’:
i3.c:1089:4: warning: array subscript has type ‘char’
find
while( isdigit( c ) )
change it to
while( isdigit( (int)c ) )
i3.c: In function ‘i3fread_line’:
i3.c:1139:4: warning: array subscript has type ‘char’
find
while( isspace( c ) );
change it to
while( isspace( (int)c ) );
i3.c: In function ‘i3fread_word’:
i3.c:1199:4: warning: array subscript has type ‘char’
find
while( isspace( cEnd ) );
change it to
while( isspace( (int)cEnd ) );
i3.c: In function ‘i3fread_word’:
i3.c:1221:7: warning: array subscript has type ‘char’
find
if( cEnd == ' ' ? isspace( *pword ) : *pword == cEnd )
change it to
if( cEnd == ' ' ? isspace( (int)*pword ) : *pword == cEnd )
i3.c: In function ‘i3fread_letter’:
i3.c:1250:4: warning: array subscript has type ‘char’
find
while( isspace( c ) );
change it to
while( isspace( (int)c ) );
i3.c: In function ‘I3_addchan’:
i3.c:7753:4: warning: array subscript has type ‘char’
find
if( !isdigit( argument[0] ) )
change it to
if( !isdigit( (int)argument[0] ) )
i3.c: In function ‘I3_find_social’:
i3.c:8815:4: warning: array subscript has type ‘char’
find
for( c = sname; *c; *c = tolower( *c ), c++ );
change it to
for( c = sname; *c; *c = tolower( (int)*c ), c++ );
i3.c: In function ‘i3act_string’:
i3.c:8951:7: warning: array subscript has type ‘char’
find
else if( should_upper == TRUE && !isspace( *format ) && *format != '$' )
change it to
else if( should_upper == TRUE && !isspace( (int)*format ) && *format != '$' )
i3.c: In function ‘I3_send_social’:
i3.c:9147:10: warning: array subscript has type ‘char’
find
buf[0] = tolower( buf[0] );
change it to
buf[0] = tolower( (int)buf[0] );
i3.c: In function ‘I3_command_hook’:
i3.c:9469:10: warning: array subscript has type ‘char’
find
while( isspace( *argument ) )
change it to
while( isspace( (int)*argument ) )
i3.c: In function ‘I3_command_hook’:
i3.c:9478:10: warning: array subscript has type ‘char’
find
while( isspace( *argument ) )
change it to
while( isspace( (int)*argument ) )
All those were similar in setup and issue and was just adding (int) to them. All this gave me a clean compile on i3.c.