| 402 | } |
| 403 | |
| 404 | QString QuaZip::getComment()const |
| 405 | { |
| 406 | QuaZip *fakeThis=const_cast<QuaZip*>(this); // non-const |
| 407 | fakeThis->p->zipError=UNZ_OK; |
| 408 | if(p->mode!=mdUnzip) { |
| 409 | qWarning("QuaZip::getComment(): ZIP is not open in mdUnzip mode"); |
| 410 | return QString(); |
| 411 | } |
| 412 | unz_global_info64 globalInfo; |
| 413 | QByteArray comment; |
| 414 | if((fakeThis->p->zipError=unzGetGlobalInfo64(p->unzFile_f, &globalInfo))!=UNZ_OK) |
| 415 | return QString(); |
| 416 | comment.resize(globalInfo.size_comment); |
| 417 | if((fakeThis->p->zipError=unzGetGlobalComment(p->unzFile_f, comment.data(), comment.size())) < 0) |
| 418 | return QString(); |
| 419 | fakeThis->p->zipError = UNZ_OK; |
| 420 | unsigned flags = 0; |
| 421 | return (unzGetFileFlags(p->unzFile_f, &flags) == UNZ_OK) && (flags & UNZ_ENCODING_UTF8) |
| 422 | ? QString::fromUtf8(comment) : p->commentCodec->toUnicode(comment); |
| 423 | } |
| 424 | |
| 425 | bool QuaZip::setCurrentFile(const QString& fileName, CaseSensitivity cs) |
| 426 | { |