aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-28 15:57:20 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-07-30 21:23:58 +0200
commit2252f1938e529b28c3ef6530ea224da243820a60 (patch)
treea6e5dce7f512ea34b539b6dfb9f1c2df2b3afe6c
parentf6413617c5eba0d0a06517059545e51af45dee16 (diff)
csn1: Fix various printf/format issues pointed out by gcc
This might clash with C++11 and literal values but we will see that once the compilers enable that by default. Fixes: csn1.cpp: In function 'gint16 csnStreamDecoder(csnStream_t*, const CSN_DESCR*, bitvec*, unsigned int&, void*)': csn1.cpp:864:17: warning: format '%d' expects argument of type 'int', but argument 8 has type 'guint64 {aka long unsigned int}' [-Wformat] csn1.cpp:1144:15: warning: format '%u' expects argument of type 'unsigned int', but argument 7 has type 'uint64_t {aka long long unsigned int}' [-Wformat] csn1.cpp:1150:15: warning: format '%u' expects argument of type 'unsigned int', but argument 7 has type 'uint64_t {aka long long unsigned int}' [-Wformat] csn1.cpp: In function 'gint16 csnStreamEncoder(csnStream_t*, const CSN_DESCR*, bitvec*, unsigned int&, void*)': csn1.cpp:2119:17: warning: format '%d' expects argument of type 'int', but argument 8 has type 'guint64 {aka long unsigned int}' [-Wformat]
-rw-r--r--src/csn1.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/csn1.cpp b/src/csn1.cpp
index de1db73..45cc848 100644
--- a/src/csn1.cpp
+++ b/src/csn1.cpp
@@ -32,6 +32,8 @@
#include <cstdlib>
#include <assert.h>
#include <string.h>
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
#include "csn1.h"
#include <gprs_debug.h>
@@ -861,7 +863,7 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, unsig
guint64 ui64 = bitvec_read_field(vector, readIndex, no_of_bits);
pui64 = pui64DATA(data, pDescr->offset);
*pui64 = ui64;
- LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui64);
+ LOGPC(DCSN1, LOGL_NOTICE, "%s = %lu | ", pDescr->sz , *pui64);
}
else
{
@@ -1141,13 +1143,13 @@ csnStreamDecoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector, unsig
guint8 bits_to_handle = remaining_bits_len%8;
if (bits_to_handle > 0)
{
- LOGPC(DCSN1, LOGL_NOTICE, "%u|", bitvec_read_field(vector, readIndex, bits_to_handle));
+ LOGPC(DCSN1, LOGL_NOTICE, "%"PRIu64"|", bitvec_read_field(vector, readIndex, bits_to_handle));
remaining_bits_len -= bits_to_handle;
bit_offset += bits_to_handle;
}
else if (bits_to_handle == 0)
{
- LOGPC(DCSN1, LOGL_NOTICE, "%u|", bitvec_read_field(vector, readIndex, 8));
+ LOGPC(DCSN1, LOGL_NOTICE, "%"PRIu64"|", bitvec_read_field(vector, readIndex, 8));
remaining_bits_len -= 8;
bit_offset += 8;
}
@@ -2116,7 +2118,7 @@ gint16 csnStreamEncoder(csnStream_t* ar, const CSN_DESCR* pDescr, bitvec *vector
{
pui64 = pui64DATA(data, pDescr->offset);
bitvec_write_field(vector, writeIndex, *pui64, no_of_bits);
- LOGPC(DCSN1, LOGL_NOTICE, "%s = %d | ", pDescr->sz , *pui64);
+ LOGPC(DCSN1, LOGL_NOTICE, "%s = %lu | ", pDescr->sz , *pui64);
}
else
{