From 84318f8d2856b69554b68b44608df502c211287e Mon Sep 17 00:00:00 2001 From: John Jones Date: Thu, 15 Nov 2018 13:46:07 -0800 Subject: [PATCH] readsome instead of read --- src/io/fstream.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/io/fstream.cpp b/src/io/fstream.cpp index e42dbe2..5ebf790 100644 --- a/src/io/fstream.cpp +++ b/src/io/fstream.cpp @@ -68,17 +68,13 @@ namespace fc { size_t ifstream::readsome( char* buf, size_t len ) { auto s = size_t(my->ifs.readsome( buf, len )); - if( s <= 0 ) { - try + if( s <= 0 ) + { + read( buf, 1 ); + s = 1; + if (len > 1) { - read( buf, len ); - s = len; - } - catch (const fc::eof_exception& eof) - { - s = my->ifs.gcount(); - if (s == 0) - throw eof; + s += size_t(my->ifs.readsome( &buf[1], len - 1)); } } return s;