From 66b0664aa1347df44ff7a5a7aa5b35d07df54ea5 Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Fri, 24 Apr 2009 18:12:53 +0200 Subject: Use the correct format specifier for size_t in fz_strdup. Prior to this patch, if the strdup failed, it would throw an error printing the number of bytes that could not be allocated. However, this was formatted as an int, while the actual argument passed is the return value of strdup itself, which is usually a size_t. This patch formats instead as an unsigned long, and adds a cast to ensure the types match even on platforms where this isn't already the case. --- fitz/base_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fitz/base_memory.c b/fitz/base_memory.c index 21effdc1..e583dc9e 100644 --- a/fitz/base_memory.c +++ b/fitz/base_memory.c @@ -25,7 +25,7 @@ char * fz_strdup(char *s) { char *ns = strdup(s); if (!ns) - fz_throw("cannot strdup %d bytes", strlen(s) + 1); + fz_throw("cannot strdup %lu bytes", (unsigned long)strlen(s) + 1); return ns; } -- cgit v1.2.3