mirror of https://github.com/OpenVPN/openvpn-gui
cppcheck cleanup:
[openvpn_config.c:194]: (style) The function 'ConfigFileOptionExist' is never used. [localization.c:299]: (style) The function 'LocalizedDialogBox' is never used. [main.c:549]: (style) The function 'PrintErrorDebug' is never used. [main.c:583]: (style) The function 'init_security_attributes_allow_all' is never used. [misc.c:180]: (style) The function 'wcseq' is never used.pull/8/head
parent
bc94c7e951
commit
08538280d0
|
@ -295,13 +295,6 @@ LocalizedDialogBoxParam(const UINT dialogId, DLGPROC dialogFunc, const LPARAM pa
|
|||
}
|
||||
|
||||
|
||||
INT_PTR
|
||||
LocalizedDialogBox(const UINT dialogId, DLGPROC dialogFunc)
|
||||
{
|
||||
return LocalizedDialogBoxParam(dialogId, dialogFunc, 0);
|
||||
}
|
||||
|
||||
|
||||
HWND
|
||||
CreateLocalizedDialogParam(const UINT dialogId, DLGPROC dialogFunc, const LPARAM param)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,6 @@ int ShowLocalizedMsgEx(const UINT, LPCTSTR, const UINT, ...);
|
|||
HICON LoadLocalizedIcon(const UINT);
|
||||
LPCDLGTEMPLATE LocalizedDialogResource(const UINT);
|
||||
INT_PTR LocalizedDialogBoxParam(const UINT, DLGPROC, const LPARAM);
|
||||
INT_PTR LocalizedDialogBox(const UINT, DLGPROC);
|
||||
HWND CreateLocalizedDialogParam(const UINT, DLGPROC, const LPARAM);
|
||||
HWND CreateLocalizedDialog(const UINT, DLGPROC);
|
||||
INT_PTR CALLBACK LanguageSettingsDlgProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
|
47
main.c
47
main.c
|
@ -545,55 +545,8 @@ void PrintDebugMsg(TCHAR *msg)
|
|||
_ftprintf(o.debug_fp, _T("%s %s\n"), date, msg);
|
||||
fflush(o.debug_fp);
|
||||
}
|
||||
|
||||
void PrintErrorDebug(TCHAR *msg)
|
||||
{
|
||||
LPVOID lpMsgBuf;
|
||||
TCHAR *buf;
|
||||
|
||||
/* Get last error message */
|
||||
if (!FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM |
|
||||
FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL,
|
||||
GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||
(LPTSTR) &lpMsgBuf,
|
||||
0,
|
||||
NULL ))
|
||||
{
|
||||
/* FormatMessage failed! */
|
||||
PrintDebug(_T("FormatMessage() failed. %s "), msg);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Cut of CR/LFs */
|
||||
buf = (TCHAR *)lpMsgBuf;
|
||||
buf[_tcslen(buf) - 3] = '\0';
|
||||
|
||||
PrintDebug(_T("%s %s"), msg, (LPCTSTR)lpMsgBuf);
|
||||
|
||||
LocalFree(lpMsgBuf);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
init_security_attributes_allow_all (struct security_attributes *obj)
|
||||
{
|
||||
CLEAR (*obj);
|
||||
|
||||
obj->sa.nLength = sizeof (SECURITY_ATTRIBUTES);
|
||||
obj->sa.lpSecurityDescriptor = &obj->sd;
|
||||
obj->sa.bInheritHandle = FALSE;
|
||||
if (!InitializeSecurityDescriptor (&obj->sd, SECURITY_DESCRIPTOR_REVISION))
|
||||
return false;
|
||||
if (!SetSecurityDescriptorDacl (&obj->sd, TRUE, NULL, FALSE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#define PACKVERSION(major,minor) MAKELONG(minor,major)
|
||||
DWORD GetDllVersion(LPCTSTR lpszDllName)
|
||||
{
|
||||
|
|
2
main.h
2
main.h
|
@ -110,8 +110,6 @@ __snprintf_0(char *buf, size_t size, char *format, ...)
|
|||
}
|
||||
|
||||
void PrintDebugMsg(TCHAR *msg);
|
||||
void PrintErrorDebug(TCHAR *msg);
|
||||
bool init_security_attributes_allow_all (struct security_attributes *obj);
|
||||
#endif
|
||||
|
||||
DWORD GetDllVersion(LPCTSTR lpszDllName);
|
||||
|
|
7
misc.c
7
misc.c
|
@ -176,13 +176,6 @@ wcsbegins(LPCWSTR str, LPCWSTR begin)
|
|||
return (wcsncmp(str, begin, wcslen(begin)) == 0);
|
||||
}
|
||||
|
||||
BOOL
|
||||
wcseq(LPCWSTR str1, LPCWSTR str2)
|
||||
{
|
||||
return (wcscmp(str1, str2) == 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Force setting window as foreground window by simulating an ALT keypress
|
||||
*/
|
||||
|
|
1
misc.h
1
misc.h
|
@ -28,7 +28,6 @@ BOOL EnsureDirExists(LPTSTR);
|
|||
|
||||
BOOL streq(LPCSTR, LPCSTR);
|
||||
BOOL wcsbegins(LPCWSTR, LPCWSTR);
|
||||
BOOL wcseq(LPCWSTR, LPCWSTR);
|
||||
|
||||
BOOL ForceForegroundWindow(HWND);
|
||||
#endif
|
||||
|
|
|
@ -185,40 +185,3 @@ BuildFileList()
|
|||
FindClose(find_handle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns TRUE if option exist in config file.
|
||||
*/
|
||||
bool
|
||||
ConfigFileOptionExist(int config, const char *option)
|
||||
{
|
||||
FILE *fp;
|
||||
char line[256];
|
||||
TCHAR path[MAX_PATH];
|
||||
|
||||
_tcsncpy(path, o.conn[config].config_dir, _countof(path));
|
||||
if (path[_tcslen(path) - 1] != _T('\\'))
|
||||
_tcscat(path, _T("\\"));
|
||||
_tcsncat(path, o.conn[config].config_file, _countof(path) - _tcslen(path) - 1);
|
||||
|
||||
fp = _tfopen(path, _T("r"));
|
||||
if (fp == NULL)
|
||||
{
|
||||
ShowLocalizedMsg(IDS_ERR_OPEN_CONFIG, path);
|
||||
return false;
|
||||
}
|
||||
|
||||
while (fgets(line, sizeof(line), fp))
|
||||
{
|
||||
if (strncmp(line, option, strlen(option)) == 0)
|
||||
{
|
||||
fclose(fp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue