[MLton-commit] r6656
Matthew Fluet
fluet at mlton.org
Sat Jun 14 09:42:12 PDT 2008
Fix some gcc 4.3 -Wconversion warnings.
----------------------------------------------------------------------
U mlton/trunk/runtime/basis/Posix/Process/exece.c
U mlton/trunk/runtime/basis/Posix/Process/execp.c
U mlton/trunk/runtime/basis/cpointer.h
U mlton/trunk/runtime/gc/done.c
U mlton/trunk/runtime/gc/generational.c
U mlton/trunk/runtime/gc/int-inf.c
U mlton/trunk/runtime/util/align.h
U mlton/trunk/runtime/util/to-string.c
----------------------------------------------------------------------
Modified: mlton/trunk/runtime/basis/Posix/Process/exece.c
===================================================================
--- mlton/trunk/runtime/basis/Posix/Process/exece.c 2008-06-14 03:38:43 UTC (rev 6655)
+++ mlton/trunk/runtime/basis/Posix/Process/exece.c 2008-06-14 16:42:08 UTC (rev 6656)
@@ -10,20 +10,20 @@
const char *path;
char **args;
char **env;
- int aLen;
- int eLen;
+ uintmax_t aLen;
+ uintmax_t eLen;
int res;
path = (const char *) pNStr;
args = (char **) aPtr;
aLen = GC_getArrayLength((pointer)aPtr);
- for (int i = 0; i < aLen - 1; i++) {
+ for (unsigned int i = 0; i < aLen - 1; i++) {
args[i] = (char *)aStr + ((size_t*)aOff)[i];
}
args[aLen - 1] = NULL;
env = (char **) ePtr;
eLen = GC_getArrayLength((pointer)ePtr);
- for (int i = 0; i < eLen - 1; i++) {
+ for (unsigned int i = 0; i < eLen - 1; i++) {
env[i] = (char *)eStr + ((size_t*)eOff)[i];
}
env[eLen - 1] = NULL;
Modified: mlton/trunk/runtime/basis/Posix/Process/execp.c
===================================================================
--- mlton/trunk/runtime/basis/Posix/Process/execp.c 2008-06-14 03:38:43 UTC (rev 6655)
+++ mlton/trunk/runtime/basis/Posix/Process/execp.c 2008-06-14 16:42:08 UTC (rev 6656)
@@ -6,13 +6,13 @@
Vector(C_Size_t) aOff) {
const char *file;
char **args;
- int aLen;
+ uintmax_t aLen;
int res;
file = (const char *) fNStr;
args = (char **) aPtr;
aLen = GC_getArrayLength((pointer)aPtr);
- for (int i = 0; i < aLen - 1; i++) {
+ for (unsigned int i = 0; i < aLen - 1; i++) {
args[i] = (char *)aStr + ((size_t*)aOff)[i];
}
args[aLen - 1] = NULL;
Modified: mlton/trunk/runtime/basis/cpointer.h
===================================================================
--- mlton/trunk/runtime/basis/cpointer.h 2008-06-14 03:38:43 UTC (rev 6655)
+++ mlton/trunk/runtime/basis/cpointer.h 2008-06-14 16:42:08 UTC (rev 6656)
@@ -20,7 +20,7 @@
}
MLTON_CODEGEN_STATIC_INLINE
C_Size_t CPointer_diff (Pointer p1, Pointer p2) {
- return (p1 - p2);
+ return (size_t)(p1 - p2);
}
MLTON_CODEGEN_STATIC_INLINE
Bool CPointer_equal (Pointer p1, Pointer p2) {
Modified: mlton/trunk/runtime/gc/done.c
===================================================================
--- mlton/trunk/runtime/gc/done.c 2008-06-14 03:38:43 UTC (rev 6655)
+++ mlton/trunk/runtime/gc/done.c 2008-06-14 16:42:08 UTC (rev 6656)
@@ -31,7 +31,7 @@
displayCol (out, 15, uintmaxToCommaString (bytes));
displayCol (out, 15,
(ms > 0)
- ? uintmaxToCommaString (1000.0 * (float)bytes/(float)ms)
+ ? uintmaxToCommaString ((uintmax_t)(1000.0 * (float)bytes/(float)ms))
: "-");
fprintf (out, "\n");
}
Modified: mlton/trunk/runtime/gc/generational.c
===================================================================
--- mlton/trunk/runtime/gc/generational.c 2008-06-14 03:38:43 UTC (rev 6655)
+++ mlton/trunk/runtime/gc/generational.c 2008-06-14 16:42:08 UTC (rev 6656)
@@ -250,7 +250,7 @@
assert (front <= back);
cardStart = getCrossMapCardStart (s, front);
cardIndex = sizeToCardMapIndex (cardStart - s->heap.start);
- map[cardIndex] = (front - cardStart) / CROSS_MAP_OFFSET_SCALE;
+ map[cardIndex] = (GC_crossMapElem)((front - cardStart) / CROSS_MAP_OFFSET_SCALE);
if (front < back) {
front += sizeofObject (s, advanceToObjectData (s, front));
goto loopObjects;
Modified: mlton/trunk/runtime/gc/int-inf.c
===================================================================
--- mlton/trunk/runtime/gc/int-inf.c 2008-06-14 03:38:43 UTC (rev 6655)
+++ mlton/trunk/runtime/gc/int-inf.c 2008-06-14 16:42:08 UTC (rev 6656)
@@ -365,7 +365,7 @@
for (unsigned int i = 0; i < size; i++) {
char c = sp->obj.body.chars[i];
if (('a' <= c) && (c <= 'z'))
- sp->obj.body.chars[i] = c + ('A' - 'a');
+ sp->obj.body.chars[i] = (char)(c + ('A' - 'a'));
}
setFrontier (&gcState, (pointer)&sp->obj + size, bytes);
sp->counter = 0;
Modified: mlton/trunk/runtime/util/align.h
===================================================================
--- mlton/trunk/runtime/util/align.h 2008-06-14 03:38:43 UTC (rev 6655)
+++ mlton/trunk/runtime/util/align.h 2008-06-14 16:42:08 UTC (rev 6656)
@@ -32,7 +32,7 @@
assert (b >= 1 && b == (b & -b));
a += b - 1;
a &= -b;
- assert (isAligned (a, b));
+ assert (isAlignedMax (a, b));
return a;
}
Modified: mlton/trunk/runtime/util/to-string.c
===================================================================
--- mlton/trunk/runtime/util/to-string.c 2008-06-14 03:38:43 UTC (rev 6655)
+++ mlton/trunk/runtime/util/to-string.c 2008-06-14 16:42:08 UTC (rev 6656)
@@ -66,7 +66,7 @@
m = -n;
while (m > 0) {
- buf[i--] = m % 10 + '0';
+ buf[i--] = (char)((m % 10) + '0');
m = m / 10;
if (i % 4 == 0 and m > 0) buf[i--] = ',';
}
@@ -95,7 +95,7 @@
buf[i--] = '0';
else {
while (n > 0) {
- buf[i--] = n % 10 + '0';
+ buf[i--] = (char)((n % 10) + '0');
n = n / 10;
if (i % 4 == 0 and n > 0) buf[i--] = ',';
}
More information about the MLton-commit
mailing list