Index: third_party/bigint/BigInteger.hh |
diff --git a/third_party/bigint/BigInteger.hh b/third_party/bigint/BigInteger.hh |
index cf6e91056f4519a87049993faaab57e2bfbd4177..b6570edfec0bbdc738adac318503699501d84c3e 100644 |
--- a/third_party/bigint/BigInteger.hh |
+++ b/third_party/bigint/BigInteger.hh |
@@ -1,3 +1,9 @@ |
+// Copyright 2014 PDFium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// Original code by Matt McCutchen, see the LICENSE file |
+ |
#ifndef BIGINTEGER_H |
#define BIGINTEGER_H |
@@ -157,14 +163,24 @@ inline BigInteger BigInteger::operator *(const BigInteger &x) const { |
return ans; |
} |
inline BigInteger BigInteger::operator /(const BigInteger &x) const { |
- if (x.isZero()) throw "BigInteger::operator /: division by zero"; |
+ if (x.isZero()) |
+#ifdef FOXIT_CHROME_BUILD |
+ abort(); |
+#else |
+ throw "BigInteger::operator /: division by zero"; |
+#endif |
BigInteger q, r; |
r = *this; |
r.divideWithRemainder(x, q); |
return q; |
} |
inline BigInteger BigInteger::operator %(const BigInteger &x) const { |
- if (x.isZero()) throw "BigInteger::operator %: division by zero"; |
+ if (x.isZero()) |
+#ifdef FOXIT_CHROME_BUILD |
+ abort(); |
+#else |
+ throw "BigInteger::operator %: division by zero"; |
+#endif |
BigInteger q, r; |
r = *this; |
r.divideWithRemainder(x, q); |
@@ -193,7 +209,12 @@ inline void BigInteger::operator *=(const BigInteger &x) { |
multiply(*this, x); |
} |
inline void BigInteger::operator /=(const BigInteger &x) { |
- if (x.isZero()) throw "BigInteger::operator /=: division by zero"; |
+ if (x.isZero()) |
+#ifdef FOXIT_CHROME_BUILD |
+ abort(); |
+#else |
+ throw "BigInteger::operator /=: division by zero"; |
+#endif |
/* The following technique is slightly faster than copying *this first |
* when x is large. */ |
BigInteger q; |
@@ -202,7 +223,12 @@ inline void BigInteger::operator /=(const BigInteger &x) { |
*this = q; |
} |
inline void BigInteger::operator %=(const BigInteger &x) { |
- if (x.isZero()) throw "BigInteger::operator %=: division by zero"; |
+ if (x.isZero()) |
+#ifdef FOXIT_CHROME_BUILD |
+ abort(); |
+#else |
+ throw "BigInteger::operator %=: division by zero"; |
+#endif |
BigInteger q; |
// Mods *this by x. Don't care about quotient left in q. |
divideWithRemainder(x, q); |