[FFmpeg-devel] MPEG-PS demuxer index memory usage

Måns Rullgård mans
Sat Jan 5 13:55:43 CET 2008

Trent Piepho <xyzzy at speakeasy.org> writes:

> On Fri, 4 Jan 2008, [iso-8859-1] M?ns Rullg?rd wrote:
>> > -            memmove(entries + index + 1, entries + index, sizeof(AVIndexEntry)*(st->nb_index_entries - index));
>> > +            memmove(&entries[index + 1], &entries[index], sizeof(AVIndexEntry)*(st->nb_index_entries - index));
>> Those two lines are exactly equivalent.  In C, the construct a[b] can
>> always be replaced by ((a) + (b)) and conversely.  This means that the
> You mean "*((a) +(b))" replaces "a[b]", or "&a[b]" replaces "((a)+(b))", of
> course.

Yes, of course.

>> first argument to the above memmove() call could be written
>> &index[entries]+1, or even &1[entries]+index, should one feel thusly
>> inclined.
> I don't think &1[entries]+index would work.  1[entries] is dereferencing an
> integer, which should be an error, but might be just a warning under some
> compiler/options/c standard combinations.  Maybe you meant
> "&entries[1]+index", which would work.

Try it.  It really works.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list