diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-04-15 18:00:00 +0100 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-04-15 18:00:00 +0100 |
commit | 1c638961543909e897bc343d260f300202687723 (patch) | |
tree | de1ff190db4916bbbb77470f3a09a7a6040d2afa /indra/llcommon/llapr.cpp | |
parent | fae92a2df852992216eb24418a1dd0b676696bee (diff) |
Supporting 'read from the end' doesn't make sense (to me), unlike 'write
from the end'.
Also, more comments.
Also, try to avoid a seek when offset==0 in read.
To be reviewed by Bao.
(transplanted from 60eb013221a83ff76054ab7dcb1d07c108f51a9d)
Diffstat (limited to 'indra/llcommon/llapr.cpp')
-rw-r--r-- | indra/llcommon/llapr.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index ed70b1d9f2..7330b00bcf 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -543,14 +543,13 @@ S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nb return 0; } - S32 off; - if (offset < 0) - off = LLAPRFile::seek(file_handle, APR_END, 0); - else - off = LLAPRFile::seek(file_handle, APR_SET, offset); + llassert(offset >= 0); + + if (offset > 0) + offset = LLAPRFile::seek(file_handle, APR_SET, offset); apr_size_t bytes_read; - if (off < 0) + if (offset < 0) { bytes_read = 0; } |