[FFmpeg-devel] [PATCH 17/27] avformat/movenchint: Simplify writing padding

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu Sep 23 22:17:16 EEST 2021


Paul B Mahol:
> lgtm if ffio_fill does not turn negative argument into very positive one.
> 

ffio_fill does not do that; and the argument here is always nonnegative.
Here is the loop:

    while (size > 0) {
        int len = size; // size is an int and > 0 and so is len is now
        if (len > 14)
            len = 14;
        /* From here on len is always <= 14 */
        avio_w8(out, 1); /* immediate constructor */
        avio_w8(out, len); /* amount of valid data */
        avio_write(out, data, len);
        data += len;
        size -= len;

        for (; len < 14; len++)
            avio_w8(out, 0);

        (*entries)++;
    }



More information about the ffmpeg-devel mailing list