Skip to content

Commit df595db

Browse files
authored
Merge pull request #106 from countingpine/gcc-warnings
GCC warnings
2 parents 3e7cdd6 + 54d4485 commit df595db

File tree

11 files changed

+79
-21
lines changed

11 files changed

+79
-21
lines changed

src/gfxlib2/gfx_draw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,9 @@ FBCALL void fb_GfxDraw(void *target, FBSTRING *command)
220220
move = draw = TRUE;
221221
break;
222222

223-
case 'F': case 'D': angle += 90;
224-
case 'G': case 'L': angle += 90;
225-
case 'H': case 'U': angle += 90;
223+
case 'F': case 'D': angle += 90; /* fall through */
224+
case 'G': case 'L': angle += 90; /* fall through */
225+
case 'H': case 'U': angle += 90; /* fall through */
226226
case 'E': case 'R':
227227
diagonal = ((toupper(*c) >= 'E') && (toupper(*c) <= 'H'));
228228
c++;

src/gfxlib2/linux/gfx_joystick.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ FBCALL int fb_GfxGetJoystick(int id, ssize_t *buttons, float *a1, float *a2, flo
3434
const char *device[] = { "/dev/input/js",
3535
"/dev/js",
3636
NULL };
37-
char device_name[16];
37+
/* overallocate device_name[] to prevent a sprintf() warning in GCC */
38+
char device_name[13 + 11 + 1];
3839
JOYDATA *joy;
3940
JS_EVENT event;
4041
int i, j, k, count = 0;

src/gfxlib2/win32/gfx_win32.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,13 @@ static void fb_hSetMouseClip( void )
8989
ClipCursor(&rc);
9090
}
9191

92-
static void ToggleFullScreen( void )
92+
static void ToggleFullScreen( EVENT *e )
9393
{
94+
if (has_focus) {
95+
e->type = EVENT_MOUSE_EXIT;
96+
fb_hPostEvent(e);
97+
}
98+
9499
if (fb_win32.flags & DRIVER_NO_SWITCH)
95100
return;
96101

@@ -322,24 +327,22 @@ LRESULT CALLBACK fb_hWin32WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
322327
break;
323328

324329
case WM_SIZE:
325-
case WM_SYSKEYDOWN:
326-
if (!fb_win32.is_active)
327-
break;
330+
if (fb_win32.is_active) {
331+
if ( wParam == SIZE_MAXIMIZED ) {
332+
ToggleFullScreen(&e);
333+
return FALSE;
334+
}
335+
}
336+
break;
328337

329-
{
330-
int is_alt_enter = ((message == WM_SYSKEYDOWN) && (wParam == VK_RETURN) && (lParam & 0x20000000));
331-
int is_maximize = ((message == WM_SIZE) && (wParam == SIZE_MAXIMIZED));
332-
if ( is_maximize || is_alt_enter) {
333-
if (has_focus) {
334-
e.type = EVENT_MOUSE_EXIT;
335-
fb_hPostEvent(&e);
336-
}
337-
ToggleFullScreen();
338+
case WM_SYSKEYDOWN:
339+
if (fb_win32.is_active) {
340+
if ( (wParam == VK_RETURN) && (lParam & 0x20000000) ) {
341+
ToggleFullScreen(&e);
338342
return FALSE;
339343
}
340-
if( message!=WM_SYSKEYDOWN )
341-
break;
342344
}
345+
/* fall through */
343346

344347
case WM_KEYDOWN:
345348
case WM_KEYUP:

src/rtlib/dev_file_encod_read_core.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,23 @@ static ssize_t hReadUTF8ToChar( FILE *fp, char *dst, ssize_t max_chars )
3636
case 5:
3737
wc += *p++;
3838
wc <<= 6;
39+
/* fall through */
3940
case 4:
4041
wc += *p++;
4142
wc <<= 6;
43+
/* fall through */
4244
case 3:
4345
wc += *p++;
4446
wc <<= 6;
47+
/* fall through */
4548
case 2:
4649
wc += *p++;
4750
wc <<= 6;
51+
/* fall through */
4852
case 1:
4953
wc += *p++;
5054
wc <<= 6;
55+
/* fall through */
5156
case 0:
5257
wc += *p++;
5358
}
@@ -161,18 +166,23 @@ static ssize_t hUTF8ToUTF16( FILE *fp, FB_WCHAR *dst, ssize_t max_chars )
161166
case 5:
162167
wc += *p++;
163168
wc <<= 6;
169+
/* fall through */
164170
case 4:
165171
wc += *p++;
166172
wc <<= 6;
173+
/* fall through */
167174
case 3:
168175
wc += *p++;
169176
wc <<= 6;
177+
/* fall through */
170178
case 2:
171179
wc += *p++;
172180
wc <<= 6;
181+
/* fall through */
173182
case 1:
174183
wc += *p++;
175184
wc <<= 6;
185+
/* fall through */
176186
case 0:
177187
wc += *p++;
178188
}
@@ -225,18 +235,23 @@ static ssize_t hUTF8ToUTF32( FILE *fp, FB_WCHAR *dst, ssize_t max_chars )
225235
case 5:
226236
wc += *p++;
227237
wc <<= 6;
238+
/* fall through */
228239
case 4:
229240
wc += *p++;
230241
wc <<= 6;
242+
/* fall through */
231243
case 3:
232244
wc += *p++;
233245
wc <<= 6;
246+
/* fall through */
234247
case 2:
235248
wc += *p++;
236249
wc <<= 6;
250+
/* fall through */
237251
case 1:
238252
wc += *p++;
239253
wc <<= 6;
254+
/* fall through */
240255
case 0:
241256
wc += *p++;
242257
}

src/rtlib/dos/io_cls.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ void fb_ConsoleClear( int mode )
88
{
99
int toprow, botrow;
1010

11-
if( mode==1 )
11+
if( mode==1 ) {
1212
return;
13+
}
1314

1415
if( (mode == 2) || (mode == (int)0xFFFF0000) ) { /* same as gfxlib's DEFAULT_COLOR */
1516
fb_ConsoleGetView( &toprow, &botrow );

src/rtlib/file_input_tok.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ int fb_FileInputNextToken
192192
goto exit;
193193
}
194194
}
195+
goto savechar;
195196

196197
default:
197198
savechar:

src/rtlib/file_input_tok_wstr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ void fb_FileInputNextTokenWstr( FB_WCHAR *buffer, ssize_t max_chars, int is_stri
159159
goto exit;
160160
}
161161
}
162+
goto savechar;
162163

163164
default:
164165
savechar:

src/rtlib/unix/io_printer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ int fb_PrinterOpen( DEV_LPT_INFO *devInfo, int iPort, const char *pszDeviceRaw )
125125

126126
} else {
127127
/* use direct port io */
128-
filename = alloca( 16 );
128+
filename = alloca( 7 + 11 + 1 );
129129
sprintf(filename, "/dev/lp%d", (devInfo->iPort-1));
130130
fp = fopen(filename, "wb");
131131

src/rtlib/utf_convfrom_wchar.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@ static void hUTF16ToUTF8( const FB_WCHAR *src, ssize_t chars, UTF_8 *dst, ssize_
3737
case 4:
3838
*--dst = ((c | UTF8_BYTEMARK) & UTF8_BYTEMASK);
3939
c >>= 6;
40+
/* fall through */
4041
case 3:
4142
*--dst = ((c | UTF8_BYTEMARK) & UTF8_BYTEMASK);
4243
c >>= 6;
44+
/* fall through */
4345
case 2:
4446
*--dst = ((c | UTF8_BYTEMARK) & UTF8_BYTEMASK);
4547
c >>= 6;
48+
/* fall through */
4649
case 1:
4750
*--dst = (c | __fb_utf8_bmarkTb[bytes]);
4851
}
@@ -78,12 +81,15 @@ static void hUTF32ToUTF8( const FB_WCHAR *src, ssize_t chars, UTF_8 *dst, ssize_
7881
case 4:
7982
*--dst = ((c | UTF8_BYTEMARK) & UTF8_BYTEMASK);
8083
c >>= 6;
84+
/* fall through */
8185
case 3:
8286
*--dst = ((c | UTF8_BYTEMARK) & UTF8_BYTEMASK);
8387
c >>= 6;
88+
/* fall through */
8489
case 2:
8590
*--dst = ((c | UTF8_BYTEMARK) & UTF8_BYTEMASK);
8691
c >>= 6;
92+
/* fall through */
8793
case 1:
8894
*--dst = (c | __fb_utf8_bmarkTb[bytes]);
8995
}

src/rtlib/utf_convto_char.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,19 @@ char *fb_hUTF8ToChar( const UTF_8 *src, char *dst, ssize_t *chars )
2626
{
2727
case 5:
2828
c += *src++; c <<= 6;
29+
/* fall through */
2930
case 4:
3031
c += *src++; c <<= 6;
32+
/* fall through */
3133
case 3:
3234
c += *src++; c <<= 6;
35+
/* fall through */
3336
case 2:
3437
c += *src++; c <<= 6;
38+
/* fall through */
3539
case 1:
3640
c += *src++; c <<= 6;
41+
/* fall through */
3742
case 0:
3843
c += *src++;
3944
}
@@ -73,14 +78,19 @@ char *fb_hUTF8ToChar( const UTF_8 *src, char *dst, ssize_t *chars )
7378
{
7479
case 5:
7580
c += *src++; c <<= 6;
81+
/* fall through */
7682
case 4:
7783
c += *src++; c <<= 6;
84+
/* fall through */
7885
case 3:
7986
c += *src++; c <<= 6;
87+
/* fall through */
8088
case 2:
8189
c += *src++; c <<= 6;
90+
/* fall through */
8291
case 1:
8392
c += *src++; c <<= 6;
93+
/* fall through */
8494
case 0:
8595
c += *src++;
8696
}

0 commit comments

Comments
 (0)