19 #if (QT_VERSION >= 0x050100)
20 #define QUAZIP_QSAVEFILE_BUG_WORKAROUND
22 #ifdef QUAZIP_QSAVEFILE_BUG_WORKAROUND
56 uLong offsetTruncated = (uLong)offset;
57 if (offsetTruncated != offset)
71 if ((tell_uLong) == ((uLong)-1))
93 QIODevice::OpenMode desiredMode;
95 desiredMode = QIODevice::ReadOnly;
97 desiredMode = QIODevice::ReadWrite;
99 desiredMode = QIODevice::WriteOnly;
100 if (iodevice->isOpen()) {
101 if ((iodevice->openMode() & desiredMode) == desiredMode) {
102 if (desiredMode != QIODevice::WriteOnly
103 && iodevice->isSequential()) {
108 if ((desiredMode & QIODevice::WriteOnly) != 0) {
110 if (!iodevice->isSequential()) {
113 d->
pos = iodevice->pos();
123 iodevice->open(desiredMode);
124 if (iodevice->isOpen()) {
125 if (desiredMode != QIODevice::WriteOnly && iodevice->isSequential()) {
148 qint64 ret64 = iodevice->read((
char*)buf,size);
167 qint64 ret64 = iodevice->write((
char*)buf,size);
183 if (iodevice->isSequential()) {
186 ret64 = iodevice->pos();
188 ret =
static_cast<uLong
>(ret64);
199 if (iodevice->isSequential()) {
202 ret = iodevice->pos();
214 if (iodevice->isSequential()) {
220 qWarning(
"qiodevice_seek_file_func() called for sequential device");
224 uLong qiodevice_seek_result=0;
229 qiodevice_seek_result = ((
QIODevice*)stream)->pos() + offset;
232 qiodevice_seek_result = ((
QIODevice*)stream)->size() - offset;
235 qiodevice_seek_result = offset;
240 ret = !iodevice->seek(qiodevice_seek_result);
251 if (iodevice->isSequential()) {
257 qWarning(
"qiodevice_seek_file_func() called for sequential device");
261 qint64 qiodevice_seek_result=0;
266 qiodevice_seek_result = ((
QIODevice*)stream)->pos() + offset;
269 qiodevice_seek_result = ((
QIODevice*)stream)->size() - offset;
272 qiodevice_seek_result = offset;
277 ret = !iodevice->seek(qiodevice_seek_result);
288 #ifdef QUAZIP_QSAVEFILE_BUG_WORKAROUND
291 QSaveFile *file = qobject_cast<QSaveFile*>(device);
294 return file->commit() ? 0 : -1;
uLong qiodevice_read_file_func(voidpf opaque, voidpf stream, void *buf, uLong size)
uLong qiodevice_write_file_func(voidpf opaque, voidpf stream, const void *buf, uLong size)
seek_file_func zseek_file
void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def *p_filefunc64_32, const zlib_filefunc_def *p_filefunc32)
close_file_func zclose_file
int qiodevice_seek_file_func(voidpf, voidpf stream, uLong offset, int origin)
int qiodevice_close_file_func(voidpf opaque, voidpf stream)
read_file_func zread_file
void fill_qiodevice64_filefunc(zlib_filefunc64_def *pzlib_filefunc_def)
seek64_file_func zseek64_file
int qiodevice_error_file_func(voidpf, voidpf)
testerror_file_func zerror_file
tell64_file_func ztell64_file
close_file_func zclose_file
tell_file_func ztell_file
#define ZLIB_FILEFUNC_MODE_READWRITEFILTER
open_file_func zopen_file
testerror_file_func zerror_file
voidpf call_zopen64(const zlib_filefunc64_32_def *pfilefunc, voidpf file, int mode)
#define ZLIB_FILEFUNC_MODE_READ
uLong qiodevice_tell_file_func(voidpf opaque, voidpf stream)
zlib_filefunc64_def zfile_func64
tell_file_func ztell32_file
open_file_func zopen32_file
read_file_func zread_file
void fill_qiodevice_filefunc(zlib_filefunc_def *pzlib_filefunc_def)
#define ZLIB_FILEFUNC_SEEK_CUR
ZPOS64_T qiodevice64_tell_file_func(voidpf opaque, voidpf stream)
int qiodevice_fakeclose_file_func(voidpf opaque, voidpf)
#define ZLIB_FILEFUNC_MODE_CREATE
unsigned long long int ZPOS64_T
write_file_func zwrite_file
#define ZLIB_FILEFUNC_MODE_EXISTING
write_file_func zwrite_file
close_file_func zfakeclose_file
voidpf qiodevice_open_file_func(voidpf opaque, voidpf file, int mode)
seek_file_func zseek32_file
ZPOS64_T call_ztell64(const zlib_filefunc64_32_def *pfilefunc, voidpf filestream)
int call_zseek64(const zlib_filefunc64_32_def *pfilefunc, voidpf filestream, ZPOS64_T offset, int origin)
#define ZLIB_FILEFUNC_SEEK_END
open64_file_func zopen64_file
#define ZLIB_FILEFUNC_SEEK_SET
int qiodevice64_seek_file_func(voidpf, voidpf stream, ZPOS64_T offset, int origin)