summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/FileCache.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2013-08-01 16:37:49 +0200
committerJose <jose@zeroc.com>2013-08-01 16:37:49 +0200
commit4997cc8890ac06065ddd3004c194a7ad33573cce (patch)
tree93606f4272ab671f0aafc5a76e3913a5d6302e26 /cpp/src/IceGrid/FileCache.cpp
parentFixed (ICE-4665) - node processors returns 0 (diff)
downloadice-4997cc8890ac06065ddd3004c194a7ad33573cce.tar.bz2
ice-4997cc8890ac06065ddd3004c194a7ad33573cce.tar.xz
ice-4997cc8890ac06065ddd3004c194a7ad33573cce.zip
Fixed ICE-5359 - Review IceGrid::FileCache::read
Diffstat (limited to 'cpp/src/IceGrid/FileCache.cpp')
-rw-r--r--cpp/src/IceGrid/FileCache.cpp10
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();
}