Skip to content
6 changes: 3 additions & 3 deletions src/gfxlib2/gfx_draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
3 changes: 2 additions & 1 deletion src/gfxlib2/linux/gfx_joystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
33 changes: 18 additions & 15 deletions src/gfxlib2/win32/gfx_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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:
Expand Down
15 changes: 15 additions & 0 deletions src/rtlib/dev_file_encod_read_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down Expand Up @@ -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++;
}
Expand Down Expand Up @@ -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++;
}
Expand Down
3 changes: 2 additions & 1 deletion src/rtlib/dos/io_cls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
1 change: 1 addition & 0 deletions src/rtlib/file_input_tok.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ int fb_FileInputNextToken
goto exit;
}
}
goto savechar;

default:
savechar:
Expand Down
1 change: 1 addition & 0 deletions src/rtlib/file_input_tok_wstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ void fb_FileInputNextTokenWstr( FB_WCHAR *buffer, ssize_t max_chars, int is_stri
goto exit;
}
}
goto savechar;

default:
savechar:
Expand Down
2 changes: 1 addition & 1 deletion src/rtlib/unix/io_printer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
6 changes: 6 additions & 0 deletions src/rtlib/utf_convfrom_wchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down Expand Up @@ -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]);
}
Expand Down
10 changes: 10 additions & 0 deletions src/rtlib/utf_convto_char.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down Expand Up @@ -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++;
}
Expand Down
20 changes: 20 additions & 0 deletions src/rtlib/utf_convto_wchar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
Expand Down Expand Up @@ -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++;
}
Expand Down Expand Up @@ -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++;
}
Expand Down Expand Up @@ -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++;
}
Expand Down