|
17 | 17 | #include <sstream> |
18 | 18 | #include <memory> |
19 | 19 | #include <set> |
20 | | -#include <stdexcept> |
21 | 20 |
|
22 | 21 | #if defined(_MSC_VER) && _MSC_VER < 1500 // VC++ 8.0 and below |
23 | 22 | #define snprintf _snprintf |
@@ -148,7 +147,7 @@ bool Reader::readValue() { |
148 | 147 | // But this deprecated class has a security problem: Bad input can |
149 | 148 | // cause a seg-fault. This seems like a fair, binary-compatible way |
150 | 149 | // to prevent the problem. |
151 | | - if (stackDepth_g >= stackLimit_g) throw std::runtime_error("Exceeded stackLimit in readValue()."); |
| 150 | + if (stackDepth_g >= stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue()."); |
152 | 151 | ++stackDepth_g; |
153 | 152 |
|
154 | 153 | Token token; |
@@ -1107,7 +1106,7 @@ bool OurReader::parse(const char* beginDoc, |
1107 | 1106 | } |
1108 | 1107 |
|
1109 | 1108 | bool OurReader::readValue() { |
1110 | | - if (stackDepth_ >= features_.stackLimit_) throw std::runtime_error("Exceeded stackLimit in readValue()."); |
| 1109 | + if (stackDepth_ >= features_.stackLimit_) throwRuntimeError("Exceeded stackLimit in readValue()."); |
1111 | 1110 | ++stackDepth_; |
1112 | 1111 | Token token; |
1113 | 1112 | skipCommentTokens(token); |
@@ -1431,7 +1430,7 @@ bool OurReader::readObject(Token& tokenStart) { |
1431 | 1430 | return addErrorAndRecover( |
1432 | 1431 | "Missing ':' after object member name", colon, tokenObjectEnd); |
1433 | 1432 | } |
1434 | | - if (name.length() >= (1U<<30)) throw std::runtime_error("keylength >= 2^30"); |
| 1433 | + if (name.length() >= (1U<<30)) throwRuntimeError("keylength >= 2^30"); |
1435 | 1434 | if (features_.rejectDupKeys_ && currentValue().isMember(name)) { |
1436 | 1435 | std::string msg = "Duplicate key: '" + name + "'"; |
1437 | 1436 | return addErrorAndRecover( |
@@ -1994,7 +1993,7 @@ std::istream& operator>>(std::istream& sin, Value& root) { |
1994 | 1993 | "Error from reader: %s", |
1995 | 1994 | errs.c_str()); |
1996 | 1995 |
|
1997 | | - throw std::runtime_error("reader error"); |
| 1996 | + throwRuntimeError("reader error"); |
1998 | 1997 | } |
1999 | 1998 | return sin; |
2000 | 1999 | } |
|
0 commit comments