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;
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;
if (is_read_op) {
if (src_block == NULL) {
if (buf_col_stride == 1) {
- OPJ_INT32* dest_ptr = buf + (y - y0) * (size_t)buf_line_stride +
+ OPJ_INT32* dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride +
(x - x0) * buf_col_stride;
for (j = 0; j < y_incr; j++) {
memset(dest_ptr, 0, sizeof(OPJ_INT32) * x_incr);
dest_ptr += buf_line_stride;
}
} else {
- OPJ_INT32* dest_ptr = buf + (y - y0) * (size_t)buf_line_stride +
+ OPJ_INT32* dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride +
(x - x0) * buf_col_stride;
for (j = 0; j < y_incr; j++) {
OPJ_UINT32 k;
}
} else {
const OPJ_INT32* OPJ_RESTRICT src_ptr = src_block + block_y_offset *
- (size_t)block_width + block_x_offset;
+ (OPJ_SIZE_T)block_width + block_x_offset;
if (buf_col_stride == 1) {
- OPJ_INT32* OPJ_RESTRICT dest_ptr = buf + (y - y0) * (size_t)buf_line_stride +
+ OPJ_INT32* OPJ_RESTRICT dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride
+ +
(x - x0) * buf_col_stride;
if (x_incr == 4) {
- // Same code as general branch, but the compiler
- // can have an efficient memcpy()
+ /* Same code as general branch, but the compiler */
+ /* can have an efficient memcpy() */
+ (void)(x_incr); /* trick to silent cppcheck duplicateBranch warning */
for (j = 0; j < y_incr; j++) {
memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
dest_ptr += buf_line_stride;
}
}
} else {
- OPJ_INT32* OPJ_RESTRICT dest_ptr = buf + (y - y0) * (size_t)buf_line_stride +
+ OPJ_INT32* OPJ_RESTRICT dest_ptr = buf + (y - y0) * (OPJ_SIZE_T)buf_line_stride
+ +
(x - x0) * buf_col_stride;
if (x_incr == 1) {
for (j = 0; j < y_incr; j++) {
}
} 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;
}
if (buf_col_stride == 1) {
OPJ_INT32* OPJ_RESTRICT dest_ptr = src_block + block_y_offset *
- (size_t)block_width + block_x_offset;
+ (OPJ_SIZE_T)block_width + block_x_offset;
const OPJ_INT32* OPJ_RESTRICT src_ptr = buf + (y - y0) *
- (size_t)buf_line_stride + (x - x0) * buf_col_stride;
+ (OPJ_SIZE_T)buf_line_stride + (x - x0) * buf_col_stride;
if (x_incr == 4) {
- // Same code as general branch, but the compiler
- // can have an efficient memcpy()
+ /* Same code as general branch, but the compiler */
+ /* can have an efficient memcpy() */
+ (void)(x_incr); /* trick to silent cppcheck duplicateBranch warning */
for (j = 0; j < y_incr; j++) {
memcpy(dest_ptr, src_ptr, sizeof(OPJ_INT32) * x_incr);
dest_ptr += block_width;
}
} else {
OPJ_INT32* OPJ_RESTRICT dest_ptr = src_block + block_y_offset *
- (size_t)block_width + block_x_offset;
+ (OPJ_SIZE_T)block_width + block_x_offset;
const OPJ_INT32* OPJ_RESTRICT src_ptr = buf + (y - y0) *
- (size_t)buf_line_stride + (x - x0) * buf_col_stride;
+ (OPJ_SIZE_T)buf_line_stride + (x - x0) * buf_col_stride;
if (x_incr == 1) {
for (j = 0; j < y_incr; j++) {
*dest_ptr = *src_ptr;