Advertisement
PVS-StudioWarnings

PVS-Studio warning V547 for TortoiseSVN

Nov 24th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. CString CPathUtils::PathUnescape (const char* path)
  2. {
  3.   // try quick path
  4.   size_t i = 0;
  5.   for (; char c = path[i]; ++i)
  6.     if ((c >= 0x80) || (c == '%'))
  7.     {
  8.       // quick path does not work for
  9.       // non-latin or escaped chars
  10.       std::string utf8Path (path);
  11.       CPathUtils::Unescape (&utf8Path[0]);
  12.       return CUnicodeUtils::UTF8ToUTF16 (utf8Path);
  13.     }
  14.   ...
  15. }
  16.  
  17. This suspicious code was found in TortoiseSVN project by PVS-Studio static code analyzer.
  18. Warning message is:
  19. V547 Expression 'c >= 0x80' is always false. The value range of signed char type: [-128, 127]. pathutils.cpp 559
  20.  
  21. 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