Skip to content

Commit 26733d1

Browse files
committed
ext/ldap: Use uint32_t type instead of int type
1 parent 2de48e1 commit 26733d1

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

ext/ldap/ldap.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -541,15 +541,14 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
541541
rc = -1;
542542
php_error_docref(NULL, E_WARNING, "Failed to allocate control value");
543543
} else {
544-
int num_attribs, i;
545544
zval* attr;
546545

547-
num_attribs = zend_hash_num_elements(Z_ARRVAL_P(tmp));
546+
uint32_t num_attribs = zend_hash_num_elements(Z_ARRVAL_P(tmp));
548547
ldap_attrs = safe_emalloc((num_attribs+1), sizeof(char *), 0);
549548
tmpstrings1 = safe_emalloc(num_attribs, sizeof(zend_string*), 0);
550549
num_tmpstrings1 = 0;
551550

552-
for (i = 0; i<num_attribs; i++) {
551+
for (uint32_t i = 0; i < num_attribs; i++) {
553552
if ((attr = zend_hash_index_find(Z_ARRVAL_P(tmp), i)) == NULL) {
554553
rc = -1;
555554
php_error_docref(NULL, E_WARNING, "Failed to encode attribute list");
@@ -582,17 +581,16 @@ static int php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, const HashT
582581
}
583582
}
584583
} else if (zend_string_equals_literal(control_oid, LDAP_CONTROL_SORTREQUEST)) {
585-
int num_keys, i;
586584
zval *sortkey, *tmp;
587585

588-
num_keys = zend_hash_num_elements(Z_ARRVAL_P(val));
586+
uint32_t num_keys = zend_hash_num_elements(Z_ARRVAL_P(val));
589587
sort_keys = safe_emalloc((num_keys+1), sizeof(LDAPSortKey*), 0);
590588
tmpstrings1 = safe_emalloc(num_keys, sizeof(zend_string*), 0);
591589
tmpstrings2 = safe_emalloc(num_keys, sizeof(zend_string*), 0);
592590
num_tmpstrings1 = 0;
593591
num_tmpstrings2 = 0;
594592

595-
for (i = 0; i<num_keys; i++) {
593+
for (uint32_t i = 0; i < num_keys; i++) {
596594
if ((sortkey = zend_hash_index_find(Z_ARRVAL_P(val), i)) == NULL) {
597595
rc = -1;
598596
php_error_docref(NULL, E_WARNING, "Failed to encode sort keys list");

0 commit comments

Comments
 (0)