more "'for' loop initial declarations are only allowed in C99 mode" fixes

main
Ozkan Sezer 2020-12-17 14:11:00 +03:00
parent ed4fcb2cfc
commit 90456670b5
6 changed files with 38 additions and 38 deletions

View File

@ -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);
}

View File

@ -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;

View File

@ -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 )
{

View File

@ -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) {

View File

@ -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);

View File

@ -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);