mirror of
https://github.com/SoftEtherVPN/SoftEtherVPN.git
synced 2024-11-22 09:29:52 +03:00
src/Mayaqua/FileIO: remove unused functions
[src/Mayaqua/FileIO.c:2299]: (style) The function 'ConvertPath' is never used. [src/Mayaqua/FileIO.c:728]: (style) The function 'ConvertSafeFileNameW' is never used. [src/Mayaqua/FileIO.c:2359]: (style) The function 'DeleteDirInner' is never used. [src/Mayaqua/FileIO.c:2232]: (style) The function 'FileCloseAndDelete' is never used. [src/Mayaqua/FileIO.c:2748]: (style) The function 'FileCreateInner' is never used. [src/Mayaqua/FileIO.c:2537]: (style) The function 'FileDeleteInner' is never used. [src/Mayaqua/FileIO.c:2858]: (style) The function 'FileOpenInner' is never used. [src/Mayaqua/FileIO.c:2276]: (style) The function 'FileRenameInner' is never used. [src/Mayaqua/FileIO.c:680]: (style) The function 'FileReplaceRename' is never used. [src/Mayaqua/FileIO.c:2581]: (style) The function 'FileSizeEx' is never used. [src/Mayaqua/FileIO.c:2812]: (style) The function 'FileWriteAll' is never used. [src/Mayaqua/FileIO.c:1992]: (style) The function 'GetCurrentDir' is never used. [src/Mayaqua/FileIO.c:765]: (style) The function 'GetDiskFreeW' is never used. [src/Mayaqua/FileIO.c:1852]: (style) The function 'IsFileExistsInner' is never used. [src/Mayaqua/FileIO.c:235]: (style) The function 'IsFileWriteLocked' is never used. [src/Mayaqua/FileIO.c:2494]: (style) The function 'MakeDirInner' is never used. [src/Mayaqua/FileIO.c:1568]: (style) The function 'MakeSafeFileNameW' is never used. [src/Mayaqua/FileIO.c:1941]: (style) The function 'ParseSplitedPath' is never used. [src/Mayaqua/FileIO.c:995]: (style) The function 'SafeFileNameW' is never used. [src/Mayaqua/FileIO.c:2369]: (style) The function 'FileSizeExW' is never used. [src/Mayaqua/FileIO.c:1848]: (style) The function 'GetCurrentDirW' is never used.
This commit is contained in:
parent
0b9bdc44f8
commit
6c9a0ddbfe
@ -232,24 +232,6 @@ bool IsFileWriteLockedW(wchar_t *name)
|
||||
|
||||
return false;
|
||||
}
|
||||
bool IsFileWriteLocked(char *name)
|
||||
{
|
||||
bool ret;
|
||||
wchar_t *tmp;
|
||||
// Validate arguments
|
||||
if (name == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
tmp = CopyStrToUni(name);
|
||||
|
||||
ret = IsFileWriteLockedW(tmp);
|
||||
|
||||
Free(tmp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Creating a ZIP packer
|
||||
ZIP_PACKER *NewZipPacker()
|
||||
@ -677,17 +659,6 @@ bool IsFileW(wchar_t *name)
|
||||
}
|
||||
|
||||
// Rename to replace the file
|
||||
bool FileReplaceRename(char *old_name, char *new_name)
|
||||
{
|
||||
wchar_t *old_name_w = CopyStrToUni(old_name);
|
||||
wchar_t *new_name_w = CopyStrToUni(new_name);
|
||||
bool ret = FileReplaceRenameW(old_name_w, new_name_w);
|
||||
|
||||
Free(old_name_w);
|
||||
Free(new_name_w);
|
||||
|
||||
return ret;
|
||||
}
|
||||
bool FileReplaceRenameW(wchar_t *old_name, wchar_t *new_name)
|
||||
{
|
||||
// Validate arguments
|
||||
@ -725,24 +696,6 @@ void ConvertSafeFileName(char *dst, UINT size, char *src)
|
||||
}
|
||||
}
|
||||
}
|
||||
void ConvertSafeFileNameW(wchar_t *dst, UINT size, wchar_t *src)
|
||||
{
|
||||
UINT i;
|
||||
// Validate arguments
|
||||
if (dst == NULL || src == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UniStrCpy(dst, size, src);
|
||||
for (i = 0;i < UniStrLen(dst);i++)
|
||||
{
|
||||
if (UniIsSafeChar(dst[i]) == false)
|
||||
{
|
||||
dst[i] = L'_';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the free disk space
|
||||
bool GetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size)
|
||||
@ -762,23 +715,6 @@ bool GetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total
|
||||
|
||||
return ret;
|
||||
}
|
||||
bool GetDiskFreeW(wchar_t *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size)
|
||||
{
|
||||
bool ret;
|
||||
// Validate arguments
|
||||
if (path == NULL)
|
||||
{
|
||||
path = L"./";
|
||||
}
|
||||
|
||||
#ifdef OS_WIN32
|
||||
ret = Win32GetDiskFreeW(path, free_size, used_size, total_size);
|
||||
#else // OS_WIN32
|
||||
ret = UnixGetDiskFreeW(path, free_size, used_size, total_size);
|
||||
#endif // OS_WIN32
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Enumeration of direction with all sub directories
|
||||
TOKEN_LIST *EnumDirWithSubDirs(char *dirname)
|
||||
@ -992,10 +928,6 @@ void UniSafeFileName(wchar_t *name)
|
||||
name[i] = c;
|
||||
}
|
||||
}
|
||||
void SafeFileNameW(wchar_t *name)
|
||||
{
|
||||
UniSafeFileName(name);
|
||||
}
|
||||
|
||||
// Read HamCore file
|
||||
BUF *ReadHamcoreW(wchar_t *filename)
|
||||
@ -1565,24 +1497,6 @@ void MakeSafeFileName(char *dst, UINT size, char *src)
|
||||
|
||||
StrCpy(dst, size, tmp);
|
||||
}
|
||||
void MakeSafeFileNameW(wchar_t *dst, UINT size, wchar_t *src)
|
||||
{
|
||||
wchar_t tmp[MAX_PATH];
|
||||
// Validate arguments
|
||||
if (dst == NULL || src == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UniStrCpy(tmp, sizeof(tmp), src);
|
||||
UniReplaceStrEx(tmp, sizeof(tmp), tmp, L"..", L"__", false);
|
||||
UniReplaceStrEx(tmp, sizeof(tmp), tmp, L"/", L"_", false);
|
||||
UniReplaceStrEx(tmp, sizeof(tmp), tmp, L"\\", L"_", false);
|
||||
UniReplaceStrEx(tmp, sizeof(tmp), tmp, L"@", L"_", false);
|
||||
UniReplaceStrEx(tmp, sizeof(tmp), tmp, L"|", L"_", false);
|
||||
|
||||
UniStrCpy(dst, size, tmp);
|
||||
}
|
||||
|
||||
// Get the file name from the file path
|
||||
void GetFileNameFromFilePathW(wchar_t *dst, UINT size, wchar_t *filepath)
|
||||
@ -1849,15 +1763,6 @@ bool IsFileExistsW(wchar_t *name)
|
||||
|
||||
return IsFileExistsInnerW(tmp);
|
||||
}
|
||||
bool IsFileExistsInner(char *name)
|
||||
{
|
||||
wchar_t *name_w = CopyStrToUni(name);
|
||||
bool ret = IsFileExistsInnerW(name_w);
|
||||
|
||||
Free(name_w);
|
||||
|
||||
return ret;
|
||||
}
|
||||
bool IsFileExistsInnerW(wchar_t *name)
|
||||
{
|
||||
IO *o;
|
||||
@ -1938,65 +1843,6 @@ UNI_TOKEN_LIST *ParseSplitedPathW(wchar_t *path)
|
||||
|
||||
return ret;
|
||||
}
|
||||
TOKEN_LIST *ParseSplitedPath(char *path)
|
||||
{
|
||||
TOKEN_LIST *ret;
|
||||
char *tmp = CopyStr(path);
|
||||
char *split_str;
|
||||
UINT i;
|
||||
|
||||
Trim(tmp);
|
||||
TrimCrlf(tmp);
|
||||
Trim(tmp);
|
||||
TrimCrlf(tmp);
|
||||
|
||||
#ifdef OS_WIN32
|
||||
split_str = ";";
|
||||
#else // OS_WIN32
|
||||
split_str = ":";
|
||||
#endif // OS_WIN32
|
||||
|
||||
ret = ParseToken(tmp, split_str);
|
||||
|
||||
if (ret != NULL)
|
||||
{
|
||||
for (i = 0;i < ret->NumTokens;i++)
|
||||
{
|
||||
Trim(ret->Token[i]);
|
||||
TrimCrlf(ret->Token[i]);
|
||||
Trim(ret->Token[i]);
|
||||
TrimCrlf(ret->Token[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Free(tmp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Get the current directory
|
||||
void GetCurrentDirW(wchar_t *name, UINT size)
|
||||
{
|
||||
// Validate arguments
|
||||
if (name == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef OS_WIN32
|
||||
Win32GetCurrentDirW(name, size);
|
||||
#else // OS_WIN32
|
||||
UnixGetCurrentDirW(name, size);
|
||||
#endif // OS_WIN32
|
||||
}
|
||||
void GetCurrentDir(char *name, UINT size)
|
||||
{
|
||||
wchar_t name_w[MAX_PATH];
|
||||
|
||||
GetCurrentDirW(name_w, sizeof(name_w));
|
||||
|
||||
UniToStr(name, size, name_w);
|
||||
}
|
||||
|
||||
// Get the relative path
|
||||
bool GetRelativePathW(wchar_t *dst, UINT size, wchar_t *fullpath, wchar_t *basepath)
|
||||
@ -2228,24 +2074,6 @@ void NormalizePath(char *dst, UINT size, char *src)
|
||||
UniToStr(dst, size, dst_w);
|
||||
}
|
||||
|
||||
// Close and delete the file
|
||||
void FileCloseAndDelete(IO *o)
|
||||
{
|
||||
wchar_t *name;
|
||||
// Validate arguments
|
||||
if (o == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
name = CopyUniStr(o->NameW);
|
||||
FileClose(o);
|
||||
|
||||
FileDeleteW(name);
|
||||
|
||||
Free(name);
|
||||
}
|
||||
|
||||
// Rename the file
|
||||
bool FileRename(char *old_name, char *new_name)
|
||||
{
|
||||
@ -2273,17 +2101,6 @@ bool FileRenameW(wchar_t *old_name, wchar_t *new_name)
|
||||
|
||||
return FileRenameInnerW(tmp1, tmp2);
|
||||
}
|
||||
bool FileRenameInner(char *old_name, char *new_name)
|
||||
{
|
||||
wchar_t *old_name_w = CopyStrToUni(old_name);
|
||||
wchar_t *new_name_w = CopyStrToUni(new_name);
|
||||
bool ret = FileRenameInnerW(old_name_w, new_name_w);
|
||||
|
||||
Free(old_name_w);
|
||||
Free(new_name_w);
|
||||
|
||||
return ret;
|
||||
}
|
||||
bool FileRenameInnerW(wchar_t *old_name, wchar_t *new_name)
|
||||
{
|
||||
// Validate arguments
|
||||
@ -2296,24 +2113,6 @@ bool FileRenameInnerW(wchar_t *old_name, wchar_t *new_name)
|
||||
}
|
||||
|
||||
// Convert the path
|
||||
void ConvertPath(char *path)
|
||||
{
|
||||
UINT i, len;
|
||||
#ifdef PATH_BACKSLASH
|
||||
char new_char = '\\';
|
||||
#else
|
||||
char new_char = '/';
|
||||
#endif
|
||||
|
||||
len = StrLen(path);
|
||||
for (i = 0;i < len;i++)
|
||||
{
|
||||
if (path[i] == '\\' || path[i] == '/')
|
||||
{
|
||||
path[i] = new_char;
|
||||
}
|
||||
}
|
||||
}
|
||||
void ConvertPathW(wchar_t *path)
|
||||
{
|
||||
UINT i, len;
|
||||
@ -2356,15 +2155,6 @@ bool DeleteDirW(wchar_t *name)
|
||||
|
||||
return DeleteDirInnerW(tmp);
|
||||
}
|
||||
bool DeleteDirInner(char *name)
|
||||
{
|
||||
wchar_t *name_w = CopyStrToUni(name);
|
||||
bool ret = DeleteDirInnerW(name_w);
|
||||
|
||||
Free(name_w);
|
||||
|
||||
return ret;
|
||||
}
|
||||
bool DeleteDirInnerW(wchar_t *name)
|
||||
{
|
||||
// Validate arguments
|
||||
@ -2491,15 +2281,6 @@ bool MakeDirW(wchar_t *name)
|
||||
|
||||
return MakeDirInnerW(tmp);
|
||||
}
|
||||
bool MakeDirInner(char *name)
|
||||
{
|
||||
wchar_t *name_w = CopyStrToUni(name);
|
||||
bool ret = MakeDirInnerW(name_w);
|
||||
|
||||
Free(name_w);
|
||||
|
||||
return ret;
|
||||
}
|
||||
bool MakeDirInnerW(wchar_t *name)
|
||||
{
|
||||
// Validate arguments
|
||||
@ -2534,15 +2315,6 @@ bool FileDeleteW(wchar_t *name)
|
||||
|
||||
return FileDeleteInnerW(tmp);
|
||||
}
|
||||
bool FileDeleteInner(char *name)
|
||||
{
|
||||
wchar_t *name_w = CopyStrToUni(name);
|
||||
bool ret = FileDeleteInnerW(name_w);
|
||||
|
||||
Free(name_w);
|
||||
|
||||
return ret;
|
||||
}
|
||||
bool FileDeleteInnerW(wchar_t *name)
|
||||
{
|
||||
wchar_t name2[MAX_SIZE];
|
||||
@ -2577,39 +2349,6 @@ bool FileSeek(IO *o, UINT mode, int offset)
|
||||
}
|
||||
}
|
||||
|
||||
// Get the file size by specifying the file name
|
||||
UINT FileSizeEx(char *name)
|
||||
{
|
||||
wchar_t *name_w = CopyStrToUni(name);
|
||||
UINT ret = FileSizeExW(name_w);
|
||||
|
||||
Free(name_w);
|
||||
|
||||
return ret;
|
||||
}
|
||||
UINT FileSizeExW(wchar_t *name)
|
||||
{
|
||||
IO *io;
|
||||
UINT size;
|
||||
// Validate arguments
|
||||
if (name == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
io = FileOpenW(name, false);
|
||||
if (io == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = FileSize(io);
|
||||
|
||||
FileClose(io);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
// Get the file size
|
||||
UINT64 FileSize64(IO *o)
|
||||
{
|
||||
@ -2745,15 +2484,6 @@ void FileCloseEx(IO *o, bool no_flush)
|
||||
}
|
||||
|
||||
// Create a file
|
||||
IO *FileCreateInner(char *name)
|
||||
{
|
||||
wchar_t *name_w = CopyStrToUni(name);
|
||||
IO *ret = FileCreateInnerW(name_w);
|
||||
|
||||
Free(name_w);
|
||||
|
||||
return ret;
|
||||
}
|
||||
IO *FileCreateInnerW(wchar_t *name)
|
||||
{
|
||||
IO *o;
|
||||
@ -2809,28 +2539,6 @@ IO *FileCreateW(wchar_t *name)
|
||||
}
|
||||
|
||||
// Write all the data to the file
|
||||
bool FileWriteAll(char *name, void *data, UINT size)
|
||||
{
|
||||
IO *io;
|
||||
// Validate arguments
|
||||
if (name == NULL || (data == NULL && size != 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
io = FileCreate(name);
|
||||
|
||||
if (io == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
FileWrite(io, data, size);
|
||||
|
||||
FileClose(io);
|
||||
|
||||
return true;
|
||||
}
|
||||
bool FileWriteAllW(wchar_t *name, void *data, UINT size)
|
||||
{
|
||||
IO *io;
|
||||
@ -2855,15 +2563,6 @@ bool FileWriteAllW(wchar_t *name, void *data, UINT size)
|
||||
}
|
||||
|
||||
// Open the file
|
||||
IO *FileOpenInner(char *name, bool write_mode, bool read_lock)
|
||||
{
|
||||
wchar_t *name_w = CopyStrToUni(name);
|
||||
IO *ret = FileOpenInnerW(name_w, write_mode, read_lock);
|
||||
|
||||
Free(name_w);
|
||||
|
||||
return ret;
|
||||
}
|
||||
IO *FileOpenInnerW(wchar_t *name, bool write_mode, bool read_lock)
|
||||
{
|
||||
IO *o;
|
||||
|
@ -277,46 +277,35 @@ void ZipAddFileFooter(ZIP_PACKER *p);
|
||||
FIFO *ZipFinish(ZIP_PACKER *p);
|
||||
bool ZipWriteW(ZIP_PACKER *p, wchar_t *name);
|
||||
|
||||
bool DeleteDirInner(char *name);
|
||||
bool DeleteDirInnerW(wchar_t *name);
|
||||
bool DeleteDir(char *name);
|
||||
bool DeleteDirW(wchar_t *name);
|
||||
bool MakeDirInner(char *name);
|
||||
bool MakeDirInnerW(wchar_t *name);
|
||||
bool MakeDir(char *name);
|
||||
bool MakeDirW(wchar_t *name);
|
||||
bool MakeDirEx(char *name);
|
||||
bool MakeDirExW(wchar_t *name);
|
||||
bool FileDeleteInner(char *name);
|
||||
bool FileDeleteInnerW(wchar_t *name);
|
||||
bool FileDelete(char *name);
|
||||
bool FileDeleteW(wchar_t *name);
|
||||
bool FileSeek(IO *o, UINT mode, int offset);
|
||||
UINT FileSize(IO *o);
|
||||
UINT64 FileSize64(IO *o);
|
||||
UINT FileSizeEx(char *name);
|
||||
UINT FileSizeExW(wchar_t *name);
|
||||
bool FileRead(IO *o, void *buf, UINT size);
|
||||
bool FileWrite(IO *o, void *buf, UINT size);
|
||||
void FileFlush(IO *o);
|
||||
void FileClose(IO *o);
|
||||
void FileCloseEx(IO *o, bool no_flush);
|
||||
void FileCloseAndDelete(IO *o);
|
||||
IO *FileCreateInner(char *name);
|
||||
IO *FileCreateInnerW(wchar_t *name);
|
||||
IO *FileCreate(char *name);
|
||||
IO *FileCreateW(wchar_t *name);
|
||||
bool FileWriteAll(char *name, void *data, UINT size);
|
||||
bool FileWriteAllW(wchar_t *name, void *data, UINT size);
|
||||
IO *FileOpenInner(char *name, bool write_mode, bool read_lock);
|
||||
IO *FileOpenInnerW(wchar_t *name, bool write_mode, bool read_lock);
|
||||
IO *FileOpen(char *name, bool write_mode);
|
||||
IO *FileOpenW(wchar_t *name, bool write_mode);
|
||||
IO *FileOpenEx(char *name, bool write_mode, bool read_lock);
|
||||
IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock);
|
||||
void ConvertPath(char *path);
|
||||
void ConvertPathW(wchar_t *path);
|
||||
bool FileRenameInner(char *old_name, char *new_name);
|
||||
bool FileRenameInnerW(wchar_t *old_name, wchar_t *new_name);
|
||||
bool FileRename(char *old_name, char *new_name);
|
||||
bool FileRenameW(wchar_t *old_name, wchar_t *new_name);
|
||||
@ -324,10 +313,8 @@ void NormalizePath(char *dst, UINT size, char *src);
|
||||
void NormalizePathW(wchar_t *dst, UINT size, wchar_t *src);
|
||||
bool GetRelativePathW(wchar_t *dst, UINT size, wchar_t *fullpath, wchar_t *basepath);
|
||||
bool GetRelativePath(char *dst, UINT size, char *fullpath, char *basepath);
|
||||
TOKEN_LIST *ParseSplitedPath(char *path);
|
||||
UNI_TOKEN_LIST *ParseSplitedPathW(wchar_t *path);
|
||||
char *GetCurrentPathEnvStr();
|
||||
bool IsFileExistsInner(char *name);
|
||||
bool IsFileExistsInnerW(wchar_t *name);
|
||||
bool IsFileExists(char *name);
|
||||
bool IsFileExistsW(wchar_t *name);
|
||||
@ -342,7 +329,6 @@ void GetDirNameFromFilePathW(wchar_t *dst, UINT size, wchar_t *filepath);
|
||||
void GetFileNameFromFilePath(char *dst, UINT size, char *filepath);
|
||||
void GetFileNameFromFilePathW(wchar_t *dst, UINT size, wchar_t *filepath);
|
||||
void MakeSafeFileName(char *dst, UINT size, char *src);
|
||||
void MakeSafeFileNameW(wchar_t *dst, UINT size, wchar_t *src);
|
||||
void InitGetExeName(char *arg);
|
||||
void UnixGetExeNameW(wchar_t *name, UINT size, wchar_t *arg);
|
||||
void GetExeName(char *name, UINT size);
|
||||
@ -356,7 +342,6 @@ void FreeHamcore();
|
||||
BUF *ReadHamcore(char *name);
|
||||
BUF *ReadHamcoreW(wchar_t *filename);
|
||||
void SafeFileName(char *name);
|
||||
void SafeFileNameW(wchar_t *name);
|
||||
void UniSafeFileName(wchar_t *name);
|
||||
DIRLIST *EnumDir(char *dirname);
|
||||
DIRLIST *EnumDirW(wchar_t *dirname);
|
||||
@ -368,19 +353,13 @@ void EnumDirWithSubDirsMain(ENUM_DIR_WITH_SUB_DATA *d, wchar_t *dirname);
|
||||
void FreeDir(DIRLIST *d);
|
||||
int CompareDirListByName(void *p1, void *p2);
|
||||
bool GetDiskFree(char *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size);
|
||||
bool GetDiskFreeW(wchar_t *path, UINT64 *free_size, UINT64 *used_size, UINT64 *total_size);
|
||||
void ConvertSafeFileName(char *dst, UINT size, char *src);
|
||||
void ConvertSafeFileNameW(wchar_t *dst, UINT size, wchar_t *src);
|
||||
bool FileReplaceRename(char *old_name, char *new_name);
|
||||
bool FileReplaceRenameW(wchar_t *old_name, wchar_t *new_name);
|
||||
bool IsFile(char *name);
|
||||
bool IsFileW(wchar_t *name);
|
||||
void GetCurrentDirW(wchar_t *name, UINT size);
|
||||
void GetCurrentDir(char *name, UINT size);
|
||||
bool SaveFileW(wchar_t *name, void *data, UINT size);
|
||||
bool SaveFile(char *name, void *data, UINT size);
|
||||
bool IsFileWriteLockedW(wchar_t *name);
|
||||
bool IsFileWriteLocked(char *name);
|
||||
bool IsInLines(BUF *buf, char *str, bool instr);
|
||||
bool IsInLinesFile(wchar_t *filename, char *str, bool instr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user