diff --git a/cocos2dx/cocoa/CCDictionary.cpp b/cocos2dx/cocoa/CCDictionary.cpp index 2265d85540..64a0c11fd6 100644 --- a/cocos2dx/cocoa/CCDictionary.cpp +++ b/cocos2dx/cocoa/CCDictionary.cpp @@ -91,8 +91,11 @@ CCArray* CCDictionary::allKeysForObject(CCObject* object) CCObject* CCDictionary::objectForKey(const std::string& key) { - if (m_eDictType == kCCDictUnknown && m_eDictType == kCCDictUnknown) return NULL; - CCAssert(m_eDictType == kCCDictStr, "this dictionary does not use string as key."); + if (m_eDictType != kCCDictStr) + { + CCAssert(m_eDictType == kCCDictStr, "this dictionary does not use string as key."); + return NULL; + } CCObject* pRetObject = NULL; CCDictElement *pElement = NULL; @@ -106,8 +109,11 @@ CCObject* CCDictionary::objectForKey(const std::string& key) CCObject* CCDictionary::objectForKey(int key) { - if (m_eDictType == kCCDictUnknown && m_eDictType == kCCDictUnknown) return NULL; - CCAssert(m_eDictType == kCCDictInt, "this dictionary does not use integer as key."); + if (m_eDictType != kCCDictInt) + { + CCAssert(m_eDictType == kCCDictInt, "this dictionary does not use integer as key."); + return NULL; + } CCObject* pRetObject = NULL; CCDictElement *pElement = NULL; diff --git a/cocos2dx/platform/win32/CCImage.cpp b/cocos2dx/platform/win32/CCImage.cpp index 27d0b69468..c339963aa0 100644 --- a/cocos2dx/platform/win32/CCImage.cpp +++ b/cocos2dx/platform/win32/CCImage.cpp @@ -126,8 +126,8 @@ public: } GetObjectA(m_hFont, sizeof(tOldFont), &tOldFont); - if (tOldFont.lfHeight == tNewFont.lfHeight - && ! strcpy(tOldFont.lfFaceName, tNewFont.lfFaceName)) + if (tOldFont.lfHeight == tNewFont.lfHeight && + !strcmp(tOldFont.lfFaceName, tNewFont.lfFaceName)) { // already has the font bRet = true;