aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llimage/llimagej2c.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/llimage/llimagej2c.cpp
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to 'linden/indra/llimage/llimagej2c.cpp')
-rw-r--r--linden/indra/llimage/llimagej2c.cpp13
1 files changed, 8 insertions, 5 deletions
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 @@
16 * There are special exceptions to the terms and conditions of the GPL as 16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception 17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or 18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 19 * online at
20 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 * 21 *
21 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
22 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -418,7 +419,9 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename)
418 resetLastError(); 419 resetLastError();
419 420
420 S32 file_size = 0; 421 S32 file_size = 0;
421 apr_file_t* apr_file = ll_apr_file_open(filename, LL_APR_RB, &file_size); 422 LLAPRFile infile ;
423 infile.open(filename, LL_APR_RB, NULL, &file_size);
424 apr_file_t* apr_file = infile.getFileHandle() ;
422 if (!apr_file) 425 if (!apr_file)
423 { 426 {
424 setLastError("Unable to open file for reading", filename); 427 setLastError("Unable to open file for reading", filename);
@@ -427,7 +430,6 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename)
427 else if (file_size == 0) 430 else if (file_size == 0)
428 { 431 {
429 setLastError("File is empty",filename); 432 setLastError("File is empty",filename);
430 apr_file_close(apr_file);
431 res = FALSE; 433 res = FALSE;
432 } 434 }
433 else 435 else
@@ -435,7 +437,8 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename)
435 U8 *data = new U8[file_size]; 437 U8 *data = new U8[file_size];
436 apr_size_t bytes_read = file_size; 438 apr_size_t bytes_read = file_size;
437 apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read 439 apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read
438 apr_file_close(apr_file); 440 infile.close() ;
441
439 if (s != APR_SUCCESS || (S32)bytes_read != file_size) 442 if (s != APR_SUCCESS || (S32)bytes_read != file_size)
440 { 443 {
441 delete[] data; 444 delete[] data;
@@ -447,7 +450,7 @@ BOOL LLImageJ2C::loadAndValidate(const std::string &filename)
447 res = validate(data, file_size); 450 res = validate(data, file_size);
448 } 451 }
449 } 452 }
450 453
451 if (!mLastError.empty()) 454 if (!mLastError.empty())
452 { 455 {
453 LLImage::setLastError(mLastError); 456 LLImage::setLastError(mLastError);