Skip to content

Commit eefd148

Browse files
committed
Fix unable to open files with unicode path under mingw 32bit
1 parent 617c886 commit eefd148

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

core_lib/src/miniz.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2986,7 +2986,7 @@ void tinfl_decompressor_free(tinfl_decompressor *pDecomp)
29862986
#else
29872987
#include <sys/stat.h>
29882988

2989-
#if defined(_MSC_VER) || defined(__MINGW64__)
2989+
#if defined(_MSC_VER) || defined(__MINGW64__) || defined(__MINGW32__)
29902990
#include <codecvt>
29912991
#include <string>
29922992
#include <locale>
@@ -3026,21 +3026,21 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
30263026
#define MZ_FFLUSH fflush
30273027
#define MZ_FREOPEN mz_freopen
30283028
#define MZ_DELETE_FILE remove
3029-
#elif defined(__MINGW32__)
3030-
#ifndef MINIZ_NO_TIME
3031-
#include <sys/utime.h>
3032-
#endif
3033-
#define MZ_FOPEN(f, m) fopen(f, m)
3034-
#define MZ_FCLOSE fclose
3035-
#define MZ_FREAD fread
3036-
#define MZ_FWRITE fwrite
3037-
#define MZ_FTELL64 ftello64
3038-
#define MZ_FSEEK64 fseeko64
3039-
#define MZ_FILE_STAT_STRUCT _stat
3040-
#define MZ_FILE_STAT _stat
3041-
#define MZ_FFLUSH fflush
3042-
#define MZ_FREOPEN(f, m, s) freopen(f, m, s)
3043-
#define MZ_DELETE_FILE remove
3029+
//#elif defined(__MINGW32__)
3030+
//#ifndef MINIZ_NO_TIME
3031+
//#include <sys/utime.h>
3032+
//#endif
3033+
//#define MZ_FOPEN(f, m) fopen(f, m)
3034+
//#define MZ_FCLOSE fclose
3035+
//#define MZ_FREAD fread
3036+
//#define MZ_FWRITE fwrite
3037+
//#define MZ_FTELL64 ftello64
3038+
//#define MZ_FSEEK64 fseeko64
3039+
//#define MZ_FILE_STAT_STRUCT _stat
3040+
//#define MZ_FILE_STAT _stat
3041+
//#define MZ_FFLUSH fflush
3042+
//#define MZ_FREOPEN(f, m, s) freopen(f, m, s)
3043+
//#define MZ_DELETE_FILE remove
30443044
#elif defined(__TINYC__)
30453045
#ifndef MINIZ_NO_TIME
30463046
#include <sys/utime.h>

core_lib/src/qminiz.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ bool MiniZ::isZip(const QString& sZipFilePath)
2828
mz_zip_archive* mz = new mz_zip_archive;
2929
OnScopeExit(delete mz);
3030
mz_zip_zero_struct(mz);
31-
32-
mz_bool ok = mz_zip_reader_init_file(mz, sZipFilePath.toUtf8().data(), 0);
31+
QByteArray utf8Bytes = sZipFilePath.toUtf8();
32+
mz_bool ok = mz_zip_reader_init_file(mz, utf8Bytes.constData(), 0);
3333
if (!ok) return false;
3434

3535
int num = mz_zip_reader_get_num_files(mz);

0 commit comments

Comments
 (0)