summaryrefslogtreecommitdiffstats
path: root/courgette
diff options
context:
space:
mode:
authordgarrett@chromium.org <dgarrett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-30 00:45:26 +0000
committerdgarrett@chromium.org <dgarrett@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-30 00:45:26 +0000
commit7b6c14509758a6c31869a52ad2d90cf8f871a00b (patch)
tree4aefad35f534f1e4b233dd9f3f74c4c7f7739a6c /courgette
parenta80c89fd7d2f4dd84824f2826a333af7476f6c9c (diff)
downloadchromium_src-7b6c14509758a6c31869a52ad2d90cf8f871a00b.zip
chromium_src-7b6c14509758a6c31869a52ad2d90cf8f871a00b.tar.gz
chromium_src-7b6c14509758a6c31869a52ad2d90cf8f871a00b.tar.bz2
Try a different library for Crc32.
BUG= TEST= Review URL: http://codereview.chromium.org/8569018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112083 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette')
-rw-r--r--courgette/crc.cc26
1 files changed, 19 insertions, 7 deletions
diff --git a/courgette/crc.cc b/courgette/crc.cc
index 02b7fe9..6af7a18 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 OS_CHROMEOS
+# 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 OS_CHROMEOS
+ // 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