Skip to content

Commit

Permalink
Replace _wfopen_s by _wfopen, _wfreopen_s by _wfreopen (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba-- authored Mar 15, 2021
1 parent 54af749 commit f72dce2
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/miniz.h
Original file line number Diff line number Diff line change
Expand Up @@ -4125,29 +4125,24 @@ static wchar_t *str2wstr(const char *str) {
}

static FILE *mz_fopen(const char *pFilename, const char *pMode) {
FILE *pFile = NULL;

wchar_t *wFilename = str2wstr(pFilename);
wchar_t *wMode = str2wstr(pMode);
_wfopen_s(&pFile, wFilename, wMode);
FILE *pFile = _wfopen(wFilename, wMode);

free(wFilename);
free(wMode);

return pFile;
}

static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream) {
FILE *pFile = NULL;

wchar_t *wPath = str2wstr(pPath);
wchar_t *wMode = str2wstr(pMode);
int res = _wfreopen_s(&pFile, wPath, wMode, pStream);
FILE *pFile = _wfreopen(wPath, wMode, pStream);

free(wPath);
free(wMode);

if (res)
return NULL;

return pFile;
}

Expand Down

0 comments on commit f72dce2

Please sign in to comment.