summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <emmanuel.peyrot@collabora.com>2016-05-18 17:18:18 +0100
committerBryce Harrington <bryce@osg.samsung.com>2016-05-19 17:15:56 -0700
commit1764d22f919b62bcb7948b8e07eaa40746b5f458 (patch)
tree6e59bb683fb70b3593732b5378d6771cfd55d1ab /tools
parent8a120690a19219312591b5a1710a0d155819787f (diff)
zunitc: use platform-independent macros for integer formatting
Fixes warnings and potential issues on 32-bit platforms, tested only on ARM but I’d expect the same issue on i686. Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/zunitc/src/zuc_base_logger.c15
-rw-r--r--tools/zunitc/src/zuc_junit_reporter.c34
2 files changed, 27 insertions, 22 deletions
diff --git a/tools/zunitc/src/zuc_base_logger.c b/tools/zunitc/src/zuc_base_logger.c
index cdbd9ea5..ffa127f0 100644
--- a/tools/zunitc/src/zuc_base_logger.c
+++ b/tools/zunitc/src/zuc_base_logger.c
@@ -27,6 +27,7 @@
#include "zuc_base_logger.h"
+#include <inttypes.h>
#include <memory.h>
#include <stdarg.h>
#include <stdbool.h>
@@ -363,9 +364,9 @@ check_triggered(void *data, char const *file, int line,
} else {
printf("%s:%d: error: Value of: %s\n", file, line,
expr2);
- printf(" Actual: %ld\n", val2);
+ printf(" Actual: %"PRIdPTR"\n", val2);
printf("Expected: %s\n", expr1);
- printf("Which is: %ld\n", val1);
+ printf("Which is: %"PRIdPTR"\n", val1);
}
break;
case ZUC_OP_NE:
@@ -376,8 +377,9 @@ check_triggered(void *data, char const *file, int line,
(char *)val1, (char *)val2);
} else {
printf("%s:%d: error: ", file, line);
- printf("Expected: (%s) %s (%s), actual: %ld vs %ld\n",
- expr1, zuc_get_opstr(op), expr2, val1, val2);
+ printf("Expected: (%s) %s (%s), actual: %"PRIdPTR" vs "
+ "%"PRIdPTR"\n", expr1, zuc_get_opstr(op), expr2,
+ val1, val2);
}
break;
case ZUC_OP_TERMINATE: {
@@ -392,7 +394,8 @@ check_triggered(void *data, char const *file, int line,
break;
default:
printf("%s:%d: error: ", file, line);
- printf("Expected: (%s) %s (%s), actual: %ld vs %ld\n",
- expr1, zuc_get_opstr(op), expr2, val1, val2);
+ printf("Expected: (%s) %s (%s), actual: %"PRIdPTR" vs "
+ "%"PRIdPTR"\n", expr1, zuc_get_opstr(op), expr2, val1,
+ val2);
}
}
diff --git a/tools/zunitc/src/zuc_junit_reporter.c b/tools/zunitc/src/zuc_junit_reporter.c
index a33b33f5..369f0354 100644
--- a/tools/zunitc/src/zuc_junit_reporter.c
+++ b/tools/zunitc/src/zuc_junit_reporter.c
@@ -30,6 +30,7 @@
#if ENABLE_JUNIT_XML
#include <fcntl.h>
+#include <inttypes.h>
#include <libxml/parser.h>
#include <memory.h>
#include <stdio.h>
@@ -128,12 +129,12 @@ emit_event(xmlNodePtr parent, struct zuc_event *event)
}
} else {
if (asprintf(&msg, "%s:%d: error: Value of: %s\n"
- " Actual: %ld\n"
- "Expected: %s\n"
- "Which is: %ld\n",
- event->file, event->line, event->expr2,
- event->val2, event->expr1,
- event->val1) < 0) {
+ " Actual: %"PRIdPTR"\n"
+ "Expected: %s\n"
+ "Which is: %"PRIdPTR"\n",
+ event->file, event->line, event->expr2,
+ event->val2, event->expr1,
+ event->val1) < 0) {
msg = NULL;
}
}
@@ -151,12 +152,12 @@ emit_event(xmlNodePtr parent, struct zuc_event *event)
}
} else {
if (asprintf(&msg, "%s:%d: error: "
- "Expected: (%s) %s (%s),"
- " actual: %ld vs %ld\n",
- event->file, event->line,
- event->expr1, zuc_get_opstr(event->op),
- event->expr2, event->val1,
- event->val2) < 0) {
+ "Expected: (%s) %s (%s),"
+ " actual: %"PRIdPTR" vs %"PRIdPTR"\n",
+ event->file, event->line,
+ event->expr1, zuc_get_opstr(event->op),
+ event->expr2, event->val1,
+ event->val2) < 0) {
msg = NULL;
}
}
@@ -181,10 +182,11 @@ emit_event(xmlNodePtr parent, struct zuc_event *event)
break;
default:
if (asprintf(&msg, "%s:%d: error: "
- "Expected: (%s) %s (%s), actual: %ld vs %ld\n",
- event->file, event->line,
- event->expr1, zuc_get_opstr(event->op),
- event->expr2, event->val1, event->val2) < 0) {
+ "Expected: (%s) %s (%s), actual: %"PRIdPTR" vs "
+ "%"PRIdPTR"\n",
+ event->file, event->line,
+ event->expr1, zuc_get_opstr(event->op),
+ event->expr2, event->val1, event->val2) < 0) {
msg = NULL;
}
}