diff options
author | Tim Angus <tim@ngus.net> | 2014-08-30 17:29:09 +0100 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2015-03-17 11:38:07 +0000 |
commit | 61f78e272375bba4c55e8a976c9f73e6ed1b5713 (patch) | |
tree | fa832f3c63db10d0ddb9d936e05b2a5e20b1bb33 /src/sys | |
parent | f67547574ba6f11f8e52ceba614992ca953aae4a (diff) |
Fix a few warnings
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/sys_unix.c | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/src/sys/sys_unix.c b/src/sys/sys_unix.c index 734a1e2c..7d497459 100644 --- a/src/sys/sys_unix.c +++ b/src/sys/sys_unix.c @@ -712,6 +712,7 @@ dialogResult_t Sys_Dialog( dialogType_t type, const char *message, const char *t qboolean tried[ NUM_DIALOG_PROGRAMS ] = { qfalse }; dialogCommandBuilder_t commands[ NUM_DIALOG_PROGRAMS ] = { NULL }; dialogCommandType_t preferredCommandType = NONE; + int i; commands[ ZENITY ] = &Sys_ZenityCommand; commands[ KDIALOG ] = &Sys_KdialogCommand; @@ -723,50 +724,37 @@ dialogResult_t Sys_Dialog( dialogType_t type, const char *message, const char *t else if( !Q_stricmp( session, "kde" ) ) preferredCommandType = KDIALOG; - while( 1 ) + for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ ) { - int i; + if( preferredCommandType != NONE && preferredCommandType != i ) + continue; - for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ ) + if( !tried[ i ] ) { - if( preferredCommandType != NONE && preferredCommandType != i ) - continue; - - if( !tried[ i ] ) - { - int exitCode; + int exitCode; - commands[ i ]( type, message, title ); - exitCode = Sys_Exec( ); + commands[ i ]( type, message, title ); + exitCode = Sys_Exec( ); - if( exitCode >= 0 ) + if( exitCode >= 0 ) + { + switch( type ) { - switch( type ) - { - case DT_YES_NO: return exitCode ? DR_NO : DR_YES; - case DT_OK_CANCEL: return exitCode ? DR_CANCEL : DR_OK; - default: return DR_OK; - } + case DT_YES_NO: return exitCode ? DR_NO : DR_YES; + case DT_OK_CANCEL: return exitCode ? DR_CANCEL : DR_OK; + default: return DR_OK; } + } - tried[ i ] = qtrue; + tried[ i ] = qtrue; - // The preference failed, so start again in order - if( preferredCommandType != NONE ) - { - preferredCommandType = NONE; - break; - } + // The preference failed, so start again in order + if( preferredCommandType != NONE ) + { + preferredCommandType = NONE; + i = NONE + 1; } } - - for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ ) - { - if( !tried[ i ] ) - continue; - } - - break; } Com_DPrintf( S_COLOR_YELLOW "WARNING: failed to show a dialog\n" ); |