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>
This commit is contained in:
parent
8a120690a1
commit
1764d22f91
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user