X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavutil%2Fbprint.h;h=c09b1ac1e1aa77686780694e7f45c4ad59b7dc5d;hp=839ec1ec0d782b21a8f9c5f6bb49fa83f44322b1;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavutil/bprint.h b/ffmpeg/libavutil/bprint.h index 839ec1e..c09b1ac 100644 --- a/ffmpeg/libavutil/bprint.h +++ b/ffmpeg/libavutil/bprint.h @@ -30,9 +30,13 @@ * Define a structure with extra padding to a fixed size * This helps ensuring binary compatibility with future versions. */ -#define FF_PAD_STRUCTURE(size, ...) \ + +#define FF_PAD_STRUCTURE(name, size, ...) \ +struct ff_pad_helper_##name { __VA_ARGS__ }; \ +typedef struct name { \ __VA_ARGS__ \ - char reserved_padding[size - sizeof(struct { __VA_ARGS__ })]; + char reserved_padding[size - sizeof(struct ff_pad_helper_##name)]; \ +} name; /** * Buffer to print data progressively @@ -74,15 +78,14 @@ * internal buffer is large enough to hold a reasonable paragraph of text, * such as the current paragraph. */ -typedef struct AVBPrint { - FF_PAD_STRUCTURE(1024, + +FF_PAD_STRUCTURE(AVBPrint, 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]; - ) -} AVBPrint; +) /** * Convenience macros for special values for av_bprint_init() size_max @@ -179,7 +182,7 @@ void av_bprint_clear(AVBPrint *buf); * It may have been truncated due to a memory allocation failure * or the size_max limit (compare size and size_max if necessary). */ -static inline int av_bprint_is_complete(AVBPrint *buf) +static inline int av_bprint_is_complete(const AVBPrint *buf) { return buf->len < buf->size; }