summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Giles <giles@ghostscript.com>2009-04-24 18:12:53 +0200
committerRalph Giles <giles@ghostscript.com>2009-04-24 18:12:53 +0200
commit66b0664aa1347df44ff7a5a7aa5b35d07df54ea5 (patch)
tree032a7ba9f1e729187a497a3e8fdbd9266e5b5b71
parent05882adb4470f3f0c05e1b6df593804cd65f9fa9 (diff)
downloadmupdf-66b0664aa1347df44ff7a5a7aa5b35d07df54ea5.tar.xz
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.
-rw-r--r--fitz/base_memory.c2
1 files changed, 1 insertions, 1 deletions
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;
}