readsome instead of read
This commit is contained in:
parent
f4dec89dc3
commit
84318f8d28
1 changed files with 6 additions and 10 deletions
|
|
@ -68,17 +68,13 @@ namespace fc {
|
||||||
|
|
||||||
size_t ifstream::readsome( char* buf, size_t len ) {
|
size_t ifstream::readsome( char* buf, size_t len ) {
|
||||||
auto s = size_t(my->ifs.readsome( buf, len ));
|
auto s = size_t(my->ifs.readsome( buf, len ));
|
||||||
if( s <= 0 ) {
|
if( s <= 0 )
|
||||||
try
|
{
|
||||||
|
read( buf, 1 );
|
||||||
|
s = 1;
|
||||||
|
if (len > 1)
|
||||||
{
|
{
|
||||||
read( buf, len );
|
s += size_t(my->ifs.readsome( &buf[1], len - 1));
|
||||||
s = len;
|
|
||||||
}
|
|
||||||
catch (const fc::eof_exception& eof)
|
|
||||||
{
|
|
||||||
s = my->ifs.gcount();
|
|
||||||
if (s == 0)
|
|
||||||
throw eof;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue