mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-09 03:00:41 +03:00
Merge pull request #818 from chipitsine/cleanup
Merge PR #818: src/Mayaqua/Cfg: remove unused functions, variables
This commit is contained in:
commit
70ee8abae8
@ -244,10 +244,6 @@ CFG_RW *NewCfgRw(FOLDER **root, char *cfg_name)
|
||||
{
|
||||
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)
|
||||
{
|
||||
wchar_t *cfg_name_w = CopyStrToUni(cfg_name);
|
||||
@ -556,7 +552,6 @@ FOLDER *CfgReadW(wchar_t *name)
|
||||
FOLDER *f;
|
||||
bool delete_new = false;
|
||||
bool binary_file = false;
|
||||
bool invalid_file = false;
|
||||
UCHAR header[8];
|
||||
bool has_eof = false;
|
||||
// Validate arguments
|
||||
@ -613,11 +608,6 @@ FOLDER *CfgReadW(wchar_t *name)
|
||||
{
|
||||
// Read the original file too if the size of temporary file is 0
|
||||
if (FileSize(o) == 0)
|
||||
{
|
||||
invalid_file = true;
|
||||
}
|
||||
|
||||
if (invalid_file)
|
||||
{
|
||||
FileClose(o);
|
||||
o = FileOpenW(name, false);
|
||||
@ -666,7 +656,6 @@ FOLDER *CfgReadW(wchar_t *name)
|
||||
if (Cmp(hash1, hash2, SHA1_SIZE) != 0)
|
||||
{
|
||||
// Corrupted file
|
||||
invalid_file = true;
|
||||
FreeBuf(b);
|
||||
return NULL;
|
||||
}
|
||||
@ -700,46 +689,6 @@ FOLDER *CfgReadW(wchar_t *name)
|
||||
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
|
||||
char *CfgReadNextLine(BUF *b)
|
||||
{
|
||||
@ -1111,10 +1060,6 @@ BUF *CfgFolderToBufBin(FOLDER *f)
|
||||
}
|
||||
|
||||
// Convert the folder to a stream text
|
||||
BUF *CfgFolderToBufText(FOLDER *f)
|
||||
{
|
||||
return CfgFolderToBufTextEx(f, false);
|
||||
}
|
||||
BUF *CfgFolderToBufTextEx(FOLDER *f, bool no_banner)
|
||||
{
|
||||
BUF *b;
|
||||
@ -1421,17 +1366,6 @@ void CfgAddData(BUF *b, UINT type, char *name, char *data, char *sub, UINT depth
|
||||
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
|
||||
char *CfgTypeToStr(UINT type)
|
||||
{
|
||||
@ -2101,14 +2035,12 @@ ITEM *CfgAddInt(FOLDER *f, char *name, UINT i)
|
||||
// Adding a bool type
|
||||
ITEM *CfgAddBool(FOLDER *f, char *name, bool b)
|
||||
{
|
||||
bool v;
|
||||
// Validate arguments
|
||||
if (f == NULL || name == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v = b ? 1 : 0;
|
||||
return CfgCreateItem(f, name, ITEM_TYPE_BOOL, &b, sizeof(bool));
|
||||
}
|
||||
|
||||
|
@ -210,14 +210,11 @@ 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);
|
||||
void CfgTest();
|
||||
void CfgTest2(FOLDER *f, UINT n);
|
||||
char *CfgEscape(char *name);
|
||||
bool CfgCheckCharForName(char c);
|
||||
char *CfgUnescape(char *str);
|
||||
BUF *CfgFolderToBuf(FOLDER *f, bool textmode);
|
||||
BUF *CfgFolderToBufEx(FOLDER *f, bool textmode, bool no_banner);
|
||||
BUF *CfgFolderToBufText(FOLDER *f);
|
||||
BUF *CfgFolderToBufTextEx(FOLDER *f, bool no_banner);
|
||||
BUF *CfgFolderToBufBin(FOLDER *f);
|
||||
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 CfgAddEnd(BUF *b, UINT depth);
|
||||
void CfgAddData(BUF *b, UINT type, char *name, char *data, char *sub, UINT depth);
|
||||
UINT CfgStrToType(char *str);
|
||||
char *CfgTypeToStr(UINT type);
|
||||
void CfgAddItemText(BUF *b, ITEM *t, UINT depth);
|
||||
bool CfgEnumFolderProc(FOLDER *f, void *param);
|
||||
@ -248,7 +244,6 @@ FOLDER *CfgCreateRoot();
|
||||
void CfgTest();
|
||||
void CfgTest2(FOLDER *f, UINT n);
|
||||
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 *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);
|
||||
|
Loading…
Reference in New Issue
Block a user