PVS-StudioWarnings

PVS-Studio warning V542 for Miranda IM

Nov 18th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.96 KB | None | 0 0
  1. static void
  2. sttRegisterToolBarButton(..., char * pszButtonName, ...)
  3. {
  4.   ...
  5.   if ((BYTE)pszButtonName)
  6.     tbb.tbbFlags=TBBF_FLEXSIZESEPARATOR;
  7.   else
  8.     tbb.tbbFlags=TBBF_ISSEPARATOR;
  9.   ...
  10. }
  11.  
  12. This code is suspicious. In fact, we check that the string address is multiple of 256. But what the programmer actually wanted to write in the condition is a mystery. I'm not sure that this is exactly an error. There are similar games with pointers - that is, something else is stored in pointers. This code should be cited simply as an example of a suspicious code fragment that needs checking.
  13.  
  14. This suspicious code was found in Miranda IM project by PVS-Studio static code analyzer.
  15. Warning message is:
  16. V542 Consider inspecting an odd type cast: 'char *' to 'char'.  clist_modern  modern_toolbar.cpp  586
  17.  
  18. 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