]> git.sesse.net Git - freerainbowtables/commitdiff
(C) origin/HEAD origin/master origin/rti2_header
authorJames Nobis <quel@quelrod.net>
Wed, 19 Jan 2011 04:00:17 +0000 (22:00 -0600)
committerJames Nobis <quel@quelrod.net>
Wed, 19 Jan 2011 04:00:17 +0000 (22:00 -0600)
misc cleanup
merging of shared source

24 files changed:
BOINC software/BOINC client apps/distrrtgen_cuda/rcuda.cu
Client Applications/converti2/converti2.cpp
Client Applications/rcracki_mt/BaseRTReader.cpp
Client Applications/rcracki_mt/BaseRTReader.h
Client Applications/rcracki_mt/ChainWalkContext.cpp
Client Applications/rcracki_mt/HashAlgorithm.cpp
Client Applications/rcracki_mt/HashRoutine.cpp
Client Applications/rcracki_mt/Public.cpp
Client Applications/rcracki_mt/Public.h
Client Applications/rcracki_mt/RTI2Reader.cpp
Client Applications/rti2rto/rti2rto.cpp
Common/rt api/BaseRTReader.cpp
Common/rt api/BaseRTReader.h
Common/rt api/ChainWalkSet.cpp
Common/rt api/HashAlgorithm.cpp
Common/rt api/MemoryPool.cpp
Common/rt api/MemoryPool.h
Common/rt api/Public.cpp
Common/rt api/RTI2Reader.cpp
Common/rt api/RTI2Reader.h
Common/rt api/RTIReader.cpp
Common/rt api/RTIReader.h
Common/rt api/RTReader.cpp
Common/rt api/RTReader.h

index b626041ede05721baf29f545226e9edcb5c9a524..412128ed6697bc929ca812b9957bc165a358e97c 100644 (file)
@@ -160,6 +160,7 @@ extern "C" int CalcChainsOnCUDA(const rcuda::RCudaTask* task, uint64 *resultBuff
        cuErr = cudaSuccess;
        
        cudaSetDeviceFlags(cudaDeviceBlockingSync);
        cuErr = cudaSuccess;
        
        cudaSetDeviceFlags(cudaDeviceBlockingSync);
+
        for(int idx = 0; idx < task->rainbowChainLen-1 && cuErr == cudaSuccess; idx+=KERN_CHAIN_SIZE) {
                switch(task->hash) {
                case rcuda::RHASH_MD5:
        for(int idx = 0; idx < task->rainbowChainLen-1 && cuErr == cudaSuccess; idx+=KERN_CHAIN_SIZE) {
                switch(task->hash) {
                case rcuda::RHASH_MD5:
index 13b492e64c78cb9d304b1fb86aa71d12ae4140b2..c447f0c79e75e96feebc0bb5f87498f0b4d3b707 100644 (file)
@@ -317,7 +317,7 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, unsigned int
 
                int size = reader->GetChainsLeft() * sizeof(RainbowChain);
                        static CMemoryPool mp;
 
                int size = reader->GetChainsLeft() * sizeof(RainbowChain);
                        static CMemoryPool mp;
-                       unsigned int nAllocatedSize;
+                       uint64 nAllocatedSize;
                        RainbowChain* pChain = (RainbowChain*)mp.Allocate(size, nAllocatedSize);                        
                        uint32 chainrowsize = (uint32)ceil((float)(rti_startptlength + rti_endptlength + rti_cplength) / 8) * 8 ; // The size in bits (in whole bytes)
                        unsigned int chainrowsizebytes = chainrowsize / 8;
                        RainbowChain* pChain = (RainbowChain*)mp.Allocate(size, nAllocatedSize);                        
                        uint32 chainrowsize = (uint32)ceil((float)(rti_startptlength + rti_endptlength + rti_cplength) / 8) * 8 ; // The size in bits (in whole bytes)
                        unsigned int chainrowsizebytes = chainrowsize / 8;
@@ -403,7 +403,7 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, unsigned int
                                indexes.push_back(index);
 
                                IndexRow high = {0}; // Used to find the highest numbers. This tells us how much we can pack the index bits
                                indexes.push_back(index);
 
                                IndexRow high = {0}; // Used to find the highest numbers. This tells us how much we can pack the index bits
-                               for(UINT4 i = 0; i < indexes.size(); i++)
+                               for(uint32 i = 0; i < indexes.size(); i++)
                                {
                                        if(indexes[i].numchains > high.numchains)
                                                high.numchains = indexes[i].numchains;
                                {
                                        if(indexes[i].numchains > high.numchains)
                                                high.numchains = indexes[i].numchains;
@@ -427,14 +427,14 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, unsigned int
 //                                     fwrite(&m_rti_index_indexlength , 1, 1, pFileIndex);
 
                                fwrite(&m_rti_index_numchainslength, 1, 1, pFileIndex);
 //                                     fwrite(&m_rti_index_indexlength , 1, 1, pFileIndex);
 
                                fwrite(&m_rti_index_numchainslength, 1, 1, pFileIndex);
-                               for(UINT4 i = 0; i < rti_cppos.size(); i++)     {
+                               for(uint32 i = 0; i < rti_cppos.size(); i++)    {
                                        fwrite(&rti_cppos[i], 1, 4, pFileIndex); // The position of the checkpoints
                                }
 //                                     fwrite(&m_rti_index_prefixlength, 1, 1, pFileIndex);
                                int zero = 0;
                                fwrite(&indexes[0].prefix, 1, 8, pFileIndex); // Write the first prefix
                                unsigned int lastPrefix = 0;
                                        fwrite(&rti_cppos[i], 1, 4, pFileIndex); // The position of the checkpoints
                                }
 //                                     fwrite(&m_rti_index_prefixlength, 1, 1, pFileIndex);
                                int zero = 0;
                                fwrite(&indexes[0].prefix, 1, 8, pFileIndex); // Write the first prefix
                                unsigned int lastPrefix = 0;
-                               for(UINT4 i = 0; i < indexes.size(); i++)       {
+                               for(uint32 i = 0; i < indexes.size(); i++)      {
                                        if(i == 0) {
                                                lastPrefix = indexes[0].prefix;
                                        }
                                        if(i == 0) {
                                                lastPrefix = indexes[0].prefix;
                                        }
@@ -457,7 +457,7 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, unsigned int
                                                                exit(1);
                                                        }
                                                }
                                                                exit(1);
                                                        }
                                                }
-                                               for(UINT4 j = 1; j < diffSize; j++)
+                                               for(uint32 j = 1; j < diffSize; j++)
                                                {                                                               
                                                        fwrite(&zero, 1, m_indexrowsizebytes, pFileIndex);
                                                }
                                                {                                                               
                                                        fwrite(&zero, 1, m_indexrowsizebytes, pFileIndex);
                                                }
@@ -589,7 +589,7 @@ int main(int argc, char* argv[])
                printf("no rainbow table found\n");
                return 0;
        }
                printf("no rainbow table found\n");
                return 0;
        }
-       for (UINT4 i = 0; i < vPathName.size(); i++) {
+       for (uint32 i = 0; i < vPathName.size(); i++) {
                string sResultFile;
                int n = vPathName[i].find_last_of('\\');
                if (n != -1) {
                string sResultFile;
                int n = vPathName[i].find_last_of('\\');
                if (n != -1) {
index e0f8fa8f08d521b5b82a8f732ebcb620efb7a3f4..7ee1223145b00e05d105f4a5112ae5426b2e39e2 100644 (file)
@@ -2,7 +2,7 @@
  * rcracki_mt is a multithreaded implementation and fork of the original 
  * RainbowCrack
  *
  * rcracki_mt is a multithreaded implementation and fork of the original 
  * RainbowCrack
  *
- * Copyright 2010 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2010, 2011 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
  * Copyright 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
  * Copyright 2010, 2011 James Nobis <frt@quelrod.net>
  *
  * Copyright 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
  * Copyright 2010, 2011 James Nobis <frt@quelrod.net>
  *
index 01073a578f095e93532de9373b7f0f7e7abba682..2086d86e394da031b9b215870225b19eddd19f98 100644 (file)
@@ -2,7 +2,7 @@
  * rcracki_mt is a multithreaded implementation and fork of the original 
  * RainbowCrack
  *
  * rcracki_mt is a multithreaded implementation and fork of the original 
  * RainbowCrack
  *
- * Copyright 2010 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2010, 2011 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
  * Copyright 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
  * Copyright 2010, 2011 James Nobis <frt@quelrod.net>
  *
  * Copyright 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
  * Copyright 2010, 2011 James Nobis <frt@quelrod.net>
  *
index deb6f511e58e1eedb8b52366dbad02dfb0b60f9b..4fdcf6e2d08811264d1d2ce58648fa4fb016b15d 100644 (file)
@@ -25,7 +25,7 @@
  */\r
 \r
 #if defined(_WIN32) && !defined(__GNUC__)\r
  */\r
 \r
 #if defined(_WIN32) && !defined(__GNUC__)\r
-       #pragma warning(disable : 4786 4267 4018)\r
+       #pragma warning(disable : 4786)\r
 #endif\r
 \r
 #include "ChainWalkContext.h"\r
 #endif\r
 \r
 #include "ChainWalkContext.h"\r
index bb5b94e2dc6227ee0d0d6743f100b0845ce16053..3c3c5583c8915071f56aea2169e2358debbe4a6b 100644 (file)
@@ -3,7 +3,7 @@
  * RainbowCrack\r
  *\r
  * Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>\r
  * RainbowCrack\r
  *\r
  * Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>\r
- * Copyright 2009, 2010 Martin Westergaard Jørgensen <martinwj2005@gmail.com>\r
+ * Copyright 2009, 2010, 2011 Martin Westergaard Jørgensen <martinwj2005@gmail.com>\r
  * Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>\r
  * Copyright 2009, 2010, 2011 James Nobis <frt@quelrod.net>\r
  *\r
  * Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>\r
  * Copyright 2009, 2010, 2011 James Nobis <frt@quelrod.net>\r
  *\r
index 1d0ca53fcdb4b704a4a275f086002ac501bea772..71e9eefa1fc5b0694f0afbcd0257649b11bb4a06 100644 (file)
@@ -24,7 +24,7 @@
  */\r
 \r
 #if defined(_WIN32) && !defined(__GNUC__)\r
  */\r
 \r
 #if defined(_WIN32) && !defined(__GNUC__)\r
-       #pragma warning(disable : 4786 4267 4018)\r
+       #pragma warning(disable : 4786)\r
 #endif\r
 \r
 #include "HashRoutine.h"\r
 #endif\r
 \r
 #include "HashRoutine.h"\r
index 959e691b8c68e2fde3a21dfa2f7002f5f3068562..6e02af61d23d0d2fe2647b10c9b07fa3982445ef 100644 (file)
@@ -23,7 +23,7 @@
  */\r
 \r
 #if defined(_WIN32) && !defined(__GNUC__)\r
  */\r
 \r
 #if defined(_WIN32) && !defined(__GNUC__)\r
-       #pragma warning(disable : 4786 4267 4018)\r
+       #pragma warning(disable : 4786)\r
 #endif\r
 \r
 #include "Public.h"\r
 #endif\r
 \r
 #include "Public.h"\r
@@ -44,8 +44,8 @@
  \r
        struct timezone\r
        {\r
  \r
        struct timezone\r
        {\r
-               int  tz_minuteswest; /* minutes W of Greenwich */\r
-               int  tz_dsttime;     /* type of dst correction */\r
+               int tz_minuteswest; /* minutes W of Greenwich */\r
+               int tz_dsttime;     /* type of dst correction */\r
        };\r
  \r
        int gettimeofday(struct timeval *tv, struct timezone *tz)\r
        };\r
  \r
        int gettimeofday(struct timeval *tv, struct timezone *tz)\r
index 050884242c1b2799be8789b9b109d146a679e5ff..08943d4b836228c417201e3c802c7b07f52e932f 100644 (file)
@@ -36,7 +36,6 @@
 \r
 using namespace std;\r
 \r
 \r
 using namespace std;\r
 \r
-\r
 struct RainbowChainO\r
 {\r
        uint64 nIndexS;\r
 struct RainbowChainO\r
 {\r
        uint64 nIndexS;\r
@@ -114,9 +113,7 @@ void tty_flush(void);
 \r
 #if defined(_WIN32) && !defined(__GNUC__)\r
        int gettimeofday( struct timeval *tv, struct timezone *tz );\r
 \r
 #if defined(_WIN32) && !defined(__GNUC__)\r
        int gettimeofday( struct timeval *tv, struct timezone *tz );\r
-#endif\r
-\r
-#if !defined(_WIN32) || defined(__GNUC__)\r
+#else\r
        #include <sys/time.h>\r
 #endif\r
 \r
        #include <sys/time.h>\r
 #endif\r
 \r
index 9176fa63e42ea260b7760ea9e0170be3b94487a6..54538986c009b478c56265a66f991f9dcbe679a9 100644 (file)
@@ -71,7 +71,7 @@ RTI2Reader::RTI2Reader(string Filename)
        fseek(m_pFile, 0, SEEK_SET);
        if(len % m_chainsizebytes > 0)
        {
        fseek(m_pFile, 0, SEEK_SET);
        if(len % m_chainsizebytes > 0)
        {
-               printf("Invalid filesize %ld\n", len);
+               printf("Invalid filesize %lu\n", len);
                return;
        }
        
                return;
        }
        
index ba7f16315e6f4f7531b33082087db2e14b27db0e..760a7f56a552b429bb583cf993dd138661f7631f 100644 (file)
@@ -97,7 +97,7 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, string sType)
                return;
        }
        static CMemoryPool mp;
                return;
        }
        static CMemoryPool mp;
-       unsigned int nAllocatedSize;
+       uint64 nAllocatedSize;
        BaseRTReader *reader = NULL;
        if(sType == "RTI2")
                reader = (BaseRTReader*)new RTI2Reader(sFileName);
        BaseRTReader *reader = NULL;
        if(sType == "RTI2")
                reader = (BaseRTReader*)new RTI2Reader(sFileName);
@@ -108,7 +108,7 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, string sType)
                printf("Invalid table type '%s'", sType.c_str());
                return ;
        }
                printf("Invalid table type '%s'", sType.c_str());
                return ;
        }
-       int size = reader->GetChainsLeft() * sizeof(RainbowChain);
+       uint64 size = reader->GetChainsLeft() * sizeof(RainbowChain);
 #ifdef _MEMORYDEBUG
        printf("Starting allocation of %i bytes\n", size);
 #endif
 #ifdef _MEMORYDEBUG
        printf("Starting allocation of %i bytes\n", size);
 #endif
index c48dd3c5e266310b79303d61f4b1ba86de2809f5..d56eefe84b776a182983874b5b8886f5b0a82796 100644 (file)
@@ -2,7 +2,7 @@
  * freerainbowtables is a project for generating, distributing, and using
  * perfect rainbow tables
  *
  * freerainbowtables is a project for generating, distributing, and using
  * perfect rainbow tables
  *
- * Copyright 2010 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2010, 2011 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
  * Copyright 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
  * Copyright 2010, 2011 James Nobis <frt@quelrod.net>
  *
  * Copyright 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
  * Copyright 2010, 2011 James Nobis <frt@quelrod.net>
  *
index 4b7accdf80a8ca858ab1c4da0ff019439f56efff..e06e94a3ffdb7a30374e47e4a599c3e91fa73e9a 100644 (file)
@@ -2,7 +2,7 @@
  * freerainbowtables is a project for generating, distributing, and using
  * perfect rainbow tables
  *
  * freerainbowtables is a project for generating, distributing, and using
  * perfect rainbow tables
  *
- * Copyright 2010 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2010, 2011 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
  * Copyright 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
  * Copyright 2010, 2011 James Nobis <frt@quelrod.net>
  *
  * Copyright 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
  * Copyright 2010, 2011 James Nobis <frt@quelrod.net>
  *
@@ -37,7 +37,7 @@ using namespace std;
 class BaseRTReader
 {
 public:
 class BaseRTReader
 {
 public:
-       virtual int ReadChains(uint32 &numChains, RainbowChainO *pData) = 0;
+       virtual int ReadChains(uint32 &numChains, RainbowChain *pData) = 0;
        virtual uint32 GetChainsLeft() = 0;
        
        virtual ~BaseRTReader()  { };
        virtual uint32 GetChainsLeft() = 0;
        
        virtual ~BaseRTReader()  { };
index f426b820eea1943a3b63ffe3bad597028ea0e0df..ff7cb292bed0030b45f2c7051ae734c3e778c804 100644 (file)
@@ -67,7 +67,7 @@ string CChainWalkSet::CheckOrRotatePreCalcFile()
                sprintf(sPreCalcFileName, "%s.%d", sPrecalcPathName.c_str(), preCalcPart);
                string sReturnPreCalcPath(sPreCalcFileName);
 
                sprintf(sPreCalcFileName, "%s.%d", sPrecalcPathName.c_str(), preCalcPart);
                string sReturnPreCalcPath(sPreCalcFileName);
 
-               unsigned int fileLen = 0;
+               long fileLen = 0;
 
                FILE* file = fopen(sReturnPreCalcPath.c_str(), "ab");
                if(file!=NULL)
 
                FILE* file = fopen(sReturnPreCalcPath.c_str(), "ab");
                if(file!=NULL)
index 2761cfafc6494a1ac96bf21d65653a912173fcf2..3fe33821ea4fc7c76ba0167ae6580200bd537e47 100644 (file)
@@ -3,7 +3,7 @@
  * perfect rainbow tables
  *
  * Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
  * perfect rainbow tables
  *
  * Copyright (C) Zhu Shuanglei <shuanglei@hotmail.com>
- * Copyright Martin Westergaard Jørgensen <martinwj2005@gmail.com>
+ * Copyright 2009, 2010, 2011 Martin Westergaard Jørgensen <martinwj2005@gmail.com>
  * Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
  * Copyright 2009, 2010, 2011 James Nobis <frt@quelrod.net>
  *
  * Copyright 2009, 2010 Daniël Niggebrugge <niggebrugge@fox-it.com>
  * Copyright 2009, 2010, 2011 James Nobis <frt@quelrod.net>
  *
index 7e17b2a6a49a39572bda55b4a79e374c946aeef0..bde4ed0e10635e1b86b7d5b6f2be2613c10e92fd 100644 (file)
@@ -32,7 +32,7 @@ CMemoryPool::CMemoryPool()
        m_pMem = NULL;
        m_nMemSize = 0;
 
        m_pMem = NULL;
        m_nMemSize = 0;
 
-       unsigned int nAvailPhys = GetAvailPhysMemorySize();
+       unsigned long nAvailPhys = GetAvailPhysMemorySize();
        if (nAvailPhys < 16 * 1024 * 1024)
        {
                nAvailPhys = 512 * 1024 * 1024; // There is atleast 256 mb available (Some Linux distros returns a really low GetAvailPhysMemorySize()
        if (nAvailPhys < 16 * 1024 * 1024)
        {
                nAvailPhys = 512 * 1024 * 1024; // There is atleast 256 mb available (Some Linux distros returns a really low GetAvailPhysMemorySize()
@@ -45,7 +45,8 @@ CMemoryPool::CMemoryPool()
 
 CMemoryPool::~CMemoryPool()
 {
 
 CMemoryPool::~CMemoryPool()
 {
-       if (m_pMem != NULL)     {
+       if (m_pMem != NULL)
+       {
 #ifdef _MEMORYDEBUG
                printf("Freeing %i bytes of memory\n", m_nMemSize);
 #endif 
 #ifdef _MEMORYDEBUG
                printf("Freeing %i bytes of memory\n", m_nMemSize);
 #endif 
@@ -55,22 +56,23 @@ CMemoryPool::~CMemoryPool()
        }
 }
 
        }
 }
 
-unsigned char* CMemoryPool::Allocate(unsigned int nFileLen, unsigned int& nAllocatedSize)
+unsigned char* CMemoryPool::Allocate(unsigned int nFileLen, uint64& nAllocatedSize)
 {
 {
-       if (nFileLen <= m_nMemSize)     {
+       if (nFileLen <= m_nMemSize)
+       {
                nAllocatedSize = nFileLen;
                return m_pMem;
        }
 
        unsigned int nTargetSize;
                nAllocatedSize = nFileLen;
                return m_pMem;
        }
 
        unsigned int nTargetSize;
-       if (nFileLen < m_nMemMax) {
+       if (nFileLen < m_nMemMax)
                nTargetSize = nFileLen;
                nTargetSize = nFileLen;
-       }
-       else {
+       else
                nTargetSize = m_nMemMax;
                nTargetSize = m_nMemMax;
-       }
+
        // Free existing memory
        // Free existing memory
-       if (m_pMem != NULL)     {
+       if (m_pMem != NULL)
+       {
 #ifdef _MEMORYDEBUG
                printf("Freeing %i bytes of memory\n", m_nMemSize);
 #endif 
 #ifdef _MEMORYDEBUG
                printf("Freeing %i bytes of memory\n", m_nMemSize);
 #endif 
@@ -81,21 +83,23 @@ unsigned char* CMemoryPool::Allocate(unsigned int nFileLen, unsigned int& nAlloc
 
        // Allocate new memory
        //printf("allocating %u bytes memory\n", nTargetSize);
 
        // Allocate new memory
        //printf("allocating %u bytes memory\n", nTargetSize);
-       //      m_pMem = new unsigned char[nTargetSize];
 #ifdef _MEMORYDEBUG
                printf("Allocating %i bytes of memory - ", nTargetSize);
 #endif 
 
        m_pMem = new (nothrow) unsigned char[nTargetSize];
 #ifdef _MEMORYDEBUG
                printf("Allocating %i bytes of memory - ", nTargetSize);
 #endif 
 
        m_pMem = new (nothrow) unsigned char[nTargetSize];
-       while (m_pMem == NULL && nTargetSize >= 512 * 1024 * 1024 )     {
+       while (m_pMem == NULL && nTargetSize >= 512 * 1024 * 1024 )
+       {
 #ifdef _MEMORYDEBUG
                printf("failed!\n");
                printf("Allocating %i bytes of memory (backup) - ", nTargetSize);
 #endif 
 #ifdef _MEMORYDEBUG
                printf("failed!\n");
                printf("Allocating %i bytes of memory (backup) - ", nTargetSize);
 #endif 
-          nTargetSize -= 16 * 1024 * 1024;
-          m_pMem = new (nothrow) unsigned char[nTargetSize];
+               nTargetSize -= 16 * 1024 * 1024;
+               m_pMem = new (nothrow) unsigned char[nTargetSize];
        }
        }
-       if (m_pMem != NULL)     {
+
+       if (m_pMem != NULL)
+       {
 #ifdef _MEMORYDEBUG
                printf("success!\n");
 #endif
 #ifdef _MEMORYDEBUG
                printf("success!\n");
 #endif
@@ -103,7 +107,9 @@ unsigned char* CMemoryPool::Allocate(unsigned int nFileLen, unsigned int& nAlloc
                nAllocatedSize = nTargetSize;
                return m_pMem;
        }
                nAllocatedSize = nTargetSize;
                return m_pMem;
        }
-       else {
+       else
+       {
+               m_nMemSize = 0;
                nAllocatedSize = 0;
                return NULL;
        }
                nAllocatedSize = 0;
                return NULL;
        }
index 2ac33d45497e588aab1c058822002dd08e4be08e..c5668e5dfde6f85d208c36ff366daee712b2e517 100644 (file)
@@ -38,12 +38,12 @@ public:
 private:
        bool debug;
        unsigned char* m_pMem;
 private:
        bool debug;
        unsigned char* m_pMem;
-       unsigned int m_nMemSize;
+       uint64 m_nMemSize;
 
 
-       unsigned int m_nMemMax;
+       uint64 m_nMemMax;
 
 public:
 
 public:
-       unsigned char* Allocate(unsigned int nFileLen, unsigned int& nAllocatedSize);
+       unsigned char* Allocate(unsigned int nFileLen, uint64& nAllocatedSize);
 };
 
 #endif
 };
 
 #endif
index a3980ffde97ef9736d0bb6ce7d8e2ee533964372..424e8f22453020303e6a2da6c90786cbd58e3df7 100644 (file)
@@ -254,7 +254,7 @@ bool boinc_ReadLinesFromFile(string sPathName, vector<string>& vLine)
 
        if (file != NULL)
        {
 
        if (file != NULL)
        {
-               unsigned int len = GetFileLen(file);
+               long len = GetFileLen(file);
                char* data = new char[len + 1];
                fread(data, 1, len, file);
                data[len] = '\0';
                char* data = new char[len + 1];
                fread(data, 1, len, file);
                data[len] = '\0';
@@ -294,7 +294,7 @@ bool ReadLinesFromFile(string sPathName, vector<string>& vLine)
        FILE* file = fopen(sPathName.c_str(), "rb");
        if (file != NULL)
        {
        FILE* file = fopen(sPathName.c_str(), "rb");
        if (file != NULL)
        {
-               unsigned int len = GetFileLen(file);
+               long len = GetFileLen(file);
                char* data = new char[len + 1];
                fread(data, 1, len, file);
                data[len] = '\0';
                char* data = new char[len + 1];
                fread(data, 1, len, file);
                data[len] = '\0';
index cd1e85d163f32f313092f2b628a43fb4dbaeda27..57f671c3459dd9b3dd2f4c8116591ea8956d47e4 100644 (file)
@@ -84,7 +84,7 @@ RTI2Reader::~RTI2Reader(void)
 
 }
 
 
 }
 
-unsigned int RTI2Reader::GetChainsLeft()
+uint32 RTI2Reader::GetChainsLeft()
 {
        long len = GetFileLen(m_pFile);
        return len / m_chainsizebytes - m_chainPosition;
 {
        long len = GetFileLen(m_pFile);
        return len / m_chainsizebytes - m_chainPosition;
@@ -104,6 +104,7 @@ int RTI2Reader::ReadChains(unsigned int &numChains, RainbowChain *pData)
        
        while(true) // Fast forward to current position
        {
        
        while(true) // Fast forward to current position
        {
+               /// XXX
                // ALERT: Possible problem here if m_indexrowsizebytes > 1 as pNumChains is a unsigned char.
                unsigned int NumChainsInRow = (unsigned int)*(pNumChains + indexRow * m_indexrowsizebytes);
                if(m_indexrowsizebytes > 1)
                // ALERT: Possible problem here if m_indexrowsizebytes > 1 as pNumChains is a unsigned char.
                unsigned int NumChainsInRow = (unsigned int)*(pNumChains + indexRow * m_indexrowsizebytes);
                if(m_indexrowsizebytes > 1)
index dadde2aaf35c4da039ce321f56c9fc228fe5a194..d56ee8d916dde80d0b17fa897aad56da27341c4e 100644 (file)
@@ -60,7 +60,7 @@ public:
        RTI2Reader(string Filename);
        ~RTI2Reader(void);
        int ReadChains(uint32 &numChains, RainbowChain *pData);
        RTI2Reader(string Filename);
        ~RTI2Reader(void);
        int ReadChains(uint32 &numChains, RainbowChain *pData);
-       unsigned int GetChainsLeft();
+       uint32 GetChainsLeft();
        static RTI2Header *GetHeader() { return m_pHeader; }
 };
 
        static RTI2Header *GetHeader() { return m_pHeader; }
 };
 
index 329f8f7b64bd253be28a4772e0b48f19429c4aac..2215f46af6b27adfca4205276c48722f5f519bac 100644 (file)
@@ -113,13 +113,13 @@ RTIReader::RTIReader(string Filename)
 
 }
 
 
 }
 
-int RTIReader::ReadChains(unsigned int &numChains, RainbowChain *pData)
+int RTIReader::ReadChains(uint32 &numChains, RainbowChain *pData)
 {      
        // We HAVE to reset the data to 0x00's or we will get in trouble
        memset(pData, 0x00, sizeof(RainbowChain) * numChains);
        unsigned int readChains = 0;
        unsigned int chainsleft = GetChainsLeft();
 {      
        // We HAVE to reset the data to 0x00's or we will get in trouble
        memset(pData, 0x00, sizeof(RainbowChain) * numChains);
        unsigned int readChains = 0;
        unsigned int chainsleft = GetChainsLeft();
-       for(UINT4 i = 0; i < m_nIndexSize; i++)
+       for(uint32 i = 0; i < m_nIndexSize; i++)
        {
                if(m_chainPosition + readChains > m_pIndex[i].nFirstChain + m_pIndex[i].nChainCount) // We found the matching index
                        continue;
        {
                if(m_chainPosition + readChains > m_pIndex[i].nFirstChain + m_pIndex[i].nChainCount) // We found the matching index
                        continue;
@@ -143,7 +143,7 @@ int RTIReader::ReadChains(unsigned int &numChains, RainbowChain *pData)
        return 0;
 }
 
        return 0;
 }
 
-UINT4 RTIReader::GetChainsLeft()
+uint32 RTIReader::GetChainsLeft()
 {      
        return (GetFileLen(m_pFile) / 8) - m_chainPosition;
 }
 {      
        return (GetFileLen(m_pFile) / 8) - m_chainPosition;
 }
index becb0003d506c9d89e295b54fc0a0f62711b1218..954eeea0243acbd89415e9958d2322e358cf3d9f 100644 (file)
@@ -43,7 +43,7 @@ public:
        RTIReader(string Filename);
        ~RTIReader(void);
 
        RTIReader(string Filename);
        ~RTIReader(void);
 
-       int ReadChains(unsigned int &numChains, RainbowChain *pData);
+       int ReadChains(uint32 &numChains, RainbowChain *pData);
        unsigned int GetChainsLeft();
 
 };
        unsigned int GetChainsLeft();
 
 };
index fc8166bc14b2579bc27d847f8950fb1f289c7c4f..9c005583b67585869e2f978f151572a211092a9a 100644 (file)
@@ -32,14 +32,14 @@ RTReader::~RTReader(void)
 {
 }
 
 {
 }
 
-int RTReader::ReadChains(unsigned int &numChains, RainbowChain *pData)
+int RTReader::ReadChains(uint32 &numChains, RainbowChain *pData)
 {
        unsigned int numRead = fread(pData, 1, 16 * numChains, m_pFile);
        numChains = numRead / 16;
        m_chainPosition += numChains;
        return 0;
 }
 {
        unsigned int numRead = fread(pData, 1, 16 * numChains, m_pFile);
        numChains = numRead / 16;
        m_chainPosition += numChains;
        return 0;
 }
-UINT4 RTReader::GetChainsLeft()
+uint32 RTReader::GetChainsLeft()
 {
        return (GetFileLen(m_pFile) / 16) - m_chainPosition;
 }
 {
        return (GetFileLen(m_pFile) / 16) - m_chainPosition;
 }
index d2ba7bca51440ebe7feed2ede94472394a428986..bcb5bc3ab8051230ff405ef16e354864aaed18f2 100644 (file)
@@ -41,7 +41,7 @@ private:
 public:
        RTReader(string Filename);
        ~RTReader(void);
 public:
        RTReader(string Filename);
        ~RTReader(void);
-       int ReadChains(unsigned int &numChains, RainbowChain *pData);
+       int ReadChains(uint32 &numChains, RainbowChain *pData);
        unsigned int GetChainsLeft();
 
 };
        unsigned int GetChainsLeft();
 
 };