mirror of
https://github.com/mpv-player/mpv
synced 2025-04-07 18:14:33 +00:00
Use negative return values for errors in pls_read_entry to make it match
with the checks later on. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30793 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
7e23f68cf7
commit
62cc3b452b
@ -252,14 +252,14 @@ pls_read_entry(char* line,pls_entry_t** _e,int* _max_entry,char** val) {
|
|||||||
v = pls_entry_get_value(line);
|
v = pls_entry_get_value(line);
|
||||||
if(!v) {
|
if(!v) {
|
||||||
mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line);
|
mp_msg(MSGT_PLAYTREE,MSGL_ERR,"No value in entry %s\n",line);
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
num = atoi(line);
|
num = atoi(line);
|
||||||
if(num <= 0 || num > limit) {
|
if(num <= 0 || num > limit) {
|
||||||
if (max_entry >= limit) {
|
if (max_entry >= limit) {
|
||||||
mp_msg(MSGT_PLAYTREE, MSGL_WARN, "Too many index entries\n");
|
mp_msg(MSGT_PLAYTREE, MSGL_WARN, "Too many index entries\n");
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
num = max_entry+1;
|
num = max_entry+1;
|
||||||
mp_msg(MSGT_PLAYTREE,MSGL_WARN,"No or invalid entry index in entry %s\nAssuming %d\n",line,num);
|
mp_msg(MSGT_PLAYTREE,MSGL_WARN,"No or invalid entry index in entry %s\nAssuming %d\n",line,num);
|
||||||
@ -267,7 +267,7 @@ pls_read_entry(char* line,pls_entry_t** _e,int* _max_entry,char** val) {
|
|||||||
if(num > max_entry) {
|
if(num > max_entry) {
|
||||||
e = realloc(e, num * sizeof(pls_entry_t));
|
e = realloc(e, num * sizeof(pls_entry_t));
|
||||||
if (!e)
|
if (!e)
|
||||||
return 0;
|
return -1;
|
||||||
memset(&e[max_entry],0,(num-max_entry)*sizeof(pls_entry_t));
|
memset(&e[max_entry],0,(num-max_entry)*sizeof(pls_entry_t));
|
||||||
max_entry = num;
|
max_entry = num;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user