Lines 449-455
static int jpc_dec_process_sot(jpc_dec_t
Link Here
|
449 |
|
449 |
|
450 |
if (dec->state == JPC_MH) { |
450 |
if (dec->state == JPC_MH) { |
451 |
|
451 |
|
452 |
compinfos = jas_malloc(dec->numcomps * sizeof(jas_image_cmptparm_t)); |
452 |
compinfos = jas_alloc2(dec->numcomps, sizeof(jas_image_cmptparm_t)); |
453 |
assert(compinfos); |
453 |
assert(compinfos); |
454 |
for (cmptno = 0, cmpt = dec->cmpts, compinfo = compinfos; |
454 |
for (cmptno = 0, cmpt = dec->cmpts, compinfo = compinfos; |
455 |
cmptno < dec->numcomps; ++cmptno, ++cmpt, ++compinfo) { |
455 |
cmptno < dec->numcomps; ++cmptno, ++cmpt, ++compinfo) { |
Lines 692-698
static int jpc_dec_tileinit(jpc_dec_t *d
Link Here
|
692 |
tile->realmode = 1; |
692 |
tile->realmode = 1; |
693 |
} |
693 |
} |
694 |
tcomp->numrlvls = ccp->numrlvls; |
694 |
tcomp->numrlvls = ccp->numrlvls; |
695 |
if (!(tcomp->rlvls = jas_malloc(tcomp->numrlvls * |
695 |
if (!(tcomp->rlvls = jas_alloc2(tcomp->numrlvls, |
696 |
sizeof(jpc_dec_rlvl_t)))) { |
696 |
sizeof(jpc_dec_rlvl_t)))) { |
697 |
return -1; |
697 |
return -1; |
698 |
} |
698 |
} |
Lines 764-770
rlvl->bands = 0;
Link Here
|
764 |
rlvl->cbgheightexpn); |
764 |
rlvl->cbgheightexpn); |
765 |
|
765 |
|
766 |
rlvl->numbands = (!rlvlno) ? 1 : 3; |
766 |
rlvl->numbands = (!rlvlno) ? 1 : 3; |
767 |
if (!(rlvl->bands = jas_malloc(rlvl->numbands * |
767 |
if (!(rlvl->bands = jas_alloc2(rlvl->numbands, |
768 |
sizeof(jpc_dec_band_t)))) { |
768 |
sizeof(jpc_dec_band_t)))) { |
769 |
return -1; |
769 |
return -1; |
770 |
} |
770 |
} |
Lines 797-803
rlvl->bands = 0;
Link Here
|
797 |
|
797 |
|
798 |
assert(rlvl->numprcs); |
798 |
assert(rlvl->numprcs); |
799 |
|
799 |
|
800 |
if (!(band->prcs = jas_malloc(rlvl->numprcs * sizeof(jpc_dec_prc_t)))) { |
800 |
if (!(band->prcs = jas_alloc2(rlvl->numprcs, sizeof(jpc_dec_prc_t)))) { |
801 |
return -1; |
801 |
return -1; |
802 |
} |
802 |
} |
803 |
|
803 |
|
Lines 834-840
rlvl->bands = 0;
Link Here
|
834 |
if (!(prc->numimsbstagtree = jpc_tagtree_create(prc->numhcblks, prc->numvcblks))) { |
834 |
if (!(prc->numimsbstagtree = jpc_tagtree_create(prc->numhcblks, prc->numvcblks))) { |
835 |
return -1; |
835 |
return -1; |
836 |
} |
836 |
} |
837 |
if (!(prc->cblks = jas_malloc(prc->numcblks * sizeof(jpc_dec_cblk_t)))) { |
837 |
if (!(prc->cblks = jas_alloc2(prc->numcblks, sizeof(jpc_dec_cblk_t)))) { |
838 |
return -1; |
838 |
return -1; |
839 |
} |
839 |
} |
840 |
|
840 |
|
Lines 1181-1187
static int jpc_dec_process_siz(jpc_dec_t
Link Here
|
1181 |
return -1; |
1181 |
return -1; |
1182 |
} |
1182 |
} |
1183 |
|
1183 |
|
1184 |
if (!(dec->cmpts = jas_malloc(dec->numcomps * sizeof(jpc_dec_cmpt_t)))) { |
1184 |
if (!(dec->cmpts = jas_alloc2(dec->numcomps, sizeof(jpc_dec_cmpt_t)))) { |
1185 |
return -1; |
1185 |
return -1; |
1186 |
} |
1186 |
} |
1187 |
|
1187 |
|
Lines 1204-1210
static int jpc_dec_process_siz(jpc_dec_t
Link Here
|
1204 |
dec->numhtiles = JPC_CEILDIV(dec->xend - dec->tilexoff, dec->tilewidth); |
1204 |
dec->numhtiles = JPC_CEILDIV(dec->xend - dec->tilexoff, dec->tilewidth); |
1205 |
dec->numvtiles = JPC_CEILDIV(dec->yend - dec->tileyoff, dec->tileheight); |
1205 |
dec->numvtiles = JPC_CEILDIV(dec->yend - dec->tileyoff, dec->tileheight); |
1206 |
dec->numtiles = dec->numhtiles * dec->numvtiles; |
1206 |
dec->numtiles = dec->numhtiles * dec->numvtiles; |
1207 |
if (!(dec->tiles = jas_malloc(dec->numtiles * sizeof(jpc_dec_tile_t)))) { |
1207 |
if (!(dec->tiles = jas_alloc2(dec->numtiles, sizeof(jpc_dec_tile_t)))) { |
1208 |
return -1; |
1208 |
return -1; |
1209 |
} |
1209 |
} |
1210 |
|
1210 |
|
Lines 1228-1234
static int jpc_dec_process_siz(jpc_dec_t
Link Here
|
1228 |
tile->pkthdrstreampos = 0; |
1228 |
tile->pkthdrstreampos = 0; |
1229 |
tile->pptstab = 0; |
1229 |
tile->pptstab = 0; |
1230 |
tile->cp = 0; |
1230 |
tile->cp = 0; |
1231 |
if (!(tile->tcomps = jas_malloc(dec->numcomps * |
1231 |
if (!(tile->tcomps = jas_alloc2(dec->numcomps, |
1232 |
sizeof(jpc_dec_tcomp_t)))) { |
1232 |
sizeof(jpc_dec_tcomp_t)))) { |
1233 |
return -1; |
1233 |
return -1; |
1234 |
} |
1234 |
} |
Lines 1491-1497
static jpc_dec_cp_t *jpc_dec_cp_create(u
Link Here
|
1491 |
cp->numlyrs = 0; |
1491 |
cp->numlyrs = 0; |
1492 |
cp->mctid = 0; |
1492 |
cp->mctid = 0; |
1493 |
cp->csty = 0; |
1493 |
cp->csty = 0; |
1494 |
if (!(cp->ccps = jas_malloc(cp->numcomps * sizeof(jpc_dec_ccp_t)))) { |
1494 |
if (!(cp->ccps = jas_alloc2(cp->numcomps, sizeof(jpc_dec_ccp_t)))) { |
1495 |
return 0; |
1495 |
return 0; |
1496 |
} |
1496 |
} |
1497 |
if (!(cp->pchglist = jpc_pchglist_create())) { |
1497 |
if (!(cp->pchglist = jpc_pchglist_create())) { |
Lines 2050-2056
jpc_streamlist_t *jpc_streamlist_create(
Link Here
|
2050 |
} |
2050 |
} |
2051 |
streamlist->numstreams = 0; |
2051 |
streamlist->numstreams = 0; |
2052 |
streamlist->maxstreams = 100; |
2052 |
streamlist->maxstreams = 100; |
2053 |
if (!(streamlist->streams = jas_malloc(streamlist->maxstreams * |
2053 |
if (!(streamlist->streams = jas_alloc2(streamlist->maxstreams, |
2054 |
sizeof(jas_stream_t *)))) { |
2054 |
sizeof(jas_stream_t *)))) { |
2055 |
jas_free(streamlist); |
2055 |
jas_free(streamlist); |
2056 |
return 0; |
2056 |
return 0; |
Lines 2070-2077
int jpc_streamlist_insert(jpc_streamlist
Link Here
|
2070 |
/* Grow the array of streams if necessary. */ |
2070 |
/* Grow the array of streams if necessary. */ |
2071 |
if (streamlist->numstreams >= streamlist->maxstreams) { |
2071 |
if (streamlist->numstreams >= streamlist->maxstreams) { |
2072 |
newmaxstreams = streamlist->maxstreams + 1024; |
2072 |
newmaxstreams = streamlist->maxstreams + 1024; |
2073 |
if (!(newstreams = jas_realloc(streamlist->streams, |
2073 |
if (!(newstreams = jas_realloc2(streamlist->streams, |
2074 |
(newmaxstreams + 1024) * sizeof(jas_stream_t *)))) { |
2074 |
(newmaxstreams + 1024), sizeof(jas_stream_t *)))) { |
2075 |
return -1; |
2075 |
return -1; |
2076 |
} |
2076 |
} |
2077 |
for (i = streamlist->numstreams; i < streamlist->maxstreams; ++i) { |
2077 |
for (i = streamlist->numstreams; i < streamlist->maxstreams; ++i) { |
Lines 2157-2164
int jpc_ppxstab_grow(jpc_ppxstab_t *tab,
Link Here
|
2157 |
{ |
2157 |
{ |
2158 |
jpc_ppxstabent_t **newents; |
2158 |
jpc_ppxstabent_t **newents; |
2159 |
if (tab->maxents < maxents) { |
2159 |
if (tab->maxents < maxents) { |
2160 |
newents = (tab->ents) ? jas_realloc(tab->ents, maxents * |
2160 |
newents = jas_realloc2(tab->ents, maxents, sizeof(jpc_ppxstabent_t *)); |
2161 |
sizeof(jpc_ppxstabent_t *)) : jas_malloc(maxents * sizeof(jpc_ppxstabent_t *)); |
|
|
2162 |
if (!newents) { |
2161 |
if (!newents) { |
2163 |
return -1; |
2162 |
return -1; |
2164 |
} |
2163 |
} |