summaryrefslogtreecommitdiff
path: root/libopenjpeg
diff options
context:
space:
mode:
authorFreeimage <freeimage@aliceadsl.fr>2006-01-26 20:02:04 +0000
committerFreeimage <freeimage@aliceadsl.fr>2006-01-26 20:02:04 +0000
commit8a662fa4b1dc489a8d6d5fe687499f25f856ba67 (patch)
tree52da800230f0ad989574402e9c1ce146c08b3824 /libopenjpeg
parent7546f19b51511ceae65e5b81448d89f18aa2dd75 (diff)
fixed various minor warnings occuring under gcc, added corrections proposed in the forum
Diffstat (limited to 'libopenjpeg')
-rw-r--r--libopenjpeg/jp2.c10
-rw-r--r--libopenjpeg/jp2.h1
-rw-r--r--libopenjpeg/openjpeg.c21
-rw-r--r--libopenjpeg/pi.c2
4 files changed, 26 insertions, 8 deletions
diff --git a/libopenjpeg/jp2.c b/libopenjpeg/jp2.c
index e224f4c6..c411f7e0 100644
--- a/libopenjpeg/jp2.c
+++ b/libopenjpeg/jp2.c
@@ -81,7 +81,7 @@ Read the FTYP box - File type box
@return Returns true if successful, returns false otherwise
*/
static bool jp2_read_ftyp(opj_jp2_t *jp2, opj_cio_t *cio);
-static int jp2_write_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, char *index);
+static int jp2_write_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, char *index);
static bool jp2_read_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, unsigned int *j2k_codestream_length, unsigned int *j2k_codestream_offset);
static void jp2_write_jp(opj_cio_t *cio);
/**
@@ -414,12 +414,11 @@ static bool jp2_read_ftyp(opj_jp2_t *jp2, opj_cio_t *cio) {
return true;
}
-static int jp2_write_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, char *index) {
+static int jp2_write_jp2c(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, char *index) {
unsigned int j2k_codestream_offset, j2k_codestream_length;
opj_jp2_box_t box;
opj_j2k_t *j2k = jp2->j2k;
- opj_image_t *image = jp2->image;
box.init_pos = cio_tell(cio);
cio_skip(cio, 4);
@@ -635,8 +634,6 @@ void jp2_setup_encoder(opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_
/* Image Header box */
- jp2->image = image;
-
jp2->numcomps = image->numcomps; /* NC */
jp2->comps = (opj_jp2_comps_t*) opj_malloc(jp2->numcomps * sizeof(opj_jp2_comps_t));
jp2->h = image->y1 - image->y0; /* HEIGHT */
@@ -684,7 +681,6 @@ void jp2_setup_encoder(opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_
}
bool jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, char *index) {
- (void)image;
/* JP2 encoding */
@@ -697,7 +693,7 @@ bool jp2_encode(opj_jp2_t *jp2, opj_cio_t *cio, opj_image_t *image, char *index)
/* J2K encoding */
- if(!jp2_write_jp2c(jp2, cio, index)) {
+ if(!jp2_write_jp2c(jp2, cio, image, index)) {
opj_event_msg(jp2->cinfo, EVT_ERROR, "Failed to encode image\n");
return false;
}
diff --git a/libopenjpeg/jp2.h b/libopenjpeg/jp2.h
index 2e4623f1..f42689e1 100644
--- a/libopenjpeg/jp2.h
+++ b/libopenjpeg/jp2.h
@@ -84,7 +84,6 @@ typedef struct opj_jp2 {
unsigned int numcl;
unsigned int *cl;
opj_jp2_comps_t *comps;
- opj_image_t *image;
unsigned int j2k_codestream_offset;
unsigned int j2k_codestream_length;
} opj_jp2_t;
diff --git a/libopenjpeg/openjpeg.c b/libopenjpeg/openjpeg.c
index 51d97e18..b90eca6f 100644
--- a/libopenjpeg/openjpeg.c
+++ b/libopenjpeg/openjpeg.c
@@ -52,6 +52,7 @@ opj_dinfo_t* opj_create_decompress(OPJ_CODEC_FORMAT format) {
return NULL;
}
break;
+ case CODEC_UNKNOWN:
default:
opj_free(dinfo);
return NULL;
@@ -73,6 +74,9 @@ void opj_destroy_decompress(opj_dinfo_t *dinfo) {
case CODEC_JP2:
jp2_destroy_decompress((opj_jp2_t*)dinfo->jp2_handle);
break;
+ case CODEC_UNKNOWN:
+ default:
+ break;
}
/* destroy the decompressor */
opj_free(dinfo);
@@ -101,6 +105,9 @@ void opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters) {
case CODEC_JP2:
jp2_setup_decoder((opj_jp2_t*)dinfo->jp2_handle, parameters);
break;
+ case CODEC_UNKNOWN:
+ default:
+ break;
}
}
}
@@ -141,6 +148,8 @@ opj_cinfo_t* opj_create_compress(OPJ_CODEC_FORMAT format) {
return NULL;
}
break;
+ case CODEC_JPT:
+ case CODEC_UNKNOWN:
default:
opj_free(cinfo);
return NULL;
@@ -161,6 +170,10 @@ void opj_destroy_compress(opj_cinfo_t *cinfo) {
case CODEC_JP2:
jp2_destroy_decompress((opj_jp2_t*)cinfo->jp2_handle);
break;
+ case CODEC_JPT:
+ case CODEC_UNKNOWN:
+ default:
+ break;
}
/* destroy the decompressor */
opj_free(cinfo);
@@ -193,6 +206,10 @@ void opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_im
case CODEC_JP2:
jp2_setup_encoder((opj_jp2_t*)cinfo->jp2_handle, parameters, image);
break;
+ case CODEC_JPT:
+ case CODEC_UNKNOWN:
+ default:
+ break;
}
}
}
@@ -204,6 +221,10 @@ bool opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *in
return j2k_encode((opj_j2k_t*)cinfo->j2k_handle, cio, image, index);
case CODEC_JP2:
return jp2_encode((opj_jp2_t*)cinfo->jp2_handle, cio, image, index);
+ case CODEC_JPT:
+ case CODEC_UNKNOWN:
+ default:
+ break;
}
}
diff --git a/libopenjpeg/pi.c b/libopenjpeg/pi.c
index 1ac811e4..c13ff472 100644
--- a/libopenjpeg/pi.c
+++ b/libopenjpeg/pi.c
@@ -545,6 +545,8 @@ bool pi_next(opj_pi_iterator_t * pi) {
return pi_next_pcrl(pi);
case CPRL:
return pi_next_cprl(pi);
+ case PROG_UNKNOWN:
+ return false;
}
return false;