diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index db06b6952189c0063a1601ae50d38a26878c18bd..e2184eaec526bb30d16df1bf634d20693ccaa777 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -332,7 +332,7 @@ apr_status_t LLAPRFile::close() return ret ; } -apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool, apr_off_t* sizep) +apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool, S32* sizep) { apr_status_t s ; @@ -355,12 +355,12 @@ apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, LLV } else if (sizep) { - apr_off_t file_size = 0; + S32 file_size = 0; apr_off_t offset = 0; if (apr_file_seek(mFile, APR_END, &offset) == APR_SUCCESS) { - llassert_always(offset <= std::numeric_limits<apr_off_t>::max()); - file_size = (apr_off_t)offset; + llassert_always(offset <= 0x7fffffff); + file_size = (S32)offset; offset = 0; apr_file_seek(mFile, APR_SET, &offset); } @@ -398,7 +398,7 @@ apr_status_t LLAPRFile::open(const std::string& filename, apr_int32_t flags, BOO } // File I/O -apr_size_t LLAPRFile::read(void *buf, apr_size_t nbytes) +S32 LLAPRFile::read(void *buf, S32 nbytes) { if(!mFile) { @@ -415,12 +415,12 @@ apr_size_t LLAPRFile::read(void *buf, apr_size_t nbytes) } else { - llassert_always(sz <= std::numeric_limits<apr_size_t>::max()); - return (apr_size_t)sz; + llassert_always(sz <= 0x7fffffff); + return (S32)sz; } } -apr_size_t LLAPRFile::write(const void *buf, apr_size_t nbytes) +S32 LLAPRFile::write(const void *buf, S32 nbytes) { if(!mFile) { @@ -437,12 +437,12 @@ apr_size_t LLAPRFile::write(const void *buf, apr_size_t nbytes) } else { - llassert_always(sz <= std::numeric_limits<apr_size_t>::max()); - return (apr_size_t)sz; + llassert_always(sz <= 0x7fffffff); + return (S32)sz; } } -apr_off_t LLAPRFile::seek(apr_seek_where_t where, apr_off_t offset) +S32 LLAPRFile::seek(apr_seek_where_t where, S32 offset) { return LLAPRFile::seek(mFile, where, offset) ; } @@ -486,7 +486,7 @@ apr_file_t* LLAPRFile::open(const std::string& filename, apr_pool_t* apr_pool, a } //static -apr_off_t LLAPRFile::seek(apr_file_t* file_handle, apr_seek_where_t where, apr_off_t offset) +S32 LLAPRFile::seek(apr_file_t* file_handle, apr_seek_where_t where, S32 offset) { if(!file_handle) { @@ -512,13 +512,13 @@ apr_off_t LLAPRFile::seek(apr_file_t* file_handle, apr_seek_where_t where, apr_o } else { - llassert_always(apr_offset <= std::numeric_limits<apr_off_t>::max()); - return apr_offset; + llassert_always(apr_offset <= 0x7fffffff); + return (S32)apr_offset; } } //static -apr_size_t LLAPRFile::readEx(const std::string& filename, void *buf, apr_off_t offset, apr_size_t nbytes, LLVolatileAPRPool* pool) +S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool) { //***************************************** LLAPRFilePoolScope scope(pool); @@ -551,18 +551,18 @@ apr_size_t LLAPRFile::readEx(const std::string& filename, void *buf, apr_off_t o } else { - llassert_always(bytes_read <= std::numeric_limits<apr_size_t>::max()); + llassert_always(bytes_read <= 0x7fffffff); } } //***************************************** close(file_handle) ; //***************************************** - return bytes_read; + return (S32)bytes_read; } //static -apr_size_t LLAPRFile::writeEx(const std::string& filename, void *buf, apr_off_t offset, apr_size_t nbytes, LLVolatileAPRPool* pool) +S32 LLAPRFile::writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool) { apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY; if (offset < 0) @@ -602,7 +602,7 @@ apr_size_t LLAPRFile::writeEx(const std::string& filename, void *buf, apr_off_t } else { - llassert_always(bytes_written <= std::numeric_limits<apr_size_t>::max()); + llassert_always(bytes_written <= 0x7fffffff); } } @@ -610,7 +610,7 @@ apr_size_t LLAPRFile::writeEx(const std::string& filename, void *buf, apr_off_t LLAPRFile::close(file_handle); //***************************************** - return (apr_size_t)bytes_written; + return (S32)bytes_written; } //static @@ -668,7 +668,7 @@ bool LLAPRFile::isExist(const std::string& filename, LLVolatileAPRPool* pool, ap } //static -apr_off_t LLAPRFile::size(const std::string& filename, LLVolatileAPRPool* pool) +S32 LLAPRFile::size(const std::string& filename, LLVolatileAPRPool* pool) { apr_file_t* apr_file; apr_finfo_t info; @@ -683,13 +683,13 @@ apr_off_t LLAPRFile::size(const std::string& filename, LLVolatileAPRPool* pool) } else { - s = apr_file_info_get(&info, APR_FINFO_SIZE, apr_file); + apr_status_t s = apr_file_info_get(&info, APR_FINFO_SIZE, apr_file); apr_file_close(apr_file) ; if (s == APR_SUCCESS) { - return (apr_off_t)info.size; + return (S32)info.size; } else { diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index 64425fae23047a2bd53a2db70027123d62045191..24374dc77dd4da494725714ecc10399131d7b155 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -162,17 +162,17 @@ class LL_COMMON_API LLAPRFile LLAPRFile(const LLAPRFile&) = delete; LLAPRFile& operator=(const LLAPRFile&) = delete; - apr_status_t open(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = nullptr, apr_off_t* sizep = nullptr); + apr_status_t open(const std::string& filename, apr_int32_t flags, LLVolatileAPRPool* pool = NULL, S32* sizep = NULL); apr_status_t open(const std::string& filename, apr_int32_t flags, BOOL use_global_pool); //use gAPRPoolp. apr_status_t close() ; // Returns actual offset, -1 if seek fails - apr_off_t seek(apr_seek_where_t where, apr_off_t offset); + S32 seek(apr_seek_where_t where, S32 offset); apr_status_t eof() { return apr_file_eof(mFile);} // Returns bytes read/written, 0 if read/write fails: - apr_size_t read(void* buf, apr_size_t nbytes); - apr_size_t write(const void* buf, apr_size_t nbytes); + S32 read(void* buf, S32 nbytes); + S32 write(const void* buf, S32 nbytes); apr_file_t* getFileHandle() {return mFile;} @@ -186,19 +186,19 @@ class LL_COMMON_API LLAPRFile private: static apr_file_t* open(const std::string& filename, apr_pool_t* apr_pool, apr_int32_t flags); static apr_status_t close(apr_file_t* file) ; - static apr_off_t seek(apr_file_t* file, apr_seek_where_t where, apr_off_t offset); + static S32 seek(apr_file_t* file, apr_seek_where_t where, S32 offset); public: // returns false if failure: - static bool remove(const std::string& filename, LLVolatileAPRPool* pool = nullptr); - static bool rename(const std::string& filename, const std::string& newname, LLVolatileAPRPool* pool = nullptr); - static bool isExist(const std::string& filename, LLVolatileAPRPool* pool = nullptr, apr_int32_t flags = APR_READ); - static apr_off_t size(const std::string& filename, LLVolatileAPRPool* pool = nullptr); - static bool makeDir(const std::string& dirname, LLVolatileAPRPool* pool = nullptr); - static bool removeDir(const std::string& dirname, LLVolatileAPRPool* pool = nullptr); + static bool remove(const std::string& filename, LLVolatileAPRPool* pool = NULL); + static bool rename(const std::string& filename, const std::string& newname, LLVolatileAPRPool* pool = NULL); + static bool isExist(const std::string& filename, LLVolatileAPRPool* pool = NULL, apr_int32_t flags = APR_READ); + static S32 size(const std::string& filename, LLVolatileAPRPool* pool = NULL); + static bool makeDir(const std::string& dirname, LLVolatileAPRPool* pool = NULL); + static bool removeDir(const std::string& dirname, LLVolatileAPRPool* pool = NULL); // Returns bytes read/written, 0 if read/write fails: - static apr_size_t readEx(const std::string& filename, void *buf, apr_off_t offset, apr_size_t nbytes, LLVolatileAPRPool* pool = nullptr); - static apr_size_t writeEx(const std::string& filename, void *buf, apr_off_t offset, apr_size_t nbytes, LLVolatileAPRPool* pool = nullptr); // offset<0 means append + 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); // offset<0 means append //******************************************************************************************************************************* }; diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 603390a22d1d29d7528400d3eba32075c351d10f..3776673071cccb7d1a8527135a0c16f5ed3e72fe 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -2183,7 +2183,7 @@ bool LLImageFormatted::load(const std::string &filename, int load_size) { resetLastError(); - apr_off_t file_size = 0; + S32 file_size = 0; LLAPRFile infile ; infile.open(filename, LL_APR_RB, NULL, &file_size); apr_file_t* apr_file = infile.getFileHandle(); diff --git a/indra/llimage/llimagedimensionsinfo.cpp b/indra/llimage/llimagedimensionsinfo.cpp index ab190c18b3e6f63ce2bd807d4430de07d52e0cd7..06042e183f0d3454da06db1ca546b7557b791993 100644 --- a/indra/llimage/llimagedimensionsinfo.cpp +++ b/indra/llimage/llimagedimensionsinfo.cpp @@ -41,7 +41,7 @@ bool LLImageDimensionsInfo::load(const std::string& src_filename,U32 codec) mSrcFilename = src_filename; - apr_off_t file_size = 0; + S32 file_size = 0; apr_status_t s = mInfile.open(src_filename, LL_APR_RB, NULL, &file_size); if (s != APR_SUCCESS) diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 9fcf053730c5551d9d7517a6a16b7eb31c6c3c8d..625f275a06f21e4c74fb384de3edc369dcbbb9d4 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -347,7 +347,7 @@ bool LLImageJ2C::loadAndValidate(const std::string &filename) resetLastError(); - apr_off_t file_size = 0; + S32 file_size = 0; LLAPRFile infile ; infile.open(filename, LL_APR_RB, NULL, &file_size); apr_file_t* apr_file = infile.getFileHandle() ; diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp index 233e8232ccf37c544bbe842becc5c6506242db58..fd91f2c62679a3fa312c02df8d5df395f6af1348 100644 --- a/indra/newview/llfloaterbvhpreview.cpp +++ b/indra/newview/llfloaterbvhpreview.cpp @@ -195,7 +195,7 @@ BOOL LLFloaterBvhPreview::postBuild() // loading a bvh file // now load bvh file - apr_off_t file_size; + S32 file_size; LLAPRFile infile ; infile.open(mFilenameAndPath, LL_APR_RB, NULL, &file_size); diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index b5658bbc5ee7d46a568d04cd6475bfc2bf49e713..5d8c447ee4ac4c3a0f37b62e7cacda3670fd3d41 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -455,7 +455,7 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile() else if (exten == "bvh") { assetType = LLAssetType::AT_ANIMATION; - apr_off_t file_size; + S32 file_size; LLAPRFile infile; infile.open(filename, LL_APR_RB, nullptr, &file_size); if (!infile.getFileHandle()) @@ -566,7 +566,7 @@ LLSD LLNewFileResourceUploadInfo::exportTempFile() setAssetType(assetType); // copy this file into the cache for upload - apr_off_t file_size; + S32 file_size; LLAPRFile infile; infile.open(filename, LL_APR_RB, NULL, &file_size); if (infile.getFileHandle())