>From a3f019aa770145f65cb6f75e400a9ab2449cd514 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Mon, 6 Jan 2014 21:44:34 +0100
Subject: [PATCH] print size_t values in a portable way
---
test/parse-auto.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/test/parse-auto.c b/test/parse-auto.c
index 2bbe61e..93ab536 100644
--- a/test/parse-auto.c
+++ b/test/parse-auto.c
@@ -1,6 +1,7 @@
#include <ctype.h>
#include <inttypes.h>
#include <stdbool.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -340,12 +341,14 @@ static void report_fail(const uint8_t *data, size_t datalen, exp_entry *e)
printf(" Expected entry:\n");
printf(" entry type:%d name:%s\n", e->type, e->name);
- printf(" bytecode len:%ld used:%ld\n", e->bclen, e->bcused);
+ printf(" bytecode len:%" PRIuMAX " used:%" PRIuMAX "\n",
+ (uintmax_t) e->bclen, (uintmax_t) e->bcused);
printf(" bytecode ");
for (bcoff = 0; bcoff < e->bcused; bcoff++) {
printf("%.2x ", ((uint8_t *) e->bytecode)[bcoff]);
}
- printf("\n string table len:%ld used %ld\n", e->stlen, e->stused);
+ printf("\n string table len:%" PRIuMAX " used %" PRIuMAX "\n",
+ (uintmax_t) e->stlen, (uintmax_t) e->stused);
/*
struct stentry {
size_t off;
@@ -513,9 +516,9 @@ bool validate_rule_selector(css_rule_selector *s, exp_entry *e)
if ((s->style->used * sizeof(css_code_t)) != e->bcused) {
printf("FAIL Bytecode lengths differ\n"
- " Got length %ld, Expected %u\n",
- (s->style->used * sizeof(css_code_t)),
- (int) e->bcused);
+ " Got length %" PRIuMAX ", Expected %" PRIuMAX "\n",
+ (uintmax_t) (s->style->used * sizeof(css_code_t)),
+ (uintmax_t) e->bcused);
return true;
}
--
1.8.4.2
Hello,
the attached patch fixes a compilation warning in libcss tests on x86.
D.
No comments:
Post a Comment