1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2026-04-20 05:49:26 +03:00

remove unused functions (identified by cppcheck)

[src/Cedar/Account.c:854]: (style) The function 'AddGroupTraffic' is never used.
[src/Mayaqua/Secure.c:1455]: (style) The function 'AddSecObjToEnumCache' is never used.
[src/Mayaqua/Network.c:18445]: (style) The function 'AddSockList' is never used.
[src/Cedar/Account.c:870]: (style) The function 'AddUserTraffic' is never used.
[src/Cedar/Server.c:1045]: (style) The function 'AdjoinEnumLogFile' is never used.
[src/Cedar/Admin.c:13780]: (style) The function 'AdminConnect' is never used.
[src/Mayaqua/Encrypt.c:855]: (style) The function 'BigNumToStr' is never used.
[src/Mayaqua/Str.c:2113]: (style) The function 'Bit128ToStr' is never used.
[src/Mayaqua/Encrypt.c:898]: (style) The function 'BufToBigNum' is never used.
[src/Mayaqua/Internat.c:1874]: (style) The function 'CalcStrToUtf8' is never used.
[src/Cedar/Hub.c:6689]: (style) The function 'CalcTrafficDiff' is never used.
[src/Mayaqua/Internat.c:1819]: (style) The function 'CalcUtf8ToStr' is never used.
[src/Mayaqua/Network.c:6495]: (style) The function 'CanGetTcpProcessId' is never used.
[src/Cedar/WinUi.c:7226]: (style) The function 'CbInsertStrA' is never used.
[src/Cedar/Client.c:3035]: (style) The function 'CcEnumObjectInSecure' is never used.
[src/Cedar/Client.c:2826]: (style) The function 'CcGetCommonProxySetting' is never used.
[src/Cedar/Client.c:2857]: (style) The function 'CcSetCommonProxySetting' is never used.
[src/Cedar/Cedar.c:575]: (style) The function 'CedarLog' is never used.
[src/Cedar/WinUi.c:9841]: (style) The function 'Center2' is never used.
[src/Mayaqua/Encrypt.c:814]: (style) The function 'CertTest' is never used.
[src/Mayaqua/Encrypt.c:809]: (style) The function 'CertTest2' is never used.
[src/Mayaqua/Encrypt.c:819]: (style) The function 'CertTest_' is never used.
[src/Mayaqua/Cfg.c:1705]: (style) The function 'CfgIsFolder' is never used.
This commit is contained in:
Ilya Shipitsin
2018-02-01 12:19:46 +05:00
committed by Moataz Elmasry
parent 56c4582da8
commit 79c06146a4
26 changed files with 0 additions and 476 deletions
-12
View File
@@ -1701,18 +1701,6 @@ bool CfgGetUniStr(FOLDER *f, char *name, wchar_t *str, UINT size)
return true;
}
// Check for the existence of a folder
bool CfgIsFolder(FOLDER *f, char *name)
{
// Validate arguments
if (f == NULL || name == NULL)
{
return false;
}
return (CfgGetFolder(f, name) == NULL) ? false : true;
}
// Check for the existence of item
bool CfgIsItem(FOLDER *f, char *name)
{
-1
View File
@@ -210,7 +210,6 @@ BUF *CfgGetBuf(FOLDER *f, char *name);
bool CfgGetStr(FOLDER *f, char *name, char *str, UINT size);
bool CfgGetUniStr(FOLDER *f, char *name, wchar_t *str, UINT size);
bool CfgIsItem(FOLDER *f, char *name);
bool CfgIsFolder(FOLDER *f, char *name);
void CfgTest();
void CfgTest2(FOLDER *f, UINT n);
char *CfgEscape(char *name);
-53
View File
@@ -805,21 +805,6 @@ UINT RsaPublicSize(K *k)
return ret;
}
// Stupid test
void CertTest2()
{
}
// Yagi test
void CertTest()
{
}
// Test function related to certificate
void CertTest_()
{
}
// Hash a pointer to a 32-bit
UINT HashPtrToUINT(void *p)
{
@@ -851,33 +836,6 @@ NAME *CopyName(NAME *n)
n->Country, n->State, n->Local);
}
// Convert a BIGNUM to a string
char *BigNumToStr(BIGNUM *bn)
{
BIO *bio;
BUF *b;
char *ret;
// Validate arguments
if (bn == NULL)
{
return NULL;
}
bio = NewBio();
BN_print(bio, bn);
b = BioToBuf(bio);
FreeBio(bio);
ret = ZeroMalloc(b->Size + 1);
Copy(ret, b->Buf, b->Size);
FreeBuf(b);
return ret;
}
// Convert the binary to the BIGNUM
BIGNUM *BinToBigNum(void *data, UINT size)
{
@@ -894,17 +852,6 @@ BIGNUM *BinToBigNum(void *data, UINT size)
return bn;
}
// Convert the buffer to a BIGNUM
BIGNUM *BufToBigNum(BUF *b)
{
if (b == NULL)
{
return NULL;
}
return BinToBigNum(b->Buf, b->Size);
}
// Convert a BIGNUM to a buffer
BUF *BigNumToBuf(const BIGNUM *bn)
{
-3
View File
@@ -388,7 +388,6 @@ UCHAR Rand8();
bool Rand1();
UINT HashPtrToUINT(void *p);
void CertTest();
BIO *BufToBio(BUF *b);
BUF *BioToBuf(BIO *bio);
BIO *NewBio();
@@ -481,8 +480,6 @@ void GetAllNameFromXEx(wchar_t *str, UINT size, X *x);
void GetAllNameFromXExA(char *str, UINT size, X *x);
BUF *BigNumToBuf(const BIGNUM *bn);
BIGNUM *BinToBigNum(void *data, UINT size);
BIGNUM *BufToBigNum(BUF *b);
char *BigNumToStr(BIGNUM *bn);
X_SERIAL *CloneXSerial(X_SERIAL *src);
bool CompareXSerial(X_SERIAL *s1, X_SERIAL *s2);
void GetXDigest(X *x, UCHAR *buf, bool sha1);
-55
View File
@@ -1815,33 +1815,6 @@ UINT Utf8ToStr(char *str, UINT str_size, BYTE *u, UINT size)
return ret;
}
// Get the size required when UTF-8 string is converted to ANSI string
UINT CalcUtf8ToStr(BYTE *u, UINT size)
{
UINT ret, uni_size;
wchar_t *tmp;
// Validate arguments
if (u == NULL)
{
return 0;
}
// Convert to Unicode
uni_size = CalcUtf8ToUni(u, size);
if (uni_size == 0)
{
return 0;
}
tmp = Malloc(uni_size);
Utf8ToUni(tmp, uni_size, u, size);
// Convert to ANSI
ret = CalcUniToStr(tmp);
Free(tmp);
return ret;
}
// Convert an ANSI string to UTF-8 string
UINT StrToUtf8(BYTE *u, UINT size, char *str)
{
@@ -1870,34 +1843,6 @@ UINT StrToUtf8(BYTE *u, UINT size, char *str)
return ret;
}
// Get the required buffer size to convert an ANSI string to an UTF-8 string
UINT CalcStrToUtf8(char *str)
{
UINT ret;
UINT uni_size;
wchar_t *tmp;
// Validate arguments
if (str == NULL)
{
return 0;
}
// Convert to Unicode
uni_size = CalcStrToUni(str);
if (uni_size == 0)
{
return 0;
}
tmp = Malloc(uni_size);
StrToUni(tmp, uni_size, str);
// Get the size as it was converted to UTF-8
ret = CalcUniToUtf8(tmp);
Free(tmp);
return ret;
}
// Convert Unicode string to ANSI string
UINT UniToStr(char *str, UINT size, wchar_t *s)
{
-2
View File
@@ -177,9 +177,7 @@ UINT CalcStrToUni(char *str);
UINT StrToUni(wchar_t *s, UINT size, char *str);
UINT CalcUniToStr(wchar_t *s);
UINT UniToStr(char *str, UINT size, wchar_t *s);
UINT CalcStrToUtf8(char *str);
UINT StrToUtf8(BYTE *u, UINT size, char *str);
UINT CalcUtf8ToStr(BYTE *u, UINT size);
UINT Utf8ToStr(char *str, UINT str_size, BYTE *u, UINT size);
bool IsSafeUniStr(wchar_t *str);
bool IsSafeUniChar(wchar_t c);
-53
View File
@@ -6490,38 +6490,6 @@ L_LOOP:
#endif // OS_WIN32
// Get whether the aquirement of the Process ID of the TCP connection succeed
bool CanGetTcpProcessId()
{
UINT i;
bool ret = false;
LIST *o = GetTcpTableList();
if (o == NULL)
{
return false;
}
for (i = 0;i < LIST_NUM(o);i++)
{
TCPTABLE *t = LIST_DATA(o, i);
if (t->ProcessId != 0)
{
ret = true;
break;
}
}
FreeTcpTableList(o);
return ret;
}
#define USE_OLD_GETIP
// Set the arp_filter in Linux
@@ -18415,27 +18383,6 @@ void FreeNetwork()
}
// Add a socket to socket list
void AddSockList(SOCKLIST *sl, SOCK *s)
{
// Validate arguments
if (sl == NULL || s == NULL)
{
return;
}
LockList(sl->SockList);
{
if (IsInList(sl->SockList, s) == false)
{
AddRef(s->ref);
Insert(sl->SockList, s);
}
}
UnlockList(sl->SockList);
}
// Remove the socket from socket list
void DelSockList(SOCKLIST *sl, SOCK *s)
{
-2
View File
@@ -1410,7 +1410,6 @@ void IntToSubnetMask4(IP *ip, UINT i);
bool GetNetBiosName(char *name, UINT size, IP *ip);
bool NormalizeMacAddress(char *dst, UINT size, char *src);
SOCKLIST *NewSockList();
void AddSockList(SOCKLIST *sl, SOCK *s);
void DelSockList(SOCKLIST *sl, SOCK *s);
void StopSockList(SOCKLIST *sl);
void FreeSockList(SOCKLIST *sl);
@@ -1432,7 +1431,6 @@ void PrintTcpTableList(LIST *o);
TCPTABLE *GetTcpTableFromEndPoint(LIST *o, IP *local_ip, UINT local_port, IP *remote_ip, UINT remote_port);
UINT GetTcpProcessIdFromSocket(SOCK *s);
UINT GetTcpProcessIdFromSocketReverse(SOCK *s);
bool CanGetTcpProcessId();
int connect_timeout(SOCKET s, struct sockaddr *addr, int size, int timeout, bool *cancel_flag);
void EnableNetworkNameCache();
void DisableNetworkNameCache();
-1
View File
@@ -201,7 +201,6 @@ bool ReadPack(BUF *b, PACK *p);
ELEMENT *ReadElement(BUF *b);
VALUE *ReadValue(BUF *b, UINT type);
void Bit160ToStr(char *str, UCHAR *data);
void Bit128ToStr(char *str, UCHAR *data);
VALUE *NewInt64Value(UINT64 i);
TOKEN_LIST *GetPackElementNames(PACK *p);
-19
View File
@@ -1451,25 +1451,6 @@ bool WriteSecData(SECURE *sec, bool private_obj, char *name, void *data, UINT si
return true;
}
// Add the information of the newly created object to the cache
void AddSecObjToEnumCache(SECURE *sec, char *name, UINT type, bool private_obj, UINT object)
{
SEC_OBJ *obj;
// Validate arguments
if (sec == NULL || name == NULL || sec->EnumCache == NULL)
{
return;
}
obj = ZeroMalloc(sizeof(SEC_OBJ));
obj->Name = CopyStr(name);
obj->Object = object;
obj->Private = private_obj;
obj->Type = type;
Add(sec->EnumCache, obj);
}
// Display the token information
void PrintSecInfo(SECURE *sec)
{
-1
View File
@@ -243,7 +243,6 @@ SEC_OBJ *CloneSecObject(SEC_OBJ *obj);
LIST *CloneEnumSecObject(LIST *o);
void EraseEnumSecObjectCache(SECURE *sec);
void DeleteSecObjFromEnumCache(SECURE *sec, char *name, UINT type);
void AddSecObjToEnumCache(SECURE *sec, char *name, UINT type, bool private_obj, UINT object);
bool WriteSecData(SECURE *sec, bool private_obj, char *name, void *data, UINT size);
int ReadSecDataFromObject(SECURE *sec, SEC_OBJ *obj, void *data, UINT size);
int ReadSecData(SECURE *sec, char *name, void *data, UINT size);
-15
View File
@@ -2109,21 +2109,6 @@ void Bit160ToStr(char *str, UCHAR *data)
data[10], data[11], data[12], data[13], data[14], data[15], data[16], data[17], data[18], data[19]);
}
// Make a string from a 128-bit sequence
void Bit128ToStr(char *str, UCHAR *data)
{
// Validate arguments
if (str == NULL || data == NULL)
{
return;
}
Format(str, 0,
"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8], data[9],
data[10], data[11], data[12], data[13], data[14], data[15]);
}
// Copy a string
char *CopyStr(char *str)
{