Simplify some redundant boolean expressions

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21013 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Bertrik Sikken 2009-05-21 14:15:24 +00:00
parent a968ddbb39
commit ab222c1705
8 changed files with 13 additions and 13 deletions

View file

@ -167,7 +167,7 @@ static int get_action_worker(int context, int timeout,
#endif
#ifndef HAS_BUTTON_HOLD
screen_has_lock = ((context & ALLOW_SOFTLOCK) == ALLOW_SOFTLOCK);
if (screen_has_lock && (keys_locked == true))
if (screen_has_lock && keys_locked)
{
if (button == unlock_combo)
{
@ -267,7 +267,7 @@ bool action_userabort(int timeout)
#ifndef HAS_BUTTON_HOLD
bool is_keys_locked(void)
{
return (screen_has_lock && (keys_locked == true));
return (screen_has_lock && keys_locked);
}
#endif

View file

@ -158,7 +158,7 @@ void option_talk_value(const struct settings_list *setting, int value, bool enqu
{
if ((setting->flags & F_BOOL_SETTING) == F_BOOL_SETTING)
{
bool val = value==1?true:false;
bool val = (value==1);
talk_id(val? setting->bool_setting->lang_yes :
setting->bool_setting->lang_no, enqueue);
}

View file

@ -351,7 +351,7 @@ int gui_syncpitchscreen_run(void)
if (pitch_mode == PITCH_MODE_ABSOLUTE) {
pitch = pitch_increase(pitch, delta, true);
} else {
pitch = pitch_increase_semitone(pitch, delta > 0 ? true:false);
pitch = pitch_increase_semitone(pitch, delta > 0);
}
delta = 0;

View file

@ -450,9 +450,9 @@ static void trigger_speak_item(const struct settings_list **settings,
selected_setting == STOP_THRESHOLD) &&
temp == 0)
{
talk_id(LANG_OFF, title?true:false);
talk_id(LANG_OFF, title);
} else {
option_talk_value(s, temp, title?true:false);
option_talk_value(s, temp, title);
}
}
int rectrigger(void)

View file

@ -2414,7 +2414,7 @@ void audio_set_recording_options(struct audio_recording_options *options)
{
bool is_mpeg1;
is_mpeg1 = (options->rec_frequency < 3)?true:false;
is_mpeg1 = (options->rec_frequency < 3);
rec_version_index = is_mpeg1?3:2;
rec_frequency_index = options->rec_frequency % 3;

View file

@ -315,9 +315,9 @@ bool settings_load_config(const char* file, bool apply)
{
int temp;
if (cfg_string_to_int(i,&temp,value))
*(bool*)settings[i].setting = (temp==0?false:true);
*(bool*)settings[i].setting = (temp!=0);
if (settings[i].bool_setting->option_callback)
settings[i].bool_setting->option_callback(temp==0?false:true);
settings[i].bool_setting->option_callback(temp!=0);
break;
}
case F_T_CHARPTR:
@ -1132,7 +1132,7 @@ bool set_option(const char* string, const void* variable, enum optiontype type,
if (!option_screen(&item, NULL, false, NULL))
{
if (type == BOOL)
*(bool*)variable = (temp == 1? true: false);
*(bool*)variable = (temp == 1);
else
*(int*)variable = temp;
return false;

View file

@ -107,7 +107,7 @@ void cpu_boost_(bool on_off, char* location, int line)
{
int message = (cpu_boost_first+cpu_boost_calls_count)%MAX_BOOST_LOG;
snprintf(cpu_boost_calls[message], MAX_PATH,
"%c %s:%d",on_off==true?'B':'U',location,line);
"%c %s:%d",on_off?'B':'U',location,line);
cpu_boost_calls_count++;
}
#else

View file

@ -323,7 +323,7 @@ static void __backlight_dim(bool dim_now)
{
/* dont let the interrupt tick happen */
backlight_control = BACKLIGHT_CONTROL_IDLE;
backlight_target = (dim_now == true) ? 0 : _backlight_brightness;
backlight_target = dim_now ? 0 : _backlight_brightness;
if(backlight_target==0 && _backlight_brightness==0)
{
if(dim_now == false)
@ -361,7 +361,7 @@ static inline void __buttonlight_off(void)
static void __buttonlight_dim(bool dim_now)
{
buttonlight_control = BUTTONLIGHT_CONTROL_IDLE;
buttonlight_target = (dim_now == true) ? 0 : buttonlight_brightness;
buttonlight_target = dim_now ? 0 : buttonlight_brightness;
if(buttonlight_target==0 && buttonlight_brightness==0)
{
if(dim_now == false)