mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
fix typos, reset memory before using
This commit is contained in:
parent
9dbe3f21d9
commit
1b7ed98325
1 changed files with 3 additions and 2 deletions
5
extern/oics/tinyxml.cpp
vendored
5
extern/oics/tinyxml.cpp
vendored
|
@ -44,7 +44,8 @@ FILE* TiXmlFOpen( const char* filename, const char* mode )
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
FILE* fp = 0;
|
FILE* fp = 0;
|
||||||
size_t len = strlen(filename);
|
size_t len = strlen(filename);
|
||||||
wchar_t *wname = new wchar_t[len]
|
wchar_t *wname = new wchar_t[len + 1];
|
||||||
|
memset(wname, 0, sizeof(*wname) * (len + 1));
|
||||||
wchar_t wmode[32] = { 0 };
|
wchar_t wmode[32] = { 0 };
|
||||||
|
|
||||||
MultiByteToWideChar(CP_UTF8, 0, filename, len, wname, len);
|
MultiByteToWideChar(CP_UTF8, 0, filename, len, wname, len);
|
||||||
|
@ -53,7 +54,7 @@ FILE* TiXmlFOpen( const char* filename, const char* mode )
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
||||||
errno_t err = _wfopen_s( &fp, wname, wmode );
|
errno_t err = _wfopen_s( &fp, wname, wmode );
|
||||||
#else
|
#else
|
||||||
fp = _wfopen(wname, wmode)
|
fp = _wfopen(wname, wmode);
|
||||||
#endif
|
#endif
|
||||||
delete[] wname;
|
delete[] wname;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue