]> git.sesse.net Git - freerainbowtables/blobdiff - BOINC software/BOINC client apps/distrrtgen/distrrtgen.cpp
cleanup signed/unsigned warnings
[freerainbowtables] / BOINC software / BOINC client apps / distrrtgen / distrrtgen.cpp
index 527151206f67e6bc8e786ad0b4cf941843d4a116..5ecd8cf49c1340a93c071193fbc0a297260ee724 100644 (file)
@@ -58,9 +58,6 @@
 #include "Public.h"
 // Rainbowcrack code
 #include "ChainWalkContext.h"
-typedef unsigned int uint32;
-//typedef unsigned __int64 uint64;
-
 
 using std::string;
 
@@ -72,7 +69,7 @@ double cpu_time = 20, comp_result;
 */
 int QuickSortPartition(RainbowChainCP* pChain, int nLow, int nHigh)
 {
-       int nRandomIndex = nLow + ((unsigned int)rand() * (RAND_MAX + 1) + (unsigned int)rand()) % (nHigh - nLow + 1);
+       int nRandomIndex = nLow + ((uint32)rand() * ((uint32)RAND_MAX + 1) + (uint32)rand()) % (nHigh - nLow + 1);
        RainbowChainCP TempChain;
        TempChain = pChain[nLow];
        pChain[nLow] = pChain[nRandomIndex];
@@ -147,7 +144,7 @@ int main(int argc, char **argv) {
        nChainStart = atoll(argv[8]);
 #endif
        sCheckPoints = argv[9];
-       vector<int> vCPPositions;
+       vector<uint32> vCPPositions;
        char *cp = strtok((char *)sCheckPoints.c_str(), ",");
        while(cp != NULL)
        {
@@ -227,7 +224,7 @@ int main(int argc, char **argv) {
        
        // Round to boundary
        nDataLen = nDataLen / 18 * 18;
-       if ((int)nDataLen == nRainbowChainCount * 18)
+       if (nDataLen == nRainbowChainCount * 18)
        {               
                std::cerr << "precomputation of this rainbow table already finished" << std::endl;
                fclose(outfile);
@@ -240,16 +237,16 @@ int main(int argc, char **argv) {
        uint64 nIndex[2];
        time_t tStart = time(NULL);
 //     std::cout << "Starting to generate chains" << std::endl;
-       for(int nCurrentCalculatedChains = nDataLen / 18; nCurrentCalculatedChains < nRainbowChainCount; nCurrentCalculatedChains++)
+       for(uint32 nCurrentCalculatedChains = nDataLen / 18; nCurrentCalculatedChains < nRainbowChainCount; nCurrentCalculatedChains++)
        {               
-               int cpcheck = 0;
+               uint32 cpcheck = 0;
                unsigned short checkpoint = 0;
                fd = (double)nCurrentCalculatedChains / (double)nRainbowChainCount;
                boinc_fraction_done(fd);
                cwc.SetIndex(nChainStart++); // use a given index now!
                nIndex[0] = cwc.GetIndex();
                
-               for (int nPos = 0; nPos < nRainbowChainLen - 1; nPos++)
+               for (uint32 nPos = 0; nPos < nRainbowChainLen - 1; nPos++)
                {
                //      std::cout << "IndexToPlain()" << std::endl;
                        cwc.IndexToPlain();
@@ -293,7 +290,7 @@ int main(int argc, char **argv) {
        {
                // Load file
                fseek(outfile, 0, SEEK_SET);
-               for(int i = 0; i < nRainbowChainCount; i++)
+               for(uint32 i = 0; i < nRainbowChainCount; i++)
                {
                        if(fread(&pChain[i], 1, 16, outfile) != 16)
                        {
@@ -312,7 +309,7 @@ int main(int argc, char **argv) {
 
                // Write file
                fseek(outfile, 0, SEEK_SET);
-               for(int i = 0; i < nRainbowChainCount; i++)
+               for(uint32 i = 0; i < nRainbowChainCount; i++)
                {
                        fwrite(&pChain[i], 1, 16, outfile);
                        fwrite(&pChain[i].nCheckPoint, 2, 1, outfile);