Advertisement
PVS-StudioWarnings

PVS-Studio warning V526 for Micro-Manager

Nov 27th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. const unsigned char stopSgn[2] = {0x04, 0x66};
  2.  
  3. int MotorStage::Stop()
  4. {
  5.   ....
  6.   if (memcmp(stopSgn, answer, sizeof(stopSgn) != 0))
  7.     return ERR_UNRECOGNIZED_ANSWER;
  8.   ....
  9. }
  10.  
  11. This suspicious code was found in Micro-Manager project by PVS-Studio static code analyzer.
  12. Warning message is:
  13. V526 The 'memcmp' function returns 0 if corresponding buffers are equal. Consider examining the condition for mistakes. MotorStage.cpp 385
  14.  
  15. 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
Advertisement