diff options
| author | Giuseppe Baruffa <gbaruffa@users.noreply.github.com> | 2007-02-23 01:23:05 +0000 |
|---|---|---|
| committer | Giuseppe Baruffa <gbaruffa@users.noreply.github.com> | 2007-02-23 01:23:05 +0000 |
| commit | 8a75823eeaa6f36c428a848d757e7d94ce4386f1 (patch) | |
| tree | 35cbd0c3181e404833790c0c1e04c0879d868bad /OPJViewer/source/imagjp2.cpp | |
| parent | e841b13166218ba152595a7c0adf5b70c4e5558d (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/imagjp2.cpp')
| -rw-r--r-- | OPJViewer/source/imagjp2.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/OPJViewer/source/imagjp2.cpp b/OPJViewer/source/imagjp2.cpp index 4b7437f8..99ef23c9 100644 --- a/OPJViewer/source/imagjp2.cpp +++ b/OPJViewer/source/imagjp2.cpp @@ -124,7 +124,6 @@ bool wxJP2Handler::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;
@@ -146,6 +145,8 @@ bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, opj_set_default_decoder_parameters(¶meters);
/* 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;
@@ -182,17 +183,20 @@ bool wxJP2Handler::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("JP2: weird number of components");
wxMutexGuiLeave();
opj_destroy_decompress(dinfo);
- opj_cio_close(cio);
free(src);
return false;
}
+
// prepare image size
image->Create(opjimage->comps[0].w, opjimage->comps[0].h, true );
@@ -238,7 +242,6 @@ bool wxJP2Handler::LoadFile(wxImage *image, wxInputStream& stream, bool verbose, /* close openjpeg structs */
opj_destroy_decompress(dinfo);
- opj_cio_close(cio);
opj_image_destroy(opjimage);
free(src);
|
