From 6cd6b35c737e0e4042a8fd79af1decc9f10ed84b Mon Sep 17 00:00:00 2001 From: Benjamin Dobell Date: Mon, 1 Oct 2012 12:43:05 +1000 Subject: Heimdall 1.4 RC1: - Massive refactoring. - Support for Qualcomm based devices. - Print PIT from file. - Use partition names as arguments e.g. --HIDDEN, --KERNEL, --MOVINAND etc. - Heimdall Frontend UI improvements. - And much more... --- heimdall-frontend/Source/Packaging.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'heimdall-frontend/Source/Packaging.cpp') diff --git a/heimdall-frontend/Source/Packaging.cpp b/heimdall-frontend/Source/Packaging.cpp index 79084e9..9bf7d46 100644 --- a/heimdall-frontend/Source/Packaging.cpp +++ b/heimdall-frontend/Source/Packaging.cpp @@ -301,7 +301,7 @@ bool Packaging::WriteTarEntry(const QString& filePath, QTemporaryFile *tarFile, // Note: We don't support base-256 encoding. Support could be added later. sprintf(tarHeader.fields.size, "%011llo", file.size()); - sprintf(tarHeader.fields.modifiedTime, "%011llo", qtFileInfo.lastModified().toMSecsSinceEpoch() / 1000); + sprintf(tarHeader.fields.modifiedTime, "%011llo", qtFileInfo.lastModified().toTime_t()); // Regular File tarHeader.fields.typeFlag = '0'; @@ -381,6 +381,24 @@ bool Packaging::CreateTar(const FirmwareInfo& firmwareInfo, QTemporaryFile *tarF for (int i = 0; i < fileInfos.length(); i++) { + // If the file was already compressed we don't compress it again. + bool skip = false; + + for (int j = 0; j < i; j++) + { + if (fileInfos[i].GetFilename() == fileInfos[j].GetFilename()) + { + skip = true; + break; + } + } + + if (skip) + { + progressDialog.setValue(i); + continue; + } + QString filename = ClashlessFilename(fileInfos, i); if (filename == "firmware.xml") @@ -389,7 +407,7 @@ bool Packaging::CreateTar(const FirmwareInfo& firmwareInfo, QTemporaryFile *tarF return (false); } - if (!WriteTarEntry(fileInfos[i].GetFilename(), tarFile, ClashlessFilename(fileInfos, i))) + if (!WriteTarEntry(fileInfos[i].GetFilename(), tarFile, filename)) { tarFile->resize(0); tarFile->close(); @@ -666,7 +684,8 @@ QString Packaging::ClashlessFilename(const QList& fileInfos, int fileI QString otherFilename = fileInfos[i].GetFilename().mid(lastSlash + 1); - if (filename == otherFilename) + // If the filenames are the same, but the files themselves aren't the same (i.e. not the same path), then rename. + if (filename == otherFilename && fileInfos[i].GetFilename() != fileInfos[fileInfoIndex].GetFilename()) renameIndex++; } -- cgit v1.1