]> granicus.if.org Git - json-c/commitdiff
Linux's %p format doesn't return "0x0" for NULL pointers, so switch to using %lx...
authorEric Haszlakiewicz <erh+git@nimenees.com>
Sat, 30 Jul 2016 19:09:51 +0000 (15:09 -0400)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Sat, 30 Jul 2016 19:09:51 +0000 (15:09 -0400)
tests/test_util_file.c

index 61bf1c5d0d0f6e1cce9a3342029207d0879564c9..776393371d444b1a2878370eedda49104f9a8f9c 100644 (file)
@@ -5,6 +5,8 @@
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #include "json.h"
 #include "json_util.h"
@@ -124,7 +126,7 @@ static void test_read_nonexistant()
        json_object *jso = json_object_from_file(filename);
        if (jso != NULL)
        {
-               printf("FAIL: json_object_from_file(%s) returned %p when NULL expected\n", filename, jso);
+               printf("FAIL: json_object_from_file(%s) returned 0x%lx when NULL expected\n", filename, (unsigned long)jso);
                json_object_put(jso);
        }
        else
@@ -142,11 +144,11 @@ static void test_read_closed()
        json_object *jso = json_object_from_fd(d);
        if (jso != NULL)
        {
-               printf("FAIL: read from closed fd returning non-NULL: %p\n", jso);
+               printf("FAIL: read from closed fd returning non-NULL: 0x%lx\n", (unsigned long)jso);
                fflush(stdout);
                printf("  jso=%s\n", json_object_to_json_string(jso));
                json_object_put(jso);
                return;
        }
-       printf("OK: json_object_from_fd(closed_fd), expecting NULL, EBADF, got:%p, %s\n", jso, json_util_get_last_err());
+       printf("OK: json_object_from_fd(closed_fd), expecting NULL, EBADF, got:0x%lx, %s\n", (unsigned long)jso, json_util_get_last_err());
 }