aboutsummaryrefslogtreecommitdiffstats
path: root/libpit/Source/libpit.h
diff options
context:
space:
mode:
authorKoushik Dutta <koushd@gmail.com>2013-08-14 10:01:22 -0700
committerKoushik Dutta <koushd@gmail.com>2013-08-14 10:01:22 -0700
commit49a02b8c916e8ef011d9f56901d208eca626b85b (patch)
tree1148a42ede0e6661854b8f92d4bbe52a4290d02b /libpit/Source/libpit.h
parentc82df274ecea32cd6528f070a21528bf80a2f466 (diff)
parentf95619028fa5c80284e6ade2ced7772e41040424 (diff)
downloadexternal_heimdall-49a02b8c916e8ef011d9f56901d208eca626b85b.zip
external_heimdall-49a02b8c916e8ef011d9f56901d208eca626b85b.tar.gz
external_heimdall-49a02b8c916e8ef011d9f56901d208eca626b85b.tar.bz2
Merge remote-tracking branch 'bd/master' into cm-10.2
Conflicts: Linux/README OSX/README.txt heimdall-frontend/doc-pak/README heimdall/doc-pak/README Change-Id: Ib5867d7a2be030290a3896ab82fe48a7f0a97e63
Diffstat (limited to 'libpit/Source/libpit.h')
-rw-r--r--libpit/Source/libpit.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/libpit/Source/libpit.h b/libpit/Source/libpit.h
index 9e6c452..c7bfe8b 100644
--- a/libpit/Source/libpit.h
+++ b/libpit/Source/libpit.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2012 Benjamin Dobell, Glass Echidna
+/* Copyright (c) 2010-2013 Benjamin Dobell, Glass Echidna
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -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;
@@ -250,7 +255,8 @@ namespace libpit
enum
{
kFileIdentifier = 0x12349876,
- kHeaderDataSize = 28
+ kHeaderDataSize = 28,
+ kPaddedSizeMultiplicand = 4096
};
private:
@@ -349,6 +355,22 @@ namespace libpit
return entryCount;
}
+ unsigned int GetDataSize(void) const
+ {
+ return PitData::kHeaderDataSize + entryCount * PitEntry::kDataSize;
+ }
+
+ unsigned int GetPaddedSize(void) const
+ {
+ unsigned int dataSize = GetDataSize();
+ unsigned int paddedSize = (dataSize / kPaddedSizeMultiplicand) * kPaddedSizeMultiplicand;
+
+ if (dataSize % kPaddedSizeMultiplicand != 0)
+ paddedSize += kPaddedSizeMultiplicand;
+
+ return paddedSize;
+ }
+
unsigned int GetUnknown1(void) const
{
return unknown1;