From 4d6eb6f69418b8ed278c2dff045f1baa0f660208 Mon Sep 17 00:00:00 2001 From: jakcron Date: Sun, 24 Jun 2018 13:20:56 +0800 Subject: [PATCH] [es] Change order of methods to fit with style. --- lib/libes/include/es/SectionHeader_V2.h | 2 +- lib/libes/include/es/TicketBody_V2.h | 2 +- lib/libes/source/SectionHeader_V2.cpp | 28 ++++++------- lib/libes/source/TicketBody_V2.cpp | 52 ++++++++++++------------- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/lib/libes/include/es/SectionHeader_V2.h b/lib/libes/include/es/SectionHeader_V2.h index 4ba539e..35b1083 100644 --- a/lib/libes/include/es/SectionHeader_V2.h +++ b/lib/libes/include/es/SectionHeader_V2.h @@ -12,9 +12,9 @@ namespace es SectionHeader_V2(); SectionHeader_V2(const SectionHeader_V2& other); + void operator=(const SectionHeader_V2& other); bool operator==(const SectionHeader_V2& other) const; bool operator!=(const SectionHeader_V2& other) const; - void operator=(const SectionHeader_V2& other); // export/import binary void toBytes(); diff --git a/lib/libes/include/es/TicketBody_V2.h b/lib/libes/include/es/TicketBody_V2.h index b22e966..6b0be01 100644 --- a/lib/libes/include/es/TicketBody_V2.h +++ b/lib/libes/include/es/TicketBody_V2.h @@ -12,9 +12,9 @@ namespace es TicketBody_V2(); TicketBody_V2(const TicketBody_V2& other); + void operator=(const TicketBody_V2& other); bool operator==(const TicketBody_V2& other) const; bool operator!=(const TicketBody_V2& other) const; - void operator=(const TicketBody_V2& other); // export/import binary void toBytes(); diff --git a/lib/libes/source/SectionHeader_V2.cpp b/lib/libes/source/SectionHeader_V2.cpp index 4388917..2fd18ac 100644 --- a/lib/libes/source/SectionHeader_V2.cpp +++ b/lib/libes/source/SectionHeader_V2.cpp @@ -10,20 +10,6 @@ es::SectionHeader_V2::SectionHeader_V2(const SectionHeader_V2 & other) *this = other; } -bool es::SectionHeader_V2::operator==(const SectionHeader_V2 & other) const -{ - return (mSectionOffset == other.mSectionOffset) \ - && (mRecordSize == other.mRecordSize) \ - && (mSectionSize == other.mSectionSize) \ - && (mRecordNum == other.mRecordNum) \ - && (mSectionType == other.mSectionType); -} - -bool es::SectionHeader_V2::operator!=(const SectionHeader_V2 & other) const -{ - return !(*this ==other); -} - void es::SectionHeader_V2::operator=(const SectionHeader_V2 & other) { if (other.getBytes().size()) @@ -41,6 +27,20 @@ void es::SectionHeader_V2::operator=(const SectionHeader_V2 & other) } } +bool es::SectionHeader_V2::operator==(const SectionHeader_V2 & other) const +{ + return (mSectionOffset == other.mSectionOffset) \ + && (mRecordSize == other.mRecordSize) \ + && (mSectionSize == other.mSectionSize) \ + && (mRecordNum == other.mRecordNum) \ + && (mSectionType == other.mSectionType); +} + +bool es::SectionHeader_V2::operator!=(const SectionHeader_V2 & other) const +{ + return !(*this ==other); +} + void es::SectionHeader_V2::toBytes() { mRawBinary.alloc(sizeof(sSectionHeader_v2)); diff --git a/lib/libes/source/TicketBody_V2.cpp b/lib/libes/source/TicketBody_V2.cpp index baafc6d..471152b 100644 --- a/lib/libes/source/TicketBody_V2.cpp +++ b/lib/libes/source/TicketBody_V2.cpp @@ -12,32 +12,6 @@ es::TicketBody_V2::TicketBody_V2(const TicketBody_V2 & other) *this = other; } -bool es::TicketBody_V2::operator==(const TicketBody_V2 & other) const -{ - return (mIssuer == other.mIssuer) \ - && (memcmp(mEncTitleKey, other.mEncTitleKey, ticket::kEncTitleKeySize) == 0) \ - && (mEncType == other.mEncType) \ - && (mTicketVersion == other.mTicketVersion) \ - && (mLicenseType == other.mLicenseType) \ - && (mPreInstall == other.mPreInstall) \ - && (mSharedTitle == other.mSharedTitle) \ - && (mAllowAllContent == other.mAllowAllContent) \ - && (memcmp(mReservedRegion, other.mReservedRegion, ticket::kReservedRegionSize) == 0) \ - && (mTicketId == other.mTicketId) \ - && (mDeviceId == other.mDeviceId) \ - && (memcmp(mRightsId, other.mRightsId, ticket::kRightsIdSize) == 0) \ - && (mAccountId == other.mAccountId) \ - && (mSectTotalSize == other.mSectTotalSize) \ - && (mSectHeaderOffset == other.mSectHeaderOffset) \ - && (mSectNum == other.mSectNum) \ - && (mSectEntrySize == other.mSectEntrySize); -} - -bool es::TicketBody_V2::operator!=(const TicketBody_V2 & other) const -{ - return !(*this == other); -} - void es::TicketBody_V2::operator=(const TicketBody_V2 & other) { if (other.getBytes().size()) @@ -67,6 +41,32 @@ void es::TicketBody_V2::operator=(const TicketBody_V2 & other) } } +bool es::TicketBody_V2::operator==(const TicketBody_V2 & other) const +{ + return (mIssuer == other.mIssuer) \ + && (memcmp(mEncTitleKey, other.mEncTitleKey, ticket::kEncTitleKeySize) == 0) \ + && (mEncType == other.mEncType) \ + && (mTicketVersion == other.mTicketVersion) \ + && (mLicenseType == other.mLicenseType) \ + && (mPreInstall == other.mPreInstall) \ + && (mSharedTitle == other.mSharedTitle) \ + && (mAllowAllContent == other.mAllowAllContent) \ + && (memcmp(mReservedRegion, other.mReservedRegion, ticket::kReservedRegionSize) == 0) \ + && (mTicketId == other.mTicketId) \ + && (mDeviceId == other.mDeviceId) \ + && (memcmp(mRightsId, other.mRightsId, ticket::kRightsIdSize) == 0) \ + && (mAccountId == other.mAccountId) \ + && (mSectTotalSize == other.mSectTotalSize) \ + && (mSectHeaderOffset == other.mSectHeaderOffset) \ + && (mSectNum == other.mSectNum) \ + && (mSectEntrySize == other.mSectEntrySize); +} + +bool es::TicketBody_V2::operator!=(const TicketBody_V2 & other) const +{ + return !(*this == other); +} + void es::TicketBody_V2::toBytes() { mRawBinary.alloc(sizeof(sTicketBody_v2));