summaryrefslogtreecommitdiff
path: root/ext/hash
diff options
context:
space:
mode:
authorScott MacVicar <scottmac@php.net>2008-07-05 00:28:16 +0000
committerScott MacVicar <scottmac@php.net>2008-07-05 00:28:16 +0000
commita164217bf292fd8a5385ab20b12f4511ee2027bd (patch)
tree336543c00ccb9298c3ac22bbea863103ebc49852 /ext/hash
parent581c48c2a09263f58903ed5f5c615393bec46a62 (diff)
downloadphp-git-a164217bf292fd8a5385ab20b12f4511ee2027bd.tar.gz
Fix break caused by previous commit, warning and remove zend_get_parameters()
Diffstat (limited to 'ext/hash')
-rw-r--r--ext/hash/hash.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 03a69cc005..6d7c33b035 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -620,30 +620,26 @@ static void mhash_init(INIT_FUNC_ARGS)
}
len = slprintf(buf, 127, "MHASH_%s", algorithm.mhash_name, strlen(algorithm.mhash_name));
- {
- char name[128];
- memcpy(name, buf, len+1);
- REGISTER_LONG_CONSTANT(name, algorithm.value, CONST_CS | CONST_PERSISTENT);
- }
+ zend_register_long_constant(buf, len + 1, algorithm.value, CONST_CS | CONST_PERSISTENT, module_number TSRMLS_CC);
}
}
PHP_FUNCTION(mhash)
{
- zval **z_algorithm;
+ zval *z_algorithm;
int algorithm;
- if (ZEND_NUM_ARGS() == 0 || zend_get_parameters_ex(1, &z_algorithm) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(1 TSRMLS_CC, "z", &z_algorithm) == FAILURE) {
+ return;
}
- algorithm = Z_LVAL_PP(z_algorithm);
+ algorithm = Z_LVAL_P(z_algorithm);
/* need to conver the first parameter from int to string */
if (algorithm >= 0 && algorithm < MHASH_NUM_ALGOS) {
struct mhash_bc_entry algorithm_lookup = mhash_to_hash[algorithm];
if (algorithm_lookup.hash_name) {
- ZVAL_STRING(*z_algorithm, algorithm_lookup.hash_name, 1);
+ ZVAL_STRING(z_algorithm, algorithm_lookup.hash_name, 1);
}
}
@@ -754,8 +750,8 @@ PHP_FUNCTION(mhash_keygen_s2k)
ops->hash_update(context, &null, 1);
}
ops->hash_update(context, (unsigned char *)padded_salt, salt_len);
- ops->hash_update(context, password, password_len);
- ops->hash_final(digest, context);
+ ops->hash_update(context, (unsigned char *)password, password_len);
+ ops->hash_final((unsigned char *)digest, context);
memcpy( &key[i*block_size], digest, block_size);
}