Permalink
Browse files

common/sclang: more integer type fixes

Signed-off-by: Tim Blechmann <tim@klingt.org>
  • Loading branch information...
1 parent fbe8bce commit 497d8309a1b3cc01768708318d2e33b466185403 @timblechmann timblechmann committed Sep 9, 2012
View
2 common/SC_AllocPool.cpp
@@ -535,7 +535,7 @@ void* AllocPool::Realloc(void* inPtr, size_t inReqSize)
void AllocPool::LinkFree(AllocChunkPtr inChunk)
{
size_t size = inChunk->Size();
- int index = BinIndex(size);
+ size_t index = BinIndex(size);
AllocChunkPtr bin = mBins + index;
View
8 include/common/SC_AllocPool.h
@@ -203,11 +203,11 @@ class AllocPool
return (bits << 3) + (inSize >> bits) ;
}
- void MarkBinBlock(int inIndex)
+ void MarkBinBlock(size_t inIndex)
{
- unsigned long word = inIndex >> 5;
- unsigned long bitPosition = inIndex & 31;
- unsigned long bitValue = 1L << bitPosition;
+ size_t word = inIndex >> 5;
+ size_t bitPosition = inIndex & 31;
+ size_t bitValue = 1L << bitPosition;
mBinBlocks[word] |= bitValue;
}
View
4 include/lang/ByteCodeArray.h
@@ -29,7 +29,7 @@ typedef unsigned char Byte;
typedef struct {
Byte *bytes;
Byte *ptr;
- long size;
+ size_t size;
} ByteCodeArray, *ByteCodes;
extern ByteCodes gCompilingByteCodes;
@@ -42,7 +42,7 @@ void copyByteCodes(Byte *dest, ByteCodes byteCodes);
ByteCodes getByteCodes();
ByteCodes saveByteCodeArray();
void restoreByteCodeArray(ByteCodes byteCodes);
-int byteCodeLength(ByteCodes byteCodes);
+size_t byteCodeLength(ByteCodes byteCodes);
void compileByteCodes(ByteCodes byteCodes);
ByteCodes allocByteCodes();
void reallocByteCodes(ByteCodes byteCodes);
View
5 lang/LangSource/ByteCodeArray.cpp
@@ -128,7 +128,7 @@ void restoreByteCodeArray(ByteCodes byteCodes)
gCompilingByteCodes = byteCodes;
}
-int byteCodeLength(ByteCodes byteCodes)
+size_t byteCodeLength(ByteCodes byteCodes)
{
if (!byteCodes) return 0;
return (byteCodes->ptr - byteCodes->bytes);
@@ -176,13 +176,12 @@ ByteCodes allocByteCodes()
void reallocByteCodes(ByteCodes byteCodes)
{
Byte *newBytes;
- int newLen;
if (byteCodes->size != (byteCodes->ptr - byteCodes->bytes)) {
error("reallocByteCodes called with size != byteCode len");
}
- newLen = byteCodes->size << 1;
+ size_t newLen = byteCodes->size << 1;
// pyrmalloc: I think that all bytecodes are copied to objects
// lifetime: kill after compile
newBytes = (Byte *)pyr_pool_compile->Alloc(newLen);
View
8 lang/LangSource/PyrInterpreter3.cpp
@@ -200,7 +200,7 @@ PyrProcess* newPyrProcess(VMGlobals *g, PyrClass *procclassobj)
}
PyrSymbol * contextsym = getsym("functionCompileContext");
- int index = slotRawInt(&class_interpreter->classIndex) + contextsym->u.index;
+ size_t index = slotRawInt(&class_interpreter->classIndex) + contextsym->u.index;
PyrMethod * meth = gRowTable[index];
if (!meth || slotRawSymbol(&meth->name) != contextsym) {
error("compile context method 'functionCompileContext' not found.\n");
@@ -537,7 +537,8 @@ HOT void Interpret(VMGlobals *g)
// byte code values
unsigned char *ip;
unsigned char op1;
- int op2, op3, index, tag;
+ size_t index;
+ int op2, op3, tag;
// interpreter globals
// temporary variables used in the interpreter
@@ -2754,7 +2755,6 @@ void DumpDetailedBackTrace(VMGlobals *g)
void DumpStack(VMGlobals *g, PyrSlot *sp)
{
- int i;
PyrSlot *slot;
char str[128];
#if BCSTAT
@@ -2763,7 +2763,7 @@ void DumpStack(VMGlobals *g, PyrSlot *sp)
postfl("STACK:\n");
slot = sp - 64;
if (slot < g->gc->Stack()->slots) slot = g->gc->Stack()->slots;
- for (i=slot - g->gc->Stack()->slots; slot<=sp; slot++, ++i) {
+ for (size_t i=slot - g->gc->Stack()->slots; slot<=sp; slot++, ++i) {
slotString(slot, str);
post(" %2d %s\n", i, str);
}

0 comments on commit 497d830

Please sign in to comment.