[FFmpeg-cvslog] mxfdec: replace x>>av_log2(sizeof(..)) by x/sizeof(..).
Ronald S. Bultje
git at videolan.org
Sat Jul 7 20:43:01 CEST 2012
ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Wed Jul 4 08:13:43 2012 -0700| [fdaad6354fbf1925c9bfeadd32950c503c1103ad] | committer: Ronald S. Bultje
mxfdec: replace x>>av_log2(sizeof(..)) by x/sizeof(..).
Also replace x>>av_log2(sizeof(..)) + 1 by x/sizeof(..). The +1 is
probably meant to emulate av_log2_ceil(sizeof(..)) in cases where ".."
is not a power of two.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fdaad6354fbf1925c9bfeadd32950c503c1103ad
---
libavformat/mxfdec.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index dd10240..594ba49 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -700,7 +700,7 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg
return 0;
else if (segment->nb_index_entries < 0 ||
segment->nb_index_entries >
- (INT_MAX >> av_log2(sizeof(*segment->stream_offset_entries))))
+ (INT_MAX / sizeof(*segment->stream_offset_entries)))
return AVERROR(ENOMEM);
length = avio_rb32(pb);
@@ -1084,7 +1084,7 @@ static int mxf_compute_ptses_fake_index(MXFContext *mxf, MXFIndexTable *index_ta
if (index_table->nb_ptses <= 0)
return 0;
- if (index_table->nb_ptses > INT_MAX >> av_log2(sizeof(AVIndexEntry)) + 1)
+ if (index_table->nb_ptses > INT_MAX / sizeof(AVIndexEntry))
return AVERROR(ENOMEM);
index_table->ptses = av_mallocz(index_table->nb_ptses *
@@ -1196,7 +1196,7 @@ static int mxf_compute_index_tables(MXFContext *mxf)
}
}
- if (mxf->nb_index_tables > INT_MAX >> av_log2(sizeof(MXFIndexTable)) + 1 ||
+ if (mxf->nb_index_tables > INT_MAX / sizeof(MXFIndexTable) ||
!(mxf->index_tables = av_mallocz(mxf->nb_index_tables *
sizeof(MXFIndexTable)))) {
av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate index tables\n");
@@ -1218,7 +1218,7 @@ static int mxf_compute_index_tables(MXFContext *mxf)
MXFIndexTable *t = &mxf->index_tables[j];
if (t->nb_segments >
- (INT_MAX >> av_log2(sizeof(MXFIndexTableSegment *))) ||
+ (INT_MAX / sizeof(MXFIndexTableSegment *)) ||
!(t->segments = av_mallocz(t->nb_segments *
sizeof(MXFIndexTableSegment*)))) {
av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate IndexTableSegment"
More information about the ffmpeg-cvslog
mailing list