Skip to content

Commit 9491c68

Browse files
committed
ext/gd: Use uint32_t type instead of int type
1 parent 80ea28e commit 9491c68

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

ext/gd/gd.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3712,7 +3712,7 @@ PHP_FUNCTION(imageconvolution)
37123712
zval *var = NULL, *var2 = NULL;
37133713
gdImagePtr im_src = NULL;
37143714
double div, offset;
3715-
int nelem, i, j, res;
3715+
int i, j, res;
37163716
float matrix[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}};
37173717

37183718
ZEND_PARSE_PARAMETERS_START(4, 4)
@@ -3724,8 +3724,7 @@ PHP_FUNCTION(imageconvolution)
37243724

37253725
im_src = php_gd_libgdimageptr_from_zval_p(SIM);
37263726

3727-
nelem = zend_hash_num_elements(Z_ARRVAL_P(hash_matrix));
3728-
if (nelem != 3) {
3727+
if (zend_hash_num_elements(Z_ARRVAL_P(hash_matrix)) != 3) {
37293728
zend_argument_value_error(2, "must be a 3x3 array");
37303729
RETURN_THROWS();
37313730
}
@@ -4045,7 +4044,6 @@ PHP_FUNCTION(imageaffine)
40454044
zval *z_affine;
40464045
zval *tmp;
40474046
double affine[6];
4048-
int i, nelems;
40494047
zval *zval_affine_elem = NULL;
40504048

40514049
ZEND_PARSE_PARAMETERS_START(2, 3)
@@ -4057,13 +4055,13 @@ PHP_FUNCTION(imageaffine)
40574055

40584056

40594057
src = php_gd_libgdimageptr_from_zval_p(IM);
4060-
4061-
if ((nelems = zend_hash_num_elements(Z_ARRVAL_P(z_affine))) != 6) {
4058+
uint32_t nelems = zend_hash_num_elements(Z_ARRVAL_P(z_affine));
4059+
if (nelems != 6) {
40624060
zend_argument_value_error(2, "must have 6 elements");
40634061
RETURN_THROWS();
40644062
}
40654063

4066-
for (i = 0; i < nelems; i++) {
4064+
for (uint32_t i = 0; i < nelems; i++) {
40674065
if ((zval_affine_elem = zend_hash_index_find_deref(Z_ARRVAL_P(z_affine), i)) != NULL) {
40684066
switch (Z_TYPE_P(zval_affine_elem)) {
40694067
case IS_LONG:

0 commit comments

Comments
 (0)