Unified · Split
| @@ -107,11 +107,11 @@ static int alloc_table(VLC *vlc, int size, int use_static) · 106 unmodified lines | ||
| 107 | 107 | vlc->table_size += size; |
| 108 | 108 | if (vlc->table_size > vlc->table_allocated) { |
| 109 | 109 | if (use_static) |
| 110 | − abort(); // cannot do anything, init_vlc() is used with too little memory | |
| 110 | + return AVERROR_BUG; | |
| 111 | 111 | vlc->table_allocated += (1 << vlc->bits); |
| 112 | 112 | vlc->table = av_realloc(vlc->table, sizeof(VLC_TYPE) * 2 * vlc->table_allocated); |
| 113 | 113 | if (!vlc->table) |
| 114 | − return -1; | |
| 114 | + return AVERROR(ENOMEM); | |
| 115 | 115 | } |
| 116 | 116 | return index; |
| 117 | 117 | } |
| @@ -163,7 +163,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, · 45 unmodified lines | ||
| 163 | 163 | table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC); |
| 164 | 164 | av_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size); |
| 165 | 165 | if (table_index < 0) |
| 166 | − return -1; | |
| 166 | + return table_index; | |
| 167 | 167 | table = &vlc->table[table_index]; |
| 168 | 168 | |
| 169 | 169 | for (i = 0; i < table_size; i++) { |
| @@ -190,7 +190,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, · 20 unmodified lines | ||
| 190 | 190 | av_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n); |
| 191 | 191 | if (table[j][1] /*bits*/ != 0) { |
| 192 | 192 | av_log(NULL, AV_LOG_ERROR, "incorrect codes\n"); |
| 193 | − return -1; | |
| 193 | + return AVERROR_INVALIDDATA; | |
| 194 | 194 | } |
| 195 | 195 | table[j][1] = n; //bits |
| 196 | 196 | table[j][0] = symbol; |
| @@ -221,7 +221,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, · 24 unmodified lines | ||
| 221 | 221 | j, codes[i].bits + table_nb_bits); |
| 222 | 222 | index = build_table(vlc, subtable_bits, k-i, codes+i, flags); |
| 223 | 223 | if (index < 0) |
| 224 | − return -1; | |
| 224 | + return index; | |
| 225 | 225 | /* note: realloc has been done, so reload tables */ |
| 226 | 226 | table = &vlc->table[table_index]; |
| 227 | 227 | table[j][0] = index; //code |
| @@ -272,7 +272,7 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, · 44 unmodified lines | ||
| 272 | 272 | if (vlc->table_size && vlc->table_size == vlc->table_allocated) { |
| 273 | 273 | return 0; |
| 274 | 274 | } else if (vlc->table_size) { |
| 275 | − abort(); // fatal error, we are called on a partially initialized table | |
| 275 | + return AVERROR_BUG; | |
| 276 | 276 | } |
| 277 | 277 | } else { |
| 278 | 278 | vlc->table = NULL; |
| @@ -313,7 +313,7 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, · 34 unmodified lines | ||
| 313 | 313 | av_free(buf); |
| 314 | 314 | if (ret < 0) { |
| 315 | 315 | av_freep(&vlc->table); |
| 316 | − return -1; | |
| 316 | + return ret; | |
| 317 | 317 | } |
| 318 | 318 | if ((flags & INIT_VLC_USE_NEW_STATIC) && |
| 319 | 319 | vlc->table_size != vlc->table_allocated) |