summaryrefslogtreecommitdiff
path: root/libavcodec/tableprint.h
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2013-01-15 16:08:58 -0500
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2013-10-15 17:00:28 +0100
commit884fd4d2590c30c7787fc05b86b050125fd53f33 (patch)
treeeb349c797568f8527b72df4f18c43c181adc0567 /libavcodec/tableprint.h
parent708b32b6f72c58ec1bf5fed6a227b3e48b971a05 (diff)
tableprint: Fix use of a size_t print with MSVC
%zu was introduced in C99, so MSVC has its own way to handle it, namely %Iu. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavcodec/tableprint.h')
-rw-r--r--libavcodec/tableprint.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/libavcodec/tableprint.h b/libavcodec/tableprint.h
index 81bb9afdcb..daa89fe99b 100644
--- a/libavcodec/tableprint.h
+++ b/libavcodec/tableprint.h
@@ -71,10 +71,20 @@ void write_uint32_t_2d_array(const void *, int, int);
void write_float_2d_array (const void *, int, int);
/** @} */ // end of printfuncs group
+/*
+ * MSVC doesn't have %zu, since it was introduced in C99,
+ * but has its own %Iu for printing size_t values.
+ */
+#if defined(_MSC_VER)
+#define FMT "Iu"
+#else
+#define FMT "zu"
+#endif
+
#define WRITE_ARRAY(prefix, type, name) \
do { \
const size_t array_size = FF_ARRAY_ELEMS(name); \
- printf(prefix" "#type" "#name"[%zu] = {\n", \
+ printf(prefix" "#type" "#name"[%"FMT"] = {\n", \
array_size); \
write_##type##_array(name, array_size); \
printf("};\n"); \
@@ -84,7 +94,7 @@ void write_float_2d_array (const void *, int, int);
do { \
const size_t array_size1 = FF_ARRAY_ELEMS(name); \
const size_t array_size2 = FF_ARRAY_ELEMS(name[0]); \
- printf(prefix" "#type" "#name"[%zu][%zu] = {\n", \
+ printf(prefix" "#type" "#name"[%"FMT"][%"FMT"] = {\n", \
array_size1, array_size2 ); \
write_##type##_2d_array(name, array_size1, array_size2); \
printf("};\n"); \