summaryrefslogtreecommitdiff
path: root/libavcodec/cbs.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-07-08 01:14:01 +0200
committerMark Thompson <sw@jkqxz.net>2019-07-08 22:59:41 +0100
commit730e5be3aa1118a63132122dd06aa4f3311af07d (patch)
tree21fee671a0a2538df4ecba1bbf2e48b5c036b23b /libavcodec/cbs.c
parent70a4f46e48da8bc8a547e490f67dde5165227dd8 (diff)
cbs: ff_cbs_delete_unit: Replace return value with assert
ff_cbs_delete_unit never fails if the index of the unit to delete is valid, as it is with all current callers of the function. So just assert in ff_cbs_delete_unit that the index is valid and change the return value to void in order to remove the callers' checks for whether ff_cbs_delete_unit failed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/cbs.c')
-rw-r--r--libavcodec/cbs.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index 47679eca1b..2350416501 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -737,12 +737,12 @@ int ff_cbs_insert_unit_data(CodedBitstreamContext *ctx,
return 0;
}
-int ff_cbs_delete_unit(CodedBitstreamContext *ctx,
- CodedBitstreamFragment *frag,
- int position)
+void ff_cbs_delete_unit(CodedBitstreamContext *ctx,
+ CodedBitstreamFragment *frag,
+ int position)
{
- if (position < 0 || position >= frag->nb_units)
- return AVERROR(EINVAL);
+ av_assert0(0 <= position && position < frag->nb_units
+ && "Unit to be deleted not in fragment.");
cbs_unit_uninit(ctx, &frag->units[position]);
@@ -752,6 +752,4 @@ int ff_cbs_delete_unit(CodedBitstreamContext *ctx,
memmove(frag->units + position,
frag->units + position + 1,
(frag->nb_units - position) * sizeof(*frag->units));
-
- return 0;
}