From 799fb0994fe4802024c588492e8873493083d505 Mon Sep 17 00:00:00 2001 From: walzer Date: Thu, 24 Mar 2011 18:17:35 +0800 Subject: [PATCH] issue #427, airplay port ok --- cocos2dx/include/ccMacros.h | 18 ++++----- cocos2dx/platform/CCSAXParser.h | 2 +- .../platform/airplay/CCFileUtils_airplay.cpp | 2 +- .../platform/airplay/CCSAXParser_airplay.cpp | 9 +++-- .../platform/airplay/CCSAXParser_airplay.h | 38 ------------------- 5 files changed, 16 insertions(+), 53 deletions(-) delete mode 100644 cocos2dx/platform/airplay/CCSAXParser_airplay.h diff --git a/cocos2dx/include/ccMacros.h b/cocos2dx/include/ccMacros.h index cb2b78c128..36d840f6bf 100644 --- a/cocos2dx/include/ccMacros.h +++ b/cocos2dx/include/ccMacros.h @@ -204,15 +204,15 @@ do { \ //---- todo: replace with wophone window - -// #define CC_DIRECTOR_END() \ -// do { \ -// CCDirector *__director = [CCDirector sharedDirector]; \ -// CC_GLVIEW *__view = [__director openGLView]; \ -// [__view removeFromSuperview]; \ -// [__director end]; \ -// } while(0) - +/* +#define CC_DIRECTOR_END() \ +do { \ + CCDirector *__director = [CCDirector sharedDirector]; \ + CC_GLVIEW *__view = [__director openGLView]; \ + [__view removeFromSuperview]; \ + [__director end]; \ +} while(0) +*/ #ifndef FLT_EPSILON #define FLT_EPSILON 1.192092896e-07F diff --git a/cocos2dx/platform/CCSAXParser.h b/cocos2dx/platform/CCSAXParser.h index 3532eec042..e3c5e865d9 100644 --- a/cocos2dx/platform/CCSAXParser.h +++ b/cocos2dx/platform/CCSAXParser.h @@ -13,7 +13,7 @@ NS_CC_BEGIN; (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) typedef unsigned char CC_XML_CHAR; #elif (CC_TARGET_PLATFORM == CC_PLATFORM_AIRPLAY) -typedef char CC_XML_CHAR +typedef char CC_XML_CHAR; #else #error #endif diff --git a/cocos2dx/platform/airplay/CCFileUtils_airplay.cpp b/cocos2dx/platform/airplay/CCFileUtils_airplay.cpp index e075b58d4f..c6c40691ac 100644 --- a/cocos2dx/platform/airplay/CCFileUtils_airplay.cpp +++ b/cocos2dx/platform/airplay/CCFileUtils_airplay.cpp @@ -6,7 +6,7 @@ #include "support/file_support/FileData.h" #include "support/zip_support/unzip.h" -#include "CCSAXParser_airplay.h" +#include "../CCSAXParser.h" #include "CCApplication.h" #include "CCMutableArray.h" diff --git a/cocos2dx/platform/airplay/CCSAXParser_airplay.cpp b/cocos2dx/platform/airplay/CCSAXParser_airplay.cpp index 6fd12a7c56..e3f152bebc 100644 --- a/cocos2dx/platform/airplay/CCSAXParser_airplay.cpp +++ b/cocos2dx/platform/airplay/CCSAXParser_airplay.cpp @@ -33,10 +33,11 @@ bool CCSAXParser::parse(const char *pszFile) { bool bRet = false; char* buf = NULL; + s3eFile* file = NULL; do { - s3eFile* file = s3eFileOpen(pszFile, "r"); + file = s3eFileOpen(pszFile, "r"); if (!file) { @@ -75,16 +76,16 @@ bool CCSAXParser::parse(const char *pszFile) } void CCSAXParser::startElement(void *ctx, const char *name, const char **atts) { - ((CCSAXParser*)(ctx))->m_pDelegator->startElement(ctx, (XML_Char)name, atts); + ((CCSAXParser*)(ctx))->m_pDelegator->startElement(ctx, (const char*)name, (const char**)atts); } void CCSAXParser::endElement(void *ctx, const char *name) { - ((CCSAXParser*)(ctx))->m_pDelegator->endElement(ctx, (XML_Char)name); + ((CCSAXParser*)(ctx))->m_pDelegator->endElement(ctx, (const char*)name); } void CCSAXParser::textHandler(void *ctx, const char *name, int len) { - ((CCSAXParser*)(ctx))->m_pDelegator->textHandler(ctx, (XML_Char)name, len); + ((CCSAXParser*)(ctx))->m_pDelegator->textHandler(ctx, (const char*)name, len); } void CCSAXParser::setDelegator(CCSAXDelegator* pDelegator) { diff --git a/cocos2dx/platform/airplay/CCSAXParser_airplay.h b/cocos2dx/platform/airplay/CCSAXParser_airplay.h deleted file mode 100644 index 966c52566f..0000000000 --- a/cocos2dx/platform/airplay/CCSAXParser_airplay.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __CCSAXPARSER_AIRPLAY_H__ -#define __CCSAXPARSER_AIRPLAY_H__ - -#if (CC_TARGET_PLATFORM == CC_PLATFORM_AIRPLAY) //for ios proj - -#include "expat.h" -#include "CCMutableDictionary.h" - -NS_CC_BEGIN; - -class CCSAXDelegator -{ -public: - virtual void startElement(void *ctx, const XML_Char *name, const XML_Char **atts) = 0; - virtual void endElement(void *ctx,const XML_Char *name) = 0; - virtual void textHandler(void *ctx,const XML_Char *s, int len) = 0; -}; - -class CCSAXParser -{ - XML_Parser m_parser; - CCSAXDelegator* m_pDelegator; -public: - - CCSAXParser(); - ~CCSAXParser(void); - - void init(const char *pszEncoding); - void parse(const char *pszFile); - void setDelegator(CCSAXDelegator* pDelegator); - - static void startElement(void *ctx, const XML_Char *name, const XML_Char **atts); - static void endElement(void *ctx, const XML_Char *name); - static void textHandler(void *ctx, const XML_Char *name, int len); -}; -NS_CC_END; -#endif //CC_TARGET_PLATFORM == CC_PLATFORM_AIRPLAY -#endif //__CCSAXPARSER_AIRPLAY_H__ \ No newline at end of file