From b69a66c1980fbb13ccce14a33f53ec7b829f3900 Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Sat, 17 Sep 2016 12:05:09 +0000
Subject: [PATCH] (serialize.c) Cleanup -Wformat-signedness warning
Cleanup -Wformat-signedness warning.
serialize.c: In function 'mc_serialize_str':
serialize.c:116:34: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
return g_strdup_printf ("%c%zd" SRLZ_DELIM_S "%s", prefix, strlen (data), data);
^
serialize.c:130:19: error: format '%zd' expects argument of type 'signed size_t', but argument 5 has type 'size_t {aka long unsigned int}' [-Werror=format=]
#define FUNC_NAME "mc_serialize_str()"
^
serialize.c:175:22: note: in expansion of macro 'FUNC_NAME'
FUNC_NAME
^~~~~~~~~
serialize.c:130:19: error: format '%zd' expects argument of type 'signed size_t', but argument 6 has type 'size_t {aka long unsigned int}' [-Werror=format=]
#define FUNC_NAME "mc_serialize_str()"
^
serialize.c:175:22: note: in expansion of macro 'FUNC_NAME'
FUNC_NAME
^~~~~~~~~
serialize.c: In function 'mc_deserialize_config':
serialize.c:267:19: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
#define FUNC_NAME "mc_deserialize_config()"
^
serialize.c:269:35: note: in expansion of macro 'FUNC_NAME'
prepend_error_message (error, FUNC_NAME " at %zd", current_position + 1); \
^~~~~~~~~
serialize.c:301:17: note: in expansion of macro 'prepend_error_and_exit'
prepend_error_and_exit ();
^~~~~~~~~~~~~~~~~~~~~~
serialize.c:267:19: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
#define FUNC_NAME "mc_deserialize_config()"
^
serialize.c:269:35: note: in expansion of macro 'FUNC_NAME'
prepend_error_message (error, FUNC_NAME " at %zd", current_position + 1); \
^~~~~~~~~
serialize.c:313:17: note: in expansion of macro 'prepend_error_and_exit'
prepend_error_and_exit ();
^~~~~~~~~~~~~~~~~~~~~~
serialize.c:267:19: error: format '%zd' expects argument of type 'signed size_t', but argument 3 has type 'size_t {aka long unsigned int}' [-Werror=format=]
#define FUNC_NAME "mc_deserialize_config()"
^
serialize.c:269:35: note: in expansion of macro 'FUNC_NAME'
prepend_error_message (error, FUNC_NAME " at %zd", current_position + 1); \
^~~~~~~~~
serialize.c:325:17: note: in expansion of macro 'prepend_error_and_exit'
prepend_error_and_exit ();
^~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Andreas Mohr <and@gmx.li>
---
lib/serialize.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/serialize.c b/lib/serialize.c
index 78504c5..df4edee 100644
a
|
b
|
mc_serialize_str (const char prefix, const char *data, GError ** error) |
113 | 113 | g_set_error (error, MC_ERROR, 0, "mc_serialize_str(): Input data is NULL."); |
114 | 114 | return NULL; |
115 | 115 | } |
116 | | return g_strdup_printf ("%c%zd" SRLZ_DELIM_S "%s", prefix, strlen (data), data); |
| 116 | return g_strdup_printf ("%c%zu" SRLZ_DELIM_S "%s", prefix, strlen (data), data); |
117 | 117 | } |
118 | 118 | |
119 | 119 | /* --------------------------------------------------------------------------------------------- */ |
… |
… |
mc_deserialize_str (const char prefix, const char *data, GError ** error) |
173 | 173 | { |
174 | 174 | g_set_error (error, MC_ERROR, 0, |
175 | 175 | FUNC_NAME |
176 | | ": Specified data length (%zd) is greater than actual data length (%zd)", |
| 176 | ": Specified data length (%zu) is greater than actual data length (%zu)", |
177 | 177 | data_len, strlen (data)); |
178 | 178 | return NULL; |
179 | 179 | } |
… |
… |
mc_serialize_config (const mc_config_t * data, GError ** error) |
266 | 266 | |
267 | 267 | #define FUNC_NAME "mc_deserialize_config()" |
268 | 268 | #define prepend_error_and_exit() { \ |
269 | | prepend_error_message (error, FUNC_NAME " at %zd", current_position + 1); \ |
| 269 | prepend_error_message (error, FUNC_NAME " at %zu", current_position + 1); \ |
270 | 270 | mc_config_deinit (ret_data); \ |
271 | 271 | return NULL; \ |
272 | 272 | } |