Downcast all qtsizetype to UINT32 manually, apply consistent identation

This commit is contained in:
Nikolaj Schlej 2022-08-28 12:47:01 +02:00
parent 10e2e60183
commit 4006954bc1
25 changed files with 3398 additions and 3398 deletions

View File

@ -1,15 +1,15 @@
/* fssfinder.cpp /* fssfinder.cpp
Copyright (c) 2015, Nikolaj Schlej. All rights reserved. Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "ffsfinder.h" #include "ffsfinder.h"
@ -92,10 +92,10 @@ USTATUS FfsFinder::findHexPattern(const UModelIndex & index, const UByteArray &
} }
return U_SUCCESS; return U_SUCCESS;
} }
USTATUS FfsFinder::findGuidPattern(const UModelIndex & index, const UByteArray & guidPattern, const UINT8 mode) USTATUS FfsFinder::findGuidPattern(const UModelIndex & index, const UByteArray & guidPattern, const UINT8 mode)
{ {
if (guidPattern.isEmpty()) if (guidPattern.isEmpty())
return U_INVALID_PARAMETER; return U_INVALID_PARAMETER;
@ -176,10 +176,10 @@ USTATUS FfsFinder::findGuidPattern(const UModelIndex & index, const UByteArray &
} }
return U_SUCCESS; return U_SUCCESS;
} }
USTATUS FfsFinder::findTextPattern(const UModelIndex & index, const UString & pattern, const UINT8 mode, const bool unicode, const Qt::CaseSensitivity caseSensitive) USTATUS FfsFinder::findTextPattern(const UModelIndex & index, const UString & pattern, const UINT8 mode, const bool unicode, const Qt::CaseSensitivity caseSensitive)
{ {
if (pattern.isEmpty()) if (pattern.isEmpty())
return U_INVALID_PARAMETER; return U_INVALID_PARAMETER;
@ -226,4 +226,4 @@ USTATUS FfsFinder::findTextPattern(const UModelIndex & index, const UString & pa
} }
return U_SUCCESS; return U_SUCCESS;
} }

View File

@ -14,12 +14,12 @@
#include "guidlineedit.h" #include "guidlineedit.h"
GuidLineEdit::GuidLineEdit(QWidget * parent) GuidLineEdit::GuidLineEdit(QWidget * parent)
:QLineEdit(parent) :QLineEdit(parent)
{ {
} }
GuidLineEdit::GuidLineEdit(const QString & contents, QWidget * parent) GuidLineEdit::GuidLineEdit(const QString & contents, QWidget * parent)
:QLineEdit(contents, parent) :QLineEdit(contents, parent)
{ {
} }
@ -42,12 +42,13 @@ void GuidLineEdit::keyPressEvent(QKeyEvent * event)
if (!selected.isEmpty()) { if (!selected.isEmpty()) {
pos = QLineEdit::selectionStart(); pos = QLineEdit::selectionStart();
for (int i = pos; i < pos + selected.count(); i++) for (int i = pos; i < pos + selected.length(); i++)
if (txt[i] != QChar('-')) if (txt[i] != QChar('-'))
txt[i] = QChar('.'); txt[i] = QChar('.');
} }
else else {
txt[pos] = QChar('.'); txt[pos] = QChar('.');
}
setCursorPosition(0); setCursorPosition(0);
insert(txt); insert(txt);

View File

@ -812,10 +812,10 @@ void UEFITool::showParserMessages()
ui->messagesTabWidget->setCurrentIndex(TAB_PARSER); ui->messagesTabWidget->setCurrentIndex(TAB_PARSER);
ui->parserMessagesListWidget->scrollToBottom(); ui->parserMessagesListWidget->scrollToBottom();
} }
void UEFITool::showFinderMessages() void UEFITool::showFinderMessages()
{ {
ui->finderMessagesListWidget->clear(); ui->finderMessagesListWidget->clear();
if (!ffsParser) if (!ffsParser)
return; return;
@ -837,10 +837,10 @@ void UEFITool::showFinderMessages()
ui->messagesTabWidget->setTabEnabled(TAB_SEARCH, true); ui->messagesTabWidget->setTabEnabled(TAB_SEARCH, true);
ui->messagesTabWidget->setCurrentIndex(TAB_SEARCH); ui->messagesTabWidget->setCurrentIndex(TAB_SEARCH);
ui->finderMessagesListWidget->scrollToBottom(); ui->finderMessagesListWidget->scrollToBottom();
} }
void UEFITool::showBuilderMessages() void UEFITool::showBuilderMessages()
{ {
ui->builderMessagesListWidget->clear(); ui->builderMessagesListWidget->clear();
if (!ffsBuilder) if (!ffsBuilder)
return; return;
@ -862,30 +862,30 @@ void UEFITool::showBuilderMessages()
ui->messagesTabWidget->setTabEnabled(TAB_BUILDER, true); ui->messagesTabWidget->setTabEnabled(TAB_BUILDER, true);
ui->messagesTabWidget->setCurrentIndex(TAB_BUILDER); ui->messagesTabWidget->setCurrentIndex(TAB_BUILDER);
ui->builderMessagesListWidget->scrollToBottom(); ui->builderMessagesListWidget->scrollToBottom();
} }
void UEFITool::scrollTreeView(QListWidgetItem* item) void UEFITool::scrollTreeView(QListWidgetItem* item)
{ {
QByteArray second = item->data(Qt::UserRole).toByteArray(); QByteArray second = item->data(Qt::UserRole).toByteArray();
QModelIndex *index = (QModelIndex *)second.data(); QModelIndex *index = (QModelIndex *)second.data();
if (index && index->isValid()) { if (index && index->isValid()) {
ui->structureTreeView->scrollTo(*index, QAbstractItemView::PositionAtCenter); ui->structureTreeView->scrollTo(*index, QAbstractItemView::PositionAtCenter);
ui->structureTreeView->selectionModel()->select(*index, QItemSelectionModel::Select | QItemSelectionModel::Rows | QItemSelectionModel::Clear); ui->structureTreeView->selectionModel()->select(*index, QItemSelectionModel::Select | QItemSelectionModel::Rows | QItemSelectionModel::Clear);
} }
} }
void UEFITool::scrollTreeView(QTableWidgetItem* item) void UEFITool::scrollTreeView(QTableWidgetItem* item)
{ {
QByteArray second = item->data(Qt::UserRole).toByteArray(); QByteArray second = item->data(Qt::UserRole).toByteArray();
QModelIndex *index = (QModelIndex *)second.data(); QModelIndex *index = (QModelIndex *)second.data();
if (index && index->isValid()) { if (index && index->isValid()) {
ui->structureTreeView->scrollTo(*index, QAbstractItemView::PositionAtCenter); ui->structureTreeView->scrollTo(*index, QAbstractItemView::PositionAtCenter);
ui->structureTreeView->selectionModel()->select(*index, QItemSelectionModel::Select | QItemSelectionModel::Rows | QItemSelectionModel::Clear); ui->structureTreeView->selectionModel()->select(*index, QItemSelectionModel::Select | QItemSelectionModel::Rows | QItemSelectionModel::Clear);
} }
} }
void UEFITool::contextMenuEvent(QContextMenuEvent* event) void UEFITool::contextMenuEvent(QContextMenuEvent* event)
{ {
// The checks involving underMouse do not work well enough on macOS, and result in right-click sometimes // The checks involving underMouse do not work well enough on macOS, and result in right-click sometimes
// not showing any context menu at all. Most likely it is a bug in Qt, which does not affect other systems. // not showing any context menu at all. Most likely it is a bug in Qt, which does not affect other systems.
// For this reason we reimplement this manually. // For this reason we reimplement this manually.
@ -929,10 +929,10 @@ void UEFITool::contextMenuEvent(QContextMenuEvent* event)
case Types::FreeSpace: break; // No menu needed for FreeSpace item case Types::FreeSpace: break; // No menu needed for FreeSpace item
default: ui->menuEntryActions->exec(event->globalPos()); break; default: ui->menuEntryActions->exec(event->globalPos()); break;
} }
} }
void UEFITool::readSettings() void UEFITool::readSettings()
{ {
QSettings settings(this); QSettings settings(this);
restoreGeometry(settings.value("mainWindow/geometry").toByteArray()); restoreGeometry(settings.value("mainWindow/geometry").toByteArray());
restoreState(settings.value("mainWindow/windowState").toByteArray()); restoreState(settings.value("mainWindow/windowState").toByteArray());
@ -976,10 +976,10 @@ void UEFITool::readSettings()
hexViewDialog->setFont(currentFont); hexViewDialog->setFont(currentFont);
goToAddressDialog->ui->hexSpinBox->setFont(currentFont); goToAddressDialog->ui->hexSpinBox->setFont(currentFont);
goToBaseDialog->ui->hexSpinBox->setFont(currentFont); goToBaseDialog->ui->hexSpinBox->setFont(currentFont);
} }
void UEFITool::writeSettings() void UEFITool::writeSettings()
{ {
QSettings settings(this); QSettings settings(this);
settings.setValue("mainWindow/geometry", saveGeometry()); settings.setValue("mainWindow/geometry", saveGeometry());
settings.setValue("mainWindow/windowState", saveState()); settings.setValue("mainWindow/windowState", saveState());
@ -994,10 +994,10 @@ void UEFITool::writeSettings()
settings.setValue("tree/markingEnabled", markingEnabled); settings.setValue("tree/markingEnabled", markingEnabled);
settings.setValue("mainWindow/fontName", currentFont.family()); settings.setValue("mainWindow/fontName", currentFont.family());
settings.setValue("mainWindow/fontSize", currentFont.pointSize()); settings.setValue("mainWindow/fontSize", currentFont.pointSize());
} }
void UEFITool::showFitTable() void UEFITool::showFitTable()
{ {
std::vector<std::pair<std::vector<UString>, UModelIndex> > fitTable = ffsParser->getFitTable(); std::vector<std::pair<std::vector<UString>, UModelIndex> > fitTable = ffsParser->getFitTable();
if (fitTable.empty()) { if (fitTable.empty()) {
// Disable FIT tab // Disable FIT tab
@ -1030,10 +1030,10 @@ void UEFITool::showFitTable()
ui->fitTableWidget->resizeColumnsToContents(); ui->fitTableWidget->resizeColumnsToContents();
ui->fitTableWidget->resizeRowsToContents(); ui->fitTableWidget->resizeRowsToContents();
ui->messagesTabWidget->setCurrentIndex(TAB_FIT); ui->messagesTabWidget->setCurrentIndex(TAB_FIT);
} }
void UEFITool::showSecurityInfo() void UEFITool::showSecurityInfo()
{ {
// Get security info // Get security info
UString secInfo = ffsParser->getSecurityInfo(); UString secInfo = ffsParser->getSecurityInfo();
if (secInfo.isEmpty()) { if (secInfo.isEmpty()) {
@ -1044,54 +1044,54 @@ void UEFITool::showSecurityInfo()
ui->messagesTabWidget->setTabEnabled(TAB_SECURITY, true); ui->messagesTabWidget->setTabEnabled(TAB_SECURITY, true);
ui->securityEdit->setPlainText(secInfo); ui->securityEdit->setPlainText(secInfo);
ui->messagesTabWidget->setCurrentIndex(TAB_SECURITY); ui->messagesTabWidget->setCurrentIndex(TAB_SECURITY);
} }
void UEFITool::currentTabChanged(int index) void UEFITool::currentTabChanged(int index)
{ {
U_UNUSED_PARAMETER(index); U_UNUSED_PARAMETER(index);
ui->menuMessageActions->setEnabled(false); ui->menuMessageActions->setEnabled(false);
ui->actionMessagesCopy->setEnabled(false); ui->actionMessagesCopy->setEnabled(false);
ui->actionMessagesCopyAll->setEnabled(false); ui->actionMessagesCopyAll->setEnabled(false);
ui->actionMessagesClear->setEnabled(false); ui->actionMessagesClear->setEnabled(false);
} }
void UEFITool::loadGuidDatabase() void UEFITool::loadGuidDatabase()
{ {
QString path = QFileDialog::getOpenFileName(this, tr("Select GUID database file to load"), currentDir, tr("Comma-separated values files (*.csv);;All files (*)")); QString path = QFileDialog::getOpenFileName(this, tr("Select GUID database file to load"), currentDir, tr("Comma-separated values files (*.csv);;All files (*)"));
if (!path.isEmpty()) { if (!path.isEmpty()) {
initGuidDatabase(path); initGuidDatabase(path);
if (!currentPath.isEmpty() && QMessageBox::Yes == QMessageBox::information(this, tr("New GUID database loaded"), tr("Apply new GUID database on the opened file?\nUnsaved changes and tree position will be lost."), QMessageBox::Yes, QMessageBox::No)) if (!currentPath.isEmpty() && QMessageBox::Yes == QMessageBox::information(this, tr("New GUID database loaded"), tr("Apply new GUID database on the opened file?\nUnsaved changes and tree position will be lost."), QMessageBox::Yes, QMessageBox::No))
openImageFile(currentPath); openImageFile(currentPath);
} }
} }
void UEFITool::unloadGuidDatabase() void UEFITool::unloadGuidDatabase()
{ {
initGuidDatabase(); initGuidDatabase();
if (!currentPath.isEmpty() && QMessageBox::Yes == QMessageBox::information(this, tr("GUID database unloaded"), tr("Apply changes on the opened file?\nUnsaved changes and tree position will be lost."), QMessageBox::Yes, QMessageBox::No)) if (!currentPath.isEmpty() && QMessageBox::Yes == QMessageBox::information(this, tr("GUID database unloaded"), tr("Apply changes on the opened file?\nUnsaved changes and tree position will be lost."), QMessageBox::Yes, QMessageBox::No))
openImageFile(currentPath); openImageFile(currentPath);
} }
void UEFITool::loadDefaultGuidDatabase() void UEFITool::loadDefaultGuidDatabase()
{ {
initGuidDatabase(":/guids.csv"); initGuidDatabase(":/guids.csv");
if (!currentPath.isEmpty() && QMessageBox::Yes == QMessageBox::information(this, tr("Default GUID database loaded"), tr("Apply default GUID database on the opened file?\nUnsaved changes and tree position will be lost."), QMessageBox::Yes, QMessageBox::No)) if (!currentPath.isEmpty() && QMessageBox::Yes == QMessageBox::information(this, tr("Default GUID database loaded"), tr("Apply default GUID database on the opened file?\nUnsaved changes and tree position will be lost."), QMessageBox::Yes, QMessageBox::No))
openImageFile(currentPath); openImageFile(currentPath);
} }
void UEFITool::exportDiscoveredGuids() void UEFITool::exportDiscoveredGuids()
{ {
GuidDatabase db = guidDatabaseFromTreeRecursive(model, model->index(0, 0)); GuidDatabase db = guidDatabaseFromTreeRecursive(model, model->index(0, 0));
if (!db.empty()) { if (!db.empty()) {
QString path = QFileDialog::getSaveFileName(this, tr("Save parsed GUIDs to database"), currentPath + ".guids.csv", tr("Comma-separated values files (*.csv);;All files (*)")); QString path = QFileDialog::getSaveFileName(this, tr("Save parsed GUIDs to database"), currentPath + ".guids.csv", tr("Comma-separated values files (*.csv);;All files (*)"));
if (!path.isEmpty()) if (!path.isEmpty())
guidDatabaseExportToFile(path, db); guidDatabaseExportToFile(path, db);
} }
} }
void UEFITool::generateReport() void UEFITool::generateReport()
{ {
QString path = QFileDialog::getSaveFileName(this, tr("Save report to text file"), currentPath + ".report.txt", tr("Text files (*.txt);;All files (*)")); QString path = QFileDialog::getSaveFileName(this, tr("Save report to text file"), currentPath + ".report.txt", tr("Text files (*.txt);;All files (*)"));
if (!path.isEmpty()) { if (!path.isEmpty()) {
std::vector<QString> report = ffsReport->generate(); std::vector<QString> report = ffsReport->generate();
@ -1106,4 +1106,4 @@ void UEFITool::generateReport()
} }
} }
} }
} }

View File

@ -1,14 +1,14 @@
/* descriptor.cpp /* descriptor.cpp
Copyright (c) 2015, Nikolaj Schlej. All rights reserved. Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "descriptor.h" #include "descriptor.h"

View File

@ -1,14 +1,14 @@
/* ffs.cpp /* ffs.cpp
Copyright (c) 2015, Nikolaj Schlej. All rights reserved. Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include <cstdio> #include <cstdio>

View File

@ -1,15 +1,15 @@
/* fssbuilder.cpp /* fssbuilder.cpp
Copyright (c) 2015, Nikolaj Schlej. All rights reserved. Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "ffsbuilder.h" #include "ffsbuilder.h"
#include "descriptor.h" #include "descriptor.h"

View File

@ -1,15 +1,15 @@
/* fssops.cpp /* fssops.cpp
Copyright (c) 2015, Nikolaj Schlej. All rights reserved. Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "ffsops.h" #include "ffsops.h"
#include "ffs.h" #include "ffs.h"

View File

@ -1,14 +1,14 @@
/* ffsparser.cpp /* ffsparser.cpp
Copyright (c) 2018, Nikolaj Schlej. All rights reserved. Copyright (c) 2018, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "ffsparser.h" #include "ffsparser.h"
@ -33,12 +33,12 @@ WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#ifndef QT_CORE_LIB #ifndef QT_CORE_LIB
namespace Qt { namespace Qt {
enum GlobalColor { enum GlobalColor {
red = 7, red = 7,
green = 8, green = 8,
cyan = 10, cyan = 10,
yellow = 12, yellow = 12,
}; };
} }
#endif #endif
@ -161,7 +161,7 @@ USTATUS FfsParser::parseGenericImage(const UByteArray & buffer, const UINT32 loc
{ {
// Parse as generic UEFI image // Parse as generic UEFI image
UString name("UEFI image"); UString name("UEFI image");
UString info = usprintf("Full size: %Xh (%u)", buffer.size(), buffer.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)buffer.size(), (UINT32)buffer.size());
// Add tree item // Add tree item
index = model->addItem(localOffset, Types::Image, Subtypes::UefiImage, name, UString(), info, UByteArray(), buffer, UByteArray(), Fixed, parent); index = model->addItem(localOffset, Types::Image, Subtypes::UefiImage, name, UString(), info, UByteArray(), buffer, UByteArray(), Fixed, parent);
@ -209,7 +209,7 @@ USTATUS FfsParser::parseCapsule(const UByteArray & capsule, const UINT32 localOf
UString name("UEFI capsule"); UString name("UEFI capsule");
UString info = UString("Capsule GUID: ") + guidToUString(capsuleHeader->CapsuleGuid, false) + UString info = UString("Capsule GUID: ") + guidToUString(capsuleHeader->CapsuleGuid, false) +
usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nImage size: %Xh (%u)\nFlags: %08Xh", usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nImage size: %Xh (%u)\nFlags: %08Xh",
capsule.size(), capsule.size(), (UINT32)capsule.size(), (UINT32)capsule.size(),
capsuleHeaderSize, capsuleHeaderSize, capsuleHeaderSize, capsuleHeaderSize,
capsuleHeader->CapsuleImageSize - capsuleHeaderSize, capsuleHeader->CapsuleImageSize - capsuleHeaderSize, capsuleHeader->CapsuleImageSize - capsuleHeaderSize, capsuleHeader->CapsuleImageSize - capsuleHeaderSize,
capsuleHeader->Flags); capsuleHeader->Flags);
@ -241,7 +241,7 @@ USTATUS FfsParser::parseCapsule(const UByteArray & capsule, const UINT32 localOf
UString name("Toshiba capsule"); UString name("Toshiba capsule");
UString info = UString("Capsule GUID: ") + guidToUString(capsuleHeader->CapsuleGuid, false) + UString info = UString("Capsule GUID: ") + guidToUString(capsuleHeader->CapsuleGuid, false) +
usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nImage size: %Xh (%u)\nFlags: %08Xh", usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nImage size: %Xh (%u)\nFlags: %08Xh",
capsule.size(), capsule.size(), (UINT32)capsule.size(), (UINT32)capsule.size(),
capsuleHeaderSize, capsuleHeaderSize, capsuleHeaderSize, capsuleHeaderSize,
capsuleHeader->FullSize - capsuleHeaderSize, capsuleHeader->FullSize - capsuleHeaderSize, capsuleHeader->FullSize - capsuleHeaderSize, capsuleHeader->FullSize - capsuleHeaderSize,
capsuleHeader->Flags); capsuleHeader->Flags);
@ -282,7 +282,7 @@ USTATUS FfsParser::parseCapsule(const UByteArray & capsule, const UINT32 localOf
UString name("AMI Aptio capsule"); UString name("AMI Aptio capsule");
UString info = UString("Capsule GUID: ") + guidToUString(capsuleHeader->CapsuleHeader.CapsuleGuid, false) + UString info = UString("Capsule GUID: ") + guidToUString(capsuleHeader->CapsuleHeader.CapsuleGuid, false) +
usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nImage size: %Xh (%u)\nFlags: %08Xh", usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nImage size: %Xh (%u)\nFlags: %08Xh",
capsule.size(), capsule.size(), (UINT32)capsule.size(), (UINT32)capsule.size(),
capsuleHeaderSize, capsuleHeaderSize, capsuleHeaderSize, capsuleHeaderSize,
capsuleHeader->CapsuleHeader.CapsuleImageSize - capsuleHeaderSize, capsuleHeader->CapsuleHeader.CapsuleImageSize - capsuleHeaderSize, capsuleHeader->CapsuleHeader.CapsuleImageSize - capsuleHeaderSize, capsuleHeader->CapsuleHeader.CapsuleImageSize - capsuleHeaderSize,
capsuleHeader->CapsuleHeader.Flags); capsuleHeader->CapsuleHeader.Flags);
@ -486,7 +486,7 @@ USTATUS FfsParser::parseIntelImage(const UByteArray & intelImage, const UINT32 l
// Intel image // Intel image
UString name("Intel image"); UString name("Intel image");
UString info = usprintf("Full size: %Xh (%u)\nFlash chips: %u\nRegions: %u\nMasters: %u\nPCH straps: %u\nPROC straps: %u", UString info = usprintf("Full size: %Xh (%u)\nFlash chips: %u\nRegions: %u\nMasters: %u\nPCH straps: %u\nPROC straps: %u",
intelImage.size(), intelImage.size(), (UINT32)intelImage.size(), (UINT32)intelImage.size(),
descriptorMap->NumberOfFlashChips + 1, // descriptorMap->NumberOfFlashChips + 1, //
descriptorMap->NumberOfRegions + 1, // Zero-based numbers in storage descriptorMap->NumberOfRegions + 1, // Zero-based numbers in storage
descriptorMap->NumberOfMasters + 1, // descriptorMap->NumberOfMasters + 1, //
@ -649,7 +649,7 @@ USTATUS FfsParser::parseIntelImage(const UByteArray & intelImage, const UINT32 l
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", info = usprintf("Full size: %Xh (%u)",
padding.size(), padding.size()); (UINT32)padding.size(), (UINT32)padding.size());
// Add tree item // Add tree item
regionIndex = model->addItem(region.offset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); regionIndex = model->addItem(region.offset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index);
@ -681,7 +681,7 @@ USTATUS FfsParser::parseGbeRegion(const UByteArray & gbe, const UINT32 localOffs
const GBE_MAC_ADDRESS* mac = (const GBE_MAC_ADDRESS*)gbe.constData(); const GBE_MAC_ADDRESS* mac = (const GBE_MAC_ADDRESS*)gbe.constData();
const GBE_VERSION* version = (const GBE_VERSION*)(gbe.constData() + GBE_VERSION_OFFSET); const GBE_VERSION* version = (const GBE_VERSION*)(gbe.constData() + GBE_VERSION_OFFSET);
UString info = usprintf("Full size: %Xh (%u)\nMAC: %02X:%02X:%02X:%02X:%02X:%02X\nVersion: %u.%u", UString info = usprintf("Full size: %Xh (%u)\nMAC: %02X:%02X:%02X:%02X:%02X:%02X\nVersion: %u.%u",
gbe.size(), gbe.size(), (UINT32)gbe.size(), (UINT32)gbe.size(),
mac->vendor[0], mac->vendor[1], mac->vendor[2], mac->vendor[0], mac->vendor[1], mac->vendor[2],
mac->device[0], mac->device[1], mac->device[2], mac->device[0], mac->device[1], mac->device[2],
version->major, version->major,
@ -701,7 +701,7 @@ USTATUS FfsParser::parseMeRegion(const UByteArray & me, const UINT32 localOffset
// Get info // Get info
UString name("ME region"); UString name("ME region");
UString info = usprintf("Full size: %Xh (%u)", me.size(), me.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)me.size(), (UINT32)me.size());
// Parse region // Parse region
bool versionFound = true; bool versionFound = true;
@ -764,7 +764,7 @@ USTATUS FfsParser::parsePdrRegion(const UByteArray & pdr, const UINT32 localOffs
// Get info // Get info
UString name("PDR region"); UString name("PDR region");
UString info = usprintf("Full size: %Xh (%u)", pdr.size(), pdr.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)pdr.size(), (UINT32)pdr.size());
// Add tree item // Add tree item
index = model->addItem(localOffset, Types::Region, Subtypes::PdrRegion, name, UString(), info, UByteArray(), pdr, UByteArray(), Fixed, parent); index = model->addItem(localOffset, Types::Region, Subtypes::PdrRegion, name, UString(), info, UByteArray(), pdr, UByteArray(), Fixed, parent);
@ -785,7 +785,7 @@ USTATUS FfsParser::parseDevExp1Region(const UByteArray & devExp1, const UINT32 l
// Get info // Get info
UString name("DevExp1 region"); UString name("DevExp1 region");
UString info = usprintf("Full size: %Xh (%u)", devExp1.size(), devExp1.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)devExp1.size(), (UINT32)devExp1.size());
bool emptyRegion = false; bool emptyRegion = false;
// Check for empty region // Check for empty region
@ -812,7 +812,7 @@ USTATUS FfsParser::parseGenericRegion(const UINT8 subtype, const UByteArray & re
// Get info // Get info
UString name = itemSubtypeToUString(Types::Region, subtype) + UString(" region"); UString name = itemSubtypeToUString(Types::Region, subtype) + UString(" region");
UString info = usprintf("Full size: %Xh (%u)", region.size(), region.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)region.size(), (UINT32)region.size());
// Add tree item // Add tree item
index = model->addItem(localOffset, Types::Region, subtype, name, UString(), info, UByteArray(), region, UByteArray(), Fixed, parent); index = model->addItem(localOffset, Types::Region, subtype, name, UString(), info, UByteArray(), region, UByteArray(), Fixed, parent);
@ -828,7 +828,7 @@ USTATUS FfsParser::parseBiosRegion(const UByteArray & bios, const UINT32 localOf
// Get info // Get info
UString name("BIOS region"); UString name("BIOS region");
UString info = usprintf("Full size: %Xh (%u)", bios.size(), bios.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)bios.size(), (UINT32)bios.size());
// Add tree item // Add tree item
index = model->addItem(localOffset, Types::Region, Subtypes::BiosRegion, name, UString(), info, UByteArray(), bios, UByteArray(), Fixed, parent); index = model->addItem(localOffset, Types::Region, Subtypes::BiosRegion, name, UString(), info, UByteArray(), bios, UByteArray(), Fixed, parent);
@ -873,7 +873,7 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index)
// Get info // Get info
UByteArray padding = data.left(prevItemOffset); UByteArray padding = data.left(prevItemOffset);
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
// Add tree item // Add tree item
model->addItem(headerSize, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); model->addItem(headerSize, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index);
@ -894,7 +894,7 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index)
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
// Add tree item // Add tree item
model->addItem(headerSize + paddingOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); model->addItem(headerSize + paddingOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index);
@ -907,7 +907,7 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index)
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
// Add tree item // Add tree item
UModelIndex paddingIndex = model->addItem(headerSize + itemOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); UModelIndex paddingIndex = model->addItem(headerSize + itemOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index);
@ -947,7 +947,7 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index)
// Get info // Get info
name = UString("BPDT region"); name = UString("BPDT region");
info = usprintf("Full size: %Xh (%u)", bpdtStore.size(), bpdtStore.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)bpdtStore.size(), (UINT32)bpdtStore.size());
// Add tree item // Add tree item
UModelIndex bpdtIndex = model->addItem(headerSize + itemOffset, Types::BpdtStore, 0, name, UString(), info, UByteArray(), bpdtStore, UByteArray(), Fixed, index); UModelIndex bpdtIndex = model->addItem(headerSize + itemOffset, Types::BpdtStore, 0, name, UString(), info, UByteArray(), bpdtStore, UByteArray(), Fixed, index);
@ -980,7 +980,7 @@ USTATUS FfsParser::parseRawArea(const UModelIndex & index)
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
// Add tree item // Add tree item
model->addItem(headerSize + itemOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); model->addItem(headerSize + itemOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index);
@ -1022,7 +1022,7 @@ USTATUS FfsParser::parseVolumeHeader(const UByteArray & volume, const UINT32 loc
// Check that there is space for the volume header // Check that there is space for the volume header
if ((UINT32)volume.size() < sizeof(EFI_FIRMWARE_VOLUME_HEADER)) { if ((UINT32)volume.size() < sizeof(EFI_FIRMWARE_VOLUME_HEADER)) {
msg(usprintf("%s: input volume size %Xh (%u) is smaller than volume header size 40h (64)", __FUNCTION__, volume.size(), volume.size())); msg(usprintf("%s: input volume size %Xh (%u) is smaller than volume header size 40h (64)", __FUNCTION__, (UINT32)volume.size(), (UINT32)volume.size()));
return U_INVALID_VOLUME; return U_INVALID_VOLUME;
} }
@ -1415,7 +1415,7 @@ USTATUS FfsParser::parseVolumeNonUefiData(const UByteArray & data, const UINT32
return U_INVALID_PARAMETER; return U_INVALID_PARAMETER;
// Get info // Get info
UString info = usprintf("Full size: %Xh (%u)", data.size(), data.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)data.size(), (UINT32)data.size());
// Add padding tree item // Add padding tree item
UModelIndex paddingIndex = model->addItem(localOffset, Types::Padding, Subtypes::DataPadding, UString("Non-UEFI data"), UString(), info, UByteArray(), data, UByteArray(), Fixed, index); UModelIndex paddingIndex = model->addItem(localOffset, Types::Padding, Subtypes::DataPadding, UString("Non-UEFI data"), UString(), info, UByteArray(), data, UByteArray(), Fixed, index);
@ -1514,7 +1514,7 @@ USTATUS FfsParser::parseVolumeBody(const UModelIndex & index)
UByteArray free = freeSpace.left(i); UByteArray free = freeSpace.left(i);
// Get info // Get info
UString info = usprintf("Full size: %Xh (%u)", free.size(), free.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)free.size(), (UINT32)free.size());
// Add free space item // Add free space item
model->addItem(volumeHeaderSize + fileOffset, Types::FreeSpace, 0, UString("Volume free space"), UString(), info, UByteArray(), free, UByteArray(), Movable, index); model->addItem(volumeHeaderSize + fileOffset, Types::FreeSpace, 0, UString("Volume free space"), UString(), info, UByteArray(), free, UByteArray(), Movable, index);
@ -1525,7 +1525,7 @@ USTATUS FfsParser::parseVolumeBody(const UModelIndex & index)
} }
else { else {
// Get info // Get info
UString info = usprintf("Full size: %Xh (%u)", freeSpace.size(), freeSpace.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)freeSpace.size(), (UINT32)freeSpace.size());
// Add free space item // Add free space item
model->addItem(volumeHeaderSize + fileOffset, Types::FreeSpace, 0, UString("Volume free space"), UString(), info, UByteArray(), freeSpace, UByteArray(), Movable, index); model->addItem(volumeHeaderSize + fileOffset, Types::FreeSpace, 0, UString("Volume free space"), UString(), info, UByteArray(), freeSpace, UByteArray(), Movable, index);
@ -1750,10 +1750,10 @@ USTATUS FfsParser::parseFileHeader(const UByteArray & file, const UINT32 localOf
usprintf("\nType: %02Xh\nAttributes: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nTail size: %Xh (%u)\nState: %02Xh", usprintf("\nType: %02Xh\nAttributes: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nTail size: %Xh (%u)\nState: %02Xh",
fileHeader->Type, fileHeader->Type,
fileHeader->Attributes, fileHeader->Attributes,
header.size() + body.size() + tail.size(), header.size() + body.size() + tail.size(), (UINT32)(header.size() + body.size() + tail.size()), (UINT32)(header.size() + body.size() + tail.size()),
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
tail.size(), tail.size(), (UINT32)tail.size(), (UINT32)tail.size(),
fileHeader->State) + fileHeader->State) +
usprintf("\nHeader checksum: %02Xh", fileHeader->IntegrityCheck.Checksum.Header) + (msgInvalidHeaderChecksum ? usprintf(", invalid, should be %02Xh", calculatedHeader) : UString(", valid")) + usprintf("\nHeader checksum: %02Xh", fileHeader->IntegrityCheck.Checksum.Header) + (msgInvalidHeaderChecksum ? usprintf(", invalid, should be %02Xh", calculatedHeader) : UString(", valid")) +
usprintf("\nData checksum: %02Xh", fileHeader->IntegrityCheck.Checksum.File) + (msgInvalidDataChecksum ? usprintf(", invalid, should be %02Xh", calculatedData) : UString(", valid")); usprintf("\nData checksum: %02Xh", fileHeader->IntegrityCheck.Checksum.File) + (msgInvalidDataChecksum ? usprintf(", invalid, should be %02Xh", calculatedData) : UString(", valid"));
@ -1926,7 +1926,7 @@ USTATUS FfsParser::parsePadFileBody(const UModelIndex & index)
UByteArray free = body.left(nonEmptyByteOffset); UByteArray free = body.left(nonEmptyByteOffset);
// Get info // Get info
UString info = usprintf("Full size: %Xh (%u)", free.size(), free.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)free.size(), (UINT32)free.size());
// Add tree item // Add tree item
model->addItem(headerSize, Types::FreeSpace, 0, UString("Free space"), UString(), info, UByteArray(), free, UByteArray(), Movable, index); model->addItem(headerSize, Types::FreeSpace, 0, UString("Free space"), UString(), info, UByteArray(), free, UByteArray(), Movable, index);
@ -1939,7 +1939,7 @@ USTATUS FfsParser::parsePadFileBody(const UModelIndex & index)
UByteArray padding = body.mid(nonEmptyByteOffset); UByteArray padding = body.mid(nonEmptyByteOffset);
// Get info // Get info
UString info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
// Add tree item // Add tree item
UModelIndex dataIndex = model->addItem(headerSize + nonEmptyByteOffset, Types::Padding, Subtypes::DataPadding, UString("Non-UEFI data"), UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); UModelIndex dataIndex = model->addItem(headerSize + nonEmptyByteOffset, Types::Padding, Subtypes::DataPadding, UString("Non-UEFI data"), UString(), info, UByteArray(), padding, UByteArray(), Fixed, index);
@ -1990,7 +1990,7 @@ USTATUS FfsParser::parseSections(const UByteArray & sections, const UModelIndex
UByteArray padding = sections.mid(sectionOffset); UByteArray padding = sections.mid(sectionOffset);
// Get info // Get info
UString info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
// Add tree item // Add tree item
UModelIndex dataIndex = model->addItem(headerSize + sectionOffset, Types::Padding, Subtypes::DataPadding, UString("Non-UEFI data"), UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); UModelIndex dataIndex = model->addItem(headerSize + sectionOffset, Types::Padding, Subtypes::DataPadding, UString("Non-UEFI data"), UString(), info, UByteArray(), padding, UByteArray(), Fixed, index);
@ -2133,9 +2133,9 @@ USTATUS FfsParser::parseCommonSectionHeader(const UByteArray & section, const UI
UString name = sectionTypeToUString(type) + UString(" section"); UString name = sectionTypeToUString(type) + UString(" section");
UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)", UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)",
type, type,
section.size(), section.size(), (UINT32)section.size(), (UINT32)section.size(),
headerSize, headerSize, headerSize, headerSize,
body.size(), body.size()); (UINT32)body.size(), (UINT32)body.size());
// Add tree item // Add tree item
if (insertIntoTree) { if (insertIntoTree) {
@ -2194,9 +2194,9 @@ USTATUS FfsParser::parseCompressedSectionHeader(const UByteArray & section, cons
UString name = sectionTypeToUString(sectionHeader->Type) + UString(" section"); UString name = sectionTypeToUString(sectionHeader->Type) + UString(" section");
UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nCompression type: %02Xh\nDecompressed size: %Xh (%u)", UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nCompression type: %02Xh\nDecompressed size: %Xh (%u)",
sectionHeader->Type, sectionHeader->Type,
section.size(), section.size(), (UINT32)section.size(), (UINT32)section.size(),
headerSize, headerSize, headerSize, headerSize,
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
compressionType, compressionType,
uncompressedLength, uncompressedLength); uncompressedLength, uncompressedLength);
@ -2364,9 +2364,9 @@ USTATUS FfsParser::parseGuidedSectionHeader(const UByteArray & section, const UI
UString info = UString("Section GUID: ") + guidToUString(guid, false) + UString info = UString("Section GUID: ") + guidToUString(guid, false) +
usprintf("\nType: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nData offset: %Xh\nAttributes: %04Xh", usprintf("\nType: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nData offset: %Xh\nAttributes: %04Xh",
sectionHeader->Type, sectionHeader->Type,
section.size(), section.size(), (UINT32)section.size(), (UINT32)section.size(),
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
dataOffset, dataOffset,
attributes); attributes);
@ -2452,9 +2452,9 @@ USTATUS FfsParser::parseFreeformGuidedSectionHeader(const UByteArray & section,
UString name = sectionTypeToUString(type) + (" section"); UString name = sectionTypeToUString(type) + (" section");
UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nSubtype GUID: ", UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nSubtype GUID: ",
type, type,
section.size(), section.size(), (UINT32)section.size(), (UINT32)section.size(),
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size()) (UINT32)body.size(), (UINT32)body.size())
+ guidToUString(guid, false); + guidToUString(guid, false);
// Add tree item // Add tree item
@ -2519,9 +2519,9 @@ USTATUS FfsParser::parseVersionSectionHeader(const UByteArray & section, const U
UString name = sectionTypeToUString(type) + (" section"); UString name = sectionTypeToUString(type) + (" section");
UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nBuild number: %u", UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nBuild number: %u",
type, type,
section.size(), section.size(), (UINT32)section.size(), (UINT32)section.size(),
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
buildNumber); buildNumber);
// Add tree item // Add tree item
@ -2578,9 +2578,9 @@ USTATUS FfsParser::parsePostcodeSectionHeader(const UByteArray & section, const
UString name = sectionTypeToUString(type) + (" section"); UString name = sectionTypeToUString(type) + (" section");
UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nPostcode: %Xh", UString info = usprintf("Type: %02Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nPostcode: %Xh",
type, type,
section.size(), section.size(), (UINT32)section.size(), (UINT32)section.size(),
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
postCode); postCode);
// Add tree item // Add tree item
@ -2660,9 +2660,9 @@ USTATUS FfsParser::parseCompressedSectionBody(const UModelIndex & index)
msg(usprintf("%s: decompressed size stored in header %Xh (%u) differs from actual %Xh (%u)", msg(usprintf("%s: decompressed size stored in header %Xh (%u) differs from actual %Xh (%u)",
__FUNCTION__, __FUNCTION__,
uncompressedSize, uncompressedSize, uncompressedSize, uncompressedSize,
decompressed.size(), decompressed.size()), (UINT32)decompressed.size(), (UINT32)decompressed.size()),
index); index);
model->addInfo(index, usprintf("\nActual decompressed size: %Xh (%u)", decompressed.size(), decompressed.size())); model->addInfo(index, usprintf("\nActual decompressed size: %Xh (%u)", (UINT32)decompressed.size(), (UINT32)decompressed.size()));
} }
// Check for undecided compression algorithm, this is a special case // Check for undecided compression algorithm, this is a special case
@ -2753,7 +2753,7 @@ USTATUS FfsParser::parseGuidedSectionBody(const UModelIndex & index)
} }
info += UString("\nCompression algorithm: ") + compressionTypeToUString(algorithm); info += UString("\nCompression algorithm: ") + compressionTypeToUString(algorithm);
info += usprintf("\nDecompressed size: %Xh (%u)", processed.size(), processed.size()); info += usprintf("\nDecompressed size: %Xh (%u)", (UINT32)processed.size(), (UINT32)processed.size());
} }
// LZMA compressed section // LZMA compressed section
else if (baGuid == EFI_GUIDED_SECTION_LZMA else if (baGuid == EFI_GUIDED_SECTION_LZMA
@ -2766,7 +2766,7 @@ USTATUS FfsParser::parseGuidedSectionBody(const UModelIndex & index)
if (algorithm == COMPRESSION_ALGORITHM_LZMA) { if (algorithm == COMPRESSION_ALGORITHM_LZMA) {
info += UString("\nCompression algorithm: LZMA"); info += UString("\nCompression algorithm: LZMA");
info += usprintf("\nDecompressed size: %Xh (%u)", processed.size(), processed.size()); info += usprintf("\nDecompressed size: %Xh (%u)", (UINT32)processed.size(), (UINT32)processed.size());
info += usprintf("\nLZMA dictionary size: %Xh", dictionarySize); info += usprintf("\nLZMA dictionary size: %Xh", dictionarySize);
} }
else { else {
@ -2784,7 +2784,7 @@ USTATUS FfsParser::parseGuidedSectionBody(const UModelIndex & index)
if (algorithm == COMPRESSION_ALGORITHM_LZMAF86) { if (algorithm == COMPRESSION_ALGORITHM_LZMAF86) {
info += UString("\nCompression algorithm: LZMAF86"); info += UString("\nCompression algorithm: LZMAF86");
info += usprintf("\nDecompressed size: %Xh (%u)", processed.size(), processed.size()); info += usprintf("\nDecompressed size: %Xh (%u)", (UINT32)processed.size(), (UINT32)processed.size());
info += usprintf("\nLZMA dictionary size: %Xh", dictionarySize); info += usprintf("\nLZMA dictionary size: %Xh", dictionarySize);
} }
else { else {
@ -2801,7 +2801,7 @@ USTATUS FfsParser::parseGuidedSectionBody(const UModelIndex & index)
} }
info += UString("\nCompression algorithm: GZip"); info += UString("\nCompression algorithm: GZip");
info += usprintf("\nDecompressed size: %Xh (%u)", processed.size(), processed.size()); info += usprintf("\nDecompressed size: %Xh (%u)", (UINT32)processed.size(), (UINT32)processed.size());
} }
// Add info // Add info
@ -4306,7 +4306,7 @@ USTATUS FfsParser::parseMicrocodeVolumeBody(const UModelIndex & index)
if (offset < bodySize) { if (offset < bodySize) {
// Get info // Get info
UString name = UString("Padding"); UString name = UString("Padding");
UString info = usprintf("Full size: %Xh (%u)", ucode.size(), ucode.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)ucode.size(), (UINT32)ucode.size());
// Add tree item // Add tree item
model->addItem(headerSize + offset, Types::Padding, getPaddingType(ucode), name, UString(), info, UByteArray(), ucode, UByteArray(), Fixed, index); model->addItem(headerSize + offset, Types::Padding, getPaddingType(ucode), name, UString(), info, UByteArray(), ucode, UByteArray(), Fixed, index);
@ -4429,8 +4429,8 @@ USTATUS FfsParser::parseIntelMicrocodeHeader(const UByteArray & microcode, const
UString name("Intel microcode"); UString name("Intel microcode");
UString info = usprintf("Full size: %Xh (%u)\nHeader size: 0h (0u)\nBody size: %Xh (%u)\nTail size: 0h (0u)\n" UString info = usprintf("Full size: %Xh (%u)\nHeader size: 0h (0u)\nBody size: %Xh (%u)\nTail size: 0h (0u)\n"
"Date: %02X.%02X.%04x\nCPU signature: %08Xh\nRevision: %08Xh\nCPU flags: %02Xh\nChecksum: %08Xh, ", "Date: %02X.%02X.%04x\nCPU signature: %08Xh\nRevision: %08Xh\nCPU flags: %02Xh\nChecksum: %08Xh, ",
microcodeBinary.size(), microcodeBinary.size(), (UINT32)microcodeBinary.size(), (UINT32)microcodeBinary.size(),
microcodeBinary.size(), microcodeBinary.size(), (UINT32)microcodeBinary.size(), (UINT32)microcodeBinary.size(),
ucodeHeader->DateDay, ucodeHeader->DateDay,
ucodeHeader->DateMonth, ucodeHeader->DateMonth,
ucodeHeader->DateYear, ucodeHeader->DateYear,
@ -4446,7 +4446,7 @@ USTATUS FfsParser::parseIntelMicrocodeHeader(const UByteArray & microcode, const
if (msgInvalidChecksum) if (msgInvalidChecksum)
msg(usprintf("%s: invalid microcode checksum %08Xh, should be %08Xh", __FUNCTION__, ucodeHeader->Checksum, calculated), index); msg(usprintf("%s: invalid microcode checksum %08Xh, should be %08Xh", __FUNCTION__, ucodeHeader->Checksum, calculated), index);
if (msgUnknownOrDamagedMicrocodeTail) if (msgUnknownOrDamagedMicrocodeTail)
msg(usprintf("%s: extended header of size %Xh (%u) found, but it's damaged or has unknown format", __FUNCTION__, tail.size(), tail.size()), index); msg(usprintf("%s: extended header of size %Xh (%u) found, but it's damaged or has unknown format", __FUNCTION__, (UINT32)tail.size(), (UINT32)tail.size()), index);
// No need to parse the body further for now // No need to parse the body further for now
return U_SUCCESS; return U_SUCCESS;
@ -4481,7 +4481,7 @@ USTATUS FfsParser::parseBpdtRegion(const UByteArray & region, const UINT32 local
UString info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nNumber of entries: %u\nVersion: %2Xh\n" UString info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nNumber of entries: %u\nVersion: %2Xh\n"
"IFWI version: %Xh\nFITC version: %u.%u.%u.%u", "IFWI version: %Xh\nFITC version: %u.%u.%u.%u",
ptSize, ptSize, ptSize, ptSize,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
ptBodySize, ptBodySize, ptBodySize, ptBodySize,
ptHeader->NumEntries, ptHeader->NumEntries,
ptHeader->HeaderVersion, ptHeader->HeaderVersion,
@ -4538,7 +4538,7 @@ USTATUS FfsParser::parseBpdtRegion(const UByteArray & region, const UINT32 local
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", info = usprintf("Full size: %Xh (%u)",
partition.size(), partition.size()); (UINT32)partition.size(), (UINT32)partition.size());
// Add tree item // Add tree item
model->addItem(localOffset + ptSize, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent); model->addItem(localOffset + ptSize, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
@ -4620,7 +4620,7 @@ make_partition_table_consistent:
UByteArray signature = partition.left(sizeof(UINT32)); UByteArray signature = partition.left(sizeof(UINT32));
UString info = usprintf("Full size: %Xh (%u)\nType: %Xh", UString info = usprintf("Full size: %Xh (%u)\nType: %Xh",
partition.size(), partition.size(), (UINT32)partition.size(), (UINT32)partition.size(),
partitions[i].ptEntry.Type) + partitions[i].ptEntry.Type) +
UString("\nSplit sub-partition first part: ") + (partitions[i].ptEntry.SplitSubPartitionFirstPart ? "Yes" : "No") + UString("\nSplit sub-partition first part: ") + (partitions[i].ptEntry.SplitSubPartitionFirstPart ? "Yes" : "No") +
UString("\nSplit sub-partition second part: ") + (partitions[i].ptEntry.SplitSubPartitionSecondPart ? "Yes" : "No") + UString("\nSplit sub-partition second part: ") + (partitions[i].ptEntry.SplitSubPartitionSecondPart ? "Yes" : "No") +
@ -4660,7 +4660,7 @@ make_partition_table_consistent:
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", info = usprintf("Full size: %Xh (%u)",
padding.size(), padding.size()); (UINT32)padding.size(), (UINT32)padding.size());
// Add tree item // Add tree item
model->addItem(localOffset + partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, parent); model->addItem(localOffset + partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, parent);
@ -4675,7 +4675,7 @@ make_partition_table_consistent:
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", info = usprintf("Full size: %Xh (%u)",
padding.size(), padding.size()); (UINT32)padding.size(), (UINT32)padding.size());
// Add tree item // Add tree item
model->addItem(localOffset + partitions.back().ptEntry.Offset + partitions.back().ptEntry.Size, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, parent); model->addItem(localOffset + partitions.back().ptEntry.Offset + partitions.back().ptEntry.Size, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, parent);
@ -4724,8 +4724,8 @@ USTATUS FfsParser::parseCpdRegion(const UByteArray & region, const UINT32 localO
UString info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nNumber of entries: %u\n" UString info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nNumber of entries: %u\n"
"Header version: %u\nEntry version: %u", "Header version: %u\nEntry version: %u",
ptSize, ptSize, ptSize, ptSize,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
cpdHeader->NumEntries, cpdHeader->NumEntries,
cpdHeader->HeaderVersion, cpdHeader->HeaderVersion,
cpdHeader->EntryVersion); cpdHeader->EntryVersion);
@ -4745,7 +4745,7 @@ USTATUS FfsParser::parseCpdRegion(const UByteArray & region, const UINT32 localO
// Get info // Get info
name = usprintf("%.12s", cpdEntry->EntryName); name = usprintf("%.12s", cpdEntry->EntryName);
info = usprintf("Full size: %Xh (%u)\nEntry offset: %Xh\nEntry length: %Xh\nHuffman compressed: ", info = usprintf("Full size: %Xh (%u)\nEntry offset: %Xh\nEntry length: %Xh\nHuffman compressed: ",
entry.size(), entry.size(), (UINT32)entry.size(), (UINT32)entry.size(),
cpdEntry->Offset.Offset, cpdEntry->Offset.Offset,
cpdEntry->Length) cpdEntry->Length)
+ (cpdEntry->Offset.HuffmanCompressed ? "Yes" : "No"); + (cpdEntry->Offset.HuffmanCompressed ? "Yes" : "No");
@ -4774,7 +4774,7 @@ USTATUS FfsParser::parseCpdRegion(const UByteArray & region, const UINT32 localO
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", info = usprintf("Full size: %Xh (%u)",
partition.size(), partition.size()); (UINT32)partition.size(), (UINT32)partition.size());
// Add tree item // Add tree item
model->addItem(localOffset + ptSize, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent); model->addItem(localOffset + ptSize, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
@ -4956,9 +4956,9 @@ make_partition_table_consistent:
info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)" info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)"
"\nHeader type: %u\nHeader length: %lXh (%lu)\nHeader version: %Xh\nFlags: %08Xh\nVendor: %Xh\n" "\nHeader type: %u\nHeader length: %lXh (%lu)\nHeader version: %Xh\nFlags: %08Xh\nVendor: %Xh\n"
"Date: %Xh\nSize: %lXh (%lu)\nVersion: %u.%u.%u.%u\nSecurity version number: %u\nModulus size: %lXh (%lu)\nExponent size: %lXh (%lu)", "Date: %Xh\nSize: %lXh (%lu)\nVersion: %u.%u.%u.%u\nSecurity version number: %u\nModulus size: %lXh (%lu)\nExponent size: %lXh (%lu)",
partition.size(), partition.size(), (UINT32)partition.size(), (UINT32)partition.size(),
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
manifestHeader->HeaderType, manifestHeader->HeaderType,
manifestHeader->HeaderLength * sizeof(UINT32), manifestHeader->HeaderLength * sizeof(UINT32), manifestHeader->HeaderLength * sizeof(UINT32), manifestHeader->HeaderLength * sizeof(UINT32),
manifestHeader->HeaderVersion, manifestHeader->HeaderVersion,
@ -4982,7 +4982,7 @@ make_partition_table_consistent:
// It's a metadata // It's a metadata
else if (name.endsWith(".met")) { else if (name.endsWith(".met")) {
info = usprintf("Full size: %Xh (%u)\nHuffman compressed: ", info = usprintf("Full size: %Xh (%u)\nHuffman compressed: ",
partition.size(), partition.size()) (UINT32)partition.size(), (UINT32)partition.size())
+ (partitions[i].ptEntry.Offset.HuffmanCompressed ? "Yes" : "No"); + (partitions[i].ptEntry.Offset.HuffmanCompressed ? "Yes" : "No");
// Calculate SHA256 hash over the metadata and add it to its info // Calculate SHA256 hash over the metadata and add it to its info
@ -4999,7 +4999,7 @@ make_partition_table_consistent:
// It's a code // It's a code
else { else {
info = usprintf("Full size: %Xh (%u)\nHuffman compressed: ", info = usprintf("Full size: %Xh (%u)\nHuffman compressed: ",
partition.size(), partition.size()) (UINT32)partition.size(), (UINT32)partition.size())
+ (partitions[i].ptEntry.Offset.HuffmanCompressed ? "Yes" : "No"); + (partitions[i].ptEntry.Offset.HuffmanCompressed ? "Yes" : "No");
// Calculate SHA256 hash over the code and add it to its info // Calculate SHA256 hash over the code and add it to its info
@ -5016,7 +5016,7 @@ make_partition_table_consistent:
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", partition.size(), partition.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)partition.size(), (UINT32)partition.size());
// Add tree item // Add tree item
model->addItem(localOffset + partitions[i].ptEntry.Offset.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent); model->addItem(localOffset + partitions[i].ptEntry.Offset.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
@ -5044,7 +5044,7 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index)
UByteArray partition = body.mid(offset, extHeader->Length); UByteArray partition = body.mid(offset, extHeader->Length);
UString name = cpdExtensionTypeToUstring(extHeader->Type); UString name = cpdExtensionTypeToUstring(extHeader->Type);
UString info = usprintf("Full size: %Xh (%u)\nType: %Xh", partition.size(), partition.size(), extHeader->Type); UString info = usprintf("Full size: %Xh (%u)\nType: %Xh", (UINT32)partition.size(), (UINT32)partition.size(), extHeader->Type);
// Parse Signed Package Info a bit further // Parse Signed Package Info a bit further
UModelIndex extIndex; UModelIndex extIndex;
@ -5057,9 +5057,9 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index)
info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %Xh\n" info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %Xh\n"
"Package name: %.4s\nVersion control number: %Xh\nSecurity version number: %Xh\n" "Package name: %.4s\nVersion control number: %Xh\nSecurity version number: %Xh\n"
"Usage bitmap: %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", "Usage bitmap: %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
partition.size(), partition.size(), (UINT32)partition.size(), (UINT32)partition.size(),
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
infoHeader->ExtensionType, infoHeader->ExtensionType,
infoHeader->PackageName, infoHeader->PackageName,
infoHeader->Vcn, infoHeader->Vcn,
@ -5093,7 +5093,7 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index)
info = usprintf("Full size: %Xh (%u)\nType: %Xh\n" info = usprintf("Full size: %Xh (%u)\nType: %Xh\n"
"Partition name: %.4s\nPartition length: %Xh\nPartition version major: %Xh\nPartition version minor: %Xh\n" "Partition name: %.4s\nPartition length: %Xh\nPartition version major: %Xh\nPartition version minor: %Xh\n"
"Data format version: %Xh\nInstance ID: %Xh\nHash algorithm: %Xh\nHash size: %Xh\nAction on update: %Xh", "Data format version: %Xh\nInstance ID: %Xh\nHash algorithm: %Xh\nHash size: %Xh\nAction on update: %Xh",
partition.size(), partition.size(), (UINT32)partition.size(), (UINT32)partition.size(),
attrHeader->ExtensionType, attrHeader->ExtensionType,
attrHeader->PartitionName, attrHeader->PartitionName,
attrHeader->CompletePartitionLength, attrHeader->CompletePartitionLength,
@ -5121,7 +5121,7 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index)
// Parse Module Attributes a bit further // Parse Module Attributes a bit further
else if (extHeader->Type == CPD_EXT_TYPE_MODULE_ATTRIBUTES) { else if (extHeader->Type == CPD_EXT_TYPE_MODULE_ATTRIBUTES) {
const CPD_EXT_MODULE_ATTRIBUTES* attrHeader = (const CPD_EXT_MODULE_ATTRIBUTES*)partition.constData(); const CPD_EXT_MODULE_ATTRIBUTES* attrHeader = (const CPD_EXT_MODULE_ATTRIBUTES*)partition.constData();
int hashSize = partition.size() - CpdExtModuleImageHashOffset; int hashSize = (UINT32)partition.size() - CpdExtModuleImageHashOffset;
// This hash is stored reversed // This hash is stored reversed
// Need to reverse it back to normal // Need to reverse it back to normal
@ -5130,7 +5130,7 @@ USTATUS FfsParser::parseCpdExtensionsArea(const UModelIndex & index)
info = usprintf("Full size: %Xh (%u)\nType: %Xh\n" info = usprintf("Full size: %Xh (%u)\nType: %Xh\n"
"Compression type: %Xh\nUncompressed size: %Xh (%u)\nCompressed size: %Xh (%u)\nGlobal module ID: %Xh\nImage hash: ", "Compression type: %Xh\nUncompressed size: %Xh (%u)\nCompressed size: %Xh (%u)\nGlobal module ID: %Xh\nImage hash: ",
partition.size(), partition.size(), (UINT32)partition.size(), (UINT32)partition.size(),
attrHeader->ExtensionType, attrHeader->ExtensionType,
attrHeader->CompressionType, attrHeader->CompressionType,
attrHeader->UncompressedSize, attrHeader->UncompressedSize, attrHeader->UncompressedSize, attrHeader->UncompressedSize,
@ -5186,7 +5186,7 @@ USTATUS FfsParser::parseSignedPackageInfoData(const UModelIndex & index)
std::reverse(hash.begin(), hash.end()); std::reverse(hash.begin(), hash.end());
UString info = usprintf("Full size: %Xh (%u)\nType: %Xh\nHash algorithm: %Xh\nHash size: %Xh (%u)\nMetadata size: %Xh (%u)\nMetadata hash: ", UString info = usprintf("Full size: %Xh (%u)\nType: %Xh\nHash algorithm: %Xh\nHash size: %Xh (%u)\nMetadata size: %Xh (%u)\nMetadata hash: ",
module.size(), module.size(), (UINT32)module.size(), (UINT32)module.size(),
moduleHeader->Type, moduleHeader->Type,
moduleHeader->HashAlgorithm, moduleHeader->HashAlgorithm,
moduleHeader->HashSize, moduleHeader->HashSize, moduleHeader->HashSize, moduleHeader->HashSize,

View File

@ -1,15 +1,15 @@
/* fssreport.cpp /* fssreport.cpp
Copyright (c) 2016, Nikolaj Schlej. All rights reserved. Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "ffsreport.h" #include "ffsreport.h"
#include "ffs.h" #include "ffs.h"
@ -63,7 +63,7 @@ USTATUS FfsReport::generateRecursive(std::vector<UString> & report, const UModel
UString(" ") + itemTypeToUString(model->type(index)).leftJustified(16) UString(" ") + itemTypeToUString(model->type(index)).leftJustified(16)
+ UString("| ") + itemSubtypeToUString(model->type(index), model->subtype(index)).leftJustified(22) + UString("| ") + itemSubtypeToUString(model->type(index), model->subtype(index)).leftJustified(22)
+ offset + offset
+ usprintf("| %08X | %08X | ", data.size(), crc) + usprintf("| %08X | %08X | ", (UINT32)data.size(), crc)
+ urepeated('-', level) + UString(" ") + model->name(index) + (text.isEmpty() ? UString() : UString(" | ") + text) + urepeated('-', level) + UString(" ") + model->name(index) + (text.isEmpty() ? UString() : UString(" | ") + text)
); );

View File

@ -1,15 +1,15 @@
/* ffsutils.cpp /* ffsutils.cpp
Copyright (c) 2019, LongSoft. All rights reserved. Copyright (c) 2019, LongSoft. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "ffsutils.h" #include "ffsutils.h"
#include "utility.h" #include "utility.h"

View File

@ -1,14 +1,14 @@
/* guiddatabase.cpp /* guiddatabase.cpp
Copyright (c) 2017, LongSoft. All rights reserved. Copyright (c) 2017, LongSoft. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "guiddatabase.h" #include "guiddatabase.h"
#include "ubytearray.h" #include "ubytearray.h"

View File

@ -1,16 +1,16 @@
/* meparser.cpp /* meparser.cpp
Copyright (c) 2019, Nikolaj Schlej. All rights reserved. Copyright (c) 2019, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php. http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include <map> #include <map>
@ -140,7 +140,7 @@ USTATUS MeParser::parseFptRegion(const UByteArray & region, const UModelIndex &
info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n" info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n"
"Header length: %02Xh\nFlags: %Xh\nTicks to add: %04Xh\nTokens to add: %04Xh\nSPS Flags: %Xh\nFITC version: %u.%u.%u.%u\nCRC32 Checksum: %08Xh", "Header length: %02Xh\nFlags: %Xh\nTicks to add: %04Xh\nTokens to add: %04Xh\nSPS Flags: %Xh\nFITC version: %u.%u.%u.%u\nCRC32 Checksum: %08Xh",
ptSize, ptSize, ptSize, ptSize,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
ptBodySize, ptBodySize, ptBodySize, ptBodySize,
(romBypassVectorSize ? "present" : "absent"), (romBypassVectorSize ? "present" : "absent"),
ptHeader21->NumEntries, ptHeader21->NumEntries,
@ -160,7 +160,7 @@ USTATUS MeParser::parseFptRegion(const UByteArray & region, const UModelIndex &
info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n" info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nROM bypass vector: %s\nNumber of entries: %u\nHeader version: %02Xh\nEntry version: %02Xh\n"
"Header length: %02Xh\nFlash cycle life: %04Xh\nFlash cycle limit: %04Xh\nUMA size: %Xh\nFlags: %Xh\nFITC version: %u.%u.%u.%u\nChecksum: %02Xh", "Header length: %02Xh\nFlash cycle life: %04Xh\nFlash cycle limit: %04Xh\nUMA size: %Xh\nFlags: %Xh\nFITC version: %u.%u.%u.%u\nChecksum: %02Xh",
ptSize, ptSize, ptSize, ptSize,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
ptBodySize, ptBodySize, ptBodySize, ptBodySize,
(romBypassVectorSize ? "present" : "absent"), (romBypassVectorSize ? "present" : "absent"),
ptHeader->NumEntries, ptHeader->NumEntries,
@ -295,7 +295,7 @@ make_partition_table_consistent:
// Get info // Get info
name = visibleAsciiOrHex((UINT8*) partitions[i].ptEntry.Name, 4); name = visibleAsciiOrHex((UINT8*) partitions[i].ptEntry.Name, 4);
info = usprintf("Full size: %Xh (%u)\nPartition type: %02Xh\n", info = usprintf("Full size: %Xh (%u)\nPartition type: %02Xh\n",
partition.size(), partition.size(), (UINT32)partition.size(), (UINT32)partition.size(),
partitions[i].ptEntry.Type); partitions[i].ptEntry.Type);
// Add tree item // Add tree item
@ -310,7 +310,7 @@ make_partition_table_consistent:
else if (partitions[i].type == Types::Padding) { else if (partitions[i].type == Types::Padding) {
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", partition.size(), partition.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)partition.size(), (UINT32)partition.size());
// Add tree item // Add tree item
model->addItem(partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent); model->addItem(partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
@ -343,7 +343,7 @@ USTATUS MeParser::parseIfwi16Region(const UByteArray & region, const UModelIndex
"Boot4 partition offset: %Xh\nBoot4 partition size: %Xh\n" "Boot4 partition offset: %Xh\nBoot4 partition size: %Xh\n"
"Boot5 partition offset: %Xh\nBoot5 partition size: %Xh\n" "Boot5 partition offset: %Xh\nBoot5 partition size: %Xh\n"
"Checksum: %llXh", "Checksum: %llXh",
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
ifwiHeader->DataPartition.Offset, ifwiHeader->DataPartition.Size, ifwiHeader->DataPartition.Offset, ifwiHeader->DataPartition.Size,
ifwiHeader->BootPartition[0].Offset, ifwiHeader->BootPartition[0].Size, ifwiHeader->BootPartition[0].Offset, ifwiHeader->BootPartition[0].Size,
ifwiHeader->BootPartition[1].Offset, ifwiHeader->BootPartition[1].Size, ifwiHeader->BootPartition[1].Offset, ifwiHeader->BootPartition[1].Size,
@ -457,8 +457,7 @@ make_partition_table_consistent:
} }
// Get info // Get info
info = usprintf("Full size: %Xh (%u)\n", info = usprintf("Full size: %Xh (%u)\n", (UINT32)partition.size(), (UINT32)partition.size());
partition.size(), partition.size());
// Add tree item // Add tree item
partitionIndex = model->addItem(partitions[i].ptEntry.Offset, partitions[i].type, partitions[i].subtype, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent); partitionIndex = model->addItem(partitions[i].ptEntry.Offset, partitions[i].type, partitions[i].subtype, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
@ -477,7 +476,7 @@ make_partition_table_consistent:
else if (partitions[i].type == Types::Padding) { else if (partitions[i].type == Types::Padding) {
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", partition.size(), partition.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)partition.size(), (UINT32)partition.size());
// Add tree item // Add tree item
model->addItem(partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent); model->addItem(partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
@ -514,7 +513,7 @@ USTATUS MeParser::parseIfwi17Region(const UByteArray & region, const UModelIndex
"Boot4 partition offset: %Xh\nBoot4 partition size: %Xh\n" "Boot4 partition offset: %Xh\nBoot4 partition size: %Xh\n"
"Boot5 partition offset: %Xh\nBoot5 partition size: %Xh\n" "Boot5 partition offset: %Xh\nBoot5 partition size: %Xh\n"
"Temp page offset: %Xh\nTemp page size: %Xh\n", "Temp page offset: %Xh\nTemp page size: %Xh\n",
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
ifwiHeader->Flags, ifwiHeader->Flags,
ifwiHeader->Reserved, ifwiHeader->Reserved,
ifwiHeader->Checksum, ifwiHeader->Checksum,
@ -643,8 +642,7 @@ make_partition_table_consistent:
} }
// Get info // Get info
info = usprintf("Full size: %Xh (%u)\n", info = usprintf("Full size: %Xh (%u)\n", (UINT32)partition.size(), (UINT32)partition.size());
partition.size(), partition.size());
// Add tree item // Add tree item
partitionIndex = model->addItem(partitions[i].ptEntry.Offset, partitions[i].type, partitions[i].subtype, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent); partitionIndex = model->addItem(partitions[i].ptEntry.Offset, partitions[i].type, partitions[i].subtype, name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);
@ -663,7 +661,7 @@ make_partition_table_consistent:
else if (partitions[i].type == Types::Padding) { else if (partitions[i].type == Types::Padding) {
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", partition.size(), partition.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)partition.size(), (UINT32)partition.size());
// Add tree item // Add tree item
model->addItem(partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent); model->addItem(partitions[i].ptEntry.Offset, Types::Padding, getPaddingType(partition), name, UString(), info, UByteArray(), partition, UByteArray(), Fixed, parent);

View File

@ -1,15 +1,15 @@
/* nvram.cpp /* nvram.cpp
Copyright (c) 2016, Nikolaj Schlej. All rights reserved. Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php. http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "nvram.h" #include "nvram.h"

View File

@ -1,16 +1,16 @@
/* nvramparser.cpp /* nvramparser.cpp
Copyright (c) 2016, Nikolaj Schlej. All rights reserved. Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php. http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
//TODO: relax fixed restrictions once NVRAM builder is ready //TODO: relax fixed restrictions once NVRAM builder is ready
@ -92,7 +92,7 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index)
UByteArray padding = data.mid(offset, unparsedSize); UByteArray padding = data.mid(offset, unparsedSize);
// Get info // Get info
UString info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
if ((UINT32)padding.count(emptyByte) == unparsedSize) { // Free space if ((UINT32)padding.count(emptyByte) == unparsedSize) { // Free space
// Add tree item // Add tree item
@ -114,7 +114,7 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index)
// Get info // Get info
name = UString("GUID store"); name = UString("GUID store");
info = usprintf("Full size: %Xh (%u)\nGUIDs in store: %u", info = usprintf("Full size: %Xh (%u)\nGUIDs in store: %u",
guidArea.size(), guidArea.size(), (UINT32)guidArea.size(), (UINT32)guidArea.size(),
guidsInStore); guidsInStore);
// Add tree item // Add tree item
model->addItem((UINT32)(localOffset + offset + padding.size()), Types::Padding, getPaddingType(guidArea), name, UString(), info, UByteArray(), guidArea, UByteArray(), Fixed, index); model->addItem((UINT32)(localOffset + offset + padding.size()), Types::Padding, getPaddingType(guidArea), name, UString(), info, UByteArray(), guidArea, UByteArray(), Fixed, index);
@ -317,8 +317,8 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index)
// Add header, body and extended data info // Add header, body and extended data info
info += usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)", info += usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)",
entryHeader->Size, entryHeader->Size, entryHeader->Size, entryHeader->Size,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size()); (UINT32)body.size(), (UINT32)body.size());
// Add attributes info // Add attributes info
info += usprintf("\nAttributes: %02Xh", entryHeader->Attributes); info += usprintf("\nAttributes: %02Xh", entryHeader->Attributes);
@ -359,9 +359,9 @@ USTATUS NvramParser::parseNvarStore(const UModelIndex & index)
// Show messages // Show messages
if (msgUnknownExtDataFormat) msg(usprintf("%s: unknown extended data format", __FUNCTION__), varIndex); if (msgUnknownExtDataFormat) msg(usprintf("%s: unknown extended data format", __FUNCTION__), varIndex);
if (msgExtHeaderTooLong) msg(usprintf("%s: extended header size (%Xh) is greater than body size (%Xh)", __FUNCTION__, if (msgExtHeaderTooLong) msg(usprintf("%s: extended header size (%Xh) is greater than body size (%Xh)", __FUNCTION__,
extendedHeaderSize, body.size()), varIndex); extendedHeaderSize, (UINT32)body.size()), varIndex);
if (msgExtDataTooShort) msg(usprintf("%s: extended header size (%Xh) is too small for timestamp and hash", __FUNCTION__, if (msgExtDataTooShort) msg(usprintf("%s: extended header size (%Xh) is too small for timestamp and hash", __FUNCTION__,
tail.size()), varIndex); (UINT32)tail.size()), varIndex);
// Try parsing the entry data as NVAR storage if it begins with NVAR signature // Try parsing the entry data as NVAR storage if it begins with NVAR signature
if ((subtype == Subtypes::DataNvarEntry || subtype == Subtypes::FullNvarEntry) if ((subtype == Subtypes::DataNvarEntry || subtype == Subtypes::FullNvarEntry)
@ -409,7 +409,7 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index)
// Get info // Get info
UByteArray padding = data.left(prevStoreOffset); UByteArray padding = data.left(prevStoreOffset);
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
// Add tree item // Add tree item
model->addItem(localOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); model->addItem(localOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index);
@ -428,7 +428,7 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index)
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
// Add tree item // Add tree item
model->addItem(localOffset + paddingOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); model->addItem(localOffset + paddingOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index);
@ -449,7 +449,7 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index)
// Get info // Get info
name = UString("Padding"); name = UString("Padding");
info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
// Add tree item // Add tree item
UModelIndex paddingIndex = model->addItem(localOffset + storeOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index); UModelIndex paddingIndex = model->addItem(localOffset + storeOffset, Types::Padding, getPaddingType(padding), name, UString(), info, UByteArray(), padding, UByteArray(), Fixed, index);
@ -479,7 +479,7 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index)
if ((UINT32)data.size() > storeOffset) { if ((UINT32)data.size() > storeOffset) {
UByteArray padding = data.mid(storeOffset); UByteArray padding = data.mid(storeOffset);
// Add info // Add info
info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
if (padding.count(emptyByte) == padding.size()) { // Free space if (padding.count(emptyByte) == padding.size()) { // Free space
// Add tree item // Add tree item
@ -807,8 +807,8 @@ USTATUS NvramParser::parseVssStoreHeader(const UByteArray & store, const UINT32
UString info = usprintf("Signature: %Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nFormat: %02Xh\nState: %02Xh\nUnknown: %04Xh", UString info = usprintf("Signature: %Xh\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nFormat: %02Xh\nState: %02Xh\nUnknown: %04Xh",
vssStoreHeader->Signature, vssStoreHeader->Signature,
storeSize, storeSize, storeSize, storeSize,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
vssStoreHeader->Format, vssStoreHeader->Format,
vssStoreHeader->State, vssStoreHeader->State,
vssStoreHeader->Unknown); vssStoreHeader->Unknown);
@ -855,8 +855,8 @@ USTATUS NvramParser::parseVss2StoreHeader(const UByteArray & store, const UINT32
UString info = UString("Signature: ") + guidToUString(vssStoreHeader->Signature, false) + UString info = UString("Signature: ") + guidToUString(vssStoreHeader->Signature, false) +
usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nFormat: %02Xh\nState: %02Xh\nUnknown: %04Xh", usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nFormat: %02Xh\nState: %02Xh\nUnknown: %04Xh",
storeSize, storeSize, storeSize, storeSize,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
vssStoreHeader->Format, vssStoreHeader->Format,
vssStoreHeader->State, vssStoreHeader->State,
vssStoreHeader->Unknown); vssStoreHeader->Unknown);
@ -926,7 +926,7 @@ USTATUS NvramParser::parseFtwStoreHeader(const UByteArray & store, const UINT32
usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nState: %02Xh\nHeader CRC32: %08Xh", usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nState: %02Xh\nHeader CRC32: %08Xh",
ftwBlockSize, ftwBlockSize, ftwBlockSize, ftwBlockSize,
headerSize, headerSize, headerSize, headerSize,
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
ftw32BlockHeader->State, ftw32BlockHeader->State,
ftw32BlockHeader->Crc) + ftw32BlockHeader->Crc) +
(ftw32BlockHeader->Crc != calculatedCrc ? usprintf(", invalid, should be %08Xh", calculatedCrc) : UString(", valid")); (ftw32BlockHeader->Crc != calculatedCrc ? usprintf(", invalid, should be %08Xh", calculatedCrc) : UString(", valid"));
@ -966,8 +966,8 @@ USTATUS NvramParser::parseFdcStoreHeader(const UByteArray & store, const UINT32
UString name("FDC store"); UString name("FDC store");
UString info = usprintf("Signature: _FDC\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)", UString info = usprintf("Signature: _FDC\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)",
fdcStoreHeader->Size, fdcStoreHeader->Size, fdcStoreHeader->Size, fdcStoreHeader->Size,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size()); (UINT32)body.size(), (UINT32)body.size());
// Add tree item // Add tree item
index = model->addItem(localOffset, Types::FdcStore, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent); index = model->addItem(localOffset, Types::FdcStore, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent);
@ -1010,8 +1010,8 @@ USTATUS NvramParser::parseFsysStoreHeader(const UByteArray & store, const UINT32
UString info = usprintf("Signature: %s\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nUnknown0: %02Xh\nUnknown1: %08Xh\nCRC32: %08Xh", UString info = usprintf("Signature: %s\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nUnknown0: %02Xh\nUnknown1: %08Xh\nCRC32: %08Xh",
isGaidStore ? "Gaid" : "Fsys", isGaidStore ? "Gaid" : "Fsys",
fsysStoreHeader->Size, fsysStoreHeader->Size, fsysStoreHeader->Size, fsysStoreHeader->Size,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
fsysStoreHeader->Unknown0, fsysStoreHeader->Unknown0,
fsysStoreHeader->Unknown1, fsysStoreHeader->Unknown1,
storedCrc) storedCrc)
@ -1055,8 +1055,8 @@ USTATUS NvramParser::parseEvsaStoreHeader(const UByteArray & store, const UINT32
UString name("EVSA store"); UString name("EVSA store");
UString info = usprintf("Signature: EVSA\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %02Xh\nAttributes: %08Xh\nChecksum: %02Xh", UString info = usprintf("Signature: EVSA\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %02Xh\nAttributes: %08Xh\nChecksum: %02Xh",
evsaStoreHeader->StoreSize, evsaStoreHeader->StoreSize, evsaStoreHeader->StoreSize, evsaStoreHeader->StoreSize,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
evsaStoreHeader->Header.Type, evsaStoreHeader->Header.Type,
evsaStoreHeader->Attributes, evsaStoreHeader->Attributes,
evsaStoreHeader->Header.Checksum) + evsaStoreHeader->Header.Checksum) +
@ -1098,8 +1098,8 @@ USTATUS NvramParser::parseFlashMapStoreHeader(const UByteArray & store, const UI
UString name("Phoenix SCT flash map"); UString name("Phoenix SCT flash map");
UString info = usprintf("Signature: _FLASH_MAP\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nNumber of entries: %u", UString info = usprintf("Signature: _FLASH_MAP\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nNumber of entries: %u",
flashMapSize, flashMapSize, flashMapSize, flashMapSize,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
flashMapHeader->NumEntries); flashMapHeader->NumEntries);
// Add tree item // Add tree item
@ -1137,8 +1137,8 @@ USTATUS NvramParser::parseCmdbStoreHeader(const UByteArray & store, const UINT32
UString name("CMDB store"); UString name("CMDB store");
UString info = usprintf("Signature: CMDB\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)", UString info = usprintf("Signature: CMDB\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)",
cmdbSize, cmdbSize, cmdbSize, cmdbSize,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size()); (UINT32)body.size(), (UINT32)body.size());
// Add tree item // Add tree item
index = model->addItem(localOffset, Types::CmdbStore, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent); index = model->addItem(localOffset, Types::CmdbStore, 0, name, UString(), info, header, body, UByteArray(), Fixed, parent);
@ -1175,7 +1175,7 @@ USTATUS NvramParser::parseSlicPubkeyHeader(const UByteArray & store, const UINT3
UString info = usprintf("Type: 0h\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: 0h (0)\n" UString info = usprintf("Type: 0h\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: 0h (0)\n"
"Key type: %02Xh\nVersion: %02Xh\nAlgorithm: %08Xh\nMagic: RSA1\nBit length: %08Xh\nExponent: %08Xh", "Key type: %02Xh\nVersion: %02Xh\nAlgorithm: %08Xh\nMagic: RSA1\nBit length: %08Xh\nExponent: %08Xh",
pubkeyHeader->Size, pubkeyHeader->Size, pubkeyHeader->Size, pubkeyHeader->Size,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
pubkeyHeader->KeyType, pubkeyHeader->KeyType,
pubkeyHeader->Version, pubkeyHeader->Version,
pubkeyHeader->Algorithm, pubkeyHeader->Algorithm,
@ -1217,7 +1217,7 @@ USTATUS NvramParser::parseSlicMarkerHeader(const UByteArray & store, const UINT3
UString info = usprintf("Type: 1h\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: 0h (0)\n" UString info = usprintf("Type: 1h\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: 0h (0)\n"
"Version: %08Xh\nOEM ID: %s\nOEM table ID: %s\nWindows flag: WINDOWS\nSLIC version: %08Xh", "Version: %08Xh\nOEM ID: %s\nOEM table ID: %s\nWindows flag: WINDOWS\nSLIC version: %08Xh",
markerHeader->Size, markerHeader->Size, markerHeader->Size, markerHeader->Size,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
markerHeader->Version, markerHeader->Version,
(const char*)UString((const char*)&(markerHeader->OemId)).left(6).toLocal8Bit(), (const char*)UString((const char*)&(markerHeader->OemId)).left(6).toLocal8Bit(),
(const char*)UString((const char*)&(markerHeader->OemTableId)).left(8).toLocal8Bit(), (const char*)UString((const char*)&(markerHeader->OemTableId)).left(8).toLocal8Bit(),
@ -1475,7 +1475,7 @@ USTATUS NvramParser::parseVssStoreBody(const UModelIndex & index, UINT8 alignmen
// Check if the data left is a free space or a padding // Check if the data left is a free space or a padding
UByteArray padding = data.mid(offset, unparsedSize); UByteArray padding = data.mid(offset, unparsedSize);
// Get info // Get info
UString info = usprintf("Full size: %Xh (%u)", padding.size(), padding.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)padding.size(), (UINT32)padding.size());
if (padding.count(emptyByte) == padding.size()) { // Free space if (padding.count(emptyByte) == padding.size()) { // Free space
// Add tree item // Add tree item
@ -1516,8 +1516,8 @@ USTATUS NvramParser::parseVssStoreBody(const UModelIndex & index, UINT8 alignmen
// Add info // Add info
info += usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nState: %02Xh\nReserved: %02Xh\nAttributes: %08Xh (", info += usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nState: %02Xh\nReserved: %02Xh\nAttributes: %08Xh (",
variableSize, variableSize, variableSize, variableSize,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
variableHeader->State, variableHeader->State,
variableHeader->Reserved, variableHeader->Reserved,
variableHeader->Attributes) + vssAttributesToUString(variableHeader->Attributes) + UString(")"); variableHeader->Attributes) + vssAttributesToUString(variableHeader->Attributes) + UString(")");
@ -1595,15 +1595,15 @@ USTATUS NvramParser::parseFsysStoreBody(const UModelIndex & index)
if (nameSize == 3 && name[0] == 'E' && name[1] == 'O' && name[2] == 'F') { if (nameSize == 3 && name[0] == 'E' && name[1] == 'O' && name[2] == 'F') {
// There is no data afterward, add EOF variable and free space and return // There is no data afterward, add EOF variable and free space and return
UByteArray header = data.mid(offset, sizeof(UINT8) + nameSize); UByteArray header = data.mid(offset, sizeof(UINT8) + nameSize);
UString info = usprintf("Full size: %Xh (%u)", header.size(), header.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)header.size(), (UINT32)header.size());
// Add EOF tree item // Add EOF tree item
model->addItem(localOffset + offset, Types::FsysEntry, Subtypes::NormalFsysEntry, UString("EOF"), UString(), info, header, UByteArray(), UByteArray(), Fixed, index); model->addItem(localOffset + offset, Types::FsysEntry, Subtypes::NormalFsysEntry, UString("EOF"), UString(), info, header, UByteArray(), UByteArray(), Fixed, index);
// Add free space // Add free space
offset += header.size(); offset += (UINT32)header.size();
UByteArray body = data.mid(offset); UByteArray body = data.mid(offset);
info = usprintf("Full size: %Xh (%u)", body.size(), body.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)body.size(), (UINT32)body.size());
// Add free space tree item // Add free space tree item
model->addItem(localOffset + offset, Types::FreeSpace, 0, UString("Free space"), UString(), info, UByteArray(), body, UByteArray(), Fixed, index); model->addItem(localOffset + offset, Types::FreeSpace, 0, UString("Free space"), UString(), info, UByteArray(), body, UByteArray(), Fixed, index);
@ -1620,7 +1620,7 @@ USTATUS NvramParser::parseFsysStoreBody(const UModelIndex & index)
else { else {
// Last variable is bad, add the rest as padding and return // Last variable is bad, add the rest as padding and return
UByteArray body = data.mid(offset); UByteArray body = data.mid(offset);
UString info = usprintf("Full size: %Xh (%u)", body.size(), body.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)body.size(), (UINT32)body.size());
// Add padding tree item // Add padding tree item
model->addItem(localOffset + offset, Types::Padding, getPaddingType(body), UString("Padding"), UString(), info, UByteArray(), body, UByteArray(), Fixed, index); model->addItem(localOffset + offset, Types::Padding, getPaddingType(body), UString("Padding"), UString(), info, UByteArray(), body, UByteArray(), Fixed, index);
@ -1638,8 +1638,8 @@ USTATUS NvramParser::parseFsysStoreBody(const UModelIndex & index)
// Add info // Add info
UString info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)", UString info = usprintf("Full size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)",
variableSize, variableSize, variableSize, variableSize,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size()); (UINT32)body.size(), (UINT32)body.size());
// Add tree item // Add tree item
model->addItem(localOffset + offset, Types::FsysEntry, valid ? Subtypes::NormalFsysEntry : Subtypes::InvalidFsysEntry, UString(name.constData()), UString(), info, header, body, UByteArray(), Fixed, index); model->addItem(localOffset + offset, Types::FsysEntry, valid ? Subtypes::NormalFsysEntry : Subtypes::InvalidFsysEntry, UString(name.constData()), UString(), info, header, body, UByteArray(), Fixed, index);
@ -1696,7 +1696,7 @@ USTATUS NvramParser::parseEvsaStoreBody(const UModelIndex & index)
variableSize = sizeof(EVSA_ENTRY_HEADER); variableSize = sizeof(EVSA_ENTRY_HEADER);
if (unparsedSize < variableSize || unparsedSize < entryHeader->Size) { if (unparsedSize < variableSize || unparsedSize < entryHeader->Size) {
body = data.mid(offset); body = data.mid(offset);
info = usprintf("Full size: %Xh (%u)", body.size(), body.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)body.size(), (UINT32)body.size());
if (body.count(emptyByte) == body.size()) { // Free space if (body.count(emptyByte) == body.size()) { // Free space
// Add free space tree item // Add free space tree item
@ -1724,10 +1724,11 @@ USTATUS NvramParser::parseEvsaStoreBody(const UModelIndex & index)
body = data.mid(offset + sizeof(EVSA_GUID_ENTRY), guidHeader->Header.Size - sizeof(EVSA_GUID_ENTRY)); body = data.mid(offset + sizeof(EVSA_GUID_ENTRY), guidHeader->Header.Size - sizeof(EVSA_GUID_ENTRY));
EFI_GUID guid = *(EFI_GUID*)body.constData(); EFI_GUID guid = *(EFI_GUID*)body.constData();
name = guidToUString(guid); name = guidToUString(guid);
info = UString("GUID: ") + guidToUString(guid, false) + usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %02Xh\nChecksum: %02Xh", info = UString("GUID: ") + guidToUString(guid, false)
+ usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %02Xh\nChecksum: %02Xh",
variableSize, variableSize, variableSize, variableSize,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
guidHeader->Header.Type, guidHeader->Header.Type,
guidHeader->Header.Checksum) guidHeader->Header.Checksum)
+ (guidHeader->Header.Checksum != calculated ? usprintf(", invalid, should be %02Xh", calculated) : UString(", valid")) + (guidHeader->Header.Checksum != calculated ? usprintf(", invalid, should be %02Xh", calculated) : UString(", valid"))
@ -1748,10 +1749,11 @@ USTATUS NvramParser::parseEvsaStoreBody(const UModelIndex & index)
name = UString::fromUtf16((const CHAR16*)body.constData()); name = UString::fromUtf16((const CHAR16*)body.constData());
#endif #endif
info = UString("Name: ") + name + usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %02Xh\nChecksum: %02Xh", info = UString("Name: ") + name
+ usprintf("\nFull size: %Xh (%u)\nHeader size: %Xh (%u)\nBody size: %Xh (%u)\nType: %02Xh\nChecksum: %02Xh",
variableSize, variableSize, variableSize, variableSize,
header.size(), header.size(), (UINT32)header.size(), (UINT32)header.size(),
body.size(), body.size(), (UINT32)body.size(), (UINT32)body.size(),
nameHeader->Header.Type, nameHeader->Header.Type,
nameHeader->Header.Checksum) nameHeader->Header.Checksum)
+ (nameHeader->Header.Checksum != calculated ? usprintf(", invalid, should be %02Xh", calculated) : UString(", valid")) + (nameHeader->Header.Checksum != calculated ? usprintf(", invalid, should be %02Xh", calculated) : UString(", valid"))
@ -1794,7 +1796,7 @@ USTATUS NvramParser::parseEvsaStoreBody(const UModelIndex & index)
// Unknown entry or free space // Unknown entry or free space
else { else {
body = data.mid(offset); body = data.mid(offset);
info = usprintf("Full size: %Xh (%u)", body.size(), body.size()); info = usprintf("Full size: %Xh (%u)", (UINT32)body.size(), (UINT32)body.size());
if (body.count(emptyByte) == body.size()) { // Free space if (body.count(emptyByte) == body.size()) { // Free space
// Add free space tree item // Add free space tree item
@ -1888,7 +1890,7 @@ USTATUS NvramParser::parseFlashMapBody(const UModelIndex & index)
if (unparsedSize < sizeof(PHOENIX_FLASH_MAP_ENTRY)) { if (unparsedSize < sizeof(PHOENIX_FLASH_MAP_ENTRY)) {
// Last variable is bad, add the rest as padding and return // Last variable is bad, add the rest as padding and return
UByteArray body = data.mid(offset); UByteArray body = data.mid(offset);
UString info = usprintf("Full size: %Xh (%u)", body.size(), body.size()); UString info = usprintf("Full size: %Xh (%u)", (UINT32)body.size(), (UINT32)body.size());
// Add padding tree item // Add padding tree item
model->addItem(localOffset + offset, Types::Padding, getPaddingType(body), UString("Padding"), UString(), info, UByteArray(), body, UByteArray(), Fixed, index); model->addItem(localOffset + offset, Types::Padding, getPaddingType(body), UString("Padding"), UString(), info, UByteArray(), body, UByteArray(), Fixed, index);

View File

@ -1,15 +1,15 @@
/* peimage.cpp /* peimage.cpp
Copyright (c) 2015, Nikolaj Schlej. All rights reserved. Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php. http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "peimage.h" #include "peimage.h"

View File

@ -1,15 +1,15 @@
/* treeitem.cpp /* treeitem.cpp
Copyright (c) 2015, Nikolaj Schlej. All rights reserved. Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "treeitem.h" #include "treeitem.h"
#include "types.h" #include "types.h"
@ -19,20 +19,20 @@ TreeItem::TreeItem(const UINT32 offset, const UINT8 type, const UINT8 subtype,
const UByteArray & header, const UByteArray & body, const UByteArray & tail, const UByteArray & header, const UByteArray & body, const UByteArray & tail,
const bool fixed, const bool compressed, const bool fixed, const bool compressed,
TreeItem *parent) : TreeItem *parent) :
itemOffset(offset), itemOffset(offset),
itemAction(Actions::NoAction), itemAction(Actions::NoAction),
itemType(type), itemType(type),
itemSubtype(subtype), itemSubtype(subtype),
itemMarking(0), itemMarking(0),
itemName(name), itemName(name),
itemText(text), itemText(text),
itemInfo(info), itemInfo(info),
itemHeader(header), itemHeader(header),
itemBody(body), itemBody(body),
itemTail(tail), itemTail(tail),
itemFixed(fixed), itemFixed(fixed),
itemCompressed(compressed), itemCompressed(compressed),
parentItem(parent) parentItem(parent)
{ {
} }

View File

@ -1,15 +1,15 @@
/* treemodel.cpp /* treemodel.cpp
Copyright (c) 2015, Nikolaj Schlej. All rights reserved. Copyright (c) 2015, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "treemodel.h" #include "treemodel.h"

View File

@ -1,14 +1,14 @@
/* types.cpp /* types.cpp
Copyright (c) 2016, Nikolaj Schlej. All rights reserved. Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHWARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "ustring.h" #include "ustring.h"
#include "types.h" #include "types.h"

View File

@ -16,7 +16,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// A workaround for compilers not supporting c++11 and c11 // A workaround for compilers not supporting c++11 and c11
// for using PRIX64. // for using PRIX64.
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#include <inttypes.h> #include <inttypes.h>
#if defined(__clang__) || defined(__GNUC__) #if defined(__clang__) || defined(__GNUC__)

View File

@ -1,14 +1,14 @@
/* ustring.cpp /* ustring.cpp
Copyright (c) 2016, Nikolaj Schlej. All rights reserved. Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include "ustring.h" #include "ustring.h"
#include <stdarg.h> #include <stdarg.h>
@ -37,16 +37,16 @@ UString urepeated(char c, int len)
#else #else
#ifdef BSTRLIB_NOVSNP #ifdef BSTRLIB_NOVSNP
/* This is just a hack. If you are using a system without a vsnprintf, it is /* This is just a hack. If you are using a system without a vsnprintf, it is
not recommended that bformat be used at all. */ not recommended that bformat be used at all. */
#define exvsnprintf(r,b,n,f,a) {vsprintf (b,f,a); r = -1;} #define exvsnprintf(r,b,n,f,a) {vsprintf (b,f,a); r = -1;}
#define START_VSNBUFF (256) #define START_VSNBUFF (256)
#else #else
#if defined (__GNUC__) && !defined (__PPC__) && !defined(__WIN32__) #if defined (__GNUC__) && !defined (__PPC__) && !defined(__WIN32__)
/* Something is making gcc complain about this prototype not being here, so /* Something is making gcc complain about this prototype not being here, so
I've just gone ahead and put it in. */ I've just gone ahead and put it in. */
extern "C" { extern "C" {
extern int vsnprintf(char *buf, size_t count, const char *format, va_list arg); extern int vsnprintf(char *buf, size_t count, const char *format, va_list arg);
} }
#endif #endif

View File

@ -1,15 +1,15 @@
/* utility.cpp /* utility.cpp
Copyright (c) 2016, Nikolaj Schlej. All rights reserved. Copyright (c) 2016, Nikolaj Schlej. All rights reserved.
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/ */
#include <cstdio> #include <cstdio>
#include <cctype> #include <cctype>