Avoid printf type modifiers not supported by MSVC C runtime library.
[cascardo/ovs.git] / tests / test-aes128.c
index 8a6c28c..642c05e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009 Nicira Networks.
+ * Copyright (c) 2009, 2010, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,18 +28,17 @@ hex_to_uint8(const char *input, uint8_t *output, size_t n)
         goto error;
     }
     for (i = 0; i < n; i++) {
-        unsigned char hi = input[i * 2];
-        unsigned char lo = input[i * 2 + 1];
+        bool ok;
 
-        if (!isxdigit(hi) || !isxdigit(lo)) {
+        output[i] = hexits_value(&input[i * 2], 2, &ok);
+        if (!ok) {
             goto error;
         }
-        output[i] = (hexit_value(hi) << 4) + hexit_value(lo);
     }
     return;
 
 error:
-    ovs_fatal(0, "\"%s\" is not exactly %zu hex digits", input, n * 2);
+    ovs_fatal(0, "\"%s\" is not exactly %"PRIuSIZE" hex digits", input, n * 2);
 }
 
 int