From ee3086ff8da50d239425838df3b5b45b0313d83b Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Fri, 10 Oct 2014 17:41:11 -0700 Subject: [PATCH 1/3] compiler fixes for windows --- cocos/base/ZipUtils.h | 3 ++- cocos/platform/win32/CCApplication-win32.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cocos/base/ZipUtils.h b/cocos/base/ZipUtils.h index 3be4dd0d3f..003a5f4e7c 100644 --- a/cocos/base/ZipUtils.h +++ b/cocos/base/ZipUtils.h @@ -37,6 +37,8 @@ THE SOFTWARE. #include "platform/CCStdC.h" #endif +typedef struct unz_file_info_s unz_file_info; + namespace cocos2d { /* XXX: pragma pack ??? */ @@ -215,7 +217,6 @@ namespace cocos2d // forward declaration class ZipFilePrivate; struct unz_file_info_s; - typedef struct unz_file_info_s unz_file_info; /** * Zip file - reader helper class. diff --git a/cocos/platform/win32/CCApplication-win32.cpp b/cocos/platform/win32/CCApplication-win32.cpp index ab3fb7f150..f42301bfa1 100644 --- a/cocos/platform/win32/CCApplication-win32.cpp +++ b/cocos/platform/win32/CCApplication-win32.cpp @@ -213,7 +213,7 @@ bool Application::openURL(const std::string &url) int wchars_num = MultiByteToWideChar(CP_UTF8, 0, url.c_str(), url.size() + 1, temp, url.size() + 1); HINSTANCE r = ShellExecuteW(NULL, L"open", temp, NULL, NULL, SW_SHOWNORMAL); delete[] temp; - return (int)r>32; + return (size_t)r>32; } void Application::setResourceRootPath(const std::string& rootResDir) From 3cd21635587760ea9dd74bfde832739b685c6d03 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Fri, 10 Oct 2014 18:21:15 -0700 Subject: [PATCH 2/3] more win fixes --- cocos/base/ZipUtils.cpp | 9 ++++++--- cocos/base/ZipUtils.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cocos/base/ZipUtils.cpp b/cocos/base/ZipUtils.cpp index 066d27b5b0..1c27143521 100644 --- a/cocos/base/ZipUtils.cpp +++ b/cocos/base/ZipUtils.cpp @@ -22,15 +22,18 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ + +// FIXME: hack, must be included before ziputils +#include "unzip.h" +#include "base/ZipUtils.h" + #include #include #include -#include "base/ZipUtils.h" #include "base/CCData.h" #include "base/ccMacros.h" #include "platform/CCFileUtils.h" -#include "unzip.h" #include NS_CC_BEGIN @@ -645,7 +648,7 @@ std::string ZipFile::getNextFilename() if (unzGoToNextFile(_data->zipFile) != UNZ_OK) return emptyFilename; std::string path; unz_file_info info; - getCurrentFileInfo(&path, &info); + getCurrentFileInfo(&path, (cocos2d::unz_file_info*)&info); return path; } diff --git a/cocos/base/ZipUtils.h b/cocos/base/ZipUtils.h index 003a5f4e7c..9b8a1f092e 100644 --- a/cocos/base/ZipUtils.h +++ b/cocos/base/ZipUtils.h @@ -37,7 +37,9 @@ THE SOFTWARE. #include "platform/CCStdC.h" #endif +#ifndef _unz64_H typedef struct unz_file_info_s unz_file_info; +#endif namespace cocos2d { From e03fb869909903c5c7451269b3daa388e1ef67fa Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Fri, 10 Oct 2014 18:28:05 -0700 Subject: [PATCH 3/3] one more fix, oops --- cocos/base/ZipUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/base/ZipUtils.cpp b/cocos/base/ZipUtils.cpp index 1c27143521..04c7f1a02f 100644 --- a/cocos/base/ZipUtils.cpp +++ b/cocos/base/ZipUtils.cpp @@ -648,7 +648,7 @@ std::string ZipFile::getNextFilename() if (unzGoToNextFile(_data->zipFile) != UNZ_OK) return emptyFilename; std::string path; unz_file_info info; - getCurrentFileInfo(&path, (cocos2d::unz_file_info*)&info); + getCurrentFileInfo(&path, &info); return path; }