Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: backlight.c, being anal about

backlight.c, being anal about

From: TP Diffenbach <rockbox_at_diffenbach.org>
Date: Sun, 27 Jul 2003 17:41:17 -0400

In backlight.c, backlight_set_timeout takes an int named seconds (line 128):

void backlight_set_timeout(int seconds)
{
    backlight_timeout = seconds;
    backlight_on();
}

and doesn't check its value.

But it uses that value as an index in a 19 element array (line 66):

backlight_timer = HZ*backlight_timeout_value[backlight_timeout];

I suspect this is only being called from the config and settings code, but it
still seems like a place where the code could be written more defensively (with an
enum rather than an int, or a sanity check of the value).

-- 
Archos FM has a Rockbox!
Received on 2003-07-27

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy