From 4760b3d0c3ef1eecfaf9b8b511416da41db97eee Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Sun, 6 Jan 2019 18:34:04 +0500 Subject: [PATCH 1/4] src/Cedar/AzureClient: remove unused function found by cppcheck [src/Cedar/AzureClient.c:526]: (style) The function 'AcGetEnable' is never used. --- src/Cedar/AzureClient.c | 12 ------------ src/Cedar/AzureClient.h | 1 - 2 files changed, 13 deletions(-) diff --git a/src/Cedar/AzureClient.c b/src/Cedar/AzureClient.c index 78d5e01b..e3376b8f 100644 --- a/src/Cedar/AzureClient.c +++ b/src/Cedar/AzureClient.c @@ -522,18 +522,6 @@ void AcMainThread(THREAD *thread, void *param) } } -// Get enabled or disabled VPN Azure client -bool AcGetEnable(AZURE_CLIENT *ac) -{ - // Validate arguments - if (ac == NULL) - { - return false; - } - - return ac->IsEnabled; -} - // Enable or disable VPN Azure client void AcSetEnable(AZURE_CLIENT *ac, bool enabled) { diff --git a/src/Cedar/AzureClient.h b/src/Cedar/AzureClient.h index ac246205..4fc31e51 100644 --- a/src/Cedar/AzureClient.h +++ b/src/Cedar/AzureClient.h @@ -166,7 +166,6 @@ void FreeAzureClient(AZURE_CLIENT *ac); void AcApplyCurrentConfig(AZURE_CLIENT *ac, DDNS_CLIENT_STATUS *ddns_status); void AcMainThread(THREAD *thread, void *param); void AcSetEnable(AZURE_CLIENT *ac, bool enabled); -bool AcGetEnable(AZURE_CLIENT *ac); void AcWaitForRequest(AZURE_CLIENT *ac, SOCK *s, AZURE_PARAM *param); From 9d4d11155540aea2c856961f58831e9620b0d226 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Sun, 6 Jan 2019 18:43:51 +0500 Subject: [PATCH 2/4] src/Cedar/CM: remove unused function, variables found by cppcheck [src/Cedar/CM.c:4509]: (style) Variable 'easy' is assigned a value that is never used. [src/Cedar/CM.c:4547]: (style) Variable 'hub_name' is assigned a value that is never used. [src/Cedar/CM.c:4609]: (style) Variable 'is_account' is assigned a value that is never used. [src/Cedar/CM.c:8545]: (style) The function 'CmLoadK' is never used. --- src/Cedar/CM.c | 14 -------------- src/Cedar/CMInner.h | 1 - 2 files changed, 15 deletions(-) diff --git a/src/Cedar/CM.c b/src/Cedar/CM.c index 31e47d0d..4df71871 100644 --- a/src/Cedar/CM.c +++ b/src/Cedar/CM.c @@ -4504,9 +4504,6 @@ HMENU CmCreateRecentSubMenu(HWND hWnd, UINT start_id) UINT i; RPC_CLIENT_ENUM_ACCOUNT a; LIST *o; - bool easy; - - easy = cm->CmSetting.EasyMode; Zero(&a, sizeof(a)); @@ -4534,7 +4531,6 @@ HMENU CmCreateRecentSubMenu(HWND hWnd, UINT start_id) wchar_t tmp[MAX_PATH]; wchar_t *account_name; char *server_name; - char *hub_name; UINT pos; if (h == NULL) @@ -4544,7 +4540,6 @@ HMENU CmCreateRecentSubMenu(HWND hWnd, UINT start_id) account_name = item->AccountName; server_name = item->ServerName; - hub_name = item->HubName; UniStrCpy(tmp, sizeof(tmp), account_name); @@ -4586,7 +4581,6 @@ HMENU CmCreateTraySubMenu(HWND hWnd, bool flag, UINT start_id) if (status_str != NULL) { bool b = false; - bool is_account = false; if (UniStrCmpi(status_str, _UU("CM_ACCOUNT_OFFLINE")) == 0) { @@ -4594,8 +4588,6 @@ HMENU CmCreateTraySubMenu(HWND hWnd, bool flag, UINT start_id) { b = true; } - - is_account = true; } if (UniStrCmpi(status_str, _UU("CM_ACCOUNT_ONLINE")) == 0 || @@ -4605,8 +4597,6 @@ HMENU CmCreateTraySubMenu(HWND hWnd, bool flag, UINT start_id) { b = true; } - - is_account = true; } if (b) @@ -8542,10 +8532,6 @@ bool CmLoadXExW(HWND hWnd, X **x, wchar_t *filename, UINT size) } // Read the secret key -bool CmLoadK(HWND hWnd, K **k) -{ - return CmLoadKEx(hWnd, k, NULL, 0); -} bool CmLoadKEx(HWND hWnd, K **k, char *filename, UINT size) { wchar_t *filename_w = CopyStrToUni(filename); diff --git a/src/Cedar/CMInner.h b/src/Cedar/CMInner.h index 046042ec..764f619a 100644 --- a/src/Cedar/CMInner.h +++ b/src/Cedar/CMInner.h @@ -506,7 +506,6 @@ void CmEditAccountDlgInit(HWND hWnd, CM_ACCOUNT *a); void CmEditAccountDlgOnOk(HWND hWnd, CM_ACCOUNT *a); void CmEditAccountDlgStartEnumHub(HWND hWnd, CM_ACCOUNT *a); bool CmLoadXAndK(HWND hWnd, X **x, K **k); -bool CmLoadK(HWND hWnd, K **k); bool CmLoadKEx(HWND hWnd, K **k, char *filename, UINT size); bool CmLoadKExW(HWND hWnd, K **k, wchar_t *filename, UINT size); bool CmLoadXFromFileOrSecureCard(HWND hWnd, X **x); From 266f013880679ed9b6cb6b6dcd5d483070910566 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Sun, 6 Jan 2019 18:49:56 +0500 Subject: [PATCH 3/4] src/Cedar/Command: remove redundant assignment found by cppcheck [src/Cedar/Command.c:23220] -> [src/Cedar/Command.c:23232]: (style) Variable 'len' is reassigned a value before the old one has been used. --- src/Cedar/Command.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Cedar/Command.c b/src/Cedar/Command.c index 5da6a795..617f3c1e 100644 --- a/src/Cedar/Command.c +++ b/src/Cedar/Command.c @@ -23229,7 +23229,6 @@ void CtEscapeCsv(wchar_t *dst, UINT size, wchar_t *src){ } // If there is no character that need to be escaped in the input characters, copy it to the output - len = UniStrLen(src); for (i=0; i Date: Sun, 6 Jan 2019 18:53:18 +0500 Subject: [PATCH 4/4] src/Cedar/Account: remove unused functions found by cppcheck [src/Cedar/Account.c:523]: (style) The function 'GetUserPolicy' is never used. [src/Cedar/Account.c:163]: (style) The function 'NormalizePolicyName' is never used. --- src/Cedar/Account.c | 38 -------------------------------------- src/Cedar/Account.h | 3 --- 2 files changed, 41 deletions(-) diff --git a/src/Cedar/Account.c b/src/Cedar/Account.c index 170c663b..99bd6e6a 100644 --- a/src/Cedar/Account.c +++ b/src/Cedar/Account.c @@ -159,18 +159,6 @@ POLICY_ITEM policy_item[] = {37, true, true, 1, 4095, 0, "POL_INT_VLAN"}, // VLanId }; -// Normalize policy name -char *NormalizePolicyName(char *name) -{ - // Validate arguments - if (name == NULL) - { - return NULL; - } - - return PolicyIdToStr(PolicyStrToId(name)); -} - // Format policy value void FormatPolicyValue(wchar_t *str, UINT size, UINT id, UINT value) { @@ -519,32 +507,6 @@ void SetUserPolicy(USER *u, POLICY *policy) Unlock(u->lock); } -// Get user policy -POLICY *GetUserPolicy(USER *u) -{ - POLICY *ret; - // Validate arguments - if (u == NULL) - { - return NULL; - } - - Lock(u->lock); - { - if (u->Policy == NULL) - { - ret = NULL; - } - else - { - ret = ClonePolicy(u->Policy); - } - } - Unlock(u->lock); - - return ret; -} - // Set group policy void SetGroupPolicy(USERGROUP *g, POLICY *policy) { diff --git a/src/Cedar/Account.h b/src/Cedar/Account.h index dfef9039..7adc64ec 100644 --- a/src/Cedar/Account.h +++ b/src/Cedar/Account.h @@ -295,7 +295,6 @@ POLICY *GetDefaultPolicy(); POLICY *ClonePolicy(POLICY *policy); void SetUserPolicy(USER *u, POLICY *policy); void OverwritePolicy(POLICY **target, POLICY *p); -POLICY *GetUserPolicy(USER *u); void SetGroupPolicy(USERGROUP *g, POLICY *policy); POLICY *GetGroupPolicy(USERGROUP *g); wchar_t *GetPolicyTitle(UINT id); @@ -309,8 +308,6 @@ char *PolicyIdToStr(UINT i); POLICY_ITEM *GetPolicyItem(UINT id); void GetPolicyValueRangeStr(wchar_t *str, UINT size, UINT id); void FormatPolicyValue(wchar_t *str, UINT size, UINT id, UINT value); -char *NormalizePolicyName(char *name); - #endif // ACCOUNT_H