Commit bae1560d authored by Marius Gedminas's avatar Marius Gedminas

Fix C compilation warning

gcc 8.3.0 emits this during python setup.py build:

persistent/cPersistence.c: In function ‘Per_repr’:
persistent/cPersistence.c:1481:44: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
         snprintf(buf, sizeof(buf) - 1, "%llx", oid_value);
                                         ~~~^   ~~~~~~~~~
                                         %lx

<stdint.h> defines standard macros such as PRId64, PRIu64 and PRIx64 for
printing {u,}int64_t values, so let's use them.
parent dc2283d8
......@@ -31,6 +31,7 @@ struct ccobject_head_struct
*/
#if !defined(PY3K) && defined(_WIN32)
typedef unsigned long long uint64_t;
#define PRIx64 "llx"
#else
#include <stdint.h>
#endif
......@@ -1478,7 +1479,7 @@ Per_repr(cPersistentObject *self)
length modifier for %x, so to format a 64-bit value we need to
use stdio.
*/
snprintf(buf, sizeof(buf) - 1, "%llx", oid_value);
snprintf(buf, sizeof(buf) - 1, "%" PRIx64, oid_value);
oid_str = PyUnicode_FromFormat(" oid 0x%s", buf);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment