Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions core/Math/hsGeometry3.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ struct HSPLASMA_EXPORT hsVector3
}

/** Returns true if the values of the vectors are non-identical */
bool operator!=(const hsVector3& other) const
{
return (X != other.X) || (Y != other.Y) || (Z != other.Z);
}
bool operator!=(const hsVector3& other) const { return !operator==(other); }

/** Reads the vector from a stream */
void read(hsStream* S);
Expand Down
1 change: 1 addition & 0 deletions core/Math/hsMatrix44.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct HSPLASMA_EXPORT hsMatrix44
float operator()(int y, int x) const { return data[y+(x*4)]; }
float& operator()(int y, int x) { return data[y+(x*4)]; }
bool operator==(const hsMatrix44& other) const;
bool operator!=(const hsMatrix44& other) const { return !operator==(other); }
const float* glMatrix() const { return data; }

hsMatrix44 operator*(const hsMatrix44& right) const;
Expand Down
5 changes: 1 addition & 4 deletions core/Math/hsQuat.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ struct HSPLASMA_EXPORT hsQuat
return (X == other.X) && (Y == other.Y) && (Z == other.Z) && (W == other.W);
}

bool operator!=(const hsQuat& other) const
{
return (X != other.X) || (Y != other.Y) || (Z != other.Z) || (W != other.W);
}
bool operator!=(const hsQuat& other) const { return !operator==(other); }

hsQuat operator+(const hsQuat& rt) const
{
Expand Down
8 changes: 5 additions & 3 deletions core/PRP/KeyedObject/plKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ class HSPLASMA_EXPORT plKeyData
* equivalent. This basically just calls the == operator on the
* plUoid (so storage information is not compared).
*/
bool operator==(plKeyData& other) const { return (fUoid == other.fUoid); }
bool operator==(const plKeyData& other) const { return (fUoid == other.fUoid); }

bool operator!=(const plKeyData& other) const { return !operator==(other); }

/**
* Read a key directly from the key index of a PRP file. This will
Expand Down Expand Up @@ -347,10 +349,10 @@ class HSPLASMA_EXPORT plKey HS_FINAL
bool operator==(const plKeyData* other) const { return fKeyData == other; }

/** Returns true if the keys point to different plKeyData structures */
bool operator!=(const plKey& other) const { return fKeyData != other.fKeyData; }
bool operator!=(const plKey& other) const { return !operator==(other); }

/** Returns true if this key's plKeyData is NOT 'other' */
bool operator!=(const plKeyData* other) const { return fKeyData != other; }
bool operator!=(const plKeyData* other) const { return !operator==(other); }

/** Provides sorting functionality for STL containers */
bool operator<(const plKey& other) const
Expand Down
21 changes: 13 additions & 8 deletions core/PRP/KeyedObject/plLocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,25 @@
bool plLocation::operator==(const plLocation& other) const
{
return (fState == other.fState && fPageNum == other.fPageNum
&& fSeqPrefix == other.fSeqPrefix);
&& fSeqPrefix == other.fSeqPrefix && fFlags == other.fFlags);
}

bool plLocation::operator!=(const plLocation& other) const
bool plLocation::operator<(const plLocation& other) const
{
return (fState != other.fState || fPageNum != other.fPageNum
|| fSeqPrefix != other.fSeqPrefix || fFlags != other.fFlags);
if (fState != other.fState) {
return fState < other.fState;
} else if (fSeqPrefix != other.fSeqPrefix) {
return fSeqPrefix < other.fSeqPrefix;
} else if (fPageNum != other.fPageNum) {
return fPageNum < other.fPageNum;
} else {
return fFlags < other.fFlags;
}
}

bool plLocation::operator<(const plLocation& other) const
bool plLocation::isSamePage(const plLocation& other) const
{
if (fSeqPrefix == other.fSeqPrefix)
return fPageNum < other.fPageNum;
return fSeqPrefix < other.fSeqPrefix;
return fState == other.fState && fSeqPrefix == other.fSeqPrefix && fPageNum == other.fPageNum;
}

void plLocation::parse(unsigned int id)
Expand Down
5 changes: 4 additions & 1 deletion core/PRP/KeyedObject/plLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ class HSPLASMA_EXPORT plLocation
void setVer(PlasmaVer pv) { fVer = pv; }

bool operator==(const plLocation& other) const;
bool operator!=(const plLocation& other) const;
bool operator!=(const plLocation& other) const { return !operator==(other); }
bool operator<(const plLocation& other) const;

/** Compare two locations only by their state and sequence number, ignoring flags. */
bool isSamePage(const plLocation& other) const;

void parse(unsigned int id);
unsigned int unparse() const;

Expand Down
14 changes: 7 additions & 7 deletions core/ResManager/plResManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ plPageInfo* plResManager::FindPage(const plLocation& loc)
{
std::vector<plPageInfo*>::iterator pi = pages.begin();
while (pi != pages.end()) {
if ((*pi)->getLocation() == loc)
if ((*pi)->getLocation().isSamePage(loc))
return *pi;
pi++;
}
Expand All @@ -282,16 +282,16 @@ plPageInfo* plResManager::FindPage(const plLocation& loc)

void plResManager::UnloadPage(const plLocation& loc)
{
// Make a copy, in case someone passed us the page's getLocation() reference
plLocation pageLoc = loc;

for (auto it = pages.begin(); it != pages.end(); it++) {
if ((*it)->getLocation() == loc) {
if ((*it)->getLocation().isSamePage(loc)) {
// Copy the location so we can still use it
// after the plPageInfo has been deleted.
plLocation foundLocation = (*it)->getLocation();
if (pageUnloadFunc)
pageUnloadFunc(loc);
pageUnloadFunc(foundLocation);
delete *it;
pages.erase(it);
keys.delAll(pageLoc);
keys.delAll(foundLocation);
break;
}
}
Expand Down
10 changes: 0 additions & 10 deletions core/Sys/hsColor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ bool hsColorRGBA::operator==(const hsColorRGBA& other) const
return (r == other.r) && (g == other.g) && (b == other.b) && (a == other.a);
}

bool hsColorRGBA::operator!=(const hsColorRGBA& other) const
{
return (r != other.r) || (g != other.g) || (b != other.b) || (a != other.a);
}

void hsColorRGBA::read(hsStream* S)
{
r = S->readFloat();
Expand Down Expand Up @@ -113,11 +108,6 @@ bool hsColor32::operator==(const hsColor32& other) const
return (color == other.color);
}

bool hsColor32::operator!=(const hsColor32& other) const
{
return (color != other.color);
}

void hsColor32::read32(hsStream* S)
{
color = S->readInt();
Expand Down
4 changes: 2 additions & 2 deletions core/Sys/hsColor.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct HSPLASMA_EXPORT hsColorRGBA
void set(const hsColorRGBA& init);

bool operator==(const hsColorRGBA& other) const;
bool operator!=(const hsColorRGBA& other) const;
bool operator!=(const hsColorRGBA& other) const { return !operator==(other); }

void read(hsStream* S);
void write(hsStream* S);
Expand Down Expand Up @@ -74,7 +74,7 @@ struct HSPLASMA_EXPORT hsColor32
: b(blue), g(green), r(red), a(alpha) { }

bool operator==(const hsColor32& other) const;
bool operator!=(const hsColor32& other) const;
bool operator!=(const hsColor32& other) const { return !operator==(other); }

void read32(hsStream* S);
void write32(hsStream* S);
Expand Down
5 changes: 0 additions & 5 deletions core/Sys/plUnifiedTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,6 @@ bool plUnifiedTime::operator==(const plUnifiedTime& other)
return (fSecs == other.fSecs && fMicros == other.fMicros);
}

bool plUnifiedTime::operator!=(const plUnifiedTime& other)
{
return (fSecs != other.fSecs || fMicros != other.fMicros);
}

bool plUnifiedTime::operator<(const plUnifiedTime& other)
{
if (fSecs < other.fSecs)
Expand Down
2 changes: 1 addition & 1 deletion core/Sys/plUnifiedTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class HSPLASMA_EXPORT plUnifiedTime
plUnifiedTime& operator+=(const plUnifiedTime& other);
plUnifiedTime& operator-=(const plUnifiedTime& other);
bool operator==(const plUnifiedTime& other);
bool operator!=(const plUnifiedTime& other);
bool operator!=(const plUnifiedTime& other) { return !operator==(other); }
bool operator<(const plUnifiedTime& other);
bool operator>(const plUnifiedTime& other);
bool operator<=(const plUnifiedTime& other);
Expand Down
7 changes: 0 additions & 7 deletions core/Sys/plUuid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ bool plUuid::operator==(const plUuid& other) const
return (memcmp(fData4, other.fData4, sizeof(fData4)) == 0);
}

bool plUuid::operator!=(const plUuid& other) const
{
if (fData1 == other.fData1 || fData2 == other.fData2 || fData3 == other.fData3)
return false;
return (memcmp(fData4, other.fData4, sizeof(fData4)) != 0);
}

void plUuid::read(hsStream* S)
{
fData1 = S->readInt();
Expand Down
2 changes: 1 addition & 1 deletion core/Sys/plUuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct HSPLASMA_EXPORT plUuid {
bool operator==(const plUuid& other) const;

/** Returns true if the two UUIDs are non-identical. */
bool operator!=(const plUuid& other) const;
bool operator!=(const plUuid& other) const { return !operator==(other); }

/** Read the UUID from a stream */
void read(hsStream* S);
Expand Down
2 changes: 2 additions & 0 deletions core/Util/hsBitVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class HSPLASMA_EXPORT hsBitVector
/** Comparison operator */
bool operator==(bool value) const;

bool operator!=(bool value) const { return !operator==(value); }

/** Assignment operator -- modifies the hsBitVector */
Bit& operator=(bool value);
};
Expand Down
5 changes: 0 additions & 5 deletions core/Util/plMD5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ bool plMD5Hash::operator==(const plMD5Hash& cmp) const
return memcmp(fHash, cmp.fHash, sizeof(fHash)) == 0;
}

bool plMD5Hash::operator!=(const plMD5Hash& cmp) const
{
return memcmp(fHash, cmp.fHash, sizeof(fHash)) != 0;
}

ST::string plMD5Hash::toHex() const
{
// Little-endian byte order
Expand Down
2 changes: 1 addition & 1 deletion core/Util/plMD5.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class HSPLASMA_EXPORT plMD5Hash
plMD5Hash();
plMD5Hash(const char* hex) { fromHex(hex); }
bool operator==(const plMD5Hash& cmp) const;
bool operator!=(const plMD5Hash& cmp) const;
bool operator!=(const plMD5Hash& cmp) const { return !operator==(cmp); }

ST::string toHex() const;
void fromHex(const char* hex);
Expand Down
1 change: 1 addition & 0 deletions net/auth/pnVaultNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ struct HSPLASMANET_EXPORT pnVaultNodeRef
void read(const unsigned char* buffer);
void write(unsigned char* buffer);
bool operator==(const pnVaultNodeRef& ref) const;
bool operator!=(const pnVaultNodeRef& ref) const { return !operator==(ref); }
};

#endif
10 changes: 0 additions & 10 deletions net/crypt/pnBigInteger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,6 @@ bool pnBigInteger::operator==(unsigned int num) const
return BN_is_word(fValue, num) != 0;
}

bool pnBigInteger::operator!=(const pnBigInteger& num) const
{
return BN_cmp(fValue, num.fValue) != 0;
}

bool pnBigInteger::operator!=(unsigned int num) const
{
return BN_is_word(fValue, num) == 0;
}

bool pnBigInteger::operator<(const pnBigInteger& num) const
{
return BN_cmp(fValue, num.fValue) < 0;
Expand Down
4 changes: 2 additions & 2 deletions net/crypt/pnBigInteger.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class HSPLASMANET_EXPORT pnBigInteger
// Comparison
bool operator==(const pnBigInteger& num) const;
bool operator==(unsigned int num) const;
bool operator!=(const pnBigInteger& num) const;
bool operator!=(unsigned int num) const;
bool operator!=(const pnBigInteger& num) const { return !operator==(num); }
bool operator!=(unsigned int num) const { return !operator==(num); }
bool operator<(const pnBigInteger& num) const;
bool operator<(unsigned int num) const;
bool operator>(const pnBigInteger& num) const;
Expand Down
Loading