misc/quazip/quazipfile.cpp
author koda
Mon, 03 Jun 2013 10:01:33 +0200
branch0.9.18
changeset 7970 a8c6b700ba1c
parent 7889 57b117d441b9
permissions -rw-r--r--
close branch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7889
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     1
/*
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     2
Copyright (C) 2005-2011 Sergey A. Tachenov
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     3
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     4
This program is free software; you can redistribute it and/or modify it
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     5
under the terms of the GNU Lesser General Public License as published by
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     6
the Free Software Foundation; either version 2 of the License, or (at
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     7
your option) any later version.
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     8
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
     9
This program is distributed in the hope that it will be useful, but
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    10
WITHOUT ANY WARRANTY; without even the implied warranty of
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    12
General Public License for more details.
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    13
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    14
You should have received a copy of the GNU Lesser General Public License
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    15
along with this program; if not, write to the Free Software Foundation,
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    16
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    17
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    18
See COPYING file for the full LGPL text.
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    19
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    20
Original ZIP package is copyrighted by Gilles Vollant, see
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    21
quazip/(un)zip.h files for details, basically it's zlib license.
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    22
 **/
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    23
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    24
#include "quazipfile.h"
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    25
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    26
using namespace std;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    27
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    28
class QuaZipFilePrivate {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    29
  friend class QuaZipFile;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    30
  private:
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    31
    QuaZipFile *q;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    32
    QuaZip *zip;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    33
    QString fileName;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    34
    QuaZip::CaseSensitivity caseSensitivity;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    35
    bool raw;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    36
    qint64 writePos;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    37
    // these two are for writing raw files
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    38
    ulong uncompressedSize;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    39
    quint32 crc;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    40
    bool internal;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    41
    int zipError;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    42
    inline void resetZipError() const {setZipError(UNZ_OK);}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    43
    // const, but sets zipError!
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    44
    void setZipError(int zipError) const;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    45
    inline QuaZipFilePrivate(QuaZipFile *q):
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    46
      q(q), zip(NULL), internal(true), zipError(UNZ_OK) {}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    47
    inline QuaZipFilePrivate(QuaZipFile *q, const QString &zipName):
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    48
      q(q), internal(true), zipError(UNZ_OK)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    49
      {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    50
        zip=new QuaZip(zipName);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    51
      }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    52
    inline QuaZipFilePrivate(QuaZipFile *q, const QString &zipName, const QString &fileName,
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    53
        QuaZip::CaseSensitivity cs):
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    54
      q(q), internal(true), zipError(UNZ_OK)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    55
      {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    56
        zip=new QuaZip(zipName);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    57
        this->fileName=fileName;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    58
        this->caseSensitivity=cs;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    59
      }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    60
    inline QuaZipFilePrivate(QuaZipFile *q, QuaZip *zip):
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    61
      q(q), zip(zip), internal(false), zipError(UNZ_OK) {}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    62
    inline ~QuaZipFilePrivate()
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    63
    {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    64
      if (internal)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    65
        delete zip;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    66
    }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    67
};
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    68
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    69
QuaZipFile::QuaZipFile():
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    70
  p(new QuaZipFilePrivate(this))
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    71
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    72
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    73
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    74
QuaZipFile::QuaZipFile(QObject *parent):
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    75
  QIODevice(parent),
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    76
  p(new QuaZipFilePrivate(this))
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    77
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    78
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    79
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    80
QuaZipFile::QuaZipFile(const QString& zipName, QObject *parent):
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    81
  QIODevice(parent),
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    82
  p(new QuaZipFilePrivate(this, zipName))
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    83
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    84
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    85
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    86
QuaZipFile::QuaZipFile(const QString& zipName, const QString& fileName,
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    87
    QuaZip::CaseSensitivity cs, QObject *parent):
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    88
  QIODevice(parent),
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    89
  p(new QuaZipFilePrivate(this, zipName, fileName, cs))
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    90
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    91
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    92
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    93
QuaZipFile::QuaZipFile(QuaZip *zip, QObject *parent):
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    94
  QIODevice(parent),
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    95
  p(new QuaZipFilePrivate(this, zip))
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    96
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    97
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    98
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
    99
QuaZipFile::~QuaZipFile()
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   100
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   101
  if (isOpen())
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   102
    close();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   103
  delete p;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   104
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   105
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   106
QString QuaZipFile::getZipName() const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   107
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   108
  return p->zip==NULL ? QString() : p->zip->getZipName();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   109
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   110
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   111
QString QuaZipFile::getActualFileName()const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   112
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   113
  p->setZipError(UNZ_OK);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   114
  if (p->zip == NULL || (openMode() & WriteOnly))
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   115
    return QString();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   116
  QString name=p->zip->getCurrentFileName();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   117
  if(name.isNull())
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   118
    p->setZipError(p->zip->getZipError());
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   119
  return name;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   120
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   121
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   122
void QuaZipFile::setZipName(const QString& zipName)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   123
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   124
  if(isOpen()) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   125
    qWarning("QuaZipFile::setZipName(): file is already open - can not set ZIP name");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   126
    return;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   127
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   128
  if(p->zip!=NULL && p->internal)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   129
    delete p->zip;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   130
  p->zip=new QuaZip(zipName);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   131
  p->internal=true;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   132
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   133
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   134
void QuaZipFile::setZip(QuaZip *zip)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   135
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   136
  if(isOpen()) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   137
    qWarning("QuaZipFile::setZip(): file is already open - can not set ZIP");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   138
    return;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   139
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   140
  if(p->zip!=NULL && p->internal)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   141
    delete p->zip;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   142
  p->zip=zip;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   143
  p->fileName=QString();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   144
  p->internal=false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   145
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   146
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   147
void QuaZipFile::setFileName(const QString& fileName, QuaZip::CaseSensitivity cs)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   148
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   149
  if(p->zip==NULL) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   150
    qWarning("QuaZipFile::setFileName(): call setZipName() first");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   151
    return;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   152
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   153
  if(!p->internal) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   154
    qWarning("QuaZipFile::setFileName(): should not be used when not using internal QuaZip");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   155
    return;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   156
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   157
  if(isOpen()) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   158
    qWarning("QuaZipFile::setFileName(): can not set file name for already opened file");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   159
    return;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   160
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   161
  p->fileName=fileName;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   162
  p->caseSensitivity=cs;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   163
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   164
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   165
void QuaZipFilePrivate::setZipError(int zipError) const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   166
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   167
  QuaZipFilePrivate *fakeThis = const_cast<QuaZipFilePrivate*>(this); // non-const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   168
  fakeThis->zipError=zipError;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   169
  if(zipError==UNZ_OK)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   170
    q->setErrorString(QString());
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   171
  else
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   172
    q->setErrorString(q->tr("ZIP/UNZIP API error %1").arg(zipError));
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   173
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   174
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   175
bool QuaZipFile::open(OpenMode mode)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   176
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   177
  return open(mode, NULL);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   178
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   179
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   180
bool QuaZipFile::open(OpenMode mode, int *method, int *level, bool raw, const char *password)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   181
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   182
  p->resetZipError();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   183
  if(isOpen()) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   184
    qWarning("QuaZipFile::open(): already opened");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   185
    return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   186
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   187
  if(mode&Unbuffered) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   188
    qWarning("QuaZipFile::open(): Unbuffered mode is not supported");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   189
    return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   190
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   191
  if((mode&ReadOnly)&&!(mode&WriteOnly)) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   192
    if(p->internal) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   193
      if(!p->zip->open(QuaZip::mdUnzip)) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   194
        p->setZipError(p->zip->getZipError());
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   195
        return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   196
      }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   197
      if(!p->zip->setCurrentFile(p->fileName, p->caseSensitivity)) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   198
        p->setZipError(p->zip->getZipError());
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   199
        p->zip->close();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   200
        return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   201
      }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   202
    } else {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   203
      if(p->zip==NULL) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   204
        qWarning("QuaZipFile::open(): zip is NULL");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   205
        return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   206
      }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   207
      if(p->zip->getMode()!=QuaZip::mdUnzip) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   208
        qWarning("QuaZipFile::open(): file open mode %d incompatible with ZIP open mode %d",
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   209
            (int)mode, (int)p->zip->getMode());
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   210
        return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   211
      }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   212
      if(!p->zip->hasCurrentFile()) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   213
        qWarning("QuaZipFile::open(): zip does not have current file");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   214
        return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   215
      }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   216
    }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   217
    p->setZipError(unzOpenCurrentFile3(p->zip->getUnzFile(), method, level, (int)raw, password));
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   218
    if(p->zipError==UNZ_OK) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   219
      setOpenMode(mode);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   220
      p->raw=raw;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   221
      return true;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   222
    } else
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   223
      return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   224
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   225
  qWarning("QuaZipFile::open(): open mode %d not supported by this function", (int)mode);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   226
  return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   227
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   228
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   229
bool QuaZipFile::open(OpenMode mode, const QuaZipNewInfo& info,
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   230
    const char *password, quint32 crc,
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   231
    int method, int level, bool raw,
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   232
    int windowBits, int memLevel, int strategy)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   233
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   234
  zip_fileinfo info_z;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   235
  p->resetZipError();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   236
  if(isOpen()) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   237
    qWarning("QuaZipFile::open(): already opened");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   238
    return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   239
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   240
  if((mode&WriteOnly)&&!(mode&ReadOnly)) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   241
    if(p->internal) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   242
      qWarning("QuaZipFile::open(): write mode is incompatible with internal QuaZip approach");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   243
      return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   244
    }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   245
    if(p->zip==NULL) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   246
      qWarning("QuaZipFile::open(): zip is NULL");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   247
      return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   248
    }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   249
    if(p->zip->getMode()!=QuaZip::mdCreate&&p->zip->getMode()!=QuaZip::mdAppend&&p->zip->getMode()!=QuaZip::mdAdd) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   250
      qWarning("QuaZipFile::open(): file open mode %d incompatible with ZIP open mode %d",
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   251
          (int)mode, (int)p->zip->getMode());
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   252
      return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   253
    }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   254
    info_z.tmz_date.tm_year=info.dateTime.date().year();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   255
    info_z.tmz_date.tm_mon=info.dateTime.date().month() - 1;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   256
    info_z.tmz_date.tm_mday=info.dateTime.date().day();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   257
    info_z.tmz_date.tm_hour=info.dateTime.time().hour();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   258
    info_z.tmz_date.tm_min=info.dateTime.time().minute();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   259
    info_z.tmz_date.tm_sec=info.dateTime.time().second();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   260
    info_z.dosDate = 0;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   261
    info_z.internal_fa=(uLong)info.internalAttr;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   262
    info_z.external_fa=(uLong)info.externalAttr;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   263
    p->setZipError(zipOpenNewFileInZip3(p->zip->getZipFile(),
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   264
          p->zip->getFileNameCodec()->fromUnicode(info.name).constData(), &info_z,
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   265
          info.extraLocal.constData(), info.extraLocal.length(),
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   266
          info.extraGlobal.constData(), info.extraGlobal.length(),
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   267
          p->zip->getCommentCodec()->fromUnicode(info.comment).constData(),
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   268
          method, level, (int)raw,
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   269
          windowBits, memLevel, strategy,
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   270
          password, (uLong)crc));
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   271
    if(p->zipError==UNZ_OK) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   272
      p->writePos=0;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   273
      setOpenMode(mode);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   274
      p->raw=raw;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   275
      if(raw) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   276
        p->crc=crc;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   277
        p->uncompressedSize=info.uncompressedSize;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   278
      }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   279
      return true;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   280
    } else
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   281
      return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   282
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   283
  qWarning("QuaZipFile::open(): open mode %d not supported by this function", (int)mode);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   284
  return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   285
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   286
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   287
bool QuaZipFile::isSequential()const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   288
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   289
  return true;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   290
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   291
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   292
qint64 QuaZipFile::pos()const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   293
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   294
  if(p->zip==NULL) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   295
    qWarning("QuaZipFile::pos(): call setZipName() or setZip() first");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   296
    return -1;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   297
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   298
  if(!isOpen()) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   299
    qWarning("QuaZipFile::pos(): file is not open");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   300
    return -1;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   301
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   302
  if(openMode()&ReadOnly)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   303
    return unztell(p->zip->getUnzFile());
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   304
  else
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   305
    return p->writePos;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   306
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   307
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   308
bool QuaZipFile::atEnd()const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   309
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   310
  if(p->zip==NULL) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   311
    qWarning("QuaZipFile::atEnd(): call setZipName() or setZip() first");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   312
    return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   313
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   314
  if(!isOpen()) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   315
    qWarning("QuaZipFile::atEnd(): file is not open");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   316
    return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   317
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   318
  if(openMode()&ReadOnly)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   319
    return unzeof(p->zip->getUnzFile())==1;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   320
  else
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   321
    return true;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   322
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   323
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   324
qint64 QuaZipFile::size()const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   325
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   326
  if(!isOpen()) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   327
    qWarning("QuaZipFile::atEnd(): file is not open");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   328
    return -1;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   329
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   330
  if(openMode()&ReadOnly)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   331
    return p->raw?csize():usize();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   332
  else
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   333
    return p->writePos;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   334
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   335
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   336
qint64 QuaZipFile::csize()const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   337
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   338
  unz_file_info info_z;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   339
  p->setZipError(UNZ_OK);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   340
  if(p->zip==NULL||p->zip->getMode()!=QuaZip::mdUnzip) return -1;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   341
  p->setZipError(unzGetCurrentFileInfo(p->zip->getUnzFile(), &info_z, NULL, 0, NULL, 0, NULL, 0));
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   342
  if(p->zipError!=UNZ_OK)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   343
    return -1;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   344
  return info_z.compressed_size;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   345
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   346
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   347
qint64 QuaZipFile::usize()const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   348
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   349
  unz_file_info info_z;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   350
  p->setZipError(UNZ_OK);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   351
  if(p->zip==NULL||p->zip->getMode()!=QuaZip::mdUnzip) return -1;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   352
  p->setZipError(unzGetCurrentFileInfo(p->zip->getUnzFile(), &info_z, NULL, 0, NULL, 0, NULL, 0));
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   353
  if(p->zipError!=UNZ_OK)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   354
    return -1;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   355
  return info_z.uncompressed_size;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   356
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   357
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   358
bool QuaZipFile::getFileInfo(QuaZipFileInfo *info)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   359
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   360
  if(p->zip==NULL||p->zip->getMode()!=QuaZip::mdUnzip) return false;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   361
  p->zip->getCurrentFileInfo(info);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   362
  p->setZipError(p->zip->getZipError());
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   363
  return p->zipError==UNZ_OK;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   364
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   365
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   366
void QuaZipFile::close()
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   367
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   368
  p->resetZipError();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   369
  if(p->zip==NULL||!p->zip->isOpen()) return;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   370
  if(!isOpen()) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   371
    qWarning("QuaZipFile::close(): file isn't open");
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   372
    return;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   373
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   374
  if(openMode()&ReadOnly)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   375
    p->setZipError(unzCloseCurrentFile(p->zip->getUnzFile()));
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   376
  else if(openMode()&WriteOnly)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   377
    if(isRaw()) p->setZipError(zipCloseFileInZipRaw(p->zip->getZipFile(), p->uncompressedSize, p->crc));
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   378
    else p->setZipError(zipCloseFileInZip(p->zip->getZipFile()));
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   379
  else {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   380
    qWarning("Wrong open mode: %d", (int)openMode());
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   381
    return;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   382
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   383
  if(p->zipError==UNZ_OK) setOpenMode(QIODevice::NotOpen);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   384
  else return;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   385
  if(p->internal) {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   386
    p->zip->close();
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   387
    p->setZipError(p->zip->getZipError());
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   388
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   389
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   390
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   391
qint64 QuaZipFile::readData(char *data, qint64 maxSize)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   392
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   393
  p->setZipError(UNZ_OK);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   394
  qint64 bytesRead=unzReadCurrentFile(p->zip->getUnzFile(), data, (unsigned)maxSize);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   395
  if(bytesRead<0) p->setZipError((int)bytesRead);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   396
  return bytesRead;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   397
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   398
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   399
qint64 QuaZipFile::writeData(const char* data, qint64 maxSize)
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   400
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   401
  p->setZipError(ZIP_OK);
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   402
  p->setZipError(zipWriteInFileInZip(p->zip->getZipFile(), data, (uint)maxSize));
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   403
  if(p->zipError!=ZIP_OK) return -1;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   404
  else {
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   405
    p->writePos+=maxSize;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   406
    return maxSize;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   407
  }
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   408
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   409
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   410
QString QuaZipFile::getFileName() const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   411
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   412
  return p->fileName;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   413
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   414
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   415
QuaZip::CaseSensitivity QuaZipFile::getCaseSensitivity() const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   416
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   417
  return p->caseSensitivity;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   418
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   419
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   420
bool QuaZipFile::isRaw() const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   421
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   422
  return p->raw;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   423
}
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   424
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   425
int QuaZipFile::getZipError() const
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   426
{
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   427
  return p->zipError;
57b117d441b9 consistent line endings
nemo
parents: 5752
diff changeset
   428
}