Advertisement
PVS-StudioWarnings

PVS-Studio warning V530 for WinMerge

Nov 25th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. /**
  2. * @brief Get the file names on both sides for specified item.
  3. * @note Return empty strings if item is special item.
  4. */
  5. void CDirView::GetItemFileNames(int sel,
  6.   String& strLeft, String& strRight) const
  7. {
  8.   UINT_PTR diffpos = GetItemKey(sel);
  9.   if (diffpos == (UINT_PTR)SPECIAL_ITEM_POS)
  10.   {
  11.     strLeft.empty();
  12.     strRight.empty();
  13.   }
  14.   else
  15.   {
  16.      ...
  17.   }
  18. }
  19.  
  20. This is what should have been written here: strLeft.clear(); strRight.clear();
  21.  
  22. This suspicious code was found in WinMerge project by PVS-Studio static code analyzer.
  23. Warning message is:
  24. V530 The return value of function 'empty' is required to be utilized
  25.  
  26. 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