Author: leo
Date: Wed Apr 13 01:44:06 2005
New Revision: 7822
Modified:
trunk/charset/ascii.c
trunk/charset/binary.c
trunk/charset/iso-8859-1.c
trunk/classes/timer.pmc
trunk/classes/unmanagedstruct.pmc
trunk/io/io_stdio.c
trunk/ops/experimental.ops
trunk/ops/math.ops
trunk/pf/pf_items.c
trunk/src/events.c
trunk/src/exec.c
trunk/src/gc_ims.c
trunk/src/interpreter.c
trunk/src/mmd.c
trunk/src/smallobject.c
trunk/src/spf_render.c
trunk/src/utils.c
Log:
[perl #34935] [PATCH] r7818: removing more warnings in src/
this patch against r7818 should eliminate many more warning messages in
src/*.c
[perl #34936] [PATCH] r7818: removing more warnings in other dirs
this patch covers charset/, ops/, pf/, classes/, and io/
adds typecast info, and removes unreferenced locals
Courtesy of Jerry Gay <[EMAIL PROTECTED]>
Modified: trunk/charset/ascii.c
==============================================================================
--- trunk/charset/ascii.c (original)
+++ trunk/charset/ascii.c Wed Apr 13 01:44:06 2005
@@ -150,7 +150,7 @@
for (offs = 0; offs < src->strlen; ++offs) {
c = ENCODING_GET_BYTE(interpreter, src, offs);
if (iter.bytepos >= PObj_buflen(dest) - 4) {
- UINTVAL need = (src->strlen - offs) * 1.5;
+ UINTVAL need = (UINTVAL)( (src->strlen - offs) * 1.5 );
if (need < 16)
need = 16;
Parrot_reallocate_string(interpreter, dest,
@@ -568,7 +568,7 @@
string_from_codepoint(Interp *interpreter, UINTVAL codepoint)
{
STRING *return_string = NULL;
- char real_codepoint = codepoint;
+ char real_codepoint = (char)codepoint;
return_string = string_make(interpreter, &real_codepoint, 1, "ascii", 0);
return return_string;
}
Modified: trunk/charset/binary.c
==============================================================================
--- trunk/charset/binary.c (original)
+++ trunk/charset/binary.c Wed Apr 13 01:44:06 2005
@@ -237,7 +237,7 @@
string_from_codepoint(Interp *interpreter, UINTVAL codepoint)
{
STRING *return_string = NULL;
- char real_codepoint = codepoint;
+ char real_codepoint = (char)codepoint;
return_string = string_make(interpreter, &real_codepoint, 1, "binary", 0);
return return_string;
}
Modified: trunk/charset/iso-8859-1.c
==============================================================================
--- trunk/charset/iso-8859-1.c (original)
+++ trunk/charset/iso-8859-1.c Wed Apr 13 01:44:06 2005
@@ -346,7 +346,7 @@
string_from_codepoint(Interp *interpreter, UINTVAL codepoint)
{
STRING *return_string = NULL;
- char real_codepoint = codepoint;
+ char real_codepoint = (char)codepoint;
return_string = string_make(interpreter, &real_codepoint, 1,
"iso-8859-1", 0);
return return_string;
Modified: trunk/classes/timer.pmc
==============================================================================
--- trunk/classes/timer.pmc (original)
+++ trunk/classes/timer.pmc Wed Apr 13 01:44:06 2005
@@ -209,7 +209,7 @@
case PARROT_TIMER_SEC:
return (INTVAL)t->abs_time;
case PARROT_TIMER_USEC:
- return (t->abs_time - (INTVAL)t->abs_time) *1000000.0;
+ return (INTVAL)( (t->abs_time - (INTVAL)t->abs_time)
*1000000.0 );
case PARROT_TIMER_REPEAT:
return (INTVAL) t->repeat;
case PARROT_TIMER_RUNNING:
Modified: trunk/classes/unmanagedstruct.pmc
==============================================================================
--- trunk/classes/unmanagedstruct.pmc (original)
+++ trunk/classes/unmanagedstruct.pmc Wed Apr 13 01:44:06 2005
@@ -390,7 +390,7 @@
case enum_type_int8:
case enum_type_char:
case enum_type_uchar:
- *(char*) p = value & 0xff;
+ *(char*) p = (char)value & 0xff;
break;
case enum_type_INTVAL:
*(INTVAL*) p = value;
Modified: trunk/io/io_stdio.c
==============================================================================
--- trunk/io/io_stdio.c (original)
+++ trunk/io/io_stdio.c Wed Apr 13 01:44:06 2005
@@ -415,7 +415,7 @@
errno = 0;
- if ((pos = fseek((FILE*)io->fd, offset, whence)) >= 0) {
+ if ((pos = fseek((FILE*)io->fd, (long)offset, whence)) >= 0) {
io->lpos = io->fpos;
io->fpos = pos;
}
Modified: trunk/ops/experimental.ops
==============================================================================
--- trunk/ops/experimental.ops (original)
+++ trunk/ops/experimental.ops Wed Apr 13 01:44:06 2005
@@ -97,8 +97,8 @@
yk = ykp1;
}
$1 = r1;
- $2 = xk * pow( -1, n );
- $3 = yk * pow( -1, n+1 );
+ $2 = (INTVAL)( xk * pow( -1, n ) );
+ $3 = (INTVAL)( yk * pow( -1, n+1 ) );
x = $2 * $4;
y = $3 * $5;
Modified: trunk/ops/math.ops
==============================================================================
--- trunk/ops/math.ops (original)
+++ trunk/ops/math.ops Wed Apr 13 01:44:06 2005
@@ -416,7 +416,7 @@
}
inline op fdiv(inout INT, in INT) :base_core {
- $1 = floor($1 / $2);
+ $1 = (INTVAL)floor($1 / $2);
goto NEXT();
}
@@ -441,7 +441,7 @@
}
inline op fdiv(out INT, in INT, in INT) :base_core {
- $1 = floor($2 / $3);
+ $1 = (INTVAL)floor($2 / $3);
goto NEXT();
}
Modified: trunk/pf/pf_items.c
==============================================================================
--- trunk/pf/pf_items.c (original)
+++ trunk/pf/pf_items.c Wed Apr 13 01:44:06 2005
@@ -499,7 +499,7 @@
UINTVAL flags;
opcode_t charset_nr;
size_t size;
- STRING *s, *cs;
+ STRING *s;
int wordsize = pf ? pf->header->wordsize : sizeof(opcode_t);
const char *charset_name;
@@ -553,7 +553,6 @@
PF_store_string(opcode_t *cursor, STRING *s)
{
opcode_t padded_size = s->bufused;
- opcode_t representation;
char *charcursor;
size_t i;
Modified: trunk/src/events.c
==============================================================================
--- trunk/src/events.c (original)
+++ trunk/src/events.c Wed Apr 13 01:44:06 2005
@@ -225,7 +225,10 @@
static void
init_events_first(Parrot_Interp interpreter)
{
- Parrot_thread ev_handle, io_handle;
+ Parrot_thread ev_handle;
+#ifndef WIN32
+ Parrot_thread io_handle;
+#endif
/*
* be sure all init is done only once
@@ -916,7 +919,7 @@
event = (parrot_event* )entry->data;
when = event->u.timer_event.abs_time;
abs_time.tv_sec = (time_t) when;
- abs_time.tv_nsec = (when - abs_time.tv_sec) *
+ abs_time.tv_nsec = (long)(when - abs_time.tv_sec) *
(1000L*1000L*1000L);
queue_timedwait(event_q, &abs_time);
}
Modified: trunk/src/exec.c
==============================================================================
--- trunk/src/exec.c (original)
+++ trunk/src/exec.c Wed Apr 13 01:44:06 2005
@@ -60,8 +60,10 @@
Parrot_exec(Interp *interpreter, opcode_t *pc,
opcode_t *code_start, opcode_t *code_end)
{
- int i, j, *k;
- char *cp, *nptr;
+#ifdef JIT_CGP
+ int i, j *k;
+#endif
+ char *nptr;
const char *output;
long bhs;
Parrot_exec_objfile_t *obj;
Modified: trunk/src/gc_ims.c
==============================================================================
--- trunk/src/gc_ims.c (original)
+++ trunk/src/gc_ims.c Wed Apr 13 01:44:06 2005
@@ -613,7 +613,7 @@
}
else
work_factor = 1.0;
- todo = (double)g_ims->alloc_trigger * g_ims->throttle * work_factor;
+ todo = (size_t)g_ims->alloc_trigger * g_ims->throttle * work_factor;
assert(arena_base->lazy_dod == 0);
Parrot_dod_trace_children(interpreter, todo);
/*
Modified: trunk/src/interpreter.c
==============================================================================
--- trunk/src/interpreter.c (original)
+++ trunk/src/interpreter.c Wed Apr 13 01:44:06 2005
@@ -197,7 +197,7 @@
pi->n_branches = 0;
}
else if (pi->n_branches >= pi->n_allocated) {
- pi->n_allocated = (UINTVAL) pi->n_allocated * 1.5;
+ pi->n_allocated = (size_t) (pi->n_allocated * 1.5);
pi->branches = mem_sys_realloc( pi->branches,
sizeof(Prederef_branch) * pi->n_allocated);
}
Modified: trunk/src/mmd.c
==============================================================================
--- trunk/src/mmd.c (original)
+++ trunk/src/mmd.c Wed Apr 13 01:44:06 2005
@@ -1047,8 +1047,8 @@
static INTVAL
distance_cmp(Interp *interpreter, INTVAL a, INTVAL b)
{
- short da = a & 0xffff;
- short db = b & 0xffff;
+ short da = (short)a & 0xffff;
+ short db = (short)b & 0xffff;
return da > db ? 1 : da < db ? -1 : 0;
}
Modified: trunk/src/smallobject.c
==============================================================================
--- trunk/src/smallobject.c (original)
+++ trunk/src/smallobject.c Wed Apr 13 01:44:06 2005
@@ -418,7 +418,7 @@
GC_DEBUG_REPLENISH_LEVEL_FACTOR);
}
else {
- pool->objects_per_alloc = (UINTVAL) pool->objects_per_alloc *
+ pool->objects_per_alloc = (size_t) pool->objects_per_alloc *
UNITS_PER_ALLOC_GROWTH_FACTOR;
pool->replenish_level =
(size_t)(pool->total_objects * REPLENISH_LEVEL_FACTOR);
Modified: trunk/src/spf_render.c
==============================================================================
--- trunk/src/spf_render.c (original)
+++ trunk/src/spf_render.c Wed Apr 13 01:44:06 2005
@@ -473,7 +473,7 @@
case '*':
info.flags |= FLAG_WIDTH;
info.width *= 10;
- info.width += obj->getint(interpreter,
+ info.width += (UINTVAL)obj->getint(interpreter,
SIZE_XVAL, obj);
continue;
@@ -506,7 +506,7 @@
case '*':
info.flags |= FLAG_PREC;
info.prec *= 10;
- info.prec += obj->getint(interpreter,
+ info.prec += (UINTVAL)obj->getint(interpreter,
SIZE_XVAL, obj);
continue;
Modified: trunk/src/utils.c
==============================================================================
--- trunk/src/utils.c (original)
+++ trunk/src/utils.c Wed Apr 13 01:44:06 2005
@@ -364,8 +364,8 @@
_srand48(long seed)
{
last_rand[0] = SEED_LO;
- last_rand[1] = seed & 0xffff;
- last_rand[2] = (seed >> 16) & 0xffff;
+ last_rand[1] = (unsigned short)seed & 0xffff;
+ last_rand[2] = (unsigned short)(seed >> 16) & 0xffff;
/*
* reinit a, c if changed by lcong48()
*/
@@ -464,7 +464,7 @@
INTVAL
Parrot_range_rand(INTVAL from, INTVAL to, INTVAL how_random)
{
- return (INTVAL) from + ((double)(to - from)) *
Parrot_float_rand(how_random);
+ return (INTVAL)( from + ((double)(to - from)) *
Parrot_float_rand(how_random) );
}
/*