瀏覽代碼

Merge pull request #431 from wivlaro/mingw-fixes

Mingw fixes
Ivan Safrin 12 年之前
父節點
當前提交
87a5a2acae
共有 3 個文件被更改,包括 9 次插入6 次删除
  1. 4 0
      Core/Contents/Include/PolyGlobals.h
  2. 4 5
      Core/Contents/Source/OSBasics.cpp
  3. 1 1
      Core/Contents/Source/PolyWinCore.cpp

+ 4 - 0
Core/Contents/Include/PolyGlobals.h

@@ -40,10 +40,14 @@ THE SOFTWARE.
 	#pragma warning(disable:4018)
 	#pragma warning(disable:4996)
 	#pragma warning(disable:4309)
+	#ifndef NULL
 	#define NULL 0
+	#endif
 	// Prevent windows.h includes from generating min/max macros that
 	// clash with the templates in <algorithm>
+    #ifndef NOMINMAX
 	#define NOMINMAX
+    #endif
 
 
 #endif

+ 4 - 5
Core/Contents/Source/OSBasics.cpp

@@ -48,6 +48,7 @@ void wtoc(char* Dest, const WCHAR* Source)
 		Dest[i] = (char)Source[i];
 		++i;
 	}
+	Dest[i] = 0;
 }
 void ctow(WCHAR* Dest, const char* Source)
 {
@@ -56,6 +57,7 @@ void ctow(WCHAR* Dest, const char* Source)
 		Dest[i] = (WCHAR)Source[i];
 		++i;
 	}
+	Dest[i] = 0;
 }
 
 #endif
@@ -313,17 +315,14 @@ vector<OSFileEntry> OSBasics::parseFolder(const String& pathString, bool showHid
 	SetCurrentDirectory(tmp);
 
 
-	HANDLE hFind = FindFirstFile((LPCWSTR)"*", &findFileData);
+	HANDLE hFind = FindFirstFile(L"*", &findFileData);
 	if(hFind  == INVALID_HANDLE_VALUE) {
 		SetCurrentDirectory(curDir);
 		return returnVector;
 	}
 
-	char fileName[260];
 	do {		
-		memset(fileName, 0, 260);
-		wtoc(fileName, findFileData.cFileName);
-		String fname = string(fileName);
+		String fname(findFileData.cFileName);
 		
 		if((fname.c_str()[0] != '.' || (fname.c_str()[0] == '.'  && showHidden)) && fname != "..") {
 			if( findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) {

+ 1 - 1
Core/Contents/Source/PolyWinCore.cpp

@@ -168,7 +168,7 @@ void Win32Core::warpCursor(int x, int y) {
 unsigned int Win32Core::getTicks() {
 	LARGE_INTEGER li;
 	QueryPerformanceCounter(&li);
-	return unsigned int(li.QuadPart / pcFreq);
+	return (unsigned int)(li.QuadPart / pcFreq);
 }
 
 void Win32Core::Render() {