diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-06-07 09:01:02 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-06-07 09:01:02 +0000 |
commit | ae49b387bfe78250808a98565f6a233f22045f12 (patch) | |
tree | 78a465d3f077edcc2e50fd88311313702eff5f62 /apps/misc.c | |
parent | cbbbaac6507987619c78a4c6c4228fd4b43d9cd6 (diff) | |
download | rockbox-ae49b387bfe78250808a98565f6a233f22045f12.tar.gz rockbox-ae49b387bfe78250808a98565f6a233f22045f12.zip |
Accept FS#9075 and rename valid_vals to set_vals
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17698 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/misc.c')
-rw-r--r-- | apps/misc.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/apps/misc.c b/apps/misc.c index 4d7ddd57e6..65688024cc 100644 --- a/apps/misc.c +++ b/apps/misc.c | |||
@@ -1217,7 +1217,7 @@ int hex_to_rgb(const char* hex, int* color) | |||
1217 | s - string (sets pointer to string, without copying) | 1217 | s - string (sets pointer to string, without copying) |
1218 | c - hex colour (RGB888 - e.g. ff00ff) | 1218 | c - hex colour (RGB888 - e.g. ff00ff) |
1219 | g - greyscale "colour" (0-3) | 1219 | g - greyscale "colour" (0-3) |
1220 | valid_vals - if not NULL 1 is set in the bitplace if the item was read OK | 1220 | set_vals - if not NULL 1 is set in the bitplace if the item was read OK |
1221 | 0 if not read. | 1221 | 0 if not read. |
1222 | first item is LSB, (max 32 items! ) | 1222 | first item is LSB, (max 32 items! ) |
1223 | Stops parseing if an item is invalid unless the item == '-' | 1223 | Stops parseing if an item is invalid unless the item == '-' |
@@ -1232,19 +1232,19 @@ int hex_to_rgb(const char* hex, int* color) | |||
1232 | /* '0'-'3' are ASCII 0x30 to 0x33 */ | 1232 | /* '0'-'3' are ASCII 0x30 to 0x33 */ |
1233 | #define is0123(x) (((x) & 0xfc) == 0x30) | 1233 | #define is0123(x) (((x) & 0xfc) == 0x30) |
1234 | 1234 | ||
1235 | const char* parse_list(const char *fmt, unsigned int *valid_vals, | 1235 | const char* parse_list(const char *fmt, unsigned int *set_vals, |
1236 | const char sep, const char* str, ...) | 1236 | const char sep, const char* str, ...) |
1237 | { | 1237 | { |
1238 | va_list ap; | 1238 | va_list ap; |
1239 | const char* p = str, *f = fmt; | 1239 | const char* p = str, *f = fmt; |
1240 | const char** s; | 1240 | const char** s; |
1241 | int* d; | 1241 | int* d; |
1242 | bool valid; | 1242 | bool set; |
1243 | int i=0; | 1243 | int i=0; |
1244 | 1244 | ||
1245 | va_start(ap, str); | 1245 | va_start(ap, str); |
1246 | if (valid_vals) | 1246 | if (set_vals) |
1247 | *valid_vals = 0; | 1247 | *set_vals = 0; |
1248 | while (*fmt) | 1248 | while (*fmt) |
1249 | { | 1249 | { |
1250 | /* Check for separator, if we're not at the start */ | 1250 | /* Check for separator, if we're not at the start */ |
@@ -1254,7 +1254,7 @@ const char* parse_list(const char *fmt, unsigned int *valid_vals, | |||
1254 | goto err; | 1254 | goto err; |
1255 | p++; | 1255 | p++; |
1256 | } | 1256 | } |
1257 | valid = false; | 1257 | set = false; |
1258 | switch (*fmt++) | 1258 | switch (*fmt++) |
1259 | { | 1259 | { |
1260 | case 's': /* string - return a pointer to it (not a copy) */ | 1260 | case 's': /* string - return a pointer to it (not a copy) */ |
@@ -1263,14 +1263,14 @@ const char* parse_list(const char *fmt, unsigned int *valid_vals, | |||
1263 | *s = p; | 1263 | *s = p; |
1264 | while (*p && *p != sep) | 1264 | while (*p && *p != sep) |
1265 | p++; | 1265 | p++; |
1266 | valid = (*s[0]!='-') && (*s[1]!=sep) ; | 1266 | set = (*s[0]!='-') && (*s[1]!=sep) ; |
1267 | break; | 1267 | break; |
1268 | 1268 | ||
1269 | case 'd': /* int */ | 1269 | case 'd': /* int */ |
1270 | d = va_arg(ap, int*); | 1270 | d = va_arg(ap, int*); |
1271 | if (!isdigit(*p)) | 1271 | if (!isdigit(*p)) |
1272 | { | 1272 | { |
1273 | if (!valid_vals || *p != '-') | 1273 | if (!set_vals || *p != '-') |
1274 | goto err; | 1274 | goto err; |
1275 | while (*p && *p != sep) | 1275 | while (*p && *p != sep) |
1276 | p++; | 1276 | p++; |
@@ -1280,7 +1280,7 @@ const char* parse_list(const char *fmt, unsigned int *valid_vals, | |||
1280 | *d = *p++ - '0'; | 1280 | *d = *p++ - '0'; |
1281 | while (isdigit(*p)) | 1281 | while (isdigit(*p)) |
1282 | *d = (*d * 10) + (*p++ - '0'); | 1282 | *d = (*d * 10) + (*p++ - '0'); |
1283 | valid = true; | 1283 | set = true; |
1284 | } | 1284 | } |
1285 | 1285 | ||
1286 | break; | 1286 | break; |
@@ -1291,7 +1291,7 @@ const char* parse_list(const char *fmt, unsigned int *valid_vals, | |||
1291 | 1291 | ||
1292 | if (hex_to_rgb(p, d) < 0) | 1292 | if (hex_to_rgb(p, d) < 0) |
1293 | { | 1293 | { |
1294 | if (!valid_vals || *p != '-') | 1294 | if (!set_vals || *p != '-') |
1295 | goto err; | 1295 | goto err; |
1296 | while (*p && *p != sep) | 1296 | while (*p && *p != sep) |
1297 | p++; | 1297 | p++; |
@@ -1299,7 +1299,7 @@ const char* parse_list(const char *fmt, unsigned int *valid_vals, | |||
1299 | else | 1299 | else |
1300 | { | 1300 | { |
1301 | p += 6; | 1301 | p += 6; |
1302 | valid = true; | 1302 | set = true; |
1303 | } | 1303 | } |
1304 | 1304 | ||
1305 | break; | 1305 | break; |
@@ -1312,9 +1312,9 @@ const char* parse_list(const char *fmt, unsigned int *valid_vals, | |||
1312 | if (is0123(*p)) | 1312 | if (is0123(*p)) |
1313 | { | 1313 | { |
1314 | *d = *p++ - '0'; | 1314 | *d = *p++ - '0'; |
1315 | valid = true; | 1315 | set = true; |
1316 | } | 1316 | } |
1317 | else if (!valid_vals || *p != '-') | 1317 | else if (!set_vals || *p != '-') |
1318 | goto err; | 1318 | goto err; |
1319 | else | 1319 | else |
1320 | { | 1320 | { |
@@ -1329,8 +1329,8 @@ const char* parse_list(const char *fmt, unsigned int *valid_vals, | |||
1329 | goto err; | 1329 | goto err; |
1330 | break; | 1330 | break; |
1331 | } | 1331 | } |
1332 | if (valid_vals && valid) | 1332 | if (set_vals && set) |
1333 | *valid_vals |= (1<<i); | 1333 | *set_vals |= (1<<i); |
1334 | i++; | 1334 | i++; |
1335 | } | 1335 | } |
1336 | 1336 | ||