issue #72,debug link error

This commit is contained in:
Walzer 2010-08-27 10:14:17 +00:00
parent 408a34603b
commit aad6392555
2 changed files with 18 additions and 18 deletions

View File

@ -34,9 +34,9 @@ THE SOFTWARE.
namespace cocos2d { namespace cocos2d {
void startElement(void *ctx, const xmlChar *name, const xmlChar **atts); void plist_startElement(void *ctx, const xmlChar *name, const xmlChar **atts);
void endElement(void *ctx, const xmlChar *name); void plist_endElement(void *ctx, const xmlChar *name);
void characters(void *ctx, const xmlChar *ch, int len); void plist_characters(void *ctx, const xmlChar *ch, int len);
typedef std::pair<std::string, void*> Pair; typedef std::pair<std::string, void*> Pair;
typedef enum typedef enum
@ -90,9 +90,9 @@ public:
memset( &saxHandler, 0, sizeof(saxHandler) ); memset( &saxHandler, 0, sizeof(saxHandler) );
// Using xmlSAXVersion( &saxHandler, 2 ) generate crash as it sets plenty of other pointers... // Using xmlSAXVersion( &saxHandler, 2 ) generate crash as it sets plenty of other pointers...
saxHandler.initialized = XML_SAX2_MAGIC; // so we do this to force parsing as SAX2. saxHandler.initialized = XML_SAX2_MAGIC; // so we do this to force parsing as SAX2.
saxHandler.startElement = &startElement; saxHandler.startElement = &plist_startElement;
saxHandler.endElement = &endElement; saxHandler.endElement = &plist_endElement;
saxHandler.characters = &characters; saxHandler.characters = &plist_characters;
int result = xmlSAXUserParseMemory( &saxHandler, this, buffer, size ); int result = xmlSAXUserParseMemory( &saxHandler, this, buffer, size );
if ( result != 0 ) if ( result != 0 )
@ -111,7 +111,7 @@ public:
return m_pRootDict; return m_pRootDict;
} }
}; };
void startElement(void *ctx, const xmlChar *name, const xmlChar **atts) void plist_startElement(void *ctx, const xmlChar *name, const xmlChar **atts)
{ {
CCDictMaker *pMaker = static_cast<CCDictMaker*>(ctx); CCDictMaker *pMaker = static_cast<CCDictMaker*>(ctx);
std::string sName((char*)name); std::string sName((char*)name);
@ -153,7 +153,7 @@ void startElement(void *ctx, const xmlChar *name, const xmlChar **atts)
pMaker->m_tState = SAX_NONE; pMaker->m_tState = SAX_NONE;
} }
} }
void endElement(void *ctx, const xmlChar *name) void plist_endElement(void *ctx, const xmlChar *name)
{ {
CCDictMaker * pMaker = static_cast<CCDictMaker*>(ctx); CCDictMaker * pMaker = static_cast<CCDictMaker*>(ctx);
std::string sName((char*)name); std::string sName((char*)name);
@ -167,7 +167,7 @@ void endElement(void *ctx, const xmlChar *name)
} }
pMaker->m_tState = SAX_NONE; pMaker->m_tState = SAX_NONE;
} }
void characters(void *ctx, const xmlChar *ch, int len) void plist_characters(void *ctx, const xmlChar *ch, int len)
{ {
CCDictMaker * pMaker = static_cast<CCDictMaker*>(ctx); CCDictMaker * pMaker = static_cast<CCDictMaker*>(ctx);
if (pMaker->m_tState == SAX_NONE) if (pMaker->m_tState == SAX_NONE)

View File

@ -33,9 +33,9 @@ THE SOFTWARE.
namespace cocos2d { namespace cocos2d {
void startElement(void *ctx, const xmlChar *name, const xmlChar **atts); void tmx_startElement(void *ctx, const xmlChar *name, const xmlChar **atts);
void endElement(void *ctx, const xmlChar *name); void tmx_endElement(void *ctx, const xmlChar *name);
void characters(void *ctx, const xmlChar *ch, int len); void tmx_characters(void *ctx, const xmlChar *ch, int len);
const char * valueForKey(std::string key, StringToStringDictionary dict); const char * valueForKey(std::string key, StringToStringDictionary dict);
// implementation CCTMXLayerInfo // implementation CCTMXLayerInfo
@ -141,9 +141,9 @@ namespace cocos2d {
memset( &saxHandler, 0, sizeof(saxHandler) ); memset( &saxHandler, 0, sizeof(saxHandler) );
// Using xmlSAXVersion( &saxHandler, 2 ) generate crash as it sets plenty of other pointers... // Using xmlSAXVersion( &saxHandler, 2 ) generate crash as it sets plenty of other pointers...
saxHandler.initialized = XML_SAX2_MAGIC; // so we do this to force parsing as SAX2. saxHandler.initialized = XML_SAX2_MAGIC; // so we do this to force parsing as SAX2.
saxHandler.startElement = &startElement; saxHandler.startElement = &tmx_startElement;
saxHandler.endElement = &endElement; saxHandler.endElement = &tmx_endElement;
saxHandler.characters = &characters; saxHandler.characters = &tmx_characters;
int result = xmlSAXUserParseMemory( &saxHandler, this, buffer, size ); int result = xmlSAXUserParseMemory( &saxHandler, this, buffer, size );
if ( result != 0 ) if ( result != 0 )
@ -182,7 +182,7 @@ namespace cocos2d {
} }
// the XML parser calls here with all the elements // the XML parser calls here with all the elements
void startElement(void *ctx, const xmlChar *name, const xmlChar **atts) void tmx_startElement(void *ctx, const xmlChar *name, const xmlChar **atts)
{ {
CCTMXMapInfo *pTMXMapInfo = (CCTMXMapInfo*)(ctx); CCTMXMapInfo *pTMXMapInfo = (CCTMXMapInfo*)(ctx);
std::string elementName = (char*)name; std::string elementName = (char*)name;
@ -424,7 +424,7 @@ namespace cocos2d {
} }
} }
void endElement(void *ctx, const xmlChar *name) void tmx_endElement(void *ctx, const xmlChar *name)
{ {
CCTMXMapInfo *pTMXMapInfo = (CCTMXMapInfo*)(ctx); CCTMXMapInfo *pTMXMapInfo = (CCTMXMapInfo*)(ctx);
std::string elementName = (char*)name; std::string elementName = (char*)name;
@ -489,7 +489,7 @@ namespace cocos2d {
pTMXMapInfo->setParentElement(TMXPropertyNone); pTMXMapInfo->setParentElement(TMXPropertyNone);
} }
} }
void characters(void *ctx, const xmlChar *ch, int len) void tmx_characters(void *ctx, const xmlChar *ch, int len)
{ {
CCTMXMapInfo *pTMXMapInfo = (CCTMXMapInfo*)(ctx); CCTMXMapInfo *pTMXMapInfo = (CCTMXMapInfo*)(ctx);
std::string pText((char*)ch,0,len); std::string pText((char*)ch,0,len);