Advertisement
PVS-StudioWarnings

PVS-Studio warning V547 for TPP

Nov 20th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. class basic_string
  2. {
  3.   ...
  4.   size_type find(const _Elem *_Ptr, size_type _Off = 0) const
  5.   ...
  6. }
  7.  
  8. void
  9. PipelineAnalysis::prepareFields(void) {
  10.   ...
  11.   if (peptideProphetOpts_.find(" PI ", 0)>=0) {
  12.     fields_.push_back(Field("PpI_zscore"));
  13.   }
  14.   ...
  15. }
  16.  
  17. This is what should have been written here: (peptideProphetOpts_.find(" PI ", 0) != string::npos).
  18.  
  19.  
  20. This suspicious code was found in TPP project by PVS-Studio static code analyzer.
  21. Warning message is:
  22. V547 Expression 'peptideProphetOpts_.find(" PI ", 0) >= 0' is always true. Unsigned type value is always >= 0. pepXMLViewer pipelineanalysis.cxx 1590
  23.  
  24. 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