Use C99 %zu format conversion in printf for size_t.

size_t is unsigned long long on LLP64 and %lu prints unsigned long (32
bit), potentially causing problems.
This commit is contained in:
iphydf 2016-09-16 14:12:47 +01:00
parent 63e0008b7d
commit 80cc32a79d
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9

View File

@ -59,7 +59,7 @@
static void print_message(Messenger *m, uint32_t friendnumber, unsigned int type, const uint8_t *string, size_t length,
void *userdata)
{
printf("Message with length %lu received from %u: %s \n", length, friendnumber, string);
printf("Message with length %zu received from %u: %s \n", length, friendnumber, string);
m_send_message_generic(m, friendnumber, type, (const uint8_t *)"Test1", 6, 0);
}
@ -81,7 +81,7 @@ static void print_request(Messenger *m, const uint8_t *public_key, const uint8_t
printf("%hhX", public_key[j]);
}
printf("\nOf length: %lu with data: %s \n", length, data);
printf("\nOf length: %zu with data: %s \n", length, data);
if (length != sizeof("Install Gentoo")) {
return;