comparison playtreeparser.c @ 30751:a375d947381b

Use negative return values for errors in pls_read_entry to make it match with the checks later on.
author reimar
date Sun, 28 Feb 2010 09:41:07 +0000
parents b9ec8956164f
children 4f837c9acc58
comparison
equal deleted inserted replaced
30750:b9ec8956164f 30751:a375d947381b
250 char* v; 250 char* v;
251 251
252 v = pls_entry_get_value(line); 252 v = pls_entry_get_value(line);
253 if(!v) { 253 if(!v) {
254 mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line); 254 mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line);
255 return 0; 255 return -1;
256 } 256 }
257 257
258 num = atoi(line); 258 num = atoi(line);
259 if(num <= 0 || num > limit) { 259 if(num <= 0 || num > limit) {
260 if (max_entry >= limit) { 260 if (max_entry >= limit) {
261 mp_msg(MSGT_PLAYTREE, MSGL_WARN, "Too many index entries\n"); 261 mp_msg(MSGT_PLAYTREE, MSGL_WARN, "Too many index entries\n");
262 return 0; 262 return -1;
263 } 263 }
264 num = max_entry+1; 264 num = max_entry+1;
265 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"No or invalid entry index in entry %s\nAssuming %d\n",line,num); 265 mp_msg(MSGT_PLAYTREE,MSGL_WARN,"No or invalid entry index in entry %s\nAssuming %d\n",line,num);
266 } 266 }
267 if(num > max_entry) { 267 if(num > max_entry) {
268 e = realloc(e, num * sizeof(pls_entry_t)); 268 e = realloc(e, num * sizeof(pls_entry_t));
269 if (!e) 269 if (!e)
270 return 0; 270 return -1;
271 memset(&e[max_entry],0,(num-max_entry)*sizeof(pls_entry_t)); 271 memset(&e[max_entry],0,(num-max_entry)*sizeof(pls_entry_t));
272 max_entry = num; 272 max_entry = num;
273 } 273 }
274 (*_e) = e; 274 (*_e) = e;
275 (*_max_entry) = max_entry; 275 (*_max_entry) = max_entry;