PVS-StudioWarnings

PVS-Studio warning V501 for OpenMS

Nov 12th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. std::vector<std::pair<std::string, long>> spectra_offsets;
  2. std::vector<std::pair<std::string, long>> chromatograms_offsets;
  3.  
  4. template <typename MapType>
  5. void MzMLHandler<MapType>::writeFooter_(std::ostream& os)
  6. {
  7.   ....
  8.   int indexlists;
  9.   if (spectra_offsets.empty() && spectra_offsets.empty() )
  10.   {
  11.     indexlists = 0;
  12.   }
  13.   else if (!spectra_offsets.empty() && !spectra_offsets.empty())
  14.   {
  15.     indexlists = 2;
  16.   }
  17.   else
  18.   {
  19.     indexlists = 1;
  20.   }
  21.   ....
  22. }
  23.  
  24. This suspicious code was found in OpenMS project by PVS-Studio static code analyzer.
  25. Warning message is:
  26. V501 There are identical sub-expressions 'spectra_offsets.empty()' to the left and to the right of the '&&' operator. mzmlhandler.h 5288
  27.  
  28. 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