| OLD | NEW |
| 1 /* | 1 /* |
| 2 * The copyright in this software is being made available under the 2-clauses | 2 * The copyright in this software is being made available under the 2-clauses |
| 3 * BSD License, included below. This software may be subject to other third | 3 * BSD License, included below. This software may be subject to other third |
| 4 * party and contributor rights, including patent rights, and no such rights | 4 * party and contributor rights, including patent rights, and no such rights |
| 5 * are granted under this license. | 5 * are granted under this license. |
| 6 * | 6 * |
| 7 * Copyright (c) 2005, Herve Drolon, FreeImage Team | 7 * Copyright (c) 2005, Herve Drolon, FreeImage Team |
| 8 * All rights reserved. | 8 * All rights reserved. |
| 9 * | 9 * |
| 10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 else | 198 else |
| 199 p_image_dest->icc_profile_buf = NULL; | 199 p_image_dest->icc_profile_buf = NULL; |
| 200 | 200 |
| 201 return; | 201 return; |
| 202 } | 202 } |
| 203 | 203 |
| 204 opj_image_t* OPJ_CALLCONV opj_image_tile_create(OPJ_UINT32 numcmpts, opj_image_c
mptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc) { | 204 opj_image_t* OPJ_CALLCONV opj_image_tile_create(OPJ_UINT32 numcmpts, opj_image_c
mptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc) { |
| 205 OPJ_UINT32 compno; | 205 OPJ_UINT32 compno; |
| 206 opj_image_t *image = 00; | 206 opj_image_t *image = 00; |
| 207 | 207 |
| 208 » image = (opj_image_t*) opj_malloc(sizeof(opj_image_t)); | 208 » image = (opj_image_t*) opj_calloc(1,sizeof(opj_image_t)); |
| 209 if (image) | 209 if (image) |
| 210 { | 210 { |
| 211 memset(image,0,sizeof(opj_image_t)); | |
| 212 | 211 |
| 213 image->color_space = clrspc; | 212 image->color_space = clrspc; |
| 214 image->numcomps = numcmpts; | 213 image->numcomps = numcmpts; |
| 215 | 214 |
| 216 /* allocate memory for the per-component information */ | 215 /* allocate memory for the per-component information */ |
| 217 » » image->comps = (opj_image_comp_t*)opj_malloc(image->numcomps * s
izeof(opj_image_comp_t)); | 216 » » image->comps = (opj_image_comp_t*)opj_calloc(image->numcomps, si
zeof(opj_image_comp_t)); |
| 218 if (!image->comps) { | 217 if (!image->comps) { |
| 219 opj_image_destroy(image); | 218 opj_image_destroy(image); |
| 220 return 00; | 219 return 00; |
| 221 } | 220 } |
| 222 memset(image->comps,0,image->numcomps * sizeof(opj_image_comp_t)
); | |
| 223 | 221 |
| 224 /* create the individual image components */ | 222 /* create the individual image components */ |
| 225 for(compno = 0; compno < numcmpts; compno++) { | 223 for(compno = 0; compno < numcmpts; compno++) { |
| 226 opj_image_comp_t *comp = &image->comps[compno]; | 224 opj_image_comp_t *comp = &image->comps[compno]; |
| 227 comp->dx = cmptparms[compno].dx; | 225 comp->dx = cmptparms[compno].dx; |
| 228 comp->dy = cmptparms[compno].dy; | 226 comp->dy = cmptparms[compno].dy; |
| 229 comp->w = cmptparms[compno].w; | 227 comp->w = cmptparms[compno].w; |
| 230 comp->h = cmptparms[compno].h; | 228 comp->h = cmptparms[compno].h; |
| 231 comp->x0 = cmptparms[compno].x0; | 229 comp->x0 = cmptparms[compno].x0; |
| 232 comp->y0 = cmptparms[compno].y0; | 230 comp->y0 = cmptparms[compno].y0; |
| 233 comp->prec = cmptparms[compno].prec; | 231 comp->prec = cmptparms[compno].prec; |
| 234 comp->sgnd = cmptparms[compno].sgnd; | 232 comp->sgnd = cmptparms[compno].sgnd; |
| 235 comp->data = 0; | 233 comp->data = 0; |
| 236 } | 234 } |
| 237 } | 235 } |
| 238 | 236 |
| 239 return image; | 237 return image; |
| 240 } | 238 } |
| OLD | NEW |