From ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Thu, 30 Apr 2009 13:04:20 -0500 Subject: Second Life viewer sources 1.23.0-RC --- linden/indra/llimage/CMakeLists.txt | 1 + linden/indra/llimage/llimage.cpp | 23 ++++++++++++----------- linden/indra/llimage/llimage.h | 3 ++- linden/indra/llimage/llimagebmp.cpp | 3 ++- linden/indra/llimage/llimagebmp.h | 3 ++- linden/indra/llimage/llimagedxt.cpp | 3 ++- linden/indra/llimage/llimagedxt.h | 3 ++- linden/indra/llimage/llimagej2c.cpp | 13 ++++++++----- linden/indra/llimage/llimagej2c.h | 3 ++- linden/indra/llimage/llimagejpeg.cpp | 3 ++- linden/indra/llimage/llimagejpeg.h | 3 ++- linden/indra/llimage/llimagepng.cpp | 3 ++- linden/indra/llimage/llimagepng.h | 3 ++- linden/indra/llimage/llimagetga.cpp | 5 +++-- linden/indra/llimage/llimagetga.h | 3 ++- linden/indra/llimage/llimageworker.cpp | 3 ++- linden/indra/llimage/llimageworker.h | 3 ++- linden/indra/llimage/llmapimagetype.h | 3 ++- linden/indra/llimage/llpngwrapper.cpp | 3 ++- linden/indra/llimage/llpngwrapper.h | 3 ++- 20 files changed, 56 insertions(+), 34 deletions(-) (limited to 'linden/indra/llimage') diff --git a/linden/indra/llimage/CMakeLists.txt b/linden/indra/llimage/CMakeLists.txt index 1a4d92b..5fa7472 100644 --- a/linden/indra/llimage/CMakeLists.txt +++ b/linden/indra/llimage/CMakeLists.txt @@ -14,6 +14,7 @@ include_directories( ${LLMATH_INCLUDE_DIRS} ${LLVFS_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS} + ${ZLIB_INCLUDE_DIRS} ) set(llimage_SOURCE_FILES diff --git a/linden/indra/llimage/llimage.cpp b/linden/indra/llimage/llimage.cpp index d4489fc..88edc99 100644 --- a/linden/indra/llimage/llimage.cpp +++ b/linden/indra/llimage/llimage.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -1136,7 +1137,7 @@ file_extensions[] = { "dxt", IMG_CODEC_DXT }, { "png", IMG_CODEC_PNG } }; -#define NUM_FILE_EXTENSIONS sizeof(file_extensions)/sizeof(file_extensions[0]) +#define NUM_FILE_EXTENSIONS LL_ARRAY_SIZE(file_extensions) static std::string find_file(std::string &name, S8 *codec) { @@ -1512,7 +1513,9 @@ BOOL LLImageFormatted::load(const std::string &filename) resetLastError(); S32 file_size = 0; - apr_file_t* apr_file = ll_apr_file_open(filename, LL_APR_RB, &file_size); + LLAPRFile infile ; + infile.open(filename, LL_APR_RB, NULL, &file_size); + apr_file_t* apr_file = infile.getFileHandle(); if (!apr_file) { setLastError("Unable to open file for reading", filename); @@ -1521,7 +1524,6 @@ BOOL LLImageFormatted::load(const std::string &filename) if (file_size == 0) { setLastError("File is empty",filename); - apr_file_close(apr_file); return FALSE; } @@ -1539,8 +1541,7 @@ BOOL LLImageFormatted::load(const std::string &filename) { res = updateData(); } - apr_file_close(apr_file); - + return res; } @@ -1548,16 +1549,16 @@ BOOL LLImageFormatted::save(const std::string &filename) { resetLastError(); - apr_file_t* apr_file = ll_apr_file_open(filename, LL_APR_WB); - if (!apr_file) + LLAPRFile outfile ; + outfile.open(filename, LL_APR_WB); + if (!outfile.getFileHandle()) { setLastError("Unable to open file for writing", filename); return FALSE; } - ll_apr_file_write(apr_file, getData(), getDataSize()); - apr_file_close(apr_file); - + outfile.write(getData(), getDataSize()); + outfile.close() ; return TRUE; } diff --git a/linden/indra/llimage/llimage.h b/linden/indra/llimage/llimage.h index 321eda8..bd609b6 100644 --- a/linden/indra/llimage/llimage.h +++ b/linden/indra/llimage/llimage.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llimagebmp.cpp b/linden/indra/llimage/llimagebmp.cpp index ddc8825..ceded29 100644 --- a/linden/indra/llimage/llimagebmp.cpp +++ b/linden/indra/llimage/llimagebmp.cpp @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llimagebmp.h b/linden/indra/llimage/llimagebmp.h index 9c0c611..c4d6fd8 100644 --- a/linden/indra/llimage/llimagebmp.h +++ b/linden/indra/llimage/llimagebmp.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llimagedxt.cpp b/linden/indra/llimage/llimagedxt.cpp index fe66ee3..1ce4517 100644 --- a/linden/indra/llimage/llimagedxt.cpp +++ b/linden/indra/llimage/llimagedxt.cpp @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llimagedxt.h b/linden/indra/llimage/llimagedxt.h index 3d81414..bc2d652 100644 --- a/linden/indra/llimage/llimagedxt.h +++ b/linden/indra/llimage/llimagedxt.h @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llimagej2c.cpp b/linden/indra/llimage/llimagej2c.cpp index fe5d656..1b93c21 100644 --- a/linden/indra/llimage/llimagej2c.cpp +++ b/linden/indra/llimage/llimagej2c.cpp @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -418,7 +419,9 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) resetLastError(); S32 file_size = 0; - apr_file_t* apr_file = ll_apr_file_open(filename, LL_APR_RB, &file_size); + LLAPRFile infile ; + infile.open(filename, LL_APR_RB, NULL, &file_size); + apr_file_t* apr_file = infile.getFileHandle() ; if (!apr_file) { setLastError("Unable to open file for reading", filename); @@ -427,7 +430,6 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) else if (file_size == 0) { setLastError("File is empty",filename); - apr_file_close(apr_file); res = FALSE; } else @@ -435,7 +437,8 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) U8 *data = new U8[file_size]; apr_size_t bytes_read = file_size; apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read - apr_file_close(apr_file); + infile.close() ; + if (s != APR_SUCCESS || (S32)bytes_read != file_size) { delete[] data; @@ -447,7 +450,7 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename) res = validate(data, file_size); } } - + if (!mLastError.empty()) { LLImage::setLastError(mLastError); diff --git a/linden/indra/llimage/llimagej2c.h b/linden/indra/llimage/llimagej2c.h index ad514eb..23f6ef5 100644 --- a/linden/indra/llimage/llimagej2c.h +++ b/linden/indra/llimage/llimagej2c.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llimagejpeg.cpp b/linden/indra/llimage/llimagejpeg.cpp index afb3368..fa0dd3f 100644 --- a/linden/indra/llimage/llimagejpeg.cpp +++ b/linden/indra/llimage/llimagejpeg.cpp @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llimagejpeg.h b/linden/indra/llimage/llimagejpeg.h index 0914fd7..884d071 100644 --- a/linden/indra/llimage/llimagejpeg.h +++ b/linden/indra/llimage/llimagejpeg.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llimagepng.cpp b/linden/indra/llimage/llimagepng.cpp index f2d6376..b5de104 100644 --- a/linden/indra/llimage/llimagepng.cpp +++ b/linden/indra/llimage/llimagepng.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llimagepng.h b/linden/indra/llimage/llimagepng.h index 0387982..083dda7 100644 --- a/linden/indra/llimage/llimagepng.h +++ b/linden/indra/llimage/llimagepng.h @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llimagetga.cpp b/linden/indra/llimage/llimagetga.cpp index 853a0dc..a6721bf 100644 --- a/linden/indra/llimage/llimagetga.cpp +++ b/linden/indra/llimage/llimagetga.cpp @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, @@ -104,7 +105,7 @@ LLImageTGA::LLImageTGA(const std::string& file_name) LLImageTGA::~LLImageTGA() { - delete mColorMap; + delete [] mColorMap; } BOOL LLImageTGA::updateData() diff --git a/linden/indra/llimage/llimagetga.h b/linden/indra/llimage/llimagetga.h index b522930..e237cc5 100644 --- a/linden/indra/llimage/llimagetga.h +++ b/linden/indra/llimage/llimagetga.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llimageworker.cpp b/linden/indra/llimage/llimageworker.cpp index d570ad1..532e996 100644 --- a/linden/indra/llimage/llimageworker.cpp +++ b/linden/indra/llimage/llimageworker.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llimageworker.h b/linden/indra/llimage/llimageworker.h index a133f77..879fcf5 100644 --- a/linden/indra/llimage/llimageworker.h +++ b/linden/indra/llimage/llimageworker.h @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llmapimagetype.h b/linden/indra/llimage/llmapimagetype.h index 0e17aaa..762d28b 100644 --- a/linden/indra/llimage/llmapimagetype.h +++ b/linden/indra/llimage/llmapimagetype.h @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llpngwrapper.cpp b/linden/indra/llimage/llpngwrapper.cpp index 2b0f7b6..0dd991a 100644 --- a/linden/indra/llimage/llpngwrapper.cpp +++ b/linden/indra/llimage/llpngwrapper.cpp @@ -17,7 +17,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, diff --git a/linden/indra/llimage/llpngwrapper.h b/linden/indra/llimage/llpngwrapper.h index 87ddb9e..2e6c1dc 100644 --- a/linden/indra/llimage/llpngwrapper.h +++ b/linden/indra/llimage/llpngwrapper.h @@ -16,7 +16,8 @@ * There are special exceptions to the terms and conditions of the GPL as * it is applied to this Source Code. View the full text of the exception * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception * * By copying, modifying or distributing this software, you acknowledge * that you have read and understood your obligations described above, -- cgit v1.1