diff options
Diffstat (limited to 'cpp/src/IceGrid/FileCache.cpp')
-rw-r--r-- | cpp/src/IceGrid/FileCache.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/cpp/src/IceGrid/FileCache.cpp b/cpp/src/IceGrid/FileCache.cpp index 1fb979fc4ef..f14e1b30349 100644 --- a/cpp/src/IceGrid/FileCache.cpp +++ b/cpp/src/IceGrid/FileCache.cpp @@ -191,15 +191,17 @@ FileCache::read(const string& file, Ice::Long offset, int size, Ice::Long& newOf totalSize += lineSize; lines.push_back(line); + // - // Some eofbit cases will also set failbit. So first - // check eof. + // If there was a partial read update the offset using the current line size, + // otherwise we have read a new complete line and we can use tellg to update + // the offset. // - if(is.eof()) + if(!is.good()) { newOffset += line.size(); } - else if(!is.fail()) + else { newOffset = is.tellg(); } |