aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>2021-07-11 16:18:31 +0200
committerKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>2021-07-19 12:44:07 +0200
commita529403c2912370a14315057e6e12d19a5c116a9 (patch)
tree2b76bfa30d23921f8ff3f2aafa98a251ee0a532f
parentb204fafacf4924bdaf216bebc3f713bf2cca76bf (diff)
downloadneard-a529403c2912370a14315057e6e12d19a5c116a9.tar.gz
ndef: use proper format for integers (-Wformat)
Properly print signed and unsigned integers. This fixes warnings like: ./include/near/log.h:45:14: error: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘uint32_t’ {aka ‘unsigned int’} [-Werror=format=] 45 | near_debug("%s:%s() " fmt, \ | ^~~~~~~~~~ src/ndef.c:1084:2: note: in expansion of macro ‘DBG’ 1084 | DBG("payload length %d", rec_header->payload_len); | ^~~ Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
-rw-r--r--src/ndef.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ndef.c b/src/ndef.c
index 928e6a1..790655a 100644
--- a/src/ndef.c
+++ b/src/ndef.c
@@ -503,8 +503,8 @@ static gboolean property_get_uri(const GDBusPropertyTable *property,
DBG("URI prefix %s", prefix);
- value = g_strdup_printf("%s%.*s", prefix, uri->field_length,
- uri->field);
+ value = g_strdup_printf("%s%.*s", prefix, (int)uri->field_length,
+ uri->field);
dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &value);
@@ -585,7 +585,7 @@ static gboolean property_get_size(const GDBusPropertyTable *property,
{
struct near_ndef_record *record = user_data;
- DBG("%d", record->sp->size);
+ DBG("%u", record->sp->size);
dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &record->sp->size);
@@ -1042,7 +1042,7 @@ static struct near_ndef_record_header *parse_record_header(uint8_t *rec,
uint8_t *type = NULL;
uint32_t header_len = 0;
- DBG("length %d", length);
+ DBG("length %u", length);
if (!rec || offset >= length)
return NULL;
@@ -1081,7 +1081,7 @@ static struct near_ndef_record_header *parse_record_header(uint8_t *rec,
goto fail;
}
- DBG("payload length %d", rec_header->payload_len);
+ DBG("payload length %u", rec_header->payload_len);
if (rec_header->il == 1) {
rec_header->il_length = rec[offset++];
@@ -1274,7 +1274,7 @@ parse_uri_payload(uint8_t *payload, uint32_t length)
}
DBG("Identifier '0X%X'", uri_payload->identifier);
- DBG("Field '%.*s'", uri_payload->field_length, uri_payload->field);
+ DBG("Field '%.*s'", (int)uri_payload->field_length, uri_payload->field);
return uri_payload;