Rockbox mail archiveSubject: settings.c and testing config_block against 0xFF
settings.c and testing config_block against 0xFF
From: TP Diffenbach <rockbox_at_diffenbach.org>
Date: Sun, 30 Mar 2003 07:15:44 -0500
In settings.c, the function init_config_buffer sets all bytes (other than the header) of config_block to 0xFF. This function is called if the header or checksum of config_block is incorrect (or if the RTC header or checksum is incorrect).
So either all bytes of config_block are set to 0xFF, or every byte is set to whatever's read from the disk (or RTC).
If the checksum is NOT incorrect, settings_load tests every byte on config_block (every byte that's not the MSB of an int) against 0xFF.
Why test each byte, rather than just loading the default settings if the config_block cannot be read from disk sucessfully?
Testing each byte against 0xFF, when the config_block has loaded successfully implies that 0xFF is a legitimate value that can be saved, which, on re-load, means to ignore the value in favor of the default setting.
This only makes sense to me if 0xFF indicates that the default value should be used, even if the default has changed from what the default was when the settings were saved, to some new version's default value when read by a newer version of Rockbox.
Is that the point of all the individual byte testing against 0xFF? To ensure that the current version's default (which may be different than a previous version's default, for some setting) is loaded if so indicated by 0xFF?
-- Archos FM needs a Rockbox!Received on 2003-03-30