* Copyright 2009, 2010 Daniƫl Niggebrugge <niggebrugge@fox-it.com>\r
* Copyright 2009, 2010 James Nobis <frt@quelrod.net>\r
*\r
- * This file is part of racrcki_mt.\r
+ * This file is part of rcracki_mt.\r
*\r
* rcracki_mt is free software: you can redistribute it and/or modify\r
* it under the terms of the GNU General Public License as published by\r
* along with rcracki_mt. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
\r
-#ifdef _WIN32\r
+#if defined(_WIN32) && !defined(__GNUC__)\r
#pragma warning(disable : 4786 4267 4018)\r
#endif\r
\r
\r
#ifdef _WIN32\r
#include <windows.h>\r
+#endif\r
+\r
+#if defined(_WIN32) && !defined(__GNUC__)\r
+ #include <windows.h>\r
#include <time.h>\r
\r
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)\r
if(sCharset.substr(0, 6) != "hybrid") // Not hybrid charset\r
return false;\r
\r
- UINT4 nEnd = (int) sCharset.rfind(')');\r
- UINT4 nStart = (int) sCharset.rfind('(');\r
+ string::size_type nEnd = sCharset.rfind(')');\r
+ string::size_type nStart = (int) sCharset.rfind('(');\r
string sChar = sCharset.substr(nStart + 1, nEnd - nStart - 1);\r
vector<string> vParts;\r
SeperateString(sChar, ",", vParts);\r
content[i] = '\n';\r
}\r
\r
- int n;\r
- while ((n = content.find("\n", 0)) != -1)\r
+ string::size_type n;\r
+ while ((n = content.find("\n", 0)) != string::npos)\r
{\r
string line = content.substr(0, n);\r
line = TrimString(line);\r
unsigned int i;\r
for (i = 0; i < sSeperator.size(); i++)\r
{\r
- int n = s.find(sSeperator[i]);\r
- if (n != -1)\r
+ string::size_type n;\r
+ if ( (n = s.find(sSeperator[i])) != string::npos)\r
{\r
vPart.push_back(s.substr(0, n));\r
s = s.substr(n + 1);\r
\r
uint64 GetAvailPhysMemorySize()\r
{\r
-#ifdef _WIN32\r
+#if defined(_WIN32)\r
MEMORYSTATUS ms;\r
GlobalMemoryStatus(&ms);\r
return ms.dwAvailPhys;\r
GetModuleFileName(NULL, fullPath, FILENAME_MAX);\r
#else\r
char szTmp[32];\r
+ // XXX linux/proc file system dependen\r
sprintf(szTmp, "/proc/%d/exe", getpid());\r
int bytes = readlink(szTmp, fullPath, FILENAME_MAX);\r
if(bytes >= 0)\r
\r
string sApplicationPath = fullPath;\r
#ifdef _WIN32\r
- int nIndex = sApplicationPath.find_last_of('\\');\r
+ string::size_type nIndex = sApplicationPath.find_last_of('\\');\r
#else\r
- int nIndex = sApplicationPath.find_last_of('/');\r
+ string::size_type nIndex = sApplicationPath.find_last_of('/');\r
#endif\r
\r
- if (nIndex != -1)\r
+ if ( nIndex != string::npos )\r
sApplicationPath = sApplicationPath.substr(0, nIndex+1);\r
\r
//printf ("\n\nDebug: The application directory is %s\n", sApplicationPath.c_str());\r