The CELL fields can be various integer types depending on the platform

(ARM uses 'int' and 'unsigned'; i386 uses 'long' and 'unsigned long'),
so we need explicit casts to long and unsigned long here to ensure
that the result matches the printf %ld and %lx specifiers.
This commit is contained in:
kientzle 2013-04-07 05:53:42 +00:00
parent 1fd889a6f3
commit a04522357c

View File

@ -216,10 +216,11 @@ static void seeColon(FICL_VM *pVM, CELL *pc)
{
FICL_WORD *pLit = (FICL_WORD *)c.p;
sprintf(cp, "%.*s ( %#lx literal )",
pLit->nName, pLit->name, c.u);
pLit->nName, pLit->name, (unsigned long)c.u);
}
else
sprintf(cp, "literal %ld (%#lx)", c.i, c.u);
sprintf(cp, "literal %ld (%#lx)",
(long)c.i, (unsigned long)c.u);
break;
case STRINGLIT:
{
@ -281,7 +282,7 @@ static void seeColon(FICL_VM *pVM, CELL *pc)
}
else /* probably not a word - punt and print value */
{
sprintf(cp, "%ld ( %#lx )", pc->i, pc->u);
sprintf(cp, "%ld ( %#lx )", (long)pc->i, (unsigned long)pc->u);
}
vmTextOut(pVM, pVM->pad, 1);
@ -324,19 +325,22 @@ static void seeXT(FICL_VM *pVM)
break;
case VARIABLE:
sprintf(pVM->pad, "variable = %ld (%#lx)", pFW->param->i, pFW->param->u);
sprintf(pVM->pad, "variable = %ld (%#lx)",
(long)pFW->param->i, (unsigned long)pFW->param->u);
vmTextOut(pVM, pVM->pad, 1);
break;
#if FICL_WANT_USER
case USER:
sprintf(pVM->pad, "user variable %ld (%#lx)", pFW->param->i, pFW->param->u);
sprintf(pVM->pad, "user variable %ld (%#lx)",
(long)pFW->param->i, (unsigned long)pFW->param->u);
vmTextOut(pVM, pVM->pad, 1);
break;
#endif
case CONSTANT:
sprintf(pVM->pad, "constant = %ld (%#lx)", pFW->param->i, pFW->param->u);
sprintf(pVM->pad, "constant = %ld (%#lx)",
(long)pFW->param->i, (unsigned long)pFW->param->u);
vmTextOut(pVM, pVM->pad, 1);
default: