From 67d2eb9b636a313464065d49c300e552fe83d7c2 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Mon, 8 Oct 2018 19:35:56 -0300 Subject: [PATCH 1/2] remove WITH_EXOTIC_JSON_PARSERS --- include/fc/io/json.hpp | 4 ---- src/io/json.cpp | 8 +------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/include/fc/io/json.hpp b/include/fc/io/json.hpp index 1980f74..2d1f306 100644 --- a/include/fc/io/json.hpp +++ b/include/fc/io/json.hpp @@ -20,19 +20,15 @@ namespace fc enum parse_type { legacy_parser = 0, -#ifdef WITH_EXOTIC_JSON_PARSERS strict_parser = 1, relaxed_parser = 2, legacy_parser_with_string_doubles = 3, -#endif broken_nul_parser = 4 }; enum output_formatting { stringify_large_ints_and_doubles = 0, -#ifdef WITH_EXOTIC_JSON_PARSERS legacy_generator = 1 -#endif }; static ostream& to_stream( ostream& out, const fc::string& ); diff --git a/src/io/json.cpp b/src/io/json.cpp index b9afc75..2af0ab7 100644 --- a/src/io/json.cpp +++ b/src/io/json.cpp @@ -328,11 +328,7 @@ namespace fc 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)); if( dot ) - return -#ifdef WITH_EXOTIC_JSON_PARSERS - parser_type == json::legacy_parser_with_string_doubles ? variant(str) : -#endif - variant(to_double(str)); + return parser_type == json::legacy_parser_with_string_doubles ? variant(str) : variant(to_double(str)); if( neg ) return to_int64(str); return to_uint64(str); @@ -764,14 +760,12 @@ namespace fc { case legacy_parser: return variant_from_stream( in, max_depth ); -#ifdef WITH_EXOTIC_JSON_PARSERS case legacy_parser_with_string_doubles: return variant_from_stream( in, max_depth ); case strict_parser: return json_relaxed::variant_from_stream( in, max_depth ); case relaxed_parser: return json_relaxed::variant_from_stream( in, max_depth ); -#endif case broken_nul_parser: return variant_from_stream( in, max_depth ); default: From 53d3f729eaaf6a16091be6a54a9baa2402848933 Mon Sep 17 00:00:00 2001 From: Alfredo Date: Tue, 9 Oct 2018 16:41:51 -0300 Subject: [PATCH 2/2] reduce number of changes --- include/fc/io/json.hpp | 2 ++ src/io/json.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/fc/io/json.hpp b/include/fc/io/json.hpp index 2d1f306..f07124b 100644 --- a/include/fc/io/json.hpp +++ b/include/fc/io/json.hpp @@ -20,9 +20,11 @@ namespace fc enum parse_type { legacy_parser = 0, +#ifdef WITH_EXOTIC_JSON_PARSERS strict_parser = 1, relaxed_parser = 2, legacy_parser_with_string_doubles = 3, +#endif broken_nul_parser = 4 }; enum output_formatting diff --git a/src/io/json.cpp b/src/io/json.cpp index 2af0ab7..b9afc75 100644 --- a/src/io/json.cpp +++ b/src/io/json.cpp @@ -328,7 +328,11 @@ namespace fc 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)); 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 ) return to_int64(str); return to_uint64(str); @@ -760,12 +764,14 @@ namespace fc { case legacy_parser: return variant_from_stream( in, max_depth ); +#ifdef WITH_EXOTIC_JSON_PARSERS case legacy_parser_with_string_doubles: return variant_from_stream( in, max_depth ); case strict_parser: return json_relaxed::variant_from_stream( in, max_depth ); case relaxed_parser: return json_relaxed::variant_from_stream( in, max_depth ); +#endif case broken_nul_parser: return variant_from_stream( in, max_depth ); default: