PVS-StudioWarnings

PVS-Studio warning V637 for OpenCV

Nov 17th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. void KeyPointsFilter::retainBest(
  2.   vector<KeyPoint>& keypoints, int n_points)
  3. {
  4.   ....
  5.   if( n_points > 0 && keypoints.size() > (size_t)n_points )
  6.   {
  7.     if (n_points==0)
  8.     {
  9.       keypoints.clear();
  10.       return;
  11.     }
  12.   ....
  13. }
  14.  
  15. This suspicious code was found in OpenCV project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. V637 Two opposite conditions were encountered. The second condition is always false. Check lines: 195, 197. keypoint.cpp 195
  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