From f72dce22bd25d10f8575ec54cf51bf5a5fdcb5ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Podg=C3=B3rski?= Date: Mon, 15 Mar 2021 11:40:41 +0100 Subject: [PATCH] Replace _wfopen_s by _wfopen, _wfreopen_s by _wfreopen (#176) --- src/miniz.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/miniz.h b/src/miniz.h index 808ad93e..c3f5f119 100644 --- a/src/miniz.h +++ b/src/miniz.h @@ -4125,11 +4125,10 @@ 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); @@ -4137,17 +4136,13 @@ static FILE *mz_fopen(const char *pFilename, const char *pMode) { } 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; }