Advertisement
PVS-StudioWarnings

PVS-Studio warning V547 for TortoiseSVN

Nov 27th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. BOOL TortoiseBlame::OpenFile(const TCHAR *fileName)
  2. {
  3.   ...
  4.   // check each line for illegal utf8 sequences.
  5.   // If one is found, we treat
  6.   // the file as ASCII, otherwise we assume
  7.   // an UTF8 file.
  8.   char * utf8CheckBuf = lineptr;
  9.   while ((bUTF8)&&(*utf8CheckBuf))
  10.   {
  11.     if ((*utf8CheckBuf == 0xC0)||
  12.         (*utf8CheckBuf == 0xC1)||
  13.         (*utf8CheckBuf >= 0xF5))
  14.     {
  15.       bUTF8 = false;
  16.       break;
  17.     }
  18.  
  19.    ...
  20.   }
  21.   ...
  22. }
  23.  
  24. This suspicious code was found in TortoiseSVN project by PVS-Studio static code analyzer.
  25. Warning message is:
  26. V547 Expression '* utf8CheckBuf == 0xC0' is always false. The value range of signed char type: [-128, 127]. tortoiseblame.cpp 310
  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
Advertisement