From c36033e00cb750ed44197f3f89a8b135d315d661 Mon Sep 17 00:00:00 2001
From: David Lovemore
Date: Tue, 1 May 2012 16:58:22 +0100
Subject: [PATCH] Fixed some places where casts are missing in vararg
arguments.
Copied from Perforce
Change: 178074
ServerID: perforce.ravenbrook.com
---
mps/code/dumper.c | 2 +-
mps/code/eventpro.c | 5 +++--
mps/code/libcbt.c | 2 +-
mps/code/locusss.c | 4 ++--
mps/code/mpsicv.c | 9 ++++++---
5 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/mps/code/dumper.c b/mps/code/dumper.c
index b2bc31de86c..9fe373cf8c2 100644
--- a/mps/code/dumper.c
+++ b/mps/code/dumper.c
@@ -146,7 +146,7 @@ int main(int argc, char *argv[]) {
switch(header[0]) {
#include "eventdef.h"
default:
- error("Unknown event code %08lX", header[0]);
+ error("Unknown event code %"PRIXPTR, (ulongest_t)header[0]);
}
}
} while(arg < argc);
diff --git a/mps/code/eventpro.c b/mps/code/eventpro.c
index 1997243ceb5..7583a9a70a9 100644
--- a/mps/code/eventpro.c
+++ b/mps/code/eventpro.c
@@ -14,6 +14,7 @@
#include "eventpro.h"
#include "misc.h"
#include "mpmtypes.h"
+#include "testlib.h" /* for ulongest_t and associated print formats */
#include /* assert */
#include /* size_t */
@@ -94,7 +95,7 @@ static size_t eventType2Index(EventType type)
for(i = 0; i < eventTypeCount; ++i)
if (eventTypes[i].type == type)
return i;
- error("Unknown event type %08lX", type);
+ error("Unknown event type %0"PRIwLONGEST PRIXLONGEST, (ulongest_t)type);
return 0;
}
@@ -109,7 +110,7 @@ static size_t eventCode2Index(EventCode code, Bool errorp)
if (eventTypes[i].code == code)
return i;
if (errorp)
- error("Unknown event code %08lX", code);
+ error("Unknown event code %0"PRIwLONGEST PRIXLONGEST, (ulongest_t)code);
return 0;
}
diff --git a/mps/code/libcbt.c b/mps/code/libcbt.c
index 9090eb8a6d5..7e13734ecf8 100644
--- a/mps/code/libcbt.c
+++ b/mps/code/libcbt.c
@@ -42,7 +42,7 @@ int main(void)
die(mps_lib_callback_register("mps_clock",
(mps_lib_function_t)libcbt_clock),
"register clock");
- die(mps_arena_create(&arena, mps_arena_class_vm(), 1000*1000),
+ die(mps_arena_create(&arena, mps_arena_class_vm(), (size_t)1000*1000),
"mps_arena_create");
if(defects) {
printf("Conclusion: Defects detected.\n");
diff --git a/mps/code/locusss.c b/mps/code/locusss.c
index 58689adea8a..f3828404c0b 100644
--- a/mps/code/locusss.c
+++ b/mps/code/locusss.c
@@ -160,12 +160,12 @@ static void testInArena(mps_arena_t arena,
int i;
die(mps_pool_create(&hipool, arena, mps_class_mvff(),
- chunkSize, chunkSize, 1024,
+ chunkSize, chunkSize, (size_t)1024,
TRUE, TRUE, TRUE),
"Create HI MFFV");
die(mps_pool_create(&lopool, arena, mps_class_mvff(),
- chunkSize, chunkSize, 1024,
+ chunkSize, chunkSize, (size_t)1024,
FALSE, FALSE, TRUE),
"Create LO MFFV");
diff --git a/mps/code/mpsicv.c b/mps/code/mpsicv.c
index b7c315a7e65..f2d3aa6f2da 100644
--- a/mps/code/mpsicv.c
+++ b/mps/code/mpsicv.c
@@ -102,7 +102,8 @@ static void alignmentTest(mps_arena_t arena)
int dummy = 0;
size_t j, size;
- die(mps_pool_create(&pool, arena, mps_class_mv(), 0x1000, 1024, 16384),
+ die(mps_pool_create(&pool, arena, mps_class_mv(),
+ (size_t)0x1000, (size_t)1024, (size_t)16384),
"alignment pool create");
size = max(sizeof(double), sizeof(long));
#ifdef HAS_LONG_LONG
@@ -336,7 +337,8 @@ static void arena_commit_test(mps_arena_t arena)
committed = mps_arena_committed(arena);
reserved = mps_arena_reserved(arena);
cdie(reserved >= committed, "reserved < committed");
- die(mps_pool_create(&pool, arena, mps_class_mv(), 0x1000, 1024, 16384),
+ die(mps_pool_create(&pool, arena, mps_class_mv(),
+ (size_t)0x1000, (size_t)1024, (size_t)16384),
"commit pool create");
limit = mps_arena_commit_limit(arena);
die(mps_arena_commit_limit_set(arena, committed), "commit_limit_set before");
@@ -411,7 +413,8 @@ static void *test(void *arg, size_t s)
die(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");
- die(mps_pool_create(&mv, arena, mps_class_mv(), 0x10000, 32, 0x10000),
+ die(mps_pool_create(&mv, arena, mps_class_mv(),
+ (size_t)0x10000, (size_t)32, (size_t)0x10000),
"pool_create(mv)");
pool_create_v_test(arena, format, chain); /* creates amc pool */