fix bugs parsing json tokens
This commit is contained in:
parent
271fe8b909
commit
c27ea9ba13
2 changed files with 11 additions and 5 deletions
|
|
@ -119,9 +119,12 @@ namespace fc
|
||||||
in.get();
|
in.get();
|
||||||
return token.str();
|
return token.str();
|
||||||
default:
|
default:
|
||||||
std::cerr<<c;
|
if( isalnum( c ) )
|
||||||
|
{
|
||||||
token << c;
|
token << c;
|
||||||
in.get();
|
in.get();
|
||||||
|
}
|
||||||
|
else return token.str();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return token.str();
|
return token.str();
|
||||||
|
|
@ -265,7 +268,8 @@ namespace fc
|
||||||
template<typename T>
|
template<typename T>
|
||||||
variant token_from_stream( T& in )
|
variant token_from_stream( T& in )
|
||||||
{
|
{
|
||||||
fc::stringstream ss;
|
std::stringstream ss;
|
||||||
|
ss.exceptions( std::ifstream::badbit );
|
||||||
bool parsed_unexpected_character = false;
|
bool parsed_unexpected_character = false;
|
||||||
bool received_eof = false;
|
bool received_eof = false;
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,13 @@ namespace fc {
|
||||||
public:
|
public:
|
||||||
impl( fc::string&s )
|
impl( fc::string&s )
|
||||||
:ss( s )
|
:ss( s )
|
||||||
{ }
|
{ ss.exceptions( std::stringstream::badbit | std::stringstream::eofbit ); }
|
||||||
|
|
||||||
impl( const fc::string&s )
|
impl( const fc::string&s )
|
||||||
:ss( s )
|
:ss( s )
|
||||||
{ }
|
{ ss.exceptions( std::stringstream::badbit | std::stringstream::eofbit ); }
|
||||||
impl(){}
|
|
||||||
|
impl(){ss.exceptions( std::stringstream::badbit | std::stringstream::eofbit ); }
|
||||||
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue