From 046fa9fb0e68784ab3a320ed9758990f131f64b9 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Thu, 8 Feb 2018 15:10:27 +0500 Subject: [PATCH] remove unused functions (identified by cppcheck) [src/Cedar/WinUi.c:6899]: (style) The function 'CbInsertStr9xA' is never used. [src/Cedar/WinUi.c:2091]: (style) The function 'FreeInfoThread' is never used. [src/Cedar/WinUi.c:2819]: (style) The function 'GetWindowAndControlSizeResizeScale' is never used. [src/Cedar/WinUi.c:1996]: (style) The function 'IsRegistedToDontShowFreeEditionDialog' is never used. [src/Cedar/WinUi.c:6597]: (style) The function 'LbAddStrA' is never used. [src/Cedar/WinUi.c:6730]: (style) The function 'LbGetSelectIndex' is never used. [src/Cedar/WinUi.c:6618]: (style) The function 'LbInsertStrA' is never used. [src/Cedar/WinUi.c:7584]: (style) The function 'PkcsUtilProc' is never used. --- src/Cedar/WinUi.c | 189 ---------------------------------------------- src/Cedar/WinUi.h | 8 -- 2 files changed, 197 deletions(-) diff --git a/src/Cedar/WinUi.c b/src/Cedar/WinUi.c index 763f7546..8aad5fd2 100644 --- a/src/Cedar/WinUi.c +++ b/src/Cedar/WinUi.c @@ -1992,30 +1992,6 @@ bool Win32CnCheckAlreadyExists(bool lock) return false; } -// Get whether it is set to not display the dialog about the free version -bool IsRegistedToDontShowFreeEditionDialog(char *server_name) -{ - // Validate arguments - if (server_name == NULL) - { - return false; - } - - if (MsRegReadInt(REG_LOCAL_MACHINE, FREE_REGKEY, server_name) != 0) - { - return true; - } - - if (MsRegWriteInt(REG_LOCAL_MACHINE, FREE_REGKEY, "__test__", 1) == false) - { - return true; - } - - MsRegDeleteValue(REG_LOCAL_MACHINE, FREE_REGKEY, "__test__"); - - return false; -} - // Set in the registry not to show a dialog about the free version void RegistToDontShowFreeEditionDialog(char *server_name) { @@ -2087,19 +2063,6 @@ void ShowFreeInfoDialog(HWND hWnd, FREEINFO *info) Set(info->Event); } -// Free Edition dialog thread -void FreeInfoThread(THREAD *thread, void *param) -{ - FREEINFO *info = (FREEINFO *)param; - // Validate arguments - if (thread == NULL || info == NULL) - { - return; - } - - ShowFreeInfoDialog(NULL, info); -} - // Show the Easter Egg void ShowEasterEgg(HWND hWnd) { @@ -2815,40 +2778,6 @@ HFONT GetDialogDefaultFontEx(bool meiryo) return GetFont(default_font_name, default_font_size, false, false, false, false); } -// Get the adjustment scale between the control size and the window size -void GetWindowAndControlSizeResizeScale(HWND hWnd, bool *need_resize, double *factor_x, double *factor_y) -{ - UINT dlgfont_x, dlgfont_y; - HFONT hDlgFont; - // Validate arguments - if (hWnd == NULL || need_resize == NULL || factor_x == NULL || factor_y == NULL) - { - return; - } - - *need_resize = true; - - // Get the font of the current window - hDlgFont = (HFONT)SendMsg(hWnd, 0, WM_GETFONT, 0, 0); - - // Get the width and height of the font of the current window - CalcFontSize(hDlgFont, &dlgfont_x, &dlgfont_y); - - if ((dlgfont_x == WINUI_DEFAULT_DIALOG_UNIT_X) && - (dlgfont_y == WINUI_DEFAULT_DIALOG_UNIT_Y)) - { - // There is no need to adjust - *need_resize = false; - *factor_x = 1.0; - *factor_y = 1.0; - return; - } - - // Calculate the adjustment amount - *factor_x = (double)dlgfont_x / (double)WINUI_DEFAULT_DIALOG_UNIT_X; - *factor_y = (double)dlgfont_y / (double)WINUI_DEFAULT_DIALOG_UNIT_Y; -} - // Adjust the control size and window size void AdjustWindowAndControlSize(HWND hWnd, bool *need_resize, double *factor_x, double *factor_y) { @@ -6593,48 +6522,6 @@ UINT LbNum(HWND hWnd, UINT id) return SendMsg(hWnd, id, LB_GETCOUNT, 0, 0); } -// Add a string -UINT LbAddStrA(HWND hWnd, UINT id, char *str, UINT data) -{ - UINT ret; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return INFINITE; - } - - ret = SendMsg(hWnd, id, LB_ADDSTRING, 0, (LPARAM)str); - SendMsg(hWnd, id, LB_SETITEMDATA, ret, (LPARAM)data); - - if (LbNum(hWnd, id) == 1) - { - LbSelectIndex(hWnd, id, 0); - } - - return ret; -} - -// Insert a string -UINT LbInsertStrA(HWND hWnd, UINT id, UINT index, char *str, UINT data) -{ - UINT ret; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return INFINITE; - } - - ret = SendMsg(hWnd, id, LB_INSERTSTRING, index, (LPARAM)str); - SendMsg(hWnd, id, LB_SETITEMDATA, ret, (LPARAM)data); - - if (LbNum(hWnd, id) == 1) - { - LbSelect(hWnd, id, 0); - } - - return ret; -} - // Remove all void LbReset(HWND hWnd, UINT id) { @@ -6726,18 +6613,6 @@ void LbSelect(HWND hWnd, UINT id, int data) LbSelectIndex(hWnd, id, index); } -// Get the currently selected item -UINT LbGetSelectIndex(HWND hWnd, UINT id) -{ - // Validate arguments - if (hWnd == NULL) - { - return INFINITE; - } - - return SendMsg(hWnd, id, LB_GETCURSEL, 0, 0); -} - // Password input dialog state change void PasswordDlgProcChange(HWND hWnd, UI_PASSWORD_DLG *p) { @@ -6895,27 +6770,6 @@ UINT CbAddStr9xA(HWND hWnd, UINT id, char *str, UINT data) return ret; } -// Insert a string -UINT CbInsertStr9xA(HWND hWnd, UINT id, UINT index, char *str, UINT data) -{ - UINT ret; - // Validate arguments - if (hWnd == NULL || str == NULL) - { - return INFINITE; - } - - ret = SendMsg(hWnd, id, CB_INSERTSTRING, index, (LPARAM)str); - SendMsg(hWnd, id, CB_SETITEMDATA, ret, (LPARAM)data); - - if (CbNum(hWnd, id) == 1) - { - CbSelect(hWnd, id, 0); - } - - return ret; -} - // Remove all void CbReset(HWND hWnd, UINT id) { @@ -7580,49 +7434,6 @@ void PkcsUtilErase(HWND hWnd) } } -// PKCS Utility dialog -UINT PkcsUtilProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) -{ - // Validate arguments - if (hWnd == NULL) - { - return 0; - } - - switch (msg) - { - case WM_INITDIALOG: - DlgFont(hWnd, S_TITLE, 12, true); - SetIcon(hWnd, 0, ICO_CERT); - SetFont(hWnd, S_COPYRIGHT, GetFont("Arial", 8, false, false, false, false)); - break; - - case WM_COMMAND: - switch (wParam) - { - case B_WRITE: - PkcsUtilWrite(hWnd); - break; - - case B_ERASE: - PkcsUtilErase(hWnd); - break; - - case IDCANCEL: - Close(hWnd); - break; - } - - break; - - case WM_CLOSE: - EndDialog(hWnd, 0); - break; - } - - return 0; -} - // [Save File] dialog wchar_t *SaveDlg(HWND hWnd, wchar_t *filter, wchar_t *title, wchar_t *default_name, wchar_t *default_ext) { diff --git a/src/Cedar/WinUi.h b/src/Cedar/WinUi.h index e3f702ac..95bd7be7 100644 --- a/src/Cedar/WinUi.h +++ b/src/Cedar/WinUi.h @@ -674,7 +674,6 @@ wchar_t *SaveDlg(HWND hWnd, wchar_t *filter, wchar_t *title, wchar_t *default_na char *SaveDlgA(HWND hWnd, char *filter, char *title, char *default_name, char *default_ext); wchar_t *MakeFilter(wchar_t *str); char *MakeFilterA(char *str); -UINT PkcsUtilProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); void PkcsUtilWrite(HWND hWnd); void PkcsUtilErase(HWND hWnd); bool PassphraseDlg(HWND hWnd, char *pass, UINT pass_size, BUF *buf, bool p12); @@ -686,7 +685,6 @@ void PasswordDlgProcChange(HWND hWnd, UI_PASSWORD_DLG *p); UINT CbAddStr(HWND hWnd, UINT id, wchar_t *str, UINT data); UINT CbAddStrA(HWND hWnd, UINT id, char *str, UINT data); UINT CbAddStr9xA(HWND hWnd, UINT id, char *str, UINT data); -UINT CbInsertStr9xA(HWND hWnd, UINT id, UINT index, char *str, UINT data); void CbSelectIndex(HWND hWnd, UINT id, UINT index); UINT CbNum(HWND hWnd, UINT id); UINT CbFindStr(HWND hWnd, UINT id, wchar_t *str); @@ -701,15 +699,12 @@ UINT CbGetSelectIndex(HWND hWnd, UINT id); UINT CbGetSelect(HWND hWnd, UINT id); void SetRange(HWND hWnd, UINT id, UINT start, UINT end); void SetPos(HWND hWnd, UINT id, UINT pos); -UINT LbAddStrA(HWND hWnd, UINT id, char *str, UINT data); -UINT LbInsertStrA(HWND hWnd, UINT id, UINT index, char *str, UINT data); void LbSelectIndex(HWND hWnd, UINT id, UINT index); UINT LbNum(HWND hWnd, UINT id); UINT LbFindData(HWND hWnd, UINT id, UINT data); UINT LbGetData(HWND hWnd, UINT id, UINT index); void LbSelect(HWND hWnd, UINT id, int data); void LbReset(HWND hWnd, UINT id); -UINT LbGetSelectIndex(HWND hWnd, UINT id); STATUS_WINDOW *StatusPrinterWindowStart(SOCK *s, wchar_t *account_name); void StatusPrinterWindowStop(STATUS_WINDOW *sw); void StatusPrinterWindowPrint(STATUS_WINDOW *sw, wchar_t *str); @@ -816,7 +811,6 @@ char *StringDlgA(HWND hWnd, wchar_t *title, wchar_t *info, char *def, UINT icon, UINT StringDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); void InitDialogInternational(HWND hWnd, void *pparam); void AdjustWindowAndControlSize(HWND hWnd, bool *need_resize, double *factor_x, double *factor_y); -void GetWindowAndControlSizeResizeScale(HWND hWnd, bool *need_resize, double *factor_x, double *factor_y); void AdjustDialogXY(UINT *x, UINT *y, UINT dlgfont_x, UINT dlgfont_y); HFONT GetDialogDefaultFont(); HFONT GetDialogDefaultFontEx(bool meiryo); @@ -834,11 +828,9 @@ void KakushiThread(THREAD *thread, void *param); KAKUSHI *InitKakushi(); void FreeKakushi(KAKUSHI *k); void ShowEasterEgg(HWND hWnd); -bool IsRegistedToDontShowFreeEditionDialog(char *server_name); void RegistToDontShowFreeEditionDialog(char *server_name); void ShowFreeInfoDialog(HWND hWnd, FREEINFO *info); UINT FreeInfoDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param); -void FreeInfoThread(THREAD *thread, void *param); bool Win32CnCheckAlreadyExists(bool lock); void RegistWindowsFirewallAll(); void RegistWindowsFirewallAllEx(char *dir);