X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=Client%20Applications%2Frcracki_mt%2FPublic.cpp;fp=Client%20Applications%2Frcracki_mt%2FPublic.cpp;h=41a95155ec9f47c41bf25630d5bf70aa69148481;hb=371055825f09b5dc2ad00e5702ef4ffe18c419b0;hp=0aba1a8943311706202a6cbef4afde7d8f340e0f;hpb=dd1ecec588c8c5773cf1c4216039c600263d9eaa;p=freerainbowtables diff --git a/Client Applications/rcracki_mt/Public.cpp b/Client Applications/rcracki_mt/Public.cpp index 0aba1a8..41a9515 100644 --- a/Client Applications/rcracki_mt/Public.cpp +++ b/Client Applications/rcracki_mt/Public.cpp @@ -7,7 +7,7 @@ * Copyright 2009, 2010 Daniël Niggebrugge * Copyright 2009, 2010 James Nobis * - * This file is part of racrcki_mt. + * This file is part of rcracki_mt. * * rcracki_mt is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ * along with rcracki_mt. If not, see . */ -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__GNUC__) #pragma warning(disable : 4786 4267 4018) #endif @@ -30,6 +30,10 @@ #ifdef _WIN32 #include +#endif + +#if defined(_WIN32) && !defined(__GNUC__) + #include #include #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) @@ -161,8 +165,8 @@ bool GetHybridCharsets(string sCharset, vector& vCharset) if(sCharset.substr(0, 6) != "hybrid") // Not hybrid charset return false; - UINT4 nEnd = (int) sCharset.rfind(')'); - UINT4 nStart = (int) sCharset.rfind('('); + string::size_type nEnd = sCharset.rfind(')'); + string::size_type nStart = (int) sCharset.rfind('('); string sChar = sCharset.substr(nStart + 1, nEnd - nStart - 1); vector vParts; SeperateString(sChar, ",", vParts); @@ -202,8 +206,8 @@ bool ReadLinesFromFile(string sPathName, vector& vLine) content[i] = '\n'; } - int n; - while ((n = content.find("\n", 0)) != -1) + string::size_type n; + while ((n = content.find("\n", 0)) != string::npos) { string line = content.substr(0, n); line = TrimString(line); @@ -241,8 +245,8 @@ bool SeperateString(string s, string sSeperator, vector& vPart) unsigned int i; for (i = 0; i < sSeperator.size(); i++) { - int n = s.find(sSeperator[i]); - if (n != -1) + string::size_type n; + if ( (n = s.find(sSeperator[i])) != string::npos) { vPart.push_back(s.substr(0, n)); s = s.substr(n + 1); @@ -301,7 +305,7 @@ string HexToStr(const unsigned char* pData, int nLen) uint64 GetAvailPhysMemorySize() { -#ifdef _WIN32 +#if defined(_WIN32) MEMORYSTATUS ms; GlobalMemoryStatus(&ms); return ms.dwAvailPhys; @@ -331,6 +335,7 @@ string GetApplicationPath() GetModuleFileName(NULL, fullPath, FILENAME_MAX); #else char szTmp[32]; + // XXX linux/proc file system dependen sprintf(szTmp, "/proc/%d/exe", getpid()); int bytes = readlink(szTmp, fullPath, FILENAME_MAX); if(bytes >= 0) @@ -339,12 +344,12 @@ string GetApplicationPath() string sApplicationPath = fullPath; #ifdef _WIN32 - int nIndex = sApplicationPath.find_last_of('\\'); + string::size_type nIndex = sApplicationPath.find_last_of('\\'); #else - int nIndex = sApplicationPath.find_last_of('/'); + string::size_type nIndex = sApplicationPath.find_last_of('/'); #endif - if (nIndex != -1) + if ( nIndex != string::npos ) sApplicationPath = sApplicationPath.substr(0, nIndex+1); //printf ("\n\nDebug: The application directory is %s\n", sApplicationPath.c_str());