PVS-StudioWarnings

PVS-Studio warning V523 for UnrealEngine4

Nov 18th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. FString FPaths::CreateTempFilename( const TCHAR* Path,
  2.   const TCHAR* Prefix, const TCHAR* Extension )
  3. {
  4.   ....
  5.   const int32 PathLen = FCString::Strlen( Path );
  6.   if( PathLen > 0 && Path[ PathLen - 1 ] != TEXT('/') )
  7.   {
  8.     UniqueFilename =
  9.       FString::Printf( TEXT("%s/%s%s%s"), Path, Prefix,
  10.                        *FGuid::NewGuid().ToString(), Extension );
  11.   }
  12.   else
  13.   {
  14.     UniqueFilename =
  15.       FString::Printf( TEXT("%s/%s%s%s"), Path, Prefix,
  16.                        *FGuid::NewGuid().ToString(), Extension );
  17.   }
  18.   ....
  19. }
  20.  
  21. This suspicious code was found in UnrealEngine4 project by PVS-Studio static code analyzer.
  22. Warning message is:
  23. V523 The 'then' statement is equivalent to the 'else' statement. paths.cpp 703
  24.  
  25. 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