PVS-StudioWarnings

PVS-Studio warning V525 for SlimDX

Nov 10th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. typedef struct DIJOYSTATE2 {
  2.   ....
  3.   LONG  rglSlider[2];
  4.   ....
  5.   LONG  rglVSlider[2];
  6.   ....
  7.   LONG  rglASlider[2];
  8.   ....
  9.   LONG  rglFSlider[2];
  10.   ....
  11. } DIJOYSTATE2, *LPDIJOYSTATE2;
  12.  
  13. void JoystickState::AssignState(const DIJOYSTATE2 &joystate)
  14. {
  15.   ....
  16.   for( int i = 0; i < 2; i++ )
  17.   {
  18.     sliders[i] = joystate.rglSlider[i];
  19.     asliders[i] = joystate.rglASlider[i];
  20.     vsliders[i] = joystate.rglVSlider[i];
  21.     fsliders[i] = joystate.rglVSlider[i];
  22.   }
  23.   ....
  24. }
  25.  
  26. This suspicious code was found in SlimDX project by PVS-Studio static code analyzer.
  27. Warning message is:
  28. V525 The code containing the collection of similar blocks. Check items 'rglSlider', 'rglASlider', 'rglVSlider', 'rglVSlider' in lines 93, 94, 95, 96. joystickstate.cpp 93
  29.  
  30. 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