summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-04-15 20:39:00 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-04-15 20:39:00 +0100
commit230314ac71a055458d9bff4fae744b8e25f7ada2 (patch)
tree35bcab18d57eda2c5f3665e287b06b2d8b7060cd /indra/llcommon
parent90800c84c4836d2eb0425ed09b7dd83e86a106db (diff)
parent12dadac44e9d5af8728e7bedab586683b2660cb4 (diff)
merge from viewer-trunk
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llapr.cpp11
-rw-r--r--indra/llcommon/llapr.h8
2 files changed, 9 insertions, 10 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;
}
diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h
index b05a222b33..08cf11e593 100644
--- a/indra/llcommon/llapr.h
+++ b/indra/llcommon/llapr.h
@@ -182,7 +182,7 @@ typedef LLAtomic32<U32> LLAtomicU32;
typedef LLAtomic32<S32> LLAtomicS32;
// File IO convenience functions.
-// Returns NULL if the file fails to openm sets *sizep to file size of not NULL
+// Returns NULL if the file fails to open, sets *sizep to file size if not NULL
// abbreviated flags
#define LL_APR_R (APR_READ) // "r"
#define LL_APR_W (APR_CREATE|APR_TRUNCATE|APR_WRITE) // "w"
@@ -200,7 +200,7 @@ typedef LLAtomic32<S32> LLAtomicS32;
// especially do not put some time-costly operations between open() and close().
// otherwise it might lock the APRFilePool.
//there are two different apr_pools the APRFile can use:
-// 1, a temperary pool passed to an APRFile function, which is used within this function and only once.
+// 1, a temporary pool passed to an APRFile function, which is used within this function and only once.
// 2, a global pool.
//
@@ -255,12 +255,12 @@ public:
// Returns bytes read/written, 0 if read/write fails:
static S32 readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL);
- static S32 writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL);
+ static S32 writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL); // offset<0 means append
//*******************************************************************************************************************************
};
/**
- * @brief Function which approprately logs error or remains quiet on
+ * @brief Function which appropriately logs error or remains quiet on
* APR_SUCCESS.
* @return Returns <code>true</code> if status is an error condition.
*/