mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 13:40:54 +03:00
add calloc explanation
This commit is contained in:
parent
f09067e45e
commit
3b7923c09f
|
@ -91,7 +91,7 @@ ImagingPrecompute(int inSize, int outSize, struct filter *filterp,
|
||||||
/* determine support size (length of resampling filter) */
|
/* determine support size (length of resampling filter) */
|
||||||
support = filterp->support * filterscale;
|
support = filterp->support * filterscale;
|
||||||
|
|
||||||
/* maximum number of coofs */
|
/* maximum number of coeffs */
|
||||||
kmax = (int) ceil(support) * 2 + 1;
|
kmax = (int) ceil(support) * 2 + 1;
|
||||||
|
|
||||||
// check for overflow
|
// check for overflow
|
||||||
|
@ -102,7 +102,9 @@ ImagingPrecompute(int inSize, int outSize, struct filter *filterp,
|
||||||
if (outSize > INT_MAX / (2 * sizeof(double)))
|
if (outSize > INT_MAX / (2 * sizeof(double)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* coefficient buffer */
|
/* coefficient buffer. kmax elements for each of outSize pixels.
|
||||||
|
Only xmax number of coefficients are initialized (xmax <= kmax),
|
||||||
|
other coefficients should be 0, so we are using calloc. */
|
||||||
kk = calloc(outSize * kmax, sizeof(double));
|
kk = calloc(outSize * kmax, sizeof(double));
|
||||||
if ( ! kk)
|
if ( ! kk)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user