diff options
Diffstat (limited to '')
-rw-r--r-- | CPP/Common/XzCrc64Reg.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/CPP/Common/XzCrc64Reg.cpp b/CPP/Common/XzCrc64Reg.cpp index 33b5249..e9e67ef 100644 --- a/CPP/Common/XzCrc64Reg.cpp +++ b/CPP/Common/XzCrc64Reg.cpp | |||
@@ -9,34 +9,31 @@ | |||
9 | 9 | ||
10 | #include "../7zip/Common/RegisterCodec.h" | 10 | #include "../7zip/Common/RegisterCodec.h" |
11 | 11 | ||
12 | class CXzCrc64Hasher: | 12 | Z7_CLASS_IMP_COM_1( |
13 | public IHasher, | 13 | CXzCrc64Hasher |
14 | public CMyUnknownImp | 14 | , IHasher |
15 | { | 15 | ) |
16 | UInt64 _crc; | 16 | UInt64 _crc; |
17 | Byte mtDummy[1 << 7]; | ||
18 | |||
19 | public: | 17 | public: |
20 | CXzCrc64Hasher(): _crc(CRC64_INIT_VAL) {} | 18 | Byte _mtDummy[1 << 7]; // it's public to eliminate clang warning: unused private field |
21 | 19 | ||
22 | MY_UNKNOWN_IMP1(IHasher) | 20 | CXzCrc64Hasher(): _crc(CRC64_INIT_VAL) {} |
23 | INTERFACE_IHasher(;) | ||
24 | }; | 21 | }; |
25 | 22 | ||
26 | STDMETHODIMP_(void) CXzCrc64Hasher::Init() throw() | 23 | Z7_COM7F_IMF2(void, CXzCrc64Hasher::Init()) |
27 | { | 24 | { |
28 | _crc = CRC64_INIT_VAL; | 25 | _crc = CRC64_INIT_VAL; |
29 | } | 26 | } |
30 | 27 | ||
31 | STDMETHODIMP_(void) CXzCrc64Hasher::Update(const void *data, UInt32 size) throw() | 28 | Z7_COM7F_IMF2(void, CXzCrc64Hasher::Update(const void *data, UInt32 size)) |
32 | { | 29 | { |
33 | _crc = Crc64Update(_crc, data, size); | 30 | _crc = Crc64Update(_crc, data, size); |
34 | } | 31 | } |
35 | 32 | ||
36 | STDMETHODIMP_(void) CXzCrc64Hasher::Final(Byte *digest) throw() | 33 | Z7_COM7F_IMF2(void, CXzCrc64Hasher::Final(Byte *digest)) |
37 | { | 34 | { |
38 | UInt64 val = CRC64_GET_DIGEST(_crc); | 35 | const UInt64 val = CRC64_GET_DIGEST(_crc); |
39 | SetUi64(digest, val); | 36 | SetUi64(digest, val) |
40 | } | 37 | } |
41 | 38 | ||
42 | REGISTER_HASHER(CXzCrc64Hasher, 0x4, "CRC64", 8) | 39 | REGISTER_HASHER(CXzCrc64Hasher, 0x4, "CRC64", 8) |