aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Kalinsky <vadim@kalinsky.ru>2014-11-24 10:38:05 -0500
committerMichael Niedermayer <michaelni@gmx.at>2014-11-29 03:51:35 +0100
commit2db29482f1ae42f9e3c40cc019fb9e04522aa0bb (patch)
tree6ddeb23f203520571a9dc9679555329afa758a73
parent0cb994dfe32efa97024962f8e46c0738722ba159 (diff)
downloadffmpeg-2db29482f1ae42f9e3c40cc019fb9e04522aa0bb.tar.gz
avutil/bprint: C++ compatible AVBPrint definition.
Previous version reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavutil/bprint.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/libavutil/bprint.h b/libavutil/bprint.h
index d1682fca92..c09b1ac1e1 100644
--- a/libavutil/bprint.h
+++ b/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