From 6e9b9a5c1f65e66d3198979deb694447793bae19 Mon Sep 17 00:00:00 2001 From: Martin Westergaard Jorgensen Date: Wed, 12 Aug 2009 11:41:51 +0200 Subject: [PATCH] Fixed RTI2 format --- Client Applications/converti2/converti2.cpp | 10 +++- Client Applications/converti2/converti2.suo | Bin 20480 -> 20992 bytes .../converti2/converti2.vcproj | 12 ++-- Client Applications/rti2rto/rti2rto.suo | Bin 12288 -> 13824 bytes Client Applications/rti2rto/rti2rto.vcproj | 28 ++++----- Common/rt api/Public.cpp | 54 ++++++++++++++++-- Common/rt api/Public.h | 1 + Common/rt api/RTIReader.cpp | 11 +++- 8 files changed, 89 insertions(+), 27 deletions(-) diff --git a/Client Applications/converti2/converti2.cpp b/Client Applications/converti2/converti2.cpp index dec2b64..a73fd95 100644 --- a/Client Applications/converti2/converti2.cpp +++ b/Client Applications/converti2/converti2.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include "Public.h" #include "MemoryPool.h" using namespace std; @@ -461,6 +462,13 @@ void ConvertRainbowTable(string sPathName, string sResultFileName, unsigned int //printf("Diffsize is %u\n", diffSize); // then write the distance amount of 00's + if(diffSize > 1000) { + printf("WARNING! The distance to the next prefix is %i. Do you want to continue writing %i bytes of 0x00? Press y to continue", diffSize, diffSize); + if(getch() != 'y') { + printf("Aborting..."); + exit(1); + } + } for(int j = 1; j < diffSize; j++) { fwrite(&zero, 1, m_indexrowsizebytes, pFileIndex); @@ -612,7 +620,7 @@ int main(int argc, char* argv[]) sResultFile = vPathName[i].substr(n+1, vPathName[i].length()) + "i2"; else sResultFile = vPathName[i] + "i2"; // Resulting file is .rt, not .rti - printf("Using %i of 64 bits\n", (sptl + eptl + usecp)); + printf("Using %i of 64 bits. sptl: %i, eptl: %i, cp: %i. Chains will be %i bytes in size\n", (sptl + eptl + usecp), sptl, eptl, usecp, ((sptl + eptl + usecp) / 8)); if(sptl + eptl + usecp > 64) { exit(1); diff --git a/Client Applications/converti2/converti2.suo b/Client Applications/converti2/converti2.su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C|hI55Jd}o1$#@+0VhH+Krw^ zz7Jz7zo(rzQywPCR`P{~aJz92^A&m}Q20L{1TFrleT#9cCu0lqM@Y2Dh1C%)T zDIU^Vhy_V=5$d4jm323BQ-qr$C3J@hY{<23FuHpwQ~Z8pws zFk=9!-eW$+y7lIremqX;dVS(bQ)0pUrgI?}=t}CXN-{i4FA<{2^^!Q9N%|+til+Ptj c$CUCz%=Pu-ORgOg{c$i#lJ+50U@HF3Uq8zi3jhEB diff --git a/Client Applications/converti2/converti2.vcproj b/Client Applications/converti2/converti2.vcproj index dbbdaf0..0103995 100644 --- a/Client Applications/converti2/converti2.vcproj +++ b/Client Applications/converti2/converti2.vcproj @@ -41,7 +41,7 @@ @@ -191,11 +191,11 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > diff --git a/Client Applications/rti2rto/rti2rto.suo b/Client Applications/rti2rto/rti2rto.suo index 3fdc2e636becf77ecc90c7a86e3ea6c3ca3d1ffc..023dd88423dd5610734f0721985fa9b1175e088d 100644 GIT binary patch delta 551 zcmZ9IODIHP6vxkJ?!7L|{gKQKv<&_%aHJ%%HEv1|tcCxWD z?vg~w!baBi_B3nb|IOTmeD&*`^FRM{`o7PO+3}l+Jfn(;DnKQu20xih<|j3IE>4xW zudAcrsM&lK9yB8L&Ve#6^cv*wWH=UXb<*myXjy}@?v8FEZn^n3;ttpadz{J--s)Dd zCTdXzcrM(|Nh7LdcbCc1NgGi`qY|`@T)XCtE&rfno0f;IK(~{wpZ1FCT(2!EC2a}r zPr(Oflj!AlCCHINMU`*zNt>ELcES5*Q1rRo9`6RUGl0XX(3A7n@t7x$`MqeB?~DA# z9`2u{ONKSIBnAcEz&GrxQIGQYnUPWzKWbkclgi71RT2* zf@?kdPcL_&58|)pvYA3m2+#-&H}7<#57GNi8%Es=uyAbt!g_>pVu;5k4rg9A1|guV;N*)2+LKE}{n;2m8ihgJ&0j?QS=bo) zfqYSjwA6V{MoDzDN~HanCm&`p-26o@gqx8MqEgErB*c~mRQ!x_av+D- @@ -207,27 +207,27 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > diff --git a/Common/rt api/Public.cpp b/Common/rt api/Public.cpp index 60d7072..f917d37 100644 --- a/Common/rt api/Public.cpp +++ b/Common/rt api/Public.cpp @@ -9,7 +9,9 @@ #endif #ifdef _WIN32 -#include "boinc_win.h" + #ifdef BOINC + #include "boinc_win.h" + #endif #else #include "config.h" #include @@ -21,9 +23,10 @@ #include #endif -#include "filesys.h" -#include "boinc_api.h" - +#ifdef BOINC + #include "filesys.h" + #include "boinc_api.h" +#endif #include "Public.h" #ifdef _WIN32 @@ -88,7 +91,8 @@ bool GetHybridCharsets(string sCharset, vector& vCharset) } return true; } -bool ReadLinesFromFile(string sPathName, vector& vLine) +#ifdef BOINC +bool boinc_ReadLinesFromFile(string sPathName, vector& vLine) { vLine.clear(); char input_path[512]; @@ -134,6 +138,46 @@ bool ReadLinesFromFile(string sPathName, vector& vLine) return true; } +#endif +bool ReadLinesFromFile(string sPathName, vector& vLine) +{ + vLine.clear(); + FILE *file = fopen(sPathName.c_str(), "rb"); + if (file != NULL) + { + unsigned int len = GetFileLen(file); + char* data = new char[len + 1]; + fread(data, 1, len, file); + data[len] = '\0'; + string content = data; + content += "\n"; + delete data; + + unsigned int i; + for (i = 0; i < content.size(); i++) + { + if (content[i] == '\r') + content[i] = '\n'; + } + + int n; + while ((n = content.find("\n", 0)) != -1) + { + string line = content.substr(0, n); + line = TrimString(line); + if (line != "") + vLine.push_back(line); + content = content.substr(n + 1); + } + + fclose(file); + } + else + return false; + + return true; +} + bool SeperateString(string s, string sSeperator, vector& vPart) { diff --git a/Common/rt api/Public.h b/Common/rt api/Public.h index a2f5657..3a315ae 100644 --- a/Common/rt api/Public.h +++ b/Common/rt api/Public.h @@ -70,6 +70,7 @@ typedef struct unsigned int GetFileLen(FILE* file); string TrimString(string s); +bool boinc_ReadLinesFromFile(string sPathName, vector& vLine); bool ReadLinesFromFile(string sPathName, vector& vLine); bool SeperateString(string s, string sSeperator, vector& vPart); string uint64tostr(uint64 n); diff --git a/Common/rt api/RTIReader.cpp b/Common/rt api/RTIReader.cpp index d96edc3..b72dbe2 100644 --- a/Common/rt api/RTIReader.cpp +++ b/Common/rt api/RTIReader.cpp @@ -4,7 +4,16 @@ RTIReader::RTIReader(string Filename) { m_pIndex = NULL; m_pFile = fopen(Filename.c_str(), "rb"); - FILE *pFileIndex = fopen(Filename.append(".index").c_str(), "rb"); + if(m_pFile == NULL) { + printf("could not open file %s\n", Filename.c_str()); + return; + } + string sIndex = Filename.append(".index").c_str(); + FILE *pFileIndex = fopen(sIndex.c_str(), "rb"); + if(pFileIndex == NULL) { + printf("could not open index file %s\n", sIndex.c_str()); + return; + } m_chainPosition = 0; // Load the index file -- 2.39.2