From 997872f62490962b545e131f5d5958ed4361f223 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sat, 30 May 2009 20:45:51 +0300 Subject: [PATCH] GUI: Fix building with MinGW. Add shlwapi library to qmake project file. Use WCHAR instead of wchar_t. --- gui/gui.pro | 1 + src/filelister.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gui/gui.pro b/gui/gui.pro index a971544b5..e3b40b829 100644 --- a/gui/gui.pro +++ b/gui/gui.pro @@ -11,6 +11,7 @@ OBJECTS_DIR = temp CONFIG += warn_on debug RESOURCES = gui.qrc RC_FILE = cppcheck-gui.rc +win32:LIBS += -lshlwapi # Input HEADERS += mainwindow.h \ diff --git a/src/filelister.cpp b/src/filelister.cpp index 407470b18..6da74fe23 100644 --- a/src/filelister.cpp +++ b/src/filelister.cpp @@ -31,7 +31,6 @@ #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__) #include #include -#pragma comment(lib, "shlwapi.lib") #endif std::string FileLister::simplifyPath(const char *originalPath) @@ -175,9 +174,9 @@ static bool TransformAnsiToUcs2(LPCSTR psAnsi, LPWSTR psUcs, UINT nUcs) static BOOL MyIsDirectory(std::string path) { - wchar_t * unicodeCleanPath = new wchar_t[path.size() + 1]; + WCHAR * unicodeCleanPath = new WCHAR[path.size() + 1]; TransformAnsiToUcs2(path.c_str(), unicodeCleanPath, - (path.size() * sizeof wchar_t) + 1); + (path.size() * sizeof(WCHAR)) + 1); // See http://msdn.microsoft.com/en-us/library/bb773621(VS.85).aspx BOOL res = PathIsDirectory(unicodeCleanPath); delete [] unicodeCleanPath; @@ -186,8 +185,8 @@ static BOOL MyIsDirectory(std::string path) static HANDLE MyFindFirstFile(std::string path, LPWIN32_FIND_DATA findData) { - wchar_t * unicodeOss = new wchar_t[path.size() + 1]; - TransformAnsiToUcs2(path.c_str(), unicodeOss, (path.size() + 1) * sizeof wchar_t); + WCHAR * unicodeOss = new wchar_t[path.size() + 1]; + TransformAnsiToUcs2(path.c_str(), unicodeOss, (path.size() + 1) * sizeof(WCHAR)); HANDLE hFind = FindFirstFile(unicodeOss, findData); delete [] unicodeOss; return hFind;