reduce number of changes

This commit is contained in:
Alfredo 2018-10-09 16:41:51 -03:00
parent 67d2eb9b63
commit 53d3f729ea
2 changed files with 9 additions and 1 deletions

View file

@ -20,9 +20,11 @@ namespace fc
enum parse_type enum parse_type
{ {
legacy_parser = 0, legacy_parser = 0,
#ifdef WITH_EXOTIC_JSON_PARSERS
strict_parser = 1, strict_parser = 1,
relaxed_parser = 2, relaxed_parser = 2,
legacy_parser_with_string_doubles = 3, legacy_parser_with_string_doubles = 3,
#endif
broken_nul_parser = 4 broken_nul_parser = 4
}; };
enum output_formatting enum output_formatting

View file

@ -328,7 +328,11 @@ namespace fc
if (str == "-." || str == "." || str == "-") // check the obviously wrong things we could have encountered if (str == "-." || str == "." || str == "-") // check the obviously wrong things we could have encountered
FC_THROW_EXCEPTION(parse_error_exception, "Can't parse token \"${token}\" as a JSON numeric constant", ("token", str)); FC_THROW_EXCEPTION(parse_error_exception, "Can't parse token \"${token}\" as a JSON numeric constant", ("token", str));
if( dot ) if( dot )
return parser_type == json::legacy_parser_with_string_doubles ? variant(str) : variant(to_double(str)); return
#ifdef WITH_EXOTIC_JSON_PARSERS
parser_type == json::legacy_parser_with_string_doubles ? variant(str) :
#endif
variant(to_double(str));
if( neg ) if( neg )
return to_int64(str); return to_int64(str);
return to_uint64(str); return to_uint64(str);
@ -760,12 +764,14 @@ namespace fc
{ {
case legacy_parser: case legacy_parser:
return variant_from_stream<fc::buffered_istream, legacy_parser>( in, max_depth ); return variant_from_stream<fc::buffered_istream, legacy_parser>( in, max_depth );
#ifdef WITH_EXOTIC_JSON_PARSERS
case legacy_parser_with_string_doubles: case legacy_parser_with_string_doubles:
return variant_from_stream<fc::buffered_istream, legacy_parser_with_string_doubles>( in, max_depth ); return variant_from_stream<fc::buffered_istream, legacy_parser_with_string_doubles>( in, max_depth );
case strict_parser: case strict_parser:
return json_relaxed::variant_from_stream<buffered_istream, true>( in, max_depth ); return json_relaxed::variant_from_stream<buffered_istream, true>( in, max_depth );
case relaxed_parser: case relaxed_parser:
return json_relaxed::variant_from_stream<buffered_istream, false>( in, max_depth ); return json_relaxed::variant_from_stream<buffered_istream, false>( in, max_depth );
#endif
case broken_nul_parser: case broken_nul_parser:
return variant_from_stream<fc::buffered_istream, broken_nul_parser>( in, max_depth ); return variant_from_stream<fc::buffered_istream, broken_nul_parser>( in, max_depth );
default: default: