diff options
author | Anatol Belski <ab@php.net> | 2014-08-19 08:07:31 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-08-19 08:07:31 +0200 |
commit | 63d3f0b844b3a5f1c94be3c97bca29235dc2b3fc (patch) | |
tree | e561a58d6e084c5e4cbdde1f84aed16cf4724383 /ext/hash/hash.c | |
parent | 1e8273964fbd517a2eb9e560f9cdb4afffa0c034 (diff) | |
download | php-git-63d3f0b844b3a5f1c94be3c97bca29235dc2b3fc.tar.gz |
basic macro replacements, all at once
Diffstat (limited to 'ext/hash/hash.c')
-rw-r--r-- | ext/hash/hash.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ext/hash/hash.c b/ext/hash/hash.c index fe02cbe83f..dceb4d0ca8 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -436,14 +436,14 @@ PHP_FUNCTION(hash_update_stream) if ((n = php_stream_read(stream, buf, toread)) <= 0) { /* Nada mas */ - RETURN_LONG(didread); + RETURN_INT(didread); } hash->ops->hash_update(hash->context, (unsigned char *) buf, n); length -= n; didread += n; } - RETURN_LONG(didread); + RETURN_INT(didread); } /* }}} */ @@ -743,7 +743,7 @@ PHP_FUNCTION(hash_equals) RETURN_FALSE; } - if (Z_STRLEN_P(known_zval) != Z_STRLEN_P(user_zval)) { + if (Z_STRSIZE_P(known_zval) != Z_STRSIZE_P(user_zval)) { RETURN_FALSE; } @@ -751,7 +751,7 @@ PHP_FUNCTION(hash_equals) user_str = Z_STRVAL_P(user_zval); /* This is security sensitive code. Do not optimize this for speed. */ - for (j = 0; j < Z_STRLEN_P(known_zval); j++) { + for (j = 0; j < Z_STRSIZE_P(known_zval); j++) { result |= known_str[j] ^ user_str[j]; } @@ -819,7 +819,7 @@ static void mhash_init(INIT_FUNC_ARGS) } len = slprintf(buf, 127, "MHASH_%s", algorithm.mhash_name, strlen(algorithm.mhash_name)); - zend_register_long_constant(buf, len, algorithm.value, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC); + zend_register_int_constant(buf, len, algorithm.value, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC); } zend_register_internal_module(&mhash_module_entry TSRMLS_CC); } @@ -836,8 +836,8 @@ PHP_FUNCTION(mhash) } SEPARATE_ZVAL(z_algorithm); - convert_to_long_ex(z_algorithm); - algorithm = Z_LVAL_P(z_algorithm); + convert_to_int_ex(z_algorithm); + algorithm = Z_IVAL_P(z_algorithm); /* need to convert the first parameter from int constant to string algorithm name */ if (algorithm >= 0 && algorithm < MHASH_NUM_ALGOS) { @@ -884,7 +884,7 @@ PHP_FUNCTION(mhash_count) if (zend_parse_parameters_none() == FAILURE) { return; } - RETURN_LONG(MHASH_NUM_ALGOS - 1); + RETURN_INT(MHASH_NUM_ALGOS - 1); } /* }}} */ @@ -904,7 +904,7 @@ PHP_FUNCTION(mhash_get_block_size) if (algorithm_lookup.mhash_name) { const php_hash_ops *ops = php_hash_fetch_ops(algorithm_lookup.hash_name, strlen(algorithm_lookup.hash_name)); if (ops) { - RETVAL_LONG(ops->digest_size); + RETVAL_INT(ops->digest_size); } } } @@ -1044,7 +1044,7 @@ PHP_MINIT_FUNCTION(hash) PHP_HASH_HAVAL_REGISTER(5,224); PHP_HASH_HAVAL_REGISTER(5,256); - REGISTER_LONG_CONSTANT("HASH_HMAC", PHP_HASH_HMAC, CONST_CS | CONST_PERSISTENT); + REGISTER_INT_CONSTANT("HASH_HMAC", PHP_HASH_HMAC, CONST_CS | CONST_PERSISTENT); #ifdef PHP_MHASH_BC mhash_init(INIT_FUNC_ARGS_PASSTHRU); |