summaryrefslogtreecommitdiff
path: root/OPJViewer/source/imagmj2.cpp
diff options
context:
space:
mode:
authorGiuseppe Baruffa <gbaruffa@users.noreply.github.com>2007-02-23 01:23:05 +0000
committerGiuseppe Baruffa <gbaruffa@users.noreply.github.com>2007-02-23 01:23:05 +0000
commit8a75823eeaa6f36c428a848d757e7d94ce4386f1 (patch)
tree35cbd0c3181e404833790c0c1e04c0879d868bad /OPJViewer/source/imagmj2.cpp
parente841b13166218ba152595a7c0adf5b70c4e5558d (diff)
Fixed a copy-and-paste type assignment error (bool instead of int) in the JPWL section of decoder parameters structure in openjpeg.h; minor type-casting in jpwl_lib.c. As a result, now OPJViewer should run correctly when built against the most current SVN trunk of LibOpenJPEG.lib
Diffstat (limited to 'OPJViewer/source/imagmj2.cpp')
-rw-r--r--OPJViewer/source/imagmj2.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/OPJViewer/source/imagmj2.cpp b/OPJViewer/source/imagmj2.cpp
index 351621ea..65c9ca73 100644
--- a/OPJViewer/source/imagmj2.cpp
+++ b/OPJViewer/source/imagmj2.cpp
@@ -589,7 +589,6 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
opj_dparameters_t parameters; /* decompression parameters */
opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *opjimage = NULL;
- FILE *fsrc = NULL;
unsigned char *src = NULL;
unsigned char *ptr;
int file_length, jp2c_point, jp2h_point;
@@ -612,6 +611,8 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
opj_set_default_decoder_parameters(&parameters);
/* prepare parameters */
+ strncpy(parameters.infile, "", sizeof(parameters.infile)-1);
+ strncpy(parameters.outfile, "", sizeof(parameters.outfile)-1);
parameters.decod_format = JP2_CFMT;
parameters.cod_format = BMP_DFMT;
@@ -671,13 +672,15 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
return false;
}
+ /* close the byte stream */
+ opj_cio_close(cio);
+
// check image size
if ((opjimage->numcomps != 1) && (opjimage->numcomps != 3)) {
wxMutexGuiEnter();
wxLogError("MJ2: weird number of components");
wxMutexGuiLeave();
opj_destroy_decompress(dinfo);
- opj_cio_close(cio);
free(src);
return false;
}
@@ -736,7 +739,6 @@ bool wxMJ2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose,
/* close openjpeg structs */
opj_destroy_decompress(dinfo);
- opj_cio_close(cio);
opj_image_destroy(opjimage);
free(src);