1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49:53 +03:00

Merge PR #799: Cedar, Mayaqua: remove unused functions and redundant checks

This commit is contained in:
Davide Beatrici 2018-11-03 21:24:41 +01:00 committed by GitHub
commit ac16d0e882
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 72 deletions

View File

@ -5580,19 +5580,16 @@ UINT StAddAccess(ADMIN *a, RPC_ADD_ACCESS *t)
if (no_include) if (no_include)
{ {
if (no_include) if (StartWith(t->Access.SrcUsername, ACCESS_LIST_INCLUDED_PREFIX) ||
StartWith(t->Access.SrcUsername, ACCESS_LIST_EXCLUDED_PREFIX))
{ {
if (StartWith(t->Access.SrcUsername, ACCESS_LIST_INCLUDED_PREFIX) || ClearStr(t->Access.SrcUsername, sizeof(t->Access.SrcUsername));
StartWith(t->Access.SrcUsername, ACCESS_LIST_EXCLUDED_PREFIX)) }
{
ClearStr(t->Access.SrcUsername, sizeof(t->Access.SrcUsername));
}
if (StartWith(t->Access.DestUsername, ACCESS_LIST_INCLUDED_PREFIX) || if (StartWith(t->Access.DestUsername, ACCESS_LIST_INCLUDED_PREFIX) ||
StartWith(t->Access.DestUsername, ACCESS_LIST_EXCLUDED_PREFIX)) StartWith(t->Access.DestUsername, ACCESS_LIST_EXCLUDED_PREFIX))
{ {
ClearStr(t->Access.DestUsername, sizeof(t->Access.DestUsername)); ClearStr(t->Access.DestUsername, sizeof(t->Access.DestUsername));
}
} }
} }

View File

@ -18711,16 +18711,9 @@ LABEL_RESTART:
// Create a thread to get a NAT-T IP address if necessary // Create a thread to get a NAT-T IP address if necessary
if (u->GetNatTIpThread == NULL) if (u->GetNatTIpThread == NULL)
{ {
// Create a thread to get a NAT-T IP address if necessary char natt_hostname[MAX_SIZE];
if (u->GetNatTIpThread == NULL) RUDPGetRegisterHostNameByIP(natt_hostname, sizeof(natt_hostname), NULL);
{ u->GetNatTIpThread = NewQueryIpThread(natt_hostname, QUERYIPTHREAD_INTERVAL_LAST_OK, QUERYIPTHREAD_INTERVAL_LAST_NG);
char natt_hostname[MAX_SIZE];
RUDPGetRegisterHostNameByIP(natt_hostname, sizeof(natt_hostname), NULL);
u->GetNatTIpThread = NewQueryIpThread(natt_hostname, QUERYIPTHREAD_INTERVAL_LAST_OK, QUERYIPTHREAD_INTERVAL_LAST_NG);
}
GetQueryIpThreadResult(u->GetNatTIpThread, &nat_t_ip); GetQueryIpThreadResult(u->GetNatTIpThread, &nat_t_ip);
} }
} }

View File

@ -328,10 +328,6 @@ UINT OSThreadId()
} }
// Rename // Rename
bool OSFileRename(char *old_name, char *new_name)
{
return os->FileRename(old_name, new_name);
}
bool OSFileRenameW(wchar_t *old_name, wchar_t *new_name) bool OSFileRenameW(wchar_t *old_name, wchar_t *new_name)
{ {
return os->FileRenameW(old_name, new_name); return os->FileRenameW(old_name, new_name);
@ -350,50 +346,30 @@ bool OSFileSeek(void *pData, UINT mode, int offset)
} }
// Delete the file // Delete the file
bool OSFileDelete(char *name)
{
return os->FileDelete(name);
}
bool OSFileDeleteW(wchar_t *name) bool OSFileDeleteW(wchar_t *name)
{ {
return os->FileDeleteW(name); return os->FileDeleteW(name);
} }
// Create a directory // Create a directory
bool OSMakeDir(char *name)
{
return os->MakeDir(name);
}
bool OSMakeDirW(wchar_t *name) bool OSMakeDirW(wchar_t *name)
{ {
return os->MakeDirW(name); return os->MakeDirW(name);
} }
// Delete the directory // Delete the directory
bool OSDeleteDir(char *name)
{
return os->DeleteDir(name);
}
bool OSDeleteDirW(wchar_t *name) bool OSDeleteDirW(wchar_t *name)
{ {
return os->DeleteDirW(name); return os->DeleteDirW(name);
} }
// Open the file // Open the file
void *OSFileOpen(char *name, bool write_mode, bool read_lock)
{
return os->FileOpen(name, write_mode, read_lock);
}
void *OSFileOpenW(wchar_t *name, bool write_mode, bool read_lock) void *OSFileOpenW(wchar_t *name, bool write_mode, bool read_lock)
{ {
return os->FileOpenW(name, write_mode, read_lock); return os->FileOpenW(name, write_mode, read_lock);
} }
// Create a file // Create a file
void *OSFileCreate(char *name)
{
return os->FileCreate(name);
}
void *OSFileCreateW(wchar_t *name) void *OSFileCreateW(wchar_t *name)
{ {
return os->FileCreateW(name); return os->FileCreateW(name);
@ -483,18 +459,6 @@ void OSGetSystemTime(SYSTEMTIME *system_time)
os->GetSystemTime(system_time); os->GetSystemTime(system_time);
} }
// 32bit increment
void OSInc32(UINT *value)
{
os->Inc32(value);
}
// 32bit decrement
void OSDec32(UINT *value)
{
os->Dec32(value);
}
// Sleep the thread // Sleep the thread
void OSSleep(UINT time) void OSSleep(UINT time)
{ {
@ -537,12 +501,6 @@ void OSSetEvent(EVENT *event)
os->SetEvent(event); os->SetEvent(event);
} }
// Reset event
void OSResetEvent(EVENT *event)
{
os->ResetEvent(event);
}
// Wait for event // Wait for event
bool OSWaitEvent(EVENT *event, UINT timeout) bool OSWaitEvent(EVENT *event, UINT timeout)
{ {

View File

@ -124,8 +124,6 @@ void *OSMemoryReAlloc(void *addr, UINT size);
void OSMemoryFree(void *addr); void OSMemoryFree(void *addr);
UINT OSGetTick(); UINT OSGetTick();
void OSGetSystemTime(SYSTEMTIME *system_time); void OSGetSystemTime(SYSTEMTIME *system_time);
void OSInc32(UINT *value);
void OSDec32(UINT *value);
void OSSleep(UINT time); void OSSleep(UINT time);
LOCK *OSNewLock(); LOCK *OSNewLock();
bool OSLock(LOCK *lock); bool OSLock(LOCK *lock);
@ -133,15 +131,12 @@ void OSUnlock(LOCK *lock);
void OSDeleteLock(LOCK *lock); void OSDeleteLock(LOCK *lock);
void OSInitEvent(EVENT *event); void OSInitEvent(EVENT *event);
void OSSetEvent(EVENT *event); void OSSetEvent(EVENT *event);
void OSResetEvent(EVENT *event);
bool OSWaitEvent(EVENT *event, UINT timeout); bool OSWaitEvent(EVENT *event, UINT timeout);
void OSFreeEvent(EVENT *event); void OSFreeEvent(EVENT *event);
bool OSWaitThread(THREAD *t); bool OSWaitThread(THREAD *t);
void OSFreeThread(THREAD *t); void OSFreeThread(THREAD *t);
bool OSInitThread(THREAD *t); bool OSInitThread(THREAD *t);
void *OSFileOpen(char *name, bool write_mode, bool read_lock);
void *OSFileOpenW(wchar_t *name, bool write_mode, bool read_lock); void *OSFileOpenW(wchar_t *name, bool write_mode, bool read_lock);
void *OSFileCreate(char *name);
void *OSFileCreateW(wchar_t *name); void *OSFileCreateW(wchar_t *name);
bool OSFileWrite(void *pData, void *buf, UINT size); bool OSFileWrite(void *pData, void *buf, UINT size);
bool OSFileRead(void *pData, void *buf, UINT size); bool OSFileRead(void *pData, void *buf, UINT size);
@ -149,15 +144,11 @@ void OSFileClose(void *pData, bool no_flush);
void OSFileFlush(void *pData); void OSFileFlush(void *pData);
UINT64 OSFileSize(void *pData); UINT64 OSFileSize(void *pData);
bool OSFileSeek(void *pData, UINT mode, int offset); bool OSFileSeek(void *pData, UINT mode, int offset);
bool OSFileDelete(char *name);
bool OSFileDeleteW(wchar_t *name); bool OSFileDeleteW(wchar_t *name);
bool OSMakeDir(char *name);
bool OSMakeDirW(wchar_t *name); bool OSMakeDirW(wchar_t *name);
bool OSDeleteDir(char *name);
bool OSDeleteDirW(wchar_t *name); bool OSDeleteDirW(wchar_t *name);
CALLSTACK_DATA *OSGetCallStack(); CALLSTACK_DATA *OSGetCallStack();
bool OSGetCallStackSymbolInfo(CALLSTACK_DATA *s); bool OSGetCallStackSymbolInfo(CALLSTACK_DATA *s);
bool OSFileRename(char *old_name, char *new_name);
bool OSFileRenameW(wchar_t *old_name, wchar_t *new_name); bool OSFileRenameW(wchar_t *old_name, wchar_t *new_name);
UINT OSThreadId(); UINT OSThreadId();
bool OSRun(char *filename, char *arg, bool hide, bool wait); bool OSRun(char *filename, char *arg, bool hide, bool wait);