diff options
| author | Dan Engelbrecht <[email protected]> | 2023-11-14 16:52:15 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-11-14 16:52:15 +0100 |
| commit | 01aedfc1c984427e7bb133539190347809b67e0e (patch) | |
| tree | a423a425d44de021a05cd8db91f832ceac0fae6e | |
| parent | 0.2.33-pre0 (diff) | |
| download | zen-01aedfc1c984427e7bb133539190347809b67e0e.tar.xz zen-01aedfc1c984427e7bb133539190347809b67e0e.zip | |
fix comparison operator for cache disk location (#534)
* proper != operator for DiskLocation
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | src/zenserver/cache/cachedisklayer.h | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a46f6d7fa..d36aaf3f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## - Bugfix: Fix index out of bounds in CacheBucket::CompactState +- Bugfix: Implement != operator for DiskLocation to avoid comparing uninitialized data - Improvement: Shrink data structures to fit after CacheBucket::CompactReferences ## 0.2.32 diff --git a/src/zenserver/cache/cachedisklayer.h b/src/zenserver/cache/cachedisklayer.h index d46d629e4..d9884a7bc 100644 --- a/src/zenserver/cache/cachedisklayer.h +++ b/src/zenserver/cache/cachedisklayer.h @@ -34,7 +34,18 @@ struct DiskLocation this->Location.BlockLocation = BlockStoreDiskLocation(Location, PayloadAlignment); } - inline bool operator!=(const DiskLocation& Rhs) const { return memcmp(&Location, &Rhs.Location, sizeof(Location)) != 0; } + inline bool operator!=(const DiskLocation& Rhs) const + { + if (Flags != Rhs.Flags) + { + return true; + } + if (Flags & kStandaloneFile) + { + return Location.StandaloneSize != Rhs.Location.StandaloneSize; + } + return Location.BlockLocation != Rhs.Location.BlockLocation; + } inline BlockStoreLocation GetBlockLocation(uint64_t PayloadAlignment) const { |