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 /apps/gui/skin_engine | |
parent | cc9e336fa14437bae8edcf11946472318d89ad9a (diff) | |
download | rockbox-8db32ddfee2577cd338e88134eb52823c04dec80.tar.gz rockbox-8db32ddfee2577cd338e88134eb52823c04dec80.zip |
Skin parser: Use parse_list() when possible
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23846 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine')
-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, | |||
1099 | /* extract max width data */ | 1099 | /* extract max width data */ |
1100 | if (*_pos != '|') | 1100 | if (*_pos != '|') |
1101 | { | 1101 | { |
1102 | if (!isdigit(*_pos)) /* malformed token: e.g. %Cl|7|59|# */ | 1102 | _pos = parse_list("d", NULL, '|', _pos, &aa->width); |
1103 | if (!_pos || _pos > newline || *_pos != '|') | ||
1103 | return WPS_ERROR_INVALID_PARAM; | 1104 | return WPS_ERROR_INVALID_PARAM; |
1104 | |||
1105 | aa->width = atoi(_pos); | ||
1106 | |||
1107 | _pos = strchr(_pos, '|'); | ||
1108 | if (!_pos || _pos > newline) | ||
1109 | return WPS_ERROR_INVALID_PARAM; /* malformed token: no | after width field | ||
1110 | e.g. %Cl|7|59|200\n */ | ||
1111 | } | 1105 | } |
1112 | 1106 | ||
1113 | /* parsing height field */ | 1107 | /* parsing height field */ |
@@ -1148,15 +1142,9 @@ static int parse_albumart_load(const char *wps_bufptr, | |||
1148 | /* extract max height data */ | 1142 | /* extract max height data */ |
1149 | if (*_pos != '|') | 1143 | if (*_pos != '|') |
1150 | { | 1144 | { |
1151 | if (!isdigit(*_pos)) | 1145 | _pos = parse_list("d", NULL, '|', _pos, &aa->height); |
1152 | return WPS_ERROR_INVALID_PARAM; /* malformed token e.g. %Cl|7|59|200|@ */ | 1146 | if (!_pos || _pos > newline || *_pos != '|') |
1153 | 1147 | return WPS_ERROR_INVALID_PARAM; | |
1154 | aa->height = atoi(_pos); | ||
1155 | |||
1156 | _pos = strchr(_pos, '|'); | ||
1157 | if (!_pos || _pos > newline) | ||
1158 | return WPS_ERROR_INVALID_PARAM; /* malformed token: no closing | | ||
1159 | e.g. %Cl|7|59|200|200\n */ | ||
1160 | } | 1148 | } |
1161 | 1149 | ||
1162 | /* if we got here, we parsed everything ok .. ! */ | 1150 | /* if we got here, we parsed everything ok .. ! */ |
@@ -1179,9 +1167,7 @@ static int parse_albumart_load(const char *wps_bufptr, | |||
1179 | 1167 | ||
1180 | albumart_slot = playback_claim_aa_slot(&dimensions); | 1168 | albumart_slot = playback_claim_aa_slot(&dimensions); |
1181 | 1169 | ||
1182 | if (albumart_slot < 0) /* didn't get a slot ? */ | 1170 | if (0 <= albumart_slot) |
1183 | return skip_end_of_line(wps_bufptr); | ||
1184 | else | ||
1185 | wps_data->playback_aa_slot = albumart_slot; | 1171 | wps_data->playback_aa_slot = albumart_slot; |
1186 | 1172 | ||
1187 | /* Skip the rest of the line */ | 1173 | /* Skip the rest of the line */ |