From c27ea9ba134ecf2a9166c3b222b733d7f1087a76 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Thu, 15 May 2014 13:52:21 -0400 Subject: [PATCH] fix bugs parsing json tokens --- src/io/json.cpp | 8 ++++++-- src/io/sstream.cpp | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/io/json.cpp b/src/io/json.cpp index 6d62b91..29c75ad 100644 --- a/src/io/json.cpp +++ b/src/io/json.cpp @@ -119,9 +119,12 @@ namespace fc in.get(); return token.str(); default: - std::cerr< variant token_from_stream( T& in ) { - fc::stringstream ss; + std::stringstream ss; + ss.exceptions( std::ifstream::badbit ); bool parsed_unexpected_character = false; bool received_eof = false; try diff --git a/src/io/sstream.cpp b/src/io/sstream.cpp index 1534f08..28a5aac 100644 --- a/src/io/sstream.cpp +++ b/src/io/sstream.cpp @@ -9,11 +9,13 @@ namespace fc { public: impl( fc::string&s ) :ss( s ) - { } + { ss.exceptions( std::stringstream::badbit | std::stringstream::eofbit ); } + impl( const fc::string&s ) :ss( s ) - { } - impl(){} + { ss.exceptions( std::stringstream::badbit | std::stringstream::eofbit ); } + + impl(){ss.exceptions( std::stringstream::badbit | std::stringstream::eofbit ); } std::stringstream ss; };