From fdef69b43ce5222ac0f2a87f2fad1442ece340e8 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 19 Sep 2017 12:46:20 +0200 Subject: Fix warnings and errors when compiling with a c++ compiler (#1021) --- src/lib/openjp2/sparse_array.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/lib/openjp2/sparse_array.c') diff --git a/src/lib/openjp2/sparse_array.c b/src/lib/openjp2/sparse_array.c index 6a2d8d43..67212d28 100644 --- a/src/lib/openjp2/sparse_array.c +++ b/src/lib/openjp2/sparse_array.c @@ -56,7 +56,8 @@ opj_sparse_array_int32_t* opj_sparse_array_int32_create(OPJ_UINT32 width, return NULL; } - sa = opj_calloc(1, sizeof(opj_sparse_array_int32_t)); + sa = (opj_sparse_array_int32_t*) opj_calloc(1, + sizeof(opj_sparse_array_int32_t)); sa->width = width; sa->height = height; sa->block_width = block_width; @@ -67,8 +68,8 @@ opj_sparse_array_int32_t* opj_sparse_array_int32_create(OPJ_UINT32 width, opj_free(sa); return NULL; } - sa->data_blocks = opj_calloc(sizeof(OPJ_INT32*), - sa->block_count_hor * sa->block_count_ver); + sa->data_blocks = (OPJ_INT32**) opj_calloc(sizeof(OPJ_INT32*), + sa->block_count_hor * sa->block_count_ver); if (sa->data_blocks == NULL) { opj_free(sa); return NULL; @@ -232,8 +233,8 @@ static OPJ_BOOL opj_sparse_array_int32_read_or_write( } } else { if (src_block == NULL) { - src_block = opj_calloc(1, - sa->block_width * sa->block_height * sizeof(OPJ_INT32)); + src_block = (OPJ_INT32*) opj_calloc(1, + sa->block_width * sa->block_height * sizeof(OPJ_INT32)); if (src_block == NULL) { return OPJ_FALSE; } -- cgit v1.2.3