Advertisement
PVS-StudioWarnings

PVS-Studio warning V516 for Audacity

Nov 21st, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. int sf_error (SNDFILE *sndfile)
  2. {
  3.   ...
  4.   if (! sndfile)
  5.   {
  6.     if (sf_error != 0)
  7.       return sf_errno ;
  8.     return 0 ;
  9.   } ;
  10.   ...
  11. }
  12.  
  13. Strange code. Perhaps there should be (sf_errno != 0). But why not simply write "return sf_errno;" then?
  14.  
  15. This suspicious code was found in Audacity project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. V516 Consider inspecting an odd expression. Non-null function pointer is compared to null: 'sf_error != 0'. libsndfile sndfile.c 491
  18.  
  19. 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