1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-09-19 18:20:40 +03:00

src/Mayaqua/Str: remove unused functions

[src/Mayaqua/Str.c:3019]: (style) The function 'CopyFormat' is never used.
[src/Mayaqua/Str.c:280]: (style) The function 'HexToInt64' is never used.
[src/Mayaqua/Str.c:2448]: (style) The function 'InChar' is never used.
[src/Mayaqua/Str.c:745]: (style) The function 'IniHasValue' is never used.
[src/Mayaqua/Str.c:692]: (style) The function 'IniInt64Value' is never used.
[src/Mayaqua/Str.c:726]: (style) The function 'IniUniStrValue' is never used.
[src/Mayaqua/Str.c:2138]: (style) The function 'IsPrintableAsciiStr' is never used.
[src/Mayaqua/Str.c:1045]: (style) The function 'NormalizeCrlf' is never used.
[src/Mayaqua/Str.c:2899]: (style) The function 'ReplaceFormatStringFor64' is never used.
[src/Mayaqua/Str.c:2442]: (style) The function 'SearchStri' is never used.
[src/Mayaqua/Str.c:3345]: (style) The function 'StrCheckSize' is never used.
[src/Mayaqua/Str.c:1386]: (style) The function 'StrListToStr' is never used.
[src/Mayaqua/Str.c:348]: (style) The function 'ToHex64' is never used.
[src/Mayaqua/Str.c:2803]: (style) The function 'ToStri' is never used.
[src/Mayaqua/Str.c:2797]: (style) The function 'ToStrx' is never used.
[src/Mayaqua/Str.c:2791]: (style) The function 'ToStrx8' is never used.
[src/Mayaqua/Str.c:1325]: (style) The function 'TokenListToList' is never used.
This commit is contained in:
Ilya Shipitsin 2018-08-12 15:34:51 +05:00
parent c9b56bf590
commit 1fd17c266a
2 changed files with 0 additions and 373 deletions

View File

@ -276,40 +276,6 @@ UINT SearchAsciiInBinary(void *data, UINT size, char *str, bool case_sensitive)
return ret; return ret;
} }
// Convert the HEX string to a 64 bit integer
UINT64 HexToInt64(char *str)
{
UINT len, i;
UINT64 ret = 0;
// Validate arguments
if (str == NULL)
{
return 0;
}
if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X'))
{
str += 2;
}
len = StrLen(str);
for (i = 0;i < len;i++)
{
char c = str[i];
if ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))
{
ret = ret * 16ULL + (UINT64)HexTo4Bit(c);
}
else
{
break;
}
}
return ret;
}
// Convert the HEX string to a 32 bit integer // Convert the HEX string to a 32 bit integer
UINT HexToInt(char *str) UINT HexToInt(char *str)
{ {
@ -344,43 +310,6 @@ UINT HexToInt(char *str)
return ret; return ret;
} }
// Convert a 64 bit integer to a HEX
void ToHex64(char *str, UINT64 value)
{
char tmp[MAX_SIZE];
UINT wp = 0;
UINT len, i;
// Validate arguments
if (str == NULL)
{
return;
}
// Set to empty character
StrCpy(tmp, 0, "");
// Append from the last digit
while (true)
{
UINT a = (UINT)(value % (UINT64)16);
value = value / (UINT)16;
tmp[wp++] = FourBitToHex(a);
if (value == 0)
{
tmp[wp++] = 0;
break;
}
}
// Reverse order
len = StrLen(tmp);
for (i = 0;i < len;i++)
{
str[len - i - 1] = tmp[i];
}
str[len] = 0;
}
// Convert a 32 bit integer into HEX // Convert a 32 bit integer into HEX
void ToHex(char *str, UINT value) void ToHex(char *str, UINT value)
{ {
@ -689,23 +618,6 @@ UINT IniIntValue(LIST *o, char *key)
return ToInt(e->Value); return ToInt(e->Value);
} }
UINT64 IniInt64Value(LIST *o, char *key)
{
INI_ENTRY *e;
// Validate arguments
if (o == NULL || key == NULL)
{
return 0;
}
e = GetIniEntry(o, key);
if (e == NULL)
{
return 0;
}
return ToInt64(e->Value);
}
char *IniStrValue(LIST *o, char *key) char *IniStrValue(LIST *o, char *key)
{ {
INI_ENTRY *e; INI_ENTRY *e;
@ -723,43 +635,6 @@ char *IniStrValue(LIST *o, char *key)
return e->Value; return e->Value;
} }
wchar_t *IniUniStrValue(LIST *o, char *key)
{
INI_ENTRY *e;
// Validate arguments
if (o == NULL || key == NULL)
{
return 0;
}
e = GetIniEntry(o, key);
if (e == NULL)
{
return L"";
}
return e->UnicodeValue;
}
// Check whether the specified value is in the INI
bool IniHasValue(LIST *o, char *key)
{
INI_ENTRY *e;
// Validate arguments
if (o == NULL || key == NULL)
{
return false;
}
e = GetIniEntry(o, key);
if (e == NULL)
{
return false;
}
return true;
}
// Release the INI // Release the INI
void FreeIni(LIST *o) void FreeIni(LIST *o)
@ -1041,54 +916,6 @@ bool IsAllUpperStr(char *str)
return true; return true;
} }
// Normalize the line breaks
char *NormalizeCrlf(char *str)
{
char *ret;
UINT ret_size, i, len, wp;
// Validate arguments
if (str == NULL)
{
return NULL;
}
len = StrLen(str);
ret_size = sizeof(char) * (len + 32) * 2;
ret = Malloc(ret_size);
wp = 0;
for (i = 0;i < len;i++)
{
char c = str[i];
switch (c)
{
case '\r':
if (str[i + 1] == '\n')
{
i++;
}
ret[wp++] = '\r';
ret[wp++] = '\n';
break;
case '\n':
ret[wp++] = '\r';
ret[wp++] = '\n';
break;
default:
ret[wp++] = c;
break;
}
}
ret[wp++] = 0;
return ret;
}
// Remove duplications from the token list // Remove duplications from the token list
TOKEN_LIST *UniqueToken(TOKEN_LIST *t) TOKEN_LIST *UniqueToken(TOKEN_LIST *t)
{ {
@ -1321,26 +1148,6 @@ bool IsEmptyStr(char *str)
} }
} }
// Convert the token list to a string list
LIST *TokenListToList(TOKEN_LIST *t)
{
UINT i;
LIST *o;
// Validate arguments
if (t == NULL)
{
return NULL;
}
o = NewListFast(NULL);
for (i = 0;i < t->NumTokens;i++)
{
Insert(o, CopyStr(t->Token[i]));
}
return o;
}
// Convert a string list to a token list // Convert a string list to a token list
TOKEN_LIST *ListToTokenList(LIST *o) TOKEN_LIST *ListToTokenList(LIST *o)
{ {
@ -1382,33 +1189,6 @@ void FreeStrList(LIST *o)
ReleaseList(o); ReleaseList(o);
} }
// Convert the string list to a string
BUF *StrListToStr(LIST *o)
{
BUF *b;
UINT i;
char c;
// Validate arguments
if (o == NULL)
{
return NULL;
}
b = NewBuf();
for (i = 0;i < LIST_NUM(o);i++)
{
char *s = LIST_DATA(o, i);
WriteBuf(b, s, StrLen(s) + 1);
}
c = 0;
WriteBuf(b, &c, 1);
SeekBuf(b, 0, 0);
return b;
}
// Convert a (NULL delimited) string to a list // Convert a (NULL delimited) string to a list
LIST *StrToStrList(char *str, UINT size) LIST *StrToStrList(char *str, UINT size)
{ {
@ -2134,30 +1914,6 @@ bool IsPrintableAsciiChar(char c)
return true; return true;
} }
// Check whether the string that can be displayed
bool IsPrintableAsciiStr(char *str)
{
UINT i, len;
// Validate arguments
if (str == NULL)
{
return false;
}
len = StrLen(str);
for (i = 0;i < len;i++)
{
char c = str[i];
if (IsPrintableAsciiChar(c) == false)
{
return false;
}
}
return true;
}
// Convert a string to a displayable string // Convert a string to a displayable string
void EnPrintableAsciiStr(char *str, char replace) void EnPrintableAsciiStr(char *str, char replace)
{ {
@ -2438,35 +2194,6 @@ UINT SearchStr(char *string, char *keyword, UINT start)
return SearchStrEx(string, keyword, start, true); return SearchStrEx(string, keyword, start, true);
} }
// Search for a string (Don't distinguish between upper / lower case)
UINT SearchStri(char *string, char *keyword, UINT start)
{
return SearchStrEx(string, keyword, start, false);
}
// Examine whether the string contains the specified character
bool InChar(char *string, char c)
{
UINT i, len;
// Validate arguments
if (string == NULL)
{
return false;
}
len = StrLen(string);
for (i = 0;i < len;i++)
{
if (string[i] == c)
{
return true;
}
}
return false;
}
// Return the position of the first found keyword in the string // Return the position of the first found keyword in the string
// (Found at first character: returns 0, Not found: returns INFINITE) // (Found at first character: returns 0, Not found: returns INFINITE)
UINT SearchStrEx(char *string, char *keyword, UINT start, bool case_sensitive) UINT SearchStrEx(char *string, char *keyword, UINT start, bool case_sensitive)
@ -2787,24 +2514,6 @@ void TrimLeft(char *str)
Free(buf); Free(buf);
} }
// Convert an integer to a hexadecimal string (8-digit fixed)
void ToStrx8(char *str, UINT i)
{
sprintf(str, "0x%08x", i);
}
// Convert an integer to a hexadecimal string
void ToStrx(char *str, UINT i)
{
sprintf(str, "0x%02x", i);
}
// Convert a signed integer to a string
void ToStri(char *str, int i)
{
sprintf(str, "%i", i);
}
// Convert an integer to a string // Convert an integer to a string
void ToStr(char *str, UINT i) void ToStr(char *str, UINT i)
{ {
@ -2895,33 +2604,6 @@ UINT ToInt(char *str)
return (UINT)strtoul(str, NULL, 0); return (UINT)strtoul(str, NULL, 0);
} }
// Replace a format string for 64-bit integer
char *ReplaceFormatStringFor64(char *fmt)
{
char *tmp;
char *ret;
UINT tmp_size;
// Validate arguments
if (fmt == NULL)
{
return NULL;
}
tmp_size = StrSize(fmt) * 2;
tmp = ZeroMalloc(tmp_size);
#ifdef OS_WIN32
ReplaceStrEx(tmp, tmp_size, fmt, "%ll", "%I64", false);
#else // OS_WIN32
ReplaceStrEx(tmp, tmp_size, fmt, "%I64", "%ll", false);
#endif // OS_WIN32
ret = CopyStr(tmp);
Free(tmp);
return ret;
}
// Display the string on the screen // Display the string on the screen
void PrintStr(char *str) void PrintStr(char *str)
{ {
@ -3015,32 +2697,6 @@ void Debug(char *fmt, ...)
va_end(args); va_end(args);
} }
// Format the string, and return the result
char *CopyFormat(char *fmt, ...)
{
char *buf;
char *ret;
UINT size;
va_list args;
// Validate arguments
if (fmt == NULL)
{
return NULL;
}
size = MAX(StrSize(fmt) * 10, MAX_SIZE * 10);
buf = Malloc(size);
va_start(args, fmt);
FormatArgs(buf, size, fmt, args);
ret = CopyStr(buf);
Free(buf);
va_end(args);
return ret;
}
// Format the string // Format the string
void Format(char *buf, UINT size, char *fmt, ...) void Format(char *buf, UINT size, char *fmt, ...)
{ {
@ -3341,18 +2997,6 @@ UINT StrCpyAllowOverlap(char *dst, UINT size, char *src)
return len; return len;
} }
// Check whether the string buffer is within the specified size
bool StrCheckSize(char *str, UINT size)
{
// Validate arguments
if (str == NULL || size == 0)
{
return false;
}
return StrCheckLen(str, size - 1);
}
// Make sure that the string is within the specified length // Make sure that the string is within the specified length
bool StrCheckLen(char *str, UINT len) bool StrCheckLen(char *str, UINT len)
{ {

View File

@ -133,7 +133,6 @@ struct INI_ENTRY
UINT StrLen(char *str); UINT StrLen(char *str);
UINT StrSize(char *str); UINT StrSize(char *str);
bool StrCheckLen(char *str, UINT len); bool StrCheckLen(char *str, UINT len);
bool StrCheckSize(char *str, UINT size);
UINT StrCpy(char *dst, UINT size, char *src); UINT StrCpy(char *dst, UINT size, char *src);
UINT StrCpyAllowOverlap(char *dst, UINT size, char *src); UINT StrCpyAllowOverlap(char *dst, UINT size, char *src);
UINT StrCat(char *dst, UINT size, char *src); UINT StrCat(char *dst, UINT size, char *src);
@ -146,7 +145,6 @@ int StrCmp(char *str1, char *str2);
int StrCmpi(char *str1, char *str2); int StrCmpi(char *str1, char *str2);
void FormatArgs(char *buf, UINT size, char *fmt, va_list args); void FormatArgs(char *buf, UINT size, char *fmt, va_list args);
void Format(char *buf, UINT size, char *fmt, ...); void Format(char *buf, UINT size, char *fmt, ...);
char *CopyFormat(char *fmt, ...);
void Print(char *fmt, ...); void Print(char *fmt, ...);
void PrintArgs(char *fmt, va_list args); void PrintArgs(char *fmt, va_list args);
void PrintStr(char *str); void PrintStr(char *str);
@ -156,9 +154,6 @@ UINT ToInt(char *str);
bool ToBool(char *str); bool ToBool(char *str);
int ToInti(char *str); int ToInti(char *str);
void ToStr(char *str, UINT i); void ToStr(char *str, UINT i);
void ToStri(char *str, int i);
void ToStrx(char *str, UINT i);
void ToStrx8(char *str, UINT i);
void TrimCrlf(char *str); void TrimCrlf(char *str);
void Trim(char *str); void Trim(char *str);
void TrimRight(char *str); void TrimRight(char *str);
@ -170,16 +165,13 @@ TOKEN_LIST *ParseToken(char *src, char *separator);
void InitStringLibrary(); void InitStringLibrary();
void FreeStringLibrary(); void FreeStringLibrary();
bool CheckStringLibrary(); bool CheckStringLibrary();
bool InChar(char *string, char c);
UINT SearchStrEx(char *string, char *keyword, UINT start, bool case_sensitive); UINT SearchStrEx(char *string, char *keyword, UINT start, bool case_sensitive);
UINT SearchStri(char *string, char *keyword, UINT start);
UINT SearchStr(char *string, char *keyword, UINT start); UINT SearchStr(char *string, char *keyword, UINT start);
UINT CalcReplaceStrEx(char *string, char *old_keyword, char *new_keyword, bool case_sensitive); UINT CalcReplaceStrEx(char *string, char *old_keyword, char *new_keyword, bool case_sensitive);
UINT ReplaceStrEx(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword, bool case_sensitive); UINT ReplaceStrEx(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword, bool case_sensitive);
UINT ReplaceStr(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword); UINT ReplaceStr(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword);
UINT ReplaceStri(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword); UINT ReplaceStri(char *dst, UINT size, char *string, char *old_keyword, char *new_keyword);
bool IsPrintableAsciiChar(char c); bool IsPrintableAsciiChar(char c);
bool IsPrintableAsciiStr(char *str);
void EnPrintableAsciiStr(char *str, char replace); void EnPrintableAsciiStr(char *str, char replace);
bool IsSafeChar(char c); bool IsSafeChar(char c);
bool IsSafeStr(char *str); bool IsSafeStr(char *str);
@ -193,16 +185,13 @@ bool StartWith(char *str, char *key);
bool EndWith(char *str, char *key); bool EndWith(char *str, char *key);
UINT64 ToInt64(char *str); UINT64 ToInt64(char *str);
void ToStr64(char *str, UINT64 value); void ToStr64(char *str, UINT64 value);
char *ReplaceFormatStringFor64(char *fmt);
TOKEN_LIST *ParseCmdLine(char *str); TOKEN_LIST *ParseCmdLine(char *str);
TOKEN_LIST *CopyToken(TOKEN_LIST *src); TOKEN_LIST *CopyToken(TOKEN_LIST *src);
TOKEN_LIST *NullToken(); TOKEN_LIST *NullToken();
bool IsNum(char *str); bool IsNum(char *str);
LIST *StrToStrList(char *str, UINT size); LIST *StrToStrList(char *str, UINT size);
BUF *StrListToStr(LIST *o);
void FreeStrList(LIST *o); void FreeStrList(LIST *o);
TOKEN_LIST *ListToTokenList(LIST *o); TOKEN_LIST *ListToTokenList(LIST *o);
LIST *TokenListToList(TOKEN_LIST *t);
bool IsEmptyStr(char *str); bool IsEmptyStr(char *str);
void BinToStrEx(char *str, UINT str_size, void *data, UINT data_size); void BinToStrEx(char *str, UINT str_size, void *data, UINT data_size);
void BinToStrEx2(char *str, UINT str_size, void *data, UINT data_size, char padding_char); void BinToStrEx2(char *str, UINT str_size, void *data, UINT data_size, char padding_char);
@ -214,7 +203,6 @@ void ToStr3(char *str, UINT size, UINT64 v);
void ToStrByte(char *str, UINT size, UINT64 v); void ToStrByte(char *str, UINT size, UINT64 v);
void ToStrByte1000(char *str, UINT size, UINT64 v); void ToStrByte1000(char *str, UINT size, UINT64 v);
TOKEN_LIST *UniqueToken(TOKEN_LIST *t); TOKEN_LIST *UniqueToken(TOKEN_LIST *t);
char *NormalizeCrlf(char *str);
bool IsAllUpperStr(char *str); bool IsAllUpperStr(char *str);
UINT StrWidth(char *str); UINT StrWidth(char *str);
char *MakeCharArray(char c, UINT count); char *MakeCharArray(char c, UINT count);
@ -226,10 +214,7 @@ LIST *ReadIni(BUF *b);
INI_ENTRY *GetIniEntry(LIST *o, char *key); INI_ENTRY *GetIniEntry(LIST *o, char *key);
void FreeIni(LIST *o); void FreeIni(LIST *o);
UINT IniIntValue(LIST *o, char *key); UINT IniIntValue(LIST *o, char *key);
UINT64 IniInt64Value(LIST *o, char *key);
char *IniStrValue(LIST *o, char *key); char *IniStrValue(LIST *o, char *key);
wchar_t *IniUniStrValue(LIST *o, char *key);
bool IniHasValue(LIST *o, char *key);
bool InStr(char *str, char *keyword); bool InStr(char *str, char *keyword);
bool InStrEx(char *str, char *keyword, bool case_sensitive); bool InStrEx(char *str, char *keyword, bool case_sensitive);
bool InStrList(char *target_str, char *tokens, char *splitter, bool case_sensitive); bool InStrList(char *target_str, char *tokens, char *splitter, bool case_sensitive);
@ -240,9 +225,7 @@ bool IsCharInStr(char *str, char c);
UINT HexTo4Bit(char c); UINT HexTo4Bit(char c);
char FourBitToHex(UINT value); char FourBitToHex(UINT value);
void ToHex(char *str, UINT value); void ToHex(char *str, UINT value);
void ToHex64(char *str, UINT64 value);
UINT HexToInt(char *str); UINT HexToInt(char *str);
UINT64 HexToInt64(char *str);
UINT SearchAsciiInBinary(void *data, UINT size, char *str, bool case_sensitive); UINT SearchAsciiInBinary(void *data, UINT size, char *str, bool case_sensitive);
void IntListToStr(char *str, UINT str_size, LIST *o, char *separate_str); void IntListToStr(char *str, UINT str_size, LIST *o, char *separate_str);
LIST *StrToIntList(char *str, bool sorted); LIST *StrToIntList(char *str, bool sorted);