summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2013-05-05 12:53:36 +0200
committerBenjamin Dobell <benjamin.dobell+git@glassechidna.com.au>2013-05-05 12:53:36 +0200
commit55d6c9551e13b108947410d7bf50b6ba2c01b633 (patch)
tree992992cd5f8de4461829efd0c000c4b09c595412
parentChanged Arguments.h constructors with default parameters so it compiles with clang. (diff)
downloadHeimdall-55d6c9551e13b108947410d7bf50b6ba2c01b633.tar
Heimdall-55d6c9551e13b108947410d7bf50b6ba2c01b633.tar.gz
Heimdall-55d6c9551e13b108947410d7bf50b6ba2c01b633.tar.bz2
Heimdall-55d6c9551e13b108947410d7bf50b6ba2c01b633.tar.lz
Heimdall-55d6c9551e13b108947410d7bf50b6ba2c01b633.tar.xz
Heimdall-55d6c9551e13b108947410d7bf50b6ba2c01b633.tar.zst
Heimdall-55d6c9551e13b108947410d7bf50b6ba2c01b633.zip
-rw-r--r--heimdall-frontend/Source/mainwindow.cpp2
-rw-r--r--libpit/Source/libpit.cpp10
-rw-r--r--libpit/Source/libpit.h5
3 files changed, 11 insertions, 6 deletions
diff --git a/heimdall-frontend/Source/mainwindow.cpp b/heimdall-frontend/Source/mainwindow.cpp
index 281fd77..862dc5a 100644
--- a/heimdall-frontend/Source/mainwindow.cpp
+++ b/heimdall-frontend/Source/mainwindow.cpp
@@ -102,7 +102,7 @@ void MainWindow::UpdateUnusedPartitionIds(void)
{
const PitEntry *pitEntry = currentPitData.GetEntry(i);
- if (pitEntry->GetBlockCount() > 0 && strcmp(pitEntry->GetPartitionName(), "PIT") != 0 && strcmp(pitEntry->GetPartitionName(), "PT") != 0)
+ if (pitEntry->IsFlashable() && strcmp(pitEntry->GetPartitionName(), "PIT") != 0 && strcmp(pitEntry->GetPartitionName(), "PT") != 0)
unusedPartitionIds.append(pitEntry->GetIdentifier());
}
diff --git a/libpit/Source/libpit.cpp b/libpit/Source/libpit.cpp
index a1138b5..1f29816 100644
--- a/libpit/Source/libpit.cpp
+++ b/libpit/Source/libpit.cpp
@@ -193,7 +193,7 @@ void PitData::Pack(unsigned char *data) const
PitData::PackInteger(data, entryOffset + 32, entries[i]->GetFileSize());
memcpy(data + entryOffset + 36, entries[i]->GetPartitionName(), PitEntry::kPartitionNameMaxLength);
- memcpy(data + entryOffset + 36 + PitEntry::kPartitionNameMaxLength, entries[i]->GetPartitionName(), PitEntry::kFlashFilenameMaxLength);
+ memcpy(data + entryOffset + 36 + PitEntry::kPartitionNameMaxLength, entries[i]->GetFlashFilename(), PitEntry::kFlashFilenameMaxLength);
memcpy(data + entryOffset + 36 + PitEntry::kPartitionNameMaxLength + PitEntry::kFlashFilenameMaxLength,
entries[i]->GetFotaFilename(), PitEntry::kFotaFilenameMaxLength);
}
@@ -255,7 +255,7 @@ PitEntry *PitData::FindEntry(const char *partitionName)
{
for (unsigned int i = 0; i < entries.size(); i++)
{
- if (entries[i]->GetBlockCount() > 0 && strcmp(entries[i]->GetPartitionName(), partitionName) == 0)
+ if (entries[i]->IsFlashable() && strcmp(entries[i]->GetPartitionName(), partitionName) == 0)
return (entries[i]);
}
@@ -266,7 +266,7 @@ const PitEntry *PitData::FindEntry(const char *partitionName) const
{
for (unsigned int i = 0; i < entries.size(); i++)
{
- if (entries[i]->GetBlockCount() > 0 && strcmp(entries[i]->GetPartitionName(), partitionName) == 0)
+ if (entries[i]->IsFlashable() && strcmp(entries[i]->GetPartitionName(), partitionName) == 0)
return (entries[i]);
}
@@ -277,7 +277,7 @@ PitEntry *PitData::FindEntry(unsigned int partitionIdentifier)
{
for (unsigned int i = 0; i < entries.size(); i++)
{
- if (entries[i]->GetBlockCount() > 0 && entries[i]->GetIdentifier() == partitionIdentifier)
+ if (entries[i]->IsFlashable() && entries[i]->GetIdentifier() == partitionIdentifier)
return (entries[i]);
}
@@ -288,7 +288,7 @@ const PitEntry *PitData::FindEntry(unsigned int partitionIdentifier) const
{
for (unsigned int i = 0; i < entries.size(); i++)
{
- if (entries[i]->GetBlockCount() > 0 && entries[i]->GetIdentifier() == partitionIdentifier)
+ if (entries[i]->IsFlashable() && entries[i]->GetIdentifier() == partitionIdentifier)
return (entries[i]);
}
diff --git a/libpit/Source/libpit.h b/libpit/Source/libpit.h
index eb37647..c2bc691 100644
--- a/libpit/Source/libpit.h
+++ b/libpit/Source/libpit.h
@@ -103,6 +103,11 @@ namespace libpit
bool Matches(const PitEntry *otherPitEntry) const;
+ bool IsFlashable(void) const
+ {
+ return strlen(partitionName) != 0;
+ }
+
unsigned int GetBinaryType(void) const
{
return binaryType;