Advertisement
PVS-StudioWarnings

PVS-Studio warning V564 for UnrealEngine4

Nov 20th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.24 KB | None | 0 0
  1. bool VertInfluencedByActiveBone(
  2.        FParticleEmitterInstance* Owner,
  3.        USkeletalMeshComponent* InSkelMeshComponent,
  4.        int32 InVertexIndex,
  5.        int32* OutBoneIndex = NULL);
  6.  
  7. void UParticleModuleLocationSkelVertSurface::Spawn(....)
  8. {
  9.   ....
  10.   int32 BoneIndex1, BoneIndex2, BoneIndex3;
  11.   BoneIndex1 = BoneIndex2 = BoneIndex3 = INDEX_NONE;
  12.  
  13.   if(!VertInfluencedByActiveBone(
  14.         Owner, SourceComponent, VertIndex[0], &BoneIndex1) &&
  15.      !VertInfluencedByActiveBone(
  16.         Owner, SourceComponent, VertIndex[1], &BoneIndex2) &&
  17.      !VertInfluencedByActiveBone(
  18.         Owner, SourceComponent, VertIndex[2]) &BoneIndex3)
  19.   {
  20.   ....
  21. }
  22.  
  23. Beautiful Bug! This is what should have been written here: !VertInfluencedByActiveBone(Owner, SourceComponent, VertIndex[2], &BoneIndex3))
  24.  
  25. This suspicious code was found in UnrealEngine4 project by PVS-Studio static code analyzer.
  26. Warning message is:
  27. V564 The '&' operator is applied to bool type value. You've probably forgotten to include parentheses or intended to use the '&&' operator. particlemodules_location.cpp 2120
  28.  
  29. 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