From: Hamatoma Date: Sun, 21 Jun 2015 07:51:47 +0000 (+0200) Subject: windows compatibility X-Git-Url: https://gitweb.hamatoma.de/?a=commitdiff_plain;h=29857c4d870dbdcef27a7d0352711a15e26daed9;p=reqt windows compatibility --- diff --git a/base/ReFile.cpp b/base/ReFile.cpp index 11fcd81..8b5e26d 100644 --- a/base/ReFile.cpp +++ b/base/ReFile.cpp @@ -191,7 +191,7 @@ void ReFile::close(){ clear(); m_file.close(); } -#ifdef __linux__ +#if defined __linux__ || defined WIN32 void* memichr(void* heap, int cc, size_t length){ const char* heap2 = reinterpret_cast(heap); int cc2 = tolower(cc); @@ -247,7 +247,7 @@ bool ReFile::findLine(const char* toFind, bool ignoreCase, int& lineNo, memchr(start, first, restLength) : memichr(start, first, restLength))) != NULL){ if ((ignoreCase ? - memicmp(ptr, toFind, sourceLength) : + _memicmp(ptr, toFind, sourceLength) : memcmp(ptr, toFind, sourceLength)) == 0){ rc = true; lineNo = m_currentLineNo; @@ -528,13 +528,13 @@ QByteArray ReFile::tempDir(const char* node, const char* parent, if (parent != NULL){ temp += parent; if (stat(temp.constData(), &info) != 0) - mkdir(temp.constData(), (-1)); + _mkdir(temp.constData()); temp += '/'; } if (node != NULL){ temp += node; if (stat(temp.data(), &info) != 0) - mkdir(temp.data(), -1); + _mkdir(temp.data()); temp += '/'; } if (!withSeparator) diff --git a/base/rebase.hpp b/base/rebase.hpp index 483b4bc..e1fc639 100644 --- a/base/rebase.hpp +++ b/base/rebase.hpp @@ -23,6 +23,8 @@ #ifdef __linux__ #include #else +#include +#include #endif #include #include @@ -51,6 +53,8 @@ typedef QString ReString; #define _strcasecmp strcasecmp #define OS_SEPARATOR '/' #define OS_SEPARATOR_STR "/" +#define _mkdir(path) mkdir(path, -1) +#define _memicmp memicmp #else #define _strcasecmp _stricmp #define OS_SEPARATOR '\\'