gettimeofday: port recent C++ fix to Emacs
[gnulib.git] / tests / test-vasnprintf-posix.c
index 0dc1fcf..af779cd 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of POSIX compatible vasnprintf() and asnprintf() functions.
-   Copyright (C) 2007-2012 Free Software Foundation, Inc.
+   Copyright (C) 2007-2013 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -118,7 +118,7 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
       ASSERT (length == 5);
       if (size < 6)
         ASSERT (result != buf);
-      ASSERT (memcmp (buf + size, "DEADBEEF" + size, 8 - size) == 0);
+      ASSERT (memcmp (buf + size, &"DEADBEEF"[size], 8 - size) == 0);
       if (result != buf)
         free (result);
     }
@@ -252,7 +252,8 @@ test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...))
     char *result =
       my_asnprintf (NULL, &length, "%.0a %d", 1.5, 33, 44, 55);
     ASSERT (result != NULL);
-    ASSERT (strcmp (result, "0x2p+0 33") == 0
+    ASSERT (strcmp (result, "0x1p+0 33") == 0
+            || strcmp (result, "0x2p+0 33") == 0
             || strcmp (result, "0x3p-1 33") == 0
             || strcmp (result, "0x6p-2 33") == 0
             || strcmp (result, "0xcp-3 33") == 0);