Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Unified Diff: courgette/crc.cc

Issue 8763014: Use a different define to decide which CRC library to use. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/crc.cc
diff --git a/courgette/crc.cc b/courgette/crc.cc
index 02b7fe9386fa49f69188d60683d0fae43d2788e2..28a0f9c0d8f1191d575b28c50419d29a4eb44d57 100644
--- a/courgette/crc.cc
+++ b/courgette/crc.cc
@@ -1,22 +1,34 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Calculate Crc by calling CRC method in LZMA SDK
-
#include "courgette/crc.h"
+#ifdef COURGETTE_USE_CRC_LIB
+# include "zlib.h"
+#else
extern "C" {
-#include "third_party/lzma_sdk/7zCrc.h"
+# include "third_party/lzma_sdk/7zCrc.h"
}
+#endif
+
+#include "base/basictypes.h"
namespace courgette {
uint32 CalculateCrc(const uint8* buffer, size_t size) {
+ uint32 crc;
+
+#ifdef COURGETTE_USE_CRC_LIB
+ // Calculate Crc by calling CRC method in zlib
+ crc = crc32(0, buffer, size);
+#else
+ // Calculate Crc by calling CRC method in LZMA SDK
CrcGenerateTable();
- uint32 crc = 0xffffffffL;
- crc = ~CrcCalc(buffer, size);
- return crc;
+ crc = CrcCalc(buffer, size);
+#endif
+
+ return ~crc;
}
} // namespace
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698