summaryrefslogtreecommitdiff
path: root/libavcodec/bitstream.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-06-16 23:29:37 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-06-16 23:29:37 +0200
commit301522f521f05c998fb8dfba153d49e557604507 (patch)
tree89342e95cce1caf0f73de912a0529decd406e7da /libavcodec/bitstream.c
parent9265bae3567c85b55fc4cdfad141bb34a939d6fd (diff)
parentf80b60ad59945dae32bb26a4e239ed94b0e92fa3 (diff)
Merge commit 'f80b60ad59945dae32bb26a4e239ed94b0e92fa3'
* commit 'f80b60ad59945dae32bb26a4e239ed94b0e92fa3': bitstream: forward error values and drop few abort() Conflicts: libavcodec/bitstream.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/bitstream.c')
-rw-r--r--libavcodec/bitstream.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index 1d0e585c22..23bea43ac7 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -112,7 +112,7 @@ static int alloc_table(VLC *vlc, int size, int use_static)
vlc->table_allocated += (1 << vlc->bits);
vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(VLC_TYPE) * 2);
if (!vlc->table)
- return -1;
+ return AVERROR(ENOMEM);
}
return index;
}
@@ -166,7 +166,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
av_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
if (table_index < 0)
- return -1;
+ return table_index;
table = &vlc->table[table_index];
for (i = 0; i < table_size; i++) {
@@ -193,7 +193,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
av_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n);
if (table[j][1] /*bits*/ != 0) {
av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
table[j][1] = n; //bits
table[j][0] = symbol;
@@ -224,7 +224,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
j, codes[i].bits + table_nb_bits);
index = build_table(vlc, subtable_bits, k-i, codes+i, flags);
if (index < 0)
- return -1;
+ return index;
/* note: realloc has been done, so reload tables */
table = &vlc->table[table_index];
table[j][0] = index; //code
@@ -339,7 +339,7 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
av_free(buf);
if (ret < 0) {
av_freep(&vlc->table);
- return -1;
+ return ret;
}
return 0;
}