diff options
Diffstat (limited to '')
-rw-r--r-- | jsoncpp-src-0.5.0/src/lib_json/json_reader.cpp | 6 | ||||
-rw-r--r-- | jsoncpp-src-0.5.0/src/lib_json/json_value.cpp | 27 |
2 files changed, 21 insertions, 12 deletions
diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_reader.cpp b/jsoncpp-src-0.5.0/src/lib_json/json_reader.cpp index 4eb2d11fd..7c94e612e 100644 --- a/jsoncpp-src-0.5.0/src/lib_json/json_reader.cpp +++ b/jsoncpp-src-0.5.0/src/lib_json/json_reader.cpp @@ -871,13 +871,13 @@ Reader::getFormatedErrorMessages() const return formattedMessage; } - +#define JSON_ASSERT( condition ) assert( condition ); std::istream& operator>>( std::istream &sin, Value &root ) { Json::Reader reader; bool ok = reader.parse(sin, root, true); - //JSON_ASSERT( ok ); - if (!ok) throw std::runtime_error(reader.getFormatedErrorMessages()); + JSON_ASSERT( ok ); + //if (!ok) throw std::runtime_error(reader.getFormatedErrorMessages()); return sin; } diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_value.cpp b/jsoncpp-src-0.5.0/src/lib_json/json_value.cpp index 573205f13..89271cd00 100644 --- a/jsoncpp-src-0.5.0/src/lib_json/json_value.cpp +++ b/jsoncpp-src-0.5.0/src/lib_json/json_value.cpp @@ -153,7 +153,8 @@ Value::CommentInfo::setComment( const char *text ) if ( comment_ ) valueAllocator()->releaseStringValue( comment_ ); JSON_ASSERT( text ); - JSON_ASSERT_MESSAGE( text[0]=='\0' || text[0]=='/', "Comments must start with /"); + //JSON_ASSERT_MESSAGE( text[0]=='\0' || text[0]=='/', "Comments must start with /"); + JSON_ASSERT( text[0]=='\0' || text[0]=='/' ); // It seems that /**/ style comments are acceptable as well. comment_ = valueAllocator()->duplicateStringValue( text ); } @@ -697,7 +698,8 @@ Value::asString() const case realValue: case arrayValue: case objectValue: - JSON_ASSERT_MESSAGE( false, "Type is not convertible to string" ); + //JSON_ASSERT_MESSAGE( false, "Type is not convertible to string" ); + JSON_ASSERT( false ); default: JSON_ASSERT_UNREACHABLE; } @@ -722,17 +724,20 @@ Value::asInt() const case intValue: return value_.int_; case uintValue: - JSON_ASSERT_MESSAGE( value_.uint_ < (unsigned)maxInt, "integer out of signed integer range" ); + //JSON_ASSERT_MESSAGE( value_.uint_ < (unsigned)maxInt, "integer out of signed integer range" ); + JSON_ASSERT( value_.uint_ < (unsigned)maxInt ); return value_.uint_; case realValue: - JSON_ASSERT_MESSAGE( value_.real_ >= minInt && value_.real_ <= maxInt, "Real out of signed integer range" ); + //JSON_ASSERT_MESSAGE( value_.real_ >= minInt && value_.real_ <= maxInt, "Real out of signed integer range" ); + JSON_ASSERT( value_.real_ >= minInt && value_.real_ <= maxInt ); return Int( value_.real_ ); case booleanValue: return value_.bool_ ? 1 : 0; case stringValue: case arrayValue: case objectValue: - JSON_ASSERT_MESSAGE( false, "Type is not convertible to int" ); + //JSON_ASSERT_MESSAGE( false, "Type is not convertible to int" ); + JSON_ASSERT( false ); default: JSON_ASSERT_UNREACHABLE; } @@ -747,19 +752,22 @@ Value::asUInt() const case nullValue: return 0; case intValue: - JSON_ASSERT_MESSAGE( value_.int_ >= 0, "Negative integer can not be converted to unsigned integer" ); + //JSON_ASSERT_MESSAGE( value_.int_ >= 0, "Negative integer can not be converted to unsigned integer" ); + JSON_ASSERT( value_.int_ >= 0 ); return value_.int_; case uintValue: return value_.uint_; case realValue: - JSON_ASSERT_MESSAGE( value_.real_ >= 0 && value_.real_ <= maxUInt, "Real out of unsigned integer range" ); + //JSON_ASSERT_MESSAGE( value_.real_ >= 0 && value_.real_ <= maxUInt, "Real out of unsigned integer range" ); + JSON_ASSERT( value_.real_ >= 0 && value_.real_ <= maxUInt ); return UInt( value_.real_ ); case booleanValue: return value_.bool_ ? 1 : 0; case stringValue: case arrayValue: case objectValue: - JSON_ASSERT_MESSAGE( false, "Type is not convertible to uint" ); + //JSON_ASSERT_MESSAGE( false, "Type is not convertible to uint" ); + JSON_ASSERT( false ); default: JSON_ASSERT_UNREACHABLE; } @@ -784,7 +792,8 @@ Value::asDouble() const case stringValue: case arrayValue: case objectValue: - JSON_ASSERT_MESSAGE( false, "Type is not convertible to double" ); + //JSON_ASSERT_MESSAGE( false, "Type is not convertible to double" ); + JSON_ASSERT( false ); default: JSON_ASSERT_UNREACHABLE; } |