https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0eecebb1cc49bc2852ddf…
commit 0eecebb1cc49bc2852ddfd600bc760a0c540c080
Author: Joachim Henze <joachim.henze(a)reactos.org>
AuthorDate: Mon Sep 18 13:48:33 2023 +0200
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Sep 18 11:48:33 2023 +0000
[KBDLAYOUT] Avoid (DLGPROC) cast (#5698)
- Avoid DLGPROC-cast
- Bring header-section closer to our coding guidelines
- Strip inconsistent empty-lines
- Strip useless return at the end of void func
Co-authored-by: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
---
.../rostests/win32/user32/kbdlayout/kbdlayout.c | 40 +++++-----------------
1 file changed, 9 insertions(+), 31 deletions(-)
diff --git a/modules/rostests/win32/user32/kbdlayout/kbdlayout.c
b/modules/rostests/win32/user32/kbdlayout/kbdlayout.c
index b8fd1800c2d..1853531f9b2 100644
--- a/modules/rostests/win32/user32/kbdlayout/kbdlayout.c
+++ b/modules/rostests/win32/user32/kbdlayout/kbdlayout.c
@@ -1,9 +1,8 @@
/*
- * PROJECT: ReactOS
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: base/applications/testset/user32/kbdlayout/kbdlayout.c
- * PURPOSE: Keyboard layout testapp
- * COPYRIGHT: Copyright 2007 Saveliy Tretiakov
+ * PROJECT: ReactOS
+ * LICENSE: GPL - See COPYING in the top level directory
+ * PURPOSE: Keyboard layout testapp
+ * COPYRIGHT: Copyright 2007 Saveliy Tretiakov
*/
#define UNICODE
@@ -13,7 +12,7 @@
-LRESULT MainDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK MainDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
HINSTANCE hInst;
@@ -27,11 +26,10 @@ typedef struct {
DWORD WINAPI ThreadProc(LPVOID lpParam)
{
-
DialogBoxParam(hInst,
MAKEINTRESOURCE(IDD_MAINDIALOG),
NULL,
- (DLGPROC)MainDialogProc,
+ MainDialogProc,
(LPARAM)NULL);
return 0;
@@ -42,8 +40,6 @@ INT WINAPI WinMain(HINSTANCE hInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
-
-
hInst = hInstance;
ThreadProc(0);
@@ -51,7 +47,6 @@ INT WINAPI WinMain(HINSTANCE hInstance,
return 0;
}
-
int GetKlList(HKL **list)
{
HKL *ret;
@@ -69,7 +64,6 @@ void FreeKlList(HKL *list)
HeapFree(GetProcessHeap(), 0, list);
}
-
void UpdateData(HWND hDlg)
{
WCHAR buf[KL_NAMELENGTH];
@@ -119,8 +113,7 @@ void FormatBox(HWND hWnd, DWORD Flags, WCHAR *Caption, WCHAR *Format,
...)
va_end(argptr);
}
-
-LRESULT CALLBACK WndSubclassProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK WndSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
WND_DATA *data = (WND_DATA*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
@@ -137,7 +130,7 @@ LRESULT CALLBACK WndSubclassProc( HWND hwnd, UINT uMsg, WPARAM wParam,
LPARAM lP
//Pass message to defwindowproc
}
- return ( CallWindowProc( data->OrigProc, hwnd, uMsg, wParam, lParam) );
+ return CallWindowProc(data->OrigProc, hwnd, uMsg, wParam, lParam);
}
void SubclassWnd(HWND hWnd, WCHAR* Name)
@@ -146,7 +139,6 @@ void SubclassWnd(HWND hWnd, WCHAR* Name)
data->OrigProc = (WNDPROC)SetWindowLongPtr( hWnd, GWLP_WNDPROC,
(LONG_PTR)WndSubclassProc);
wcsncpy(data->WndName, Name, 25);
SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)data);
- return;
}
DWORD GetActivateFlags(HWND hDlg)
@@ -166,7 +158,6 @@ DWORD GetActivateFlags(HWND hDlg)
ret |= KLF_SETFORPROCESS;
return ret;
-
}
DWORD GetLoadFlags(HWND hDlg)
@@ -218,22 +209,15 @@ HKL GetSelectedLayout(HWND hDlg)
HKL GetActivateHandle(HWND hDlg)
{
-
if(IsDlgButtonChecked(hDlg, IDC_FROMLIST))
return GetSelectedLayout(hDlg);
else if(IsDlgButtonChecked(hDlg, IDC_HKL_NEXT))
return (HKL)HKL_NEXT;
return (HKL)HKL_PREV;
-
}
-
-/***************************************************
- * MainDialogProc *
- ***************************************************/
-
-LRESULT MainDialogProc(HWND hDlg,
+INT_PTR CALLBACK MainDialogProc(HWND hDlg,
UINT Msg,
WPARAM wParam,
LPARAM lParam)
@@ -350,13 +334,11 @@ LRESULT MainDialogProc(HWND hDlg,
}
break;
}
-
}
return TRUE;
} /* WM_COMMAND */
-
case WM_INPUTLANGCHANGE:
{
FormatMsg(L"dlg WM_INPUTLANGCHANGE lParam=%x wParam=%x\n", lParam, wParam);
@@ -379,9 +361,5 @@ LRESULT MainDialogProc(HWND hDlg,
default:
return FALSE;
}
-
}
-
-
-