Skip to content

Commit

Permalink
Fix unable to open files with unicode path under mingw 32bit
Browse files Browse the repository at this point in the history
  • Loading branch information
chchwy committed May 31, 2021
1 parent 617c886 commit eefd148
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
32 changes: 16 additions & 16 deletions core_lib/src/miniz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2986,7 +2986,7 @@ void tinfl_decompressor_free(tinfl_decompressor *pDecomp)
#else
#include <sys/stat.h>

#if defined(_MSC_VER) || defined(__MINGW64__)
#if defined(_MSC_VER) || defined(__MINGW64__) || defined(__MINGW32__)
#include <codecvt>
#include <string>
#include <locale>
Expand Down Expand Up @@ -3026,21 +3026,21 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
#define MZ_FFLUSH fflush
#define MZ_FREOPEN mz_freopen
#define MZ_DELETE_FILE remove
#elif defined(__MINGW32__)
#ifndef MINIZ_NO_TIME
#include <sys/utime.h>
#endif
#define MZ_FOPEN(f, m) fopen(f, m)
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
#define MZ_FWRITE fwrite
#define MZ_FTELL64 ftello64
#define MZ_FSEEK64 fseeko64
#define MZ_FILE_STAT_STRUCT _stat
#define MZ_FILE_STAT _stat
#define MZ_FFLUSH fflush
#define MZ_FREOPEN(f, m, s) freopen(f, m, s)
#define MZ_DELETE_FILE remove
//#elif defined(__MINGW32__)
//#ifndef MINIZ_NO_TIME
//#include <sys/utime.h>
//#endif
//#define MZ_FOPEN(f, m) fopen(f, m)
//#define MZ_FCLOSE fclose
//#define MZ_FREAD fread
//#define MZ_FWRITE fwrite
//#define MZ_FTELL64 ftello64
//#define MZ_FSEEK64 fseeko64
//#define MZ_FILE_STAT_STRUCT _stat
//#define MZ_FILE_STAT _stat
//#define MZ_FFLUSH fflush
//#define MZ_FREOPEN(f, m, s) freopen(f, m, s)
//#define MZ_DELETE_FILE remove
#elif defined(__TINYC__)
#ifndef MINIZ_NO_TIME
#include <sys/utime.h>
Expand Down
4 changes: 2 additions & 2 deletions core_lib/src/qminiz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ bool MiniZ::isZip(const QString& sZipFilePath)
mz_zip_archive* mz = new mz_zip_archive;
OnScopeExit(delete mz);
mz_zip_zero_struct(mz);

mz_bool ok = mz_zip_reader_init_file(mz, sZipFilePath.toUtf8().data(), 0);
QByteArray utf8Bytes = sZipFilePath.toUtf8();
mz_bool ok = mz_zip_reader_init_file(mz, utf8Bytes.constData(), 0);
if (!ok) return false;

int num = mz_zip_reader_get_num_files(mz);
Expand Down

0 comments on commit eefd148

Please sign in to comment.