more "'for' loop initial declarations are only allowed in C99 mode" fixes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
diff --git a/src/core/freebsd/SDL_evdev_kbd_freebsd.c b/src/core/freebsd/SDL_evdev_kbd_freebsd.c
index 661db40..9d7dcd9 100644
--- a/src/core/freebsd/SDL_evdev_kbd_freebsd.c
+++ b/src/core/freebsd/SDL_evdev_kbd_freebsd.c
@@ -250,8 +250,8 @@ SDL_EVDEV_kbd_init(void)
{
SDL_free(kbd->accents);
kbd->accents = &accentmap_default_us_acc;
- }
-
+ }
+
if (ioctl(kbd->console_fd, KDGKBMODE, &kbd->old_kbd_mode) == 0) {
/* Set the keyboard in XLATE mode and load the keymaps */
ioctl(kbd->console_fd, KDSKBMODE, (unsigned long)(K_XLATE));
@@ -285,7 +285,7 @@ SDL_EVDEV_kbd_init(void)
}
else kbd->keyboard_fd = kbd->console_fd;
}
-
+
return kbd;
}
@@ -301,7 +301,7 @@ SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd)
if (kbd->keyboard_fd >= 0) {
/* Restore the original keyboard mode */
ioctl(kbd->keyboard_fd, KDSKBMODE, kbd->old_kbd_mode);
-
+
close(kbd->keyboard_fd);
if (kbd->console_fd != kbd->keyboard_fd && kbd->console_fd >= 0)
{
@@ -362,14 +362,14 @@ static void put_utf8(SDL_EVDEV_keyboard_state *kbd, uint c)
static unsigned int handle_diacr(SDL_EVDEV_keyboard_state *kbd, unsigned int ch)
{
unsigned int d = kbd->diacr;
- unsigned int i;
+ unsigned int i, j;
kbd->diacr = 0;
for (i = 0; i < kbd->accents->n_accs; i++) {
if (kbd->accents->acc[i].accchar == d)
{
- for (int j = 0; j < NUM_ACCENTCHARS; ++j) {
+ for (j = 0; j < NUM_ACCENTCHARS; ++j) {
if (kbd->accents->acc[i].map[j][0] == 0) /* end of table */
break;
if (kbd->accents->acc[i].map[j][0] == ch)
@@ -462,9 +462,9 @@ SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int d
struct keyent_t keysym;
unsigned int final_key_state;
unsigned int map_from_key_sym;
-
+
key_map = *kbd->key_map;
-
+
if (!kbd) {
return;
}
@@ -476,7 +476,7 @@ SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int d
/* These constitute unprintable language-related keys, so ignore them. */
return;
}
- if (keycode > 95)
+ if (keycode > 95)
keycode -= 7;
if (vc_kbd_led(kbd, ALKED) || (kbd->shift_state & 0x8))
{
@@ -486,13 +486,13 @@ SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int d
} else {
return;
}
-
+
final_key_state = kbd->shift_state & 0x7;
if ((keysym.flgs & FLAG_LOCK_C) && vc_kbd_led(kbd, LED_CAP))
final_key_state ^= 0x1;
if ((keysym.flgs & FLAG_LOCK_N) && vc_kbd_led(kbd, LED_NUM))
final_key_state ^= 0x1;
-
+
map_from_key_sym = keysym.map[final_key_state];
if ((keysym.spcl & (0x80 >> final_key_state)) || (map_from_key_sym & SPCLKEY)) {
/* Special function.*/
@@ -506,7 +506,7 @@ SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int d
if (kbd->accents->acc[accent_index].accchar != 0) {
k_deadunicode(kbd, kbd->accents->acc[accent_index].accchar, !down);
}
- } else {
+ } else {
switch(map_from_key_sym) {
case ASH: /* alt/meta shift */
k_shift(kbd, 3, down == 0);
@@ -549,12 +549,12 @@ SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int d
}
}
} else {
- if (map_from_key_sym == '\n' || map_from_key_sym == '\r') {
- if (kbd->diacr) {
- kbd->diacr = 0;
- return;
- }
- }
+ if (map_from_key_sym == '\n' || map_from_key_sym == '\r') {
+ if (kbd->diacr) {
+ kbd->diacr = 0;
+ return;
+ }
+ }
if (map_from_key_sym >= ' ' && map_from_key_sym != 127) {
k_self(kbd, map_from_key_sym, !down);
}
diff --git a/src/hidapi/windows/hid.c b/src/hidapi/windows/hid.c
index 7802924..3965a28 100644
--- a/src/hidapi/windows/hid.c
+++ b/src/hidapi/windows/hid.c
@@ -1002,23 +1002,23 @@ HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
/*#define S11*/
#define P32
#ifdef S11
- unsigned short VendorID = 0xa0a0;
+ unsigned short VendorID = 0xa0a0;
unsigned short ProductID = 0x0001;
#endif
#ifdef P32
- unsigned short VendorID = 0x04d8;
+ unsigned short VendorID = 0x04d8;
unsigned short ProductID = 0x3f;
#endif
#ifdef PICPGM
- unsigned short VendorID = 0x04d8;
- unsigned short ProductID = 0x0033;
+ unsigned short VendorID = 0x04d8;
+ unsigned short ProductID = 0x0033;
#endif
int __cdecl main(int argc, char* argv[])
{
- int res;
+ int i, res;
unsigned char buf[65];
UNREFERENCED_PARAMETER(argc);
@@ -1054,7 +1054,7 @@ int __cdecl main(int argc, char* argv[])
printf("Unable to read()\n");
/* Print out the returned buffer. */
- for (int i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
printf("buf[%d]: %d\n", i, buf[i]);
return 0;
diff --git a/src/joystick/controller_type.h b/src/joystick/controller_type.h
index 88b66cd..7b9e1d1 100644
--- a/src/joystick/controller_type.h
+++ b/src/joystick/controller_type.h
@@ -600,10 +600,10 @@ static SDL_INLINE EControllerType GuessControllerType( int nVID, int nPID )
if ( !s_bCheckedForDuplicates )
{
s_bCheckedForDuplicates = true;
-
- for ( int i = 0; i < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++i )
+ int i, j;
+ for ( i = 0; i < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++i )
{
- for ( int j = i + 1; j < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++j )
+ for ( j = i + 1; j < sizeof( arrControllers ) / sizeof( arrControllers[ 0 ] ); ++j )
{
if ( arrControllers[ i ].m_unDeviceID == arrControllers[ j ].m_unDeviceID )
{
diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c
index 7bdda8f..0af76b0 100644
--- a/src/joystick/windows/SDL_rawinputjoystick.c
+++ b/src/joystick/windows/SDL_rawinputjoystick.c
@@ -577,10 +577,10 @@ RAWINPUT_WindowsGamingInputSlotMatches(const WindowsMatchState *state, WindowsGa
static SDL_bool
RAWINPUT_GuessWindowsGamingInputSlot(const WindowsMatchState *state, Uint8 *correlation_id, WindowsGamingInputGamepadState **slot)
{
- int match_count;
+ int match_count, user_index;
match_count = 0;
- for (int user_index = 0; user_index < wgi_state.per_gamepad_count; ++user_index) {
+ for (user_index = 0; user_index < wgi_state.per_gamepad_count; ++user_index) {
WindowsGamingInputGamepadState *gamepad_state = wgi_state.per_gamepad[user_index];
if (RAWINPUT_WindowsGamingInputSlotMatches(state, gamepad_state)) {
++match_count;
@@ -604,7 +604,8 @@ RAWINPUT_QuitWindowsGamingInput(RAWINPUT_DeviceContext *ctx)
wgi_state.need_device_list_update = SDL_TRUE;
--wgi_state.ref_count;
if (!wgi_state.ref_count && wgi_state.initialized) {
- for (int ii = 0; ii < wgi_state.per_gamepad_count; ii++) {
+ int ii;
+ for (ii = 0; ii < wgi_state.per_gamepad_count; ii++) {
__x_ABI_CWindows_CGaming_CInput_CIGamepad_Release(wgi_state.per_gamepad[ii]->gamepad);
}
if (wgi_state.per_gamepad) {
diff --git a/src/video/cocoa/SDL_cocoamodes.m b/src/video/cocoa/SDL_cocoamodes.m
index c33ae2f..238be8d 100644
--- a/src/video/cocoa/SDL_cocoamodes.m
+++ b/src/video/cocoa/SDL_cocoamodes.m
@@ -197,8 +197,9 @@ GetDisplayMode(_THIS, CGDisplayModeRef vidmode, CFArrayRef modelist, CVDisplayLi
int pixelH = (int) CGDisplayModeGetPixelHeight(vidmode);
CFIndex modescount = CFArrayGetCount(modelist);
+ int i;
- for (int i = 0; i < modescount; i++) {
+ for (i = 0; i < modescount; i++) {
CGDisplayModeRef othermode = (CGDisplayModeRef) CFArrayGetValueAtIndex(modelist, i);
uint32_t otherioflags = CGDisplayModeGetIOFlags(othermode);
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index da2defe..dc8338b 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -381,19 +381,17 @@ void print_plane_info(_THIS, drmModePlanePtr plane)
drmModeRes *resources;
uint32_t type = 0;
SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
+ int i;
drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(viddata->drm_fd,
plane->plane_id, DRM_MODE_OBJECT_PLANE);
/* Search the plane props for the plane type. */
- for (int j = 0; j < props->count_props; j++) {
-
- drmModePropertyPtr p = KMSDRM_drmModeGetProperty(viddata->drm_fd, props->props[j]);
-
+ for (i = 0; i < props->count_props; i++) {
+ drmModePropertyPtr p = KMSDRM_drmModeGetProperty(viddata->drm_fd, props->props[i]);
if ((strcmp(p->name, "type") == 0)) {
- type = props->prop_values[j];
+ type = props->prop_values[i];
}
-
KMSDRM_drmModeFreeProperty(p);
}
@@ -422,7 +420,7 @@ void print_plane_info(_THIS, drmModePlanePtr plane)
return;
printf("--PLANE ID: %d\nPLANE TYPE: %s\nCRTC READING THIS PLANE: %d\nCRTCS SUPPORTED BY THIS PLANE: ", plane->plane_id, plane_type, plane->crtc_id);
- for (int i = 0; i < resources->count_crtcs; i++) {
+ for (i = 0; i < resources->count_crtcs; i++) {
if (plane->possible_crtcs & (1 << i)) {
uint32_t crtc_id = resources->crtcs[i];
printf ("%d", crtc_id);