PVS-StudioWarnings

PVS-Studio warning V547 for Cocos2d-x

Nov 20th, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. struct CommonScriptData
  2. {
  3.   // Now this struct is only used in LuaBinding.
  4.   int handler;
  5.   char eventName[64];                                    //<==
  6.   ....
  7. };
  8.  
  9. int LuaEngine::handleCommonEvent(void* data)
  10. {
  11.   ....
  12.   CommonScriptData* commonInfo = static_cast<....*>(data);
  13.   if (NULL == commonInfo->eventName ||                   //<==
  14.       0 == commonInfo->handler)
  15.     return 0;
  16.   ....
  17. }
  18.  
  19. This suspicious code was found in Cocos2d-x project by PVS-Studio static code analyzer.
  20. Warning message is:
  21. V547 Expression '0 == commonInfo->eventName' is always false. Pointer 'commonInfo->eventName' != NULL. ccluaengine.cpp 436
  22.  
  23. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment