dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: cvs: apps settings.c,1.152,1.153

Re: cvs: apps settings.c,1.152,1.153

From: TP Diffenbach <>
Date: Wed, 28 May 2003 13:54:17 -0400

Quoting Kjell Ericson <>:

> On Wed, 28 May 2003, TP Diffenbach wrote:
> > As it happens, I am working on a standard way to do the compression,
> Good idea!
> > Everyting in struct user_settings is either an int or a bool or an array of
> > char.
> As I can see in the "documentation" of the settings, it is "hard" to see what
> range the chars can be. I shall take a look at "my" settings and define the
> range and maybe shrink them. It will be incompatible anyway when you are
> done...
Prresumably you've already defined a range, as the settings code UI for integral
values wants to know a minimum and maximum for integral values; then it can loop
around when the user presses up/+ on the high value, or down/- on the low value.

The range can be whatever you like. Conventionally, 0xFF is used to test for
incorrect/superseded settings, but AS EACH SETTING IS HANDLED WITH SEPERATE CODE,
it's really up to the author to check or not.

In other words, you can write an int (with appropriate casting) to the
config_block, you can write a char, you can mask bits off the char and write the
result of that. Whatever you want.

The question for you is, what should the allowable range be. Assuming the range
starts at zero, you mask off the remaining unused bits, "OR" the bits with other
bits to fill 7 bits (assuming you're going to reserve the 8th bit for the
conventional error checking); if the range doesn't start at sero, you shift right
and then mask. Blah blah blah.

Given that you're writing a patch, it would be very bad form for you to "OR" with
other settings data, so at most you're or'ing together your own masked settings,
and shoving that all into a single char (or whatever you require).

Archos FM has a Rockbox!
Received on 2003-05-28

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