summaryrefslogtreecommitdiffstats
path: root/heimdall-frontend/Source
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--[-rwxr-xr-x]heimdall-frontend/Source/Alerts.cpp0
-rw-r--r--[-rwxr-xr-x]heimdall-frontend/Source/Alerts.h0
-rw-r--r--[-rwxr-xr-x]heimdall-frontend/Source/FirmwareInfo.cpp0
-rw-r--r--[-rwxr-xr-x]heimdall-frontend/Source/FirmwareInfo.h0
-rw-r--r--[-rwxr-xr-x]heimdall-frontend/Source/PackageData.cpp0
-rw-r--r--[-rwxr-xr-x]heimdall-frontend/Source/PackageData.h0
-rw-r--r--[-rwxr-xr-x]heimdall-frontend/Source/Packaging.cpp16
-rw-r--r--[-rwxr-xr-x]heimdall-frontend/Source/Packaging.h10
-rw-r--r--heimdall-frontend/Source/mainwindow.cpp6
9 files changed, 18 insertions, 14 deletions
diff --git a/heimdall-frontend/Source/Alerts.cpp b/heimdall-frontend/Source/Alerts.cpp
index e8e8752..e8e8752 100755..100644
--- a/heimdall-frontend/Source/Alerts.cpp
+++ b/heimdall-frontend/Source/Alerts.cpp
diff --git a/heimdall-frontend/Source/Alerts.h b/heimdall-frontend/Source/Alerts.h
index 95c2b75..95c2b75 100755..100644
--- a/heimdall-frontend/Source/Alerts.h
+++ b/heimdall-frontend/Source/Alerts.h
diff --git a/heimdall-frontend/Source/FirmwareInfo.cpp b/heimdall-frontend/Source/FirmwareInfo.cpp
index aee9313..aee9313 100755..100644
--- a/heimdall-frontend/Source/FirmwareInfo.cpp
+++ b/heimdall-frontend/Source/FirmwareInfo.cpp
diff --git a/heimdall-frontend/Source/FirmwareInfo.h b/heimdall-frontend/Source/FirmwareInfo.h
index 64c73cb..64c73cb 100755..100644
--- a/heimdall-frontend/Source/FirmwareInfo.h
+++ b/heimdall-frontend/Source/FirmwareInfo.h
diff --git a/heimdall-frontend/Source/PackageData.cpp b/heimdall-frontend/Source/PackageData.cpp
index ad25515..ad25515 100755..100644
--- a/heimdall-frontend/Source/PackageData.cpp
+++ b/heimdall-frontend/Source/PackageData.cpp
diff --git a/heimdall-frontend/Source/PackageData.h b/heimdall-frontend/Source/PackageData.h
index 2039a08..2039a08 100755..100644
--- a/heimdall-frontend/Source/PackageData.h
+++ b/heimdall-frontend/Source/PackageData.h
diff --git a/heimdall-frontend/Source/Packaging.cpp b/heimdall-frontend/Source/Packaging.cpp
index 8db5dff..fc41ba6 100755..100644
--- a/heimdall-frontend/Source/Packaging.cpp
+++ b/heimdall-frontend/Source/Packaging.cpp
@@ -39,6 +39,7 @@
using namespace HeimdallFrontend;
+const qint64 Packaging::kMaxFileSize = 8589934592ll;
const char *Packaging::ustarMagic = "ustar";
bool Packaging::ExtractTar(QTemporaryFile& tarFile, PackageData *packageData)
@@ -81,7 +82,7 @@ bool Packaging::ExtractTar(QTemporaryFile& tarFile, PackageData *packageData)
return (false);
}
- bool ustarFormat = strcmp(tarHeader.fields.magic, ustarMagic) == 0;
+ //bool ustarFormat = strcmp(tarHeader.fields.magic, ustarMagic) == 0;
bool empty = true;
for (int i = 0; i < TarHeader::kBlockLength; i++)
@@ -233,7 +234,7 @@ bool Packaging::WriteTarEntry(const QString& filename, QTemporaryFile *tarFile,
return (false);
}
- if (file.size() > TarHeader::kMaxFileSize)
+ if (file.size() > Packaging::kMaxFileSize)
{
Alerts::DisplayError(QString("File is too large to be packaged:\n%1").arg(file.fileName()));
return (false);
@@ -306,8 +307,8 @@ bool Packaging::WriteTarEntry(const QString& filename, QTemporaryFile *tarFile,
sprintf(tarHeader.fields.groupId, "%07o", 0);
// Note: We don't support base-256 encoding. Support could be added later.
- sprintf(tarHeader.fields.size, "%011o", file.size());
- sprintf(tarHeader.fields.modifiedTime, "%011o", qtFileInfo.lastModified().toMSecsSinceEpoch() / 1000);
+ sprintf(tarHeader.fields.size, "%011llo", file.size());
+ sprintf(tarHeader.fields.modifiedTime, "%011llo", qtFileInfo.lastModified().toMSecsSinceEpoch() / 1000);
// Regular File
tarHeader.fields.typeFlag = '0';
@@ -373,7 +374,8 @@ bool Packaging::CreateTar(const FirmwareInfo& firmwareInfo, QTemporaryFile *tarF
return (false);
}
- firmwareInfo.WriteXml(QXmlStreamWriter(&firmwareXmlFile));
+ QXmlStreamWriter xml(&firmwareXmlFile);
+ firmwareInfo.WriteXml(xml);
firmwareXmlFile.close();
if (!tarFile->open())
@@ -456,7 +458,7 @@ bool Packaging::ExtractPackage(const QString& packagePath, PackageData *packageD
{
FILE *compressedPackageFile = fopen(packagePath.toStdString().c_str(), "rb");
- if (fopen == NULL)
+ if (!compressedPackageFile)
{
Alerts::DisplayError(QString("Failed to open package:\n%1").arg(packagePath));
return (false);
@@ -547,7 +549,7 @@ bool Packaging::BuildPackage(const QString& packagePath, const FirmwareInfo& fir
{
FILE *compressedPackageFile = fopen(packagePath.toStdString().c_str(), "wb");
- if (fopen == NULL)
+ if (!compressedPackageFile)
{
Alerts::DisplayError(QString("Failed to create package:\n%1").arg(packagePath));
return (false);
diff --git a/heimdall-frontend/Source/Packaging.h b/heimdall-frontend/Source/Packaging.h
index b02637a..402f786 100755..100644
--- a/heimdall-frontend/Source/Packaging.h
+++ b/heimdall-frontend/Source/Packaging.h
@@ -43,11 +43,6 @@ namespace HeimdallFrontend
kUstarHeaderLength = 500,
};
- enum : quint64
- {
- kMaxFileSize = 8589934592
- };
-
enum
{
kModeOtherExecute = 1,
@@ -92,6 +87,11 @@ namespace HeimdallFrontend
class Packaging
{
+ public:
+
+ // Would definitely prefer to use an enum but VC++ and GCC give conflicting warnings about C++0x or type overflow.
+ static const qint64 kMaxFileSize;
+
private:
enum
diff --git a/heimdall-frontend/Source/mainwindow.cpp b/heimdall-frontend/Source/mainwindow.cpp
index f5880f9..a777c77 100644
--- a/heimdall-frontend/Source/mainwindow.cpp
+++ b/heimdall-frontend/Source/mainwindow.cpp
@@ -343,12 +343,14 @@ void MainWindow::SelectFirmwarePackage(void)
void MainWindow::OpenDeveloperHomepage(void)
{
- QDesktopServices::openUrl(QUrl(loadedPackageData.GetFirmwareInfo().GetUrl(), QUrl::TolerantMode));
+ if(!QDesktopServices::openUrl(QUrl(loadedPackageData.GetFirmwareInfo().GetUrl(), QUrl::TolerantMode)))
+ Alerts::DisplayWarning(QString("Cannot open invalid URL:\n%1").arg(loadedPackageData.GetFirmwareInfo().GetUrl()));
}
void MainWindow::OpenDeveloperDonationWebpage(void)
{
- QDesktopServices::openUrl(QUrl(loadedPackageData.GetFirmwareInfo().GetDonateUrl(), QUrl::TolerantMode));
+ if (!QDesktopServices::openUrl(QUrl(loadedPackageData.GetFirmwareInfo().GetDonateUrl(), QUrl::TolerantMode)))
+ Alerts::DisplayWarning(QString("Cannot open invalid URL:\n%1").arg(loadedPackageData.GetFirmwareInfo().GetDonateUrl()));
}
void MainWindow::LoadFirmwarePackage(void)