diff --git a/common/SC_AllocPool.cpp b/common/SC_AllocPool.cpp index b10c91c5221..3ed832adc46 100644 --- a/common/SC_AllocPool.cpp +++ b/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; diff --git a/include/common/SC_AllocPool.h b/include/common/SC_AllocPool.h index b9cdf668d9c..c3f6ce19276 100644 --- a/include/common/SC_AllocPool.h +++ b/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; } diff --git a/include/lang/ByteCodeArray.h b/include/lang/ByteCodeArray.h index 5e23ed288fe..9cd1b3fbc4f 100644 --- a/include/lang/ByteCodeArray.h +++ b/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); diff --git a/lang/LangSource/ByteCodeArray.cpp b/lang/LangSource/ByteCodeArray.cpp index 6b583a24f6e..80ff41e4c73 100644 --- a/lang/LangSource/ByteCodeArray.cpp +++ b/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); diff --git a/lang/LangSource/PyrInterpreter3.cpp b/lang/LangSource/PyrInterpreter3.cpp index 88e6903c4e3..606625688e5 100644 --- a/lang/LangSource/PyrInterpreter3.cpp +++ b/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); }