This change should be ABI-compatible. Since the size of the useable internal buffer was actually different on 32 bit and 64 bit, so the code contains a somewhat ugly kludge to maintain ABI-compatibility. It can be removed on the next ABI-bump. --- Note that there are the following (and IMO sufficient) methods left to add fields without breaking ABI: - allocate extra fields in reserved_internal_buffer - add the fields freely, and mess with the reserved_internal_buffer size - add unused dummy fields --- libavutil/bprint.c | 3 +-- libavutil/bprint.h | 12 +----------- 2 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/libavutil/bprint.c b/libavutil/bprint.c index 0a0d078..d340c1f 100644 --- a/libavutil/bprint.c +++ b/libavutil/bprint.c @@ -68,8 +68,7 @@ static void av_bprint_grow(AVBPrint *buf, unsigned extra_len) void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max) { - unsigned size_auto = (char *)buf + sizeof(*buf) - - buf->reserved_internal_buffer; + unsigned size_auto = sizeof(buf->reserved_internal_buffer); if (size_max == 1) size_max = size_auto; diff --git a/libavutil/bprint.h b/libavutil/bprint.h index d1682fc..781d711 100644 --- a/libavutil/bprint.h +++ b/libavutil/bprint.h @@ -27,14 +27,6 @@ #include "avstring.h" /** - * Define a structure with extra padding to a fixed size - * This helps ensuring binary compatibility with future versions. - */ -#define FF_PAD_STRUCTURE(size, ...) \ - __VA_ARGS__ \ - char reserved_padding[size - sizeof(struct { __VA_ARGS__ })]; - -/** * Buffer to print data progressively * * The string buffer grows as necessary and is always 0-terminated. @@ -75,13 +67,11 @@ * such as the current paragraph. */ typedef struct AVBPrint { - FF_PAD_STRUCTURE(1024, char *str; /**< string so far */ unsigned len; /**< length so far */ unsigned size; /**< allocated memory */ unsigned size_max; /**< maximum allocated memory */ - char reserved_internal_buffer[1]; - ) + char reserved_internal_buffer[1000 + (sizeof(void*) == 4 ? 8 : 0)]; } AVBPrint; /** -- 2.1.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel