summaryrefslogtreecommitdiffstats
path: root/base/bzip2_error_handler.cc
diff options
context:
space:
mode:
authordeanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-30 16:15:12 +0000
committerdeanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-30 16:15:12 +0000
commitf23423a1245dffc2a368708fafd2867d2cf3e0f8 (patch)
treede905c0589e2d13dc6ea5c1338ed24f79d432417 /base/bzip2_error_handler.cc
parent8e674e456d8fa2a7e79ee4cb4f200c0399036fb4 (diff)
downloadchromium_src-f23423a1245dffc2a368708fafd2867d2cf3e0f8.zip
chromium_src-f23423a1245dffc2a368708fafd2867d2cf3e0f8.tar.gz
chromium_src-f23423a1245dffc2a368708fafd2867d2cf3e0f8.tar.bz2
Use own our bzip2 error handler instead of the default which prints error messages to STDERR and calls exit(1). This is better, since we will now crash instead of exiting. This also removes some unnecessary code and error strings from bzip2.
BUG=1289861 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/bzip2_error_handler.cc')
-rw-r--r--base/bzip2_error_handler.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/base/bzip2_error_handler.cc b/base/bzip2_error_handler.cc
new file mode 100644
index 0000000..2774627
--- /dev/null
+++ b/base/bzip2_error_handler.cc
@@ -0,0 +1,36 @@
+// Copyright 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "base/logging.h"
+
+// We define BZ_NO_STDIO in third_party/bzip2 to remove its internal STDERR
+// error reporting. This requires us to export our own error handler.
+void bz_internal_error(int errcode) {
+ CHECK(false) << "bzip2 internal error: " << errcode;
+}