diff --git a/Extras/Serialize/BulletFileLoader/bFile.cpp b/Extras/Serialize/BulletFileLoader/bFile.cpp index b41729256..79b349557 100644 --- a/Extras/Serialize/BulletFileLoader/bFile.cpp +++ b/Extras/Serialize/BulletFileLoader/bFile.cpp @@ -295,8 +295,9 @@ char* bFile::readStruct(char *head, bChunkInd& dataChunk) numallocs++; // numBlocks * length - char *dataAlloc = new char[(dataChunk.nr*curLen)+1]; - memset(dataAlloc, 0, (dataChunk.nr*curLen)+1); + int allocLen = curLen > oldLen ? curLen : oldLen; + char *dataAlloc = new char[(dataChunk.nr*allocLen)+1]; + memset(dataAlloc, 0, (dataChunk.nr*allocLen)+1); // track allocated addDataBlock(dataAlloc); @@ -552,8 +553,8 @@ void bFile::getMatchingFileDNA(short* dna_addr, const char* lookupName, const c if (name[0] == '*') { // cast pointers - //int ptrFile = mFileDNA->getPointerSize(); - //int ptrMem = mMemoryDNA->getPointerSize(); + int ptrFile = mFileDNA->getPointerSize(); + int ptrMem = mMemoryDNA->getPointerSize(); swapPtr(strcData, data); @@ -561,13 +562,19 @@ void bFile::getMatchingFileDNA(short* dna_addr, const char* lookupName, const c { if (arrayLen > 1) { - void **sarray = (void**)strcData; - void **darray = (void**)data; - + //void **sarray = (void**)strcData; + //void **darray = (void**)data; + + char *cpc, *cpo; + cpc = (char*)strcData; + cpo = (char*)data; + for (int a=0; agetPointerSize(); + int ptrFile = mFileDNA->getPointerSize(); + int n=0, n2=0; - int swapoffs = mFileDNA->getPointerSize() > mMemoryDNA->getPointerSize() ? 2 : 1; + int swapoffs = 2; void *np = array[n]; while(np) { - if (mFlags & FD_BITS_VARIES) + if (ptrMem > ptrFile) + { + swapPtr((char*)&array[n2], (char*)&array[n]); + np = findLibPointer(array[n2]); + } + else if (ptrMem < ptrFile) + { swapPtr((char*)&array[n], (char*)&array[n2]); - - np = findLibPointer(array[n]); + np = findLibPointer(array[n]); + } + else + np = findLibPointer(array[n]); + if (np) array[n] = np; ++n;