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

Compare commits

..

No commits in common. "ff37c35cfa16a85e866d09824800ea10e99386f7" and "f6c185f2794a0808fdf3e50e709251412839953b" have entirely different histories.

View File

@ -2124,24 +2124,6 @@ IO *FileOpenEx(char *name, bool write_mode, bool read_lock)
return ret; return ret;
} }
// Replace the specified character in the string with a new character
wchar_t *UniReplaceCharW(wchar_t *src, UINT size, wchar_t c, wchar_t newc) {
if (src == NULL)
{
return NULL;
}
for (; *src; src++, size -= sizeof(wchar_t)) {
if (size < sizeof(wchar_t)) {
break;
}
if (*src == c) {
*src = newc;
}
}
return (wchar_t *)src;
}
IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock) IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock)
{ {
wchar_t tmp[MAX_SIZE]; wchar_t tmp[MAX_SIZE];
@ -2158,12 +2140,9 @@ IO *FileOpenExW(wchar_t *name, bool write_mode, bool read_lock)
IO *o = ZeroMalloc(sizeof(IO)); IO *o = ZeroMalloc(sizeof(IO));
name++; name++;
UniStrCpy(o->NameW, sizeof(o->NameW), name); UniStrCpy(o->NameW, sizeof(o->NameW), name);
#ifdef OS_WIN32
UniReplaceCharW(o->NameW, sizeof(o->NameW), L'\\', L'/'); // Path separator "/" is used.
#endif // OS_WIN32
UniToStr(o->Name, sizeof(o->Name), o->NameW); UniToStr(o->Name, sizeof(o->Name), o->NameW);
o->HamMode = true; o->HamMode = true;
o->HamBuf = ReadHamcoreW(o->NameW); o->HamBuf = ReadHamcoreW(name);
if (o->HamBuf == NULL) if (o->HamBuf == NULL)
{ {
Free(o); Free(o);