diff --git a/src/gfxlib2/gfx_draw.c b/src/gfxlib2/gfx_draw.c index 2dce8a332c..611029bf24 100644 --- a/src/gfxlib2/gfx_draw.c +++ b/src/gfxlib2/gfx_draw.c @@ -220,9 +220,9 @@ FBCALL void fb_GfxDraw(void *target, FBSTRING *command) move = draw = TRUE; break; - case 'F': case 'D': angle += 90; - case 'G': case 'L': angle += 90; - case 'H': case 'U': angle += 90; + case 'F': case 'D': angle += 90; /* fall through */ + case 'G': case 'L': angle += 90; /* fall through */ + case 'H': case 'U': angle += 90; /* fall through */ case 'E': case 'R': diagonal = ((toupper(*c) >= 'E') && (toupper(*c) <= 'H')); c++; diff --git a/src/gfxlib2/linux/gfx_joystick.c b/src/gfxlib2/linux/gfx_joystick.c index 2fd4fe5f6c..2c0cc9afd5 100644 --- a/src/gfxlib2/linux/gfx_joystick.c +++ b/src/gfxlib2/linux/gfx_joystick.c @@ -34,7 +34,8 @@ FBCALL int fb_GfxGetJoystick(int id, ssize_t *buttons, float *a1, float *a2, flo const char *device[] = { "/dev/input/js", "/dev/js", NULL }; - char device_name[16]; + /* overallocate device_name[] to prevent a sprintf() warning in GCC */ + char device_name[13 + 11 + 1]; JOYDATA *joy; JS_EVENT event; int i, j, k, count = 0; diff --git a/src/gfxlib2/win32/gfx_win32.c b/src/gfxlib2/win32/gfx_win32.c index 204752f1ca..57e0cb0ecc 100644 --- a/src/gfxlib2/win32/gfx_win32.c +++ b/src/gfxlib2/win32/gfx_win32.c @@ -89,8 +89,13 @@ static void fb_hSetMouseClip( void ) ClipCursor(&rc); } -static void ToggleFullScreen( void ) +static void ToggleFullScreen( EVENT *e ) { + if (has_focus) { + e->type = EVENT_MOUSE_EXIT; + fb_hPostEvent(e); + } + if (fb_win32.flags & DRIVER_NO_SWITCH) return; @@ -322,24 +327,22 @@ LRESULT CALLBACK fb_hWin32WinProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM break; case WM_SIZE: - case WM_SYSKEYDOWN: - if (!fb_win32.is_active) - break; + if (fb_win32.is_active) { + if ( wParam == SIZE_MAXIMIZED ) { + ToggleFullScreen(&e); + return FALSE; + } + } + break; - { - int is_alt_enter = ((message == WM_SYSKEYDOWN) && (wParam == VK_RETURN) && (lParam & 0x20000000)); - int is_maximize = ((message == WM_SIZE) && (wParam == SIZE_MAXIMIZED)); - if ( is_maximize || is_alt_enter) { - if (has_focus) { - e.type = EVENT_MOUSE_EXIT; - fb_hPostEvent(&e); - } - ToggleFullScreen(); + case WM_SYSKEYDOWN: + if (fb_win32.is_active) { + if ( (wParam == VK_RETURN) && (lParam & 0x20000000) ) { + ToggleFullScreen(&e); return FALSE; } - if( message!=WM_SYSKEYDOWN ) - break; } + /* fall through */ case WM_KEYDOWN: case WM_KEYUP: diff --git a/src/rtlib/dev_file_encod_read_core.c b/src/rtlib/dev_file_encod_read_core.c index 76f0561e47..b078694df9 100644 --- a/src/rtlib/dev_file_encod_read_core.c +++ b/src/rtlib/dev_file_encod_read_core.c @@ -36,18 +36,23 @@ static ssize_t hReadUTF8ToChar( FILE *fp, char *dst, ssize_t max_chars ) case 5: wc += *p++; wc <<= 6; + /* fall through */ case 4: wc += *p++; wc <<= 6; + /* fall through */ case 3: wc += *p++; wc <<= 6; + /* fall through */ case 2: wc += *p++; wc <<= 6; + /* fall through */ case 1: wc += *p++; wc <<= 6; + /* fall through */ case 0: wc += *p++; } @@ -161,18 +166,23 @@ static ssize_t hUTF8ToUTF16( FILE *fp, FB_WCHAR *dst, ssize_t max_chars ) case 5: wc += *p++; wc <<= 6; + /* fall through */ case 4: wc += *p++; wc <<= 6; + /* fall through */ case 3: wc += *p++; wc <<= 6; + /* fall through */ case 2: wc += *p++; wc <<= 6; + /* fall through */ case 1: wc += *p++; wc <<= 6; + /* fall through */ case 0: wc += *p++; } @@ -225,18 +235,23 @@ static ssize_t hUTF8ToUTF32( FILE *fp, FB_WCHAR *dst, ssize_t max_chars ) case 5: wc += *p++; wc <<= 6; + /* fall through */ case 4: wc += *p++; wc <<= 6; + /* fall through */ case 3: wc += *p++; wc <<= 6; + /* fall through */ case 2: wc += *p++; wc <<= 6; + /* fall through */ case 1: wc += *p++; wc <<= 6; + /* fall through */ case 0: wc += *p++; } diff --git a/src/rtlib/dos/io_cls.c b/src/rtlib/dos/io_cls.c index 8f8f4ed656..d1c0445869 100644 --- a/src/rtlib/dos/io_cls.c +++ b/src/rtlib/dos/io_cls.c @@ -8,8 +8,9 @@ void fb_ConsoleClear( int mode ) { int toprow, botrow; - if( mode==1 ) + if( mode==1 ) { return; + } if( (mode == 2) || (mode == (int)0xFFFF0000) ) { /* same as gfxlib's DEFAULT_COLOR */ fb_ConsoleGetView( &toprow, &botrow ); diff --git a/src/rtlib/file_input_tok.c b/src/rtlib/file_input_tok.c index cfe33068bf..e1e91e0500 100644 --- a/src/rtlib/file_input_tok.c +++ b/src/rtlib/file_input_tok.c @@ -192,6 +192,7 @@ int fb_FileInputNextToken goto exit; } } + goto savechar; default: savechar: diff --git a/src/rtlib/file_input_tok_wstr.c b/src/rtlib/file_input_tok_wstr.c index 4cddc5dd65..a6d0877047 100644 --- a/src/rtlib/file_input_tok_wstr.c +++ b/src/rtlib/file_input_tok_wstr.c @@ -159,6 +159,7 @@ void fb_FileInputNextTokenWstr( FB_WCHAR *buffer, ssize_t max_chars, int is_stri goto exit; } } + goto savechar; default: savechar: diff --git a/src/rtlib/unix/io_printer.c b/src/rtlib/unix/io_printer.c index 5a0475eaea..26ca2ae458 100644 --- a/src/rtlib/unix/io_printer.c +++ b/src/rtlib/unix/io_printer.c @@ -125,7 +125,7 @@ int fb_PrinterOpen( DEV_LPT_INFO *devInfo, int iPort, const char *pszDeviceRaw ) } else { /* use direct port io */ - filename = alloca( 16 ); + filename = alloca( 7 + 11 + 1 ); sprintf(filename, "/dev/lp%d", (devInfo->iPort-1)); fp = fopen(filename, "wb"); diff --git a/src/rtlib/utf_convfrom_wchar.c b/src/rtlib/utf_convfrom_wchar.c index b695dba64e..a84407ef73 100644 --- a/src/rtlib/utf_convfrom_wchar.c +++ b/src/rtlib/utf_convfrom_wchar.c @@ -37,12 +37,15 @@ static void hUTF16ToUTF8( const FB_WCHAR *src, ssize_t chars, UTF_8 *dst, ssize_ case 4: *--dst = ((c | UTF8_BYTEMARK) & UTF8_BYTEMASK); c >>= 6; + /* fall through */ case 3: *--dst = ((c | UTF8_BYTEMARK) & UTF8_BYTEMASK); c >>= 6; + /* fall through */ case 2: *--dst = ((c | UTF8_BYTEMARK) & UTF8_BYTEMASK); c >>= 6; + /* fall through */ case 1: *--dst = (c | __fb_utf8_bmarkTb[bytes]); } @@ -78,12 +81,15 @@ static void hUTF32ToUTF8( const FB_WCHAR *src, ssize_t chars, UTF_8 *dst, ssize_ case 4: *--dst = ((c | UTF8_BYTEMARK) & UTF8_BYTEMASK); c >>= 6; + /* fall through */ case 3: *--dst = ((c | UTF8_BYTEMARK) & UTF8_BYTEMASK); c >>= 6; + /* fall through */ case 2: *--dst = ((c | UTF8_BYTEMARK) & UTF8_BYTEMASK); c >>= 6; + /* fall through */ case 1: *--dst = (c | __fb_utf8_bmarkTb[bytes]); } diff --git a/src/rtlib/utf_convto_char.c b/src/rtlib/utf_convto_char.c index c3b615bedc..95c4784e0d 100644 --- a/src/rtlib/utf_convto_char.c +++ b/src/rtlib/utf_convto_char.c @@ -26,14 +26,19 @@ char *fb_hUTF8ToChar( const UTF_8 *src, char *dst, ssize_t *chars ) { case 5: c += *src++; c <<= 6; + /* fall through */ case 4: c += *src++; c <<= 6; + /* fall through */ case 3: c += *src++; c <<= 6; + /* fall through */ case 2: c += *src++; c <<= 6; + /* fall through */ case 1: c += *src++; c <<= 6; + /* fall through */ case 0: c += *src++; } @@ -73,14 +78,19 @@ char *fb_hUTF8ToChar( const UTF_8 *src, char *dst, ssize_t *chars ) { case 5: c += *src++; c <<= 6; + /* fall through */ case 4: c += *src++; c <<= 6; + /* fall through */ case 3: c += *src++; c <<= 6; + /* fall through */ case 2: c += *src++; c <<= 6; + /* fall through */ case 1: c += *src++; c <<= 6; + /* fall through */ case 0: c += *src++; } diff --git a/src/rtlib/utf_convto_wchar.c b/src/rtlib/utf_convto_wchar.c index db6eea02bd..225b031bed 100644 --- a/src/rtlib/utf_convto_wchar.c +++ b/src/rtlib/utf_convto_wchar.c @@ -30,14 +30,19 @@ static FB_WCHAR *hUTF8ToUTF16( const UTF_8 *src, FB_WCHAR *dst, ssize_t *chars ) { case 5: c += *src++; c <<= 6; + /* fall through */ case 4: c += *src++; c <<= 6; + /* fall through */ case 3: c += *src++; c <<= 6; + /* fall through */ case 2: c += *src++; c <<= 6; + /* fall through */ case 1: c += *src++; c <<= 6; + /* fall through */ case 0: c += *src++; } @@ -88,14 +93,19 @@ static FB_WCHAR *hUTF8ToUTF16( const UTF_8 *src, FB_WCHAR *dst, ssize_t *chars ) { case 5: c += *src++; c <<= 6; + /* fall through */ case 4: c += *src++; c <<= 6; + /* fall through */ case 3: c += *src++; c <<= 6; + /* fall through */ case 2: c += *src++; c <<= 6; + /* fall through */ case 1: c += *src++; c <<= 6; + /* fall through */ case 0: c += *src++; } @@ -146,14 +156,19 @@ static FB_WCHAR *hUTF8ToUTF32( const UTF_8 *src, FB_WCHAR *dst, ssize_t *chars ) { case 5: c += *src++; c <<= 6; + /* fall through */ case 4: c += *src++; c <<= 6; + /* fall through */ case 3: c += *src++; c <<= 6; + /* fall through */ case 2: c += *src++; c <<= 6; + /* fall through */ case 1: c += *src++; c <<= 6; + /* fall through */ case 0: c += *src++; } @@ -190,14 +205,19 @@ static FB_WCHAR *hUTF8ToUTF32( const UTF_8 *src, FB_WCHAR *dst, ssize_t *chars ) { case 5: c += *src++; c <<= 6; + /* fall through */ case 4: c += *src++; c <<= 6; + /* fall through */ case 3: c += *src++; c <<= 6; + /* fall through */ case 2: c += *src++; c <<= 6; + /* fall through */ case 1: c += *src++; c <<= 6; + /* fall through */ case 0: c += *src++; }