mirror of
https://github.com/YACReader/yacreader
synced 2025-07-14 02:54:46 -04:00
clang-format
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
CompressedArchive::CompressedArchive(const QString &filePath, QObject *parent)
|
||||
: QObject(parent), tools(true), valid(false), numFiles(0), ar(NULL), stream(NULL)
|
||||
{
|
||||
//open file
|
||||
// open file
|
||||
#ifdef Q_OS_WIN
|
||||
stream = ar_open_file_w((wchar_t *)filePath.utf16());
|
||||
#else
|
||||
@ -19,23 +19,23 @@ CompressedArchive::CompressedArchive(const QString &filePath, QObject *parent)
|
||||
return;
|
||||
}
|
||||
|
||||
//open archive
|
||||
// open archive
|
||||
ar = ar_open_rar_archive(stream);
|
||||
//TODO: build unarr with 7z support and test this!
|
||||
// TODO: build unarr with 7z support and test this!
|
||||
if (!ar)
|
||||
ar = ar_open_7z_archive(stream);
|
||||
if (!ar)
|
||||
ar = ar_open_tar_archive(stream);
|
||||
//zip detection is costly, so it comes last...
|
||||
// zip detection is costly, so it comes last...
|
||||
if (!ar)
|
||||
ar = ar_open_zip_archive(stream, false);
|
||||
if (!ar) {
|
||||
return;
|
||||
}
|
||||
|
||||
//initial parse
|
||||
// initial parse
|
||||
while (ar_parse_entry(ar)) {
|
||||
//make sure we really got a file header
|
||||
// make sure we really got a file header
|
||||
if (ar_entry_get_size(ar) > 0) {
|
||||
fileNames.append(ar_entry_get_name(ar));
|
||||
offsets.append(ar_entry_get_offset(ar));
|
||||
@ -43,8 +43,8 @@ CompressedArchive::CompressedArchive(const QString &filePath, QObject *parent)
|
||||
}
|
||||
}
|
||||
if (!ar_at_eof(ar)) {
|
||||
//fail if the initial parse didn't reach EOF
|
||||
//this might be a bit too drastic
|
||||
// fail if the initial parse didn't reach EOF
|
||||
// this might be a bit too drastic
|
||||
qDebug() << "Error while parsing archive";
|
||||
return;
|
||||
}
|
||||
@ -71,7 +71,7 @@ bool CompressedArchive::isValid()
|
||||
|
||||
bool CompressedArchive::toolsLoaded()
|
||||
{
|
||||
//for backwards compatibilty
|
||||
// for backwards compatibilty
|
||||
return tools;
|
||||
}
|
||||
|
||||
@ -93,14 +93,14 @@ void CompressedArchive::getAllData(const QVector<quint32> &indexes, ExtractDeleg
|
||||
return;
|
||||
}
|
||||
|
||||
//use the offset list so we generated so we're not getting any non-page files
|
||||
ar_parse_entry_at(ar, offsets.at(indexes.at(i))); //set ar_entry to start of indexes
|
||||
// use the offset list so we generated so we're not getting any non-page files
|
||||
ar_parse_entry_at(ar, offsets.at(indexes.at(i))); // set ar_entry to start of indexes
|
||||
buffer.resize(ar_entry_get_size(ar));
|
||||
if (ar_entry_uncompress(ar, buffer.data(), buffer.size())) //did we extract it?
|
||||
if (ar_entry_uncompress(ar, buffer.data(), buffer.size())) // did we extract it?
|
||||
{
|
||||
delegate->fileExtracted(indexes.at(i), buffer); //return extracted file
|
||||
delegate->fileExtracted(indexes.at(i), buffer); // return extracted file
|
||||
} else {
|
||||
delegate->crcError(indexes.at(i)); //we could not extract it...
|
||||
delegate->crcError(indexes.at(i)); // we could not extract it...
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
@ -12,4 +12,4 @@ public:
|
||||
virtual bool isCancelled() = 0;
|
||||
};
|
||||
|
||||
#endif //EXTRACT_DELEGATE_H
|
||||
#endif // EXTRACT_DELEGATE_H
|
Reference in New Issue
Block a user