diff --git a/libopenjpeg/image.c b/libopenjpeg/image.c index 3b87e6c4..baebc2a2 100644 --- a/libopenjpeg/image.c +++ b/libopenjpeg/image.c @@ -201,21 +201,21 @@ opj_image_t* OPJ_CALLCONV opj_image_tile_create(OPJ_UINT32 numcmpts, opj_image_c opj_image_t *image = 00; image = (opj_image_t*) opj_malloc(sizeof(opj_image_t)); - if - (image) + if (image) { memset(image,0,sizeof(opj_image_t)); + image->color_space = clrspc; image->numcomps = numcmpts; + /* allocate memory for the per-component information */ image->comps = (opj_image_comp_t*)opj_malloc(image->numcomps * sizeof(opj_image_comp_t)); - if - (!image->comps) - { + if (!image->comps) { opj_image_destroy(image); return 00; } memset(image->comps,0,image->numcomps * sizeof(opj_image_comp_t)); + /* create the individual image components */ for(compno = 0; compno < numcmpts; compno++) { opj_image_comp_t *comp = &image->comps[compno]; @@ -230,5 +230,6 @@ opj_image_t* OPJ_CALLCONV opj_image_tile_create(OPJ_UINT32 numcmpts, opj_image_c comp->data = 0; } } + return image; } diff --git a/libopenjpeg/openjpeg.c b/libopenjpeg/openjpeg.c index 36964492..fb0c748c 100644 --- a/libopenjpeg/openjpeg.c +++ b/libopenjpeg/openjpeg.c @@ -1333,7 +1333,7 @@ opj_bool OPJ_CALLCONV opj_write_tile ( opj_codec_t *p_codec, { if (p_codec && p_stream && p_data) { opj_codec_private_t * l_codec = (opj_codec_private_t *) p_codec; - opj_stream_private_t * l_cio = (opj_stream_private_t *) p_stream; + opj_stream_private_t * l_stream = (opj_stream_private_t *) p_stream; if (l_codec->is_decompressor) { return OPJ_FALSE; @@ -1343,7 +1343,7 @@ opj_bool OPJ_CALLCONV opj_write_tile ( opj_codec_t *p_codec, p_tile_index, p_data, p_data_size, - l_cio, + l_stream, &(l_codec->m_event_mgr) ); }