Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#257 Warning + Typo Fixes in sdl_mapper.cpp MAPPER_StartUp

Unstable_(example)
open
nobody
None
1
2014-02-18
2013-04-09
No

When compiling the latest SVN with gcc 4.8.0 I got a warning about undefined behavior:

src/gui/sdl_mapper.cpp: In function ‘void MAPPER_StartUp(Section*)’:
src/gui/sdl_mapper.cpp:2394:47: warning: iteration 8ul invokes undefined behavior [-Waggressive-loop-optimizations]
virtual_joysticks[0].button_pressed[i]=false;
^
src/gui/sdl_mapper.cpp:2393:2: note: containing loop
for (i=0; i<16; i++) {
^

"button_pressed" seems only to contain 8 elements while the loop processes 16. Thus, I moved its initialization to a new loop. Furthermore, I spotted that the axis_pos initialization in the loop below did not initialize the axis_pos entries of the second virtual joystick. I fixed what seems to be a typo there.

I hope these are indeed fixes.

1 Attachments

Discussion