OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Calculate Crc by calling CRC method in LZMA SDK | 5 // Calculate Crc by calling CRC method in LZMA SDK |
6 | 6 |
7 #include "courgette/crc.h" | 7 #include "courgette/crc.h" |
8 | 8 |
9 extern "C" { | 9 extern "C" { |
10 #include "third_party/lzma_sdk/7zCrc.h" | 10 #include "third_party/lzma_sdk/C/7zCrc.h" |
11 } | 11 } |
12 | 12 |
13 namespace courgette { | 13 namespace courgette { |
14 | 14 |
15 uint32 CalculateCrc(const uint8* buffer, size_t size) { | 15 uint32 CalculateCrc(const uint8* buffer, size_t size) { |
16 CrcGenerateTable(); | 16 CrcGenerateTable(); |
17 uint32 crc = 0xffffffffL; | 17 uint32 crc = 0xffffffffL; |
18 crc = ~CrcCalc(buffer, size); | 18 crc = ~CrcCalc(buffer, size); |
19 return crc; | 19 return crc; |
20 } | 20 } |
21 | 21 |
22 } // namespace | 22 } // namespace |
OLD | NEW |