Patch by Callum Lerwick. Instead of reinventing realloc, j2k_read_sod now just uses opj_realloc in j2k.c

This commit is contained in:
Francois-Olivier Devaux 2007-11-14 08:29:12 +00:00
parent dbeebe72b9
commit 61a15672bb
2 changed files with 6 additions and 6 deletions

View File

@ -5,6 +5,10 @@ What's New for OpenJPEG
! : changed ! : changed
+ : added + : added
November 14, 2007
! [FOD] Patch by Callum Lerwick. Instead of reinventing realloc, j2k_read_sod now just uses opj_realloc in j2k.c
November 13, 2007 November 13, 2007
! [FOD] Patch by Dzonatas and Callum Lerwick. ! [FOD] Patch by Dzonatas and Callum Lerwick.
Fp/vectorization patch which basically converts most of the irreversible decode codepath to floating point, Fp/vectorization patch which basically converts most of the irreversible decode codepath to floating point,

View File

@ -1509,11 +1509,8 @@ static void j2k_read_sod(opj_j2k_t *j2k) {
truncate = 1; /* Case of a truncate codestream */ truncate = 1; /* Case of a truncate codestream */
} }
data = (unsigned char *) opj_malloc((j2k->tile_len[curtileno] + len) * sizeof(unsigned char)); data = j2k->tile_data[curtileno];
data = (unsigned char*) opj_realloc(data, (j2k->tile_len[curtileno] + len) * sizeof(unsigned char));
for (i = 0; i < j2k->tile_len[curtileno]; i++) {
data[i] = j2k->tile_data[curtileno][i];
}
data_ptr = data + j2k->tile_len[curtileno]; data_ptr = data + j2k->tile_len[curtileno];
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
@ -1521,7 +1518,6 @@ static void j2k_read_sod(opj_j2k_t *j2k) {
} }
j2k->tile_len[curtileno] += len; j2k->tile_len[curtileno] += len;
opj_free(j2k->tile_data[curtileno]);
j2k->tile_data[curtileno] = data; j2k->tile_data[curtileno] = data;
if (!truncate) { if (!truncate) {