diff options
| author | Dan Engelbrecht <[email protected]> | 2022-03-23 23:45:06 +0100 |
|---|---|---|
| committer | Dan Engelbrecht <[email protected]> | 2022-03-31 11:29:27 +0200 |
| commit | 7255a5652f5e4788f13a1d6bbcbd53c7f93f90d8 (patch) | |
| tree | aeabdf91c72dbd61f8b55096cc1e42e1337c2cc6 /zenstore/compactcas.cpp | |
| parent | Rename FormatHex to ToHex (diff) | |
| download | zen-7255a5652f5e4788f13a1d6bbcbd53c7f93f90d8.tar.xz zen-7255a5652f5e4788f13a1d6bbcbd53c7f93f90d8.zip | |
clean up number -> hex -> number code
Diffstat (limited to 'zenstore/compactcas.cpp')
| -rw-r--r-- | zenstore/compactcas.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/zenstore/compactcas.cpp b/zenstore/compactcas.cpp index 65b9bc969..51c515e8d 100644 --- a/zenstore/compactcas.cpp +++ b/zenstore/compactcas.cpp @@ -27,15 +27,15 @@ namespace zen { struct CasDiskIndexHeader { - static constexpr uint32_t ExpectedMagic = 0x75696478; // 'uidx'; - static constexpr uint32_t CurrentVersion = 1; - uint32_t Magic = ExpectedMagic; - uint32_t Version = CurrentVersion; - uint32_t PayloadAlignement; - uint32_t Reserved0 = 0; - uint64_t EntryCount; - uint32_t Reserved1 = 0; - uint32_t Reserved2 = 0; + static constexpr uint32_t ExpectedMagic = 0x75696478; // 'uidx'; + static constexpr uint32_t CurrentVersion = 1; + uint32_t Magic = ExpectedMagic; + uint32_t Version = CurrentVersion; + uint32_t PayloadAlignement = 0; + uint32_t Reserved0 = 0; + uint64_t EntryCount = 0; + uint32_t Reserved1 = 0; + uint32_t Reserved2 = 0; }; static_assert(sizeof(CasDiskIndexHeader) == 32); @@ -46,7 +46,7 @@ namespace { ExtendablePathBuilder<256> Path; char BlockHexString[9]; - ToHex(BlockIndex, BlockHexString); + ToHexNumber(BlockIndex, BlockHexString); Path.Append(BlocksBasePath); Path.AppendSeparator(); @@ -1119,7 +1119,7 @@ CasContainerStrategy::OpenContainer(bool IsNewStore) } std::string FileName = Path.stem().string(); uint32_t BlockIndex; - bool OK = ParseHex(FileName, BlockIndex); + bool OK = ParseHexNumber(FileName, BlockIndex); if (!OK) { continue; @@ -1219,36 +1219,36 @@ TEST_CASE("compactcas.hex") { uint32_t Value; std::string HexString; - CHECK(!ParseHex("", Value)); + CHECK(!ParseHexNumber("", Value)); char Hex[9]; - ToHex(0, Hex); + ToHexNumber(0, Hex); HexString = std::string(Hex); - CHECK(ParseHex(HexString, Value)); + CHECK(ParseHexNumber(HexString, Value)); CHECK(Value == 0); - ToHex(std::numeric_limits<std::uint32_t>::max(), Hex); + ToHexNumber(std::numeric_limits<std::uint32_t>::max(), Hex); HexString = std::string(Hex); CHECK(HexString == "ffffffff"); - CHECK(ParseHex(HexString, Value)); + CHECK(ParseHexNumber(HexString, Value)); CHECK(Value == std::numeric_limits<std::uint32_t>::max()); - ToHex(0xadf14711, Hex); + ToHexNumber(0xadf14711, Hex); HexString = std::string(Hex); CHECK(HexString == "adf14711"); - CHECK(ParseHex(HexString, Value)); + CHECK(ParseHexNumber(HexString, Value)); CHECK(Value == 0xadf14711); - ToHex(0x80000000, Hex); + ToHexNumber(0x80000000, Hex); HexString = std::string(Hex); CHECK(HexString == "80000000"); - CHECK(ParseHex(HexString, Value)); + CHECK(ParseHexNumber(HexString, Value)); CHECK(Value == 0x80000000); - ToHex(0x718293a4, Hex); + ToHexNumber(0x718293a4, Hex); HexString = std::string(Hex); CHECK(HexString == "718293a4"); - CHECK(ParseHex(HexString, Value)); + CHECK(ParseHexNumber(HexString, Value)); CHECK(Value == 0x718293a4); } |