summaryrefslogtreecommitdiffstats
path: root/libpit
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xlibpit/Source/libpit.cpp35
-rwxr-xr-xlibpit/Source/libpit.h8
2 files changed, 43 insertions, 0 deletions
diff --git a/libpit/Source/libpit.cpp b/libpit/Source/libpit.cpp
index 030a80b..1eb3e76 100755
--- a/libpit/Source/libpit.cpp
+++ b/libpit/Source/libpit.cpp
@@ -43,6 +43,21 @@ PitEntry::~PitEntry()
{
}
+bool PitEntry::Matches(const PitEntry *otherPitEntry) const
+{
+ if (unused == otherPitEntry->unused && partitionType == otherPitEntry->partitionType && partitionIdentifier == otherPitEntry->partitionIdentifier
+ && partitionFlags == otherPitEntry->partitionFlags && unknown1 == otherPitEntry->unknown1 && partitionBlockSize == otherPitEntry->partitionBlockSize
+ && partitionBlockCount == otherPitEntry->partitionBlockCount && unknown2 == otherPitEntry->unknown2 && unknown3 == otherPitEntry->unknown3
+ && strcmp(partitionName, otherPitEntry->partitionName) == 0 && strcmp(filename, otherPitEntry->filename) == 0)
+ {
+ return (true);
+ }
+ else
+ {
+ return (false);
+ }
+}
+
PitData::PitData()
@@ -179,6 +194,26 @@ void PitData::Pack(unsigned char *data) const
}
}
+bool PitData::Matches(const PitData *otherPitData) const
+{
+ if (entryCount == otherPitData->entryCount && unknown1 == otherPitData->unknown1 && unknown2 == otherPitData->unknown2
+ && unknown3 == otherPitData->unknown3 && unknown4 == otherPitData->unknown4 && unknown5 == otherPitData->unknown5
+ && unknown6 == otherPitData->unknown6 && unknown7 == otherPitData->unknown7 && unknown8 == otherPitData->unknown8)
+ {
+ for (unsigned int i = 0; i < entryCount; i++)
+ {
+ if (!entries[i]->Matches(otherPitData->entries[i]))
+ return (false);
+ }
+
+ return (true);
+ }
+ else
+ {
+ return (false);
+ }
+}
+
void PitData::Clear(void)
{
entryCount = 0;
diff --git a/libpit/Source/libpit.h b/libpit/Source/libpit.h
index 636f1e1..fa4a534 100755
--- a/libpit/Source/libpit.h
+++ b/libpit/Source/libpit.h
@@ -21,6 +21,10 @@
#ifndef LIBPIT_H
#define LIBPIT_H
+#ifdef WIN32
+#pragma warning(disable : 4996)
+#endif
+
// C Standard Library
#include <string.h>
#include <vector>
@@ -74,6 +78,8 @@ namespace libpit
PitEntry();
~PitEntry();
+ bool Matches(const PitEntry *otherPitEntry) const;
+
bool GetUnused(void) const
{
return unused;
@@ -285,6 +291,8 @@ namespace libpit
bool Unpack(const unsigned char *data);
void Pack(unsigned char *data) const;
+ bool Matches(const PitData *otherPitData) const;
+
void Clear(void);
PitEntry *GetEntry(unsigned int index);