1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

src/Mayaqua/Cfg: remove unused functions, variables

found by cppcheck

[src/Mayaqua/Cfg.c:669]: (style) Variable 'invalid_file' is assigned a value that is never used.
[src/Mayaqua/Cfg.c:2111]: (style) Variable 'v' is assigned a value that is never used.
[src/Mayaqua/Cfg.c:1114]: (style) The function 'CfgFolderToBufText' is never used.
[src/Mayaqua/Cfg.c:539]: (style) The function 'CfgRead' is never used.
[src/Mayaqua/Cfg.c:418]: (style) The function 'CfgSave' is never used.
[src/Mayaqua/Cfg.c:1425]: (style) The function 'CfgStrToType' is never used.
[src/Mayaqua/Cfg.c:708]: (style) The function 'CfgTest' is never used.
[src/Mayaqua/Cfg.c:704]: (style) The function 'CfgTest2' is never used.
[src/Mayaqua/Cfg.c:247]: (style) The function 'NewCfgRwW' is never used.
This commit is contained in:
Ilya Shipitsin 2018-11-27 01:52:27 +05:00
parent 4cbb8a8560
commit d72329c007
2 changed files with 0 additions and 73 deletions

View File

@ -244,10 +244,6 @@ CFG_RW *NewCfgRw(FOLDER **root, char *cfg_name)
{ {
return NewCfgRwEx(root, cfg_name, false); return NewCfgRwEx(root, cfg_name, false);
} }
CFG_RW *NewCfgRwW(FOLDER **root, wchar_t *cfg_name)
{
return NewCfgRwExW(root, cfg_name, false);
}
CFG_RW *NewCfgRwEx(FOLDER **root, char *cfg_name, bool dont_backup) CFG_RW *NewCfgRwEx(FOLDER **root, char *cfg_name, bool dont_backup)
{ {
wchar_t *cfg_name_w = CopyStrToUni(cfg_name); wchar_t *cfg_name_w = CopyStrToUni(cfg_name);
@ -556,7 +552,6 @@ FOLDER *CfgReadW(wchar_t *name)
FOLDER *f; FOLDER *f;
bool delete_new = false; bool delete_new = false;
bool binary_file = false; bool binary_file = false;
bool invalid_file = false;
UCHAR header[8]; UCHAR header[8];
bool has_eof = false; bool has_eof = false;
// Validate arguments // Validate arguments
@ -613,11 +608,6 @@ FOLDER *CfgReadW(wchar_t *name)
{ {
// Read the original file too if the size of temporary file is 0 // Read the original file too if the size of temporary file is 0
if (FileSize(o) == 0) if (FileSize(o) == 0)
{
invalid_file = true;
}
if (invalid_file)
{ {
FileClose(o); FileClose(o);
o = FileOpenW(name, false); o = FileOpenW(name, false);
@ -666,7 +656,6 @@ FOLDER *CfgReadW(wchar_t *name)
if (Cmp(hash1, hash2, SHA1_SIZE) != 0) if (Cmp(hash1, hash2, SHA1_SIZE) != 0)
{ {
// Corrupted file // Corrupted file
invalid_file = true;
FreeBuf(b); FreeBuf(b);
return NULL; return NULL;
} }
@ -700,46 +689,6 @@ FOLDER *CfgReadW(wchar_t *name)
return f; return f;
} }
// Test of Cfg
void CfgTest2(FOLDER *f, UINT n)
{
}
void CfgTest()
{
#if 0
FOLDER *root;
BUF *b;
Debug("\nCFG Test Begin\n");
root = CfgCreateFolder(NULL, TAG_ROOT);
CfgTest2(root, 5);
b = CfgFolderToBufText(root);
//Print("%s\n", b->Buf);
SeekBuf(b, 0, 0);
CfgDeleteFolder(root);
DumpBuf(b, "test1.config");
root = CfgBufTextToFolder(b);
FreeBuf(b);
b = CfgFolderToBufText(root);
// Print("%s\n", b->Buf);
DumpBuf(b, "test2.config");
FreeBuf(b);
CfgSave(root, "test.txt");
CfgDeleteFolder(root);
Debug("\nCFG Test End\n");
#endif
}
// Read one line // Read one line
char *CfgReadNextLine(BUF *b) char *CfgReadNextLine(BUF *b)
{ {
@ -1111,10 +1060,6 @@ BUF *CfgFolderToBufBin(FOLDER *f)
} }
// Convert the folder to a stream text // Convert the folder to a stream text
BUF *CfgFolderToBufText(FOLDER *f)
{
return CfgFolderToBufTextEx(f, false);
}
BUF *CfgFolderToBufTextEx(FOLDER *f, bool no_banner) BUF *CfgFolderToBufTextEx(FOLDER *f, bool no_banner)
{ {
BUF *b; BUF *b;
@ -1421,17 +1366,6 @@ void CfgAddData(BUF *b, UINT type, char *name, char *data, char *sub, UINT depth
Free(tmp); Free(tmp);
} }
// Convert the data type string to an integer value
UINT CfgStrToType(char *str)
{
if (!StrCmpi(str, TAG_INT)) return ITEM_TYPE_INT;
if (!StrCmpi(str, TAG_INT64)) return ITEM_TYPE_INT64;
if (!StrCmpi(str, TAG_BYTE)) return ITEM_TYPE_BYTE;
if (!StrCmpi(str, TAG_STRING)) return ITEM_TYPE_STRING;
if (!StrCmpi(str, TAG_BOOL)) return ITEM_TYPE_BOOL;
return 0;
}
// Convert the type of data to a string // Convert the type of data to a string
char *CfgTypeToStr(UINT type) char *CfgTypeToStr(UINT type)
{ {
@ -2101,14 +2035,12 @@ ITEM *CfgAddInt(FOLDER *f, char *name, UINT i)
// Adding a bool type // Adding a bool type
ITEM *CfgAddBool(FOLDER *f, char *name, bool b) ITEM *CfgAddBool(FOLDER *f, char *name, bool b)
{ {
bool v;
// Validate arguments // Validate arguments
if (f == NULL || name == NULL) if (f == NULL || name == NULL)
{ {
return NULL; return NULL;
} }
v = b ? 1 : 0;
return CfgCreateItem(f, name, ITEM_TYPE_BOOL, &b, sizeof(bool)); return CfgCreateItem(f, name, ITEM_TYPE_BOOL, &b, sizeof(bool));
} }

View File

@ -210,14 +210,11 @@ BUF *CfgGetBuf(FOLDER *f, char *name);
bool CfgGetStr(FOLDER *f, char *name, char *str, UINT size); bool CfgGetStr(FOLDER *f, char *name, char *str, UINT size);
bool CfgGetUniStr(FOLDER *f, char *name, wchar_t *str, UINT size); bool CfgGetUniStr(FOLDER *f, char *name, wchar_t *str, UINT size);
bool CfgIsItem(FOLDER *f, char *name); bool CfgIsItem(FOLDER *f, char *name);
void CfgTest();
void CfgTest2(FOLDER *f, UINT n);
char *CfgEscape(char *name); char *CfgEscape(char *name);
bool CfgCheckCharForName(char c); bool CfgCheckCharForName(char c);
char *CfgUnescape(char *str); char *CfgUnescape(char *str);
BUF *CfgFolderToBuf(FOLDER *f, bool textmode); BUF *CfgFolderToBuf(FOLDER *f, bool textmode);
BUF *CfgFolderToBufEx(FOLDER *f, bool textmode, bool no_banner); BUF *CfgFolderToBufEx(FOLDER *f, bool textmode, bool no_banner);
BUF *CfgFolderToBufText(FOLDER *f);
BUF *CfgFolderToBufTextEx(FOLDER *f, bool no_banner); BUF *CfgFolderToBufTextEx(FOLDER *f, bool no_banner);
BUF *CfgFolderToBufBin(FOLDER *f); BUF *CfgFolderToBufBin(FOLDER *f);
void CfgOutputFolderText(BUF *b, FOLDER *f, UINT depth); void CfgOutputFolderText(BUF *b, FOLDER *f, UINT depth);
@ -226,7 +223,6 @@ void CfgAddLine(BUF *b, char *str, UINT depth);
void CfgAddDeclare(BUF *b, char *name, UINT depth); void CfgAddDeclare(BUF *b, char *name, UINT depth);
void CfgAddEnd(BUF *b, UINT depth); void CfgAddEnd(BUF *b, UINT depth);
void CfgAddData(BUF *b, UINT type, char *name, char *data, char *sub, UINT depth); void CfgAddData(BUF *b, UINT type, char *name, char *data, char *sub, UINT depth);
UINT CfgStrToType(char *str);
char *CfgTypeToStr(UINT type); char *CfgTypeToStr(UINT type);
void CfgAddItemText(BUF *b, ITEM *t, UINT depth); void CfgAddItemText(BUF *b, ITEM *t, UINT depth);
bool CfgEnumFolderProc(FOLDER *f, void *param); bool CfgEnumFolderProc(FOLDER *f, void *param);
@ -248,7 +244,6 @@ FOLDER *CfgCreateRoot();
void CfgTest(); void CfgTest();
void CfgTest2(FOLDER *f, UINT n); void CfgTest2(FOLDER *f, UINT n);
CFG_RW *NewCfgRw(FOLDER **root, char *cfg_name); CFG_RW *NewCfgRw(FOLDER **root, char *cfg_name);
CFG_RW *NewCfgRwW(FOLDER **root, wchar_t *cfg_name);
CFG_RW *NewCfgRwEx(FOLDER **root, char *cfg_name, bool dont_backup); CFG_RW *NewCfgRwEx(FOLDER **root, char *cfg_name, bool dont_backup);
CFG_RW *NewCfgRwExW(FOLDER **root, wchar_t *cfg_name, bool dont_backup); CFG_RW *NewCfgRwExW(FOLDER **root, wchar_t *cfg_name, bool dont_backup);
CFG_RW *NewCfgRwEx2W(FOLDER **root, wchar_t *cfg_name, bool dont_backup, wchar_t *template_name); CFG_RW *NewCfgRwEx2W(FOLDER **root, wchar_t *cfg_name, bool dont_backup, wchar_t *template_name);