diff options
author | Tomer Shalev <shalev.tomer@gmail.com> | 2009-12-04 13:10:06 +0000 |
---|---|---|
committer | Tomer Shalev <shalev.tomer@gmail.com> | 2009-12-04 13:10:06 +0000 |
commit | 8db32ddfee2577cd338e88134eb52823c04dec80 (patch) | |
tree | e1107aa716945b18018e9029e38b4fb7c84a4065 | |
parent | cc9e336fa14437bae8edcf11946472318d89ad9a (diff) |
Skin parser: Use parse_list() when possible
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23846 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 7c889346a1..17fd82b8b3 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -1099,15 +1099,9 @@ static int parse_albumart_load(const char *wps_bufptr, /* extract max width data */ if (*_pos != '|') { - if (!isdigit(*_pos)) /* malformed token: e.g. %Cl|7|59|# */ + _pos = parse_list("d", NULL, '|', _pos, &aa->width); + if (!_pos || _pos > newline || *_pos != '|') return WPS_ERROR_INVALID_PARAM; - - aa->width = atoi(_pos); - - _pos = strchr(_pos, '|'); - if (!_pos || _pos > newline) - return WPS_ERROR_INVALID_PARAM; /* malformed token: no | after width field - e.g. %Cl|7|59|200\n */ } /* parsing height field */ @@ -1148,15 +1142,9 @@ static int parse_albumart_load(const char *wps_bufptr, /* extract max height data */ if (*_pos != '|') { - if (!isdigit(*_pos)) - return WPS_ERROR_INVALID_PARAM; /* malformed token e.g. %Cl|7|59|200|@ */ - - aa->height = atoi(_pos); - - _pos = strchr(_pos, '|'); - if (!_pos || _pos > newline) - return WPS_ERROR_INVALID_PARAM; /* malformed token: no closing | - e.g. %Cl|7|59|200|200\n */ + _pos = parse_list("d", NULL, '|', _pos, &aa->height); + if (!_pos || _pos > newline || *_pos != '|') + return WPS_ERROR_INVALID_PARAM; } /* if we got here, we parsed everything ok .. ! */ @@ -1179,9 +1167,7 @@ static int parse_albumart_load(const char *wps_bufptr, albumart_slot = playback_claim_aa_slot(&dimensions); - if (albumart_slot < 0) /* didn't get a slot ? */ - return skip_end_of_line(wps_bufptr); - else + if (0 <= albumart_slot) wps_data->playback_aa_slot = albumart_slot; /* Skip the rest of the line */ |