mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
remove useless casts and checks
This commit is contained in:
parent
77137b56b8
commit
34e39783b1
@ -86,7 +86,7 @@ static int php_password_salt_to64(const char *str, const size_t str_len, const s
|
||||
if ((int) str_len < 0) {
|
||||
return FAILURE;
|
||||
}
|
||||
buffer = php_base64_encode((unsigned char*) str, (int) str_len);
|
||||
buffer = php_base64_encode((unsigned char*) str, str_len);
|
||||
if (buffer->len < out_len) {
|
||||
/* Too short of an encoded string generated */
|
||||
zend_string_release(buffer);
|
||||
@ -163,7 +163,7 @@ static int php_password_make_salt(size_t length, char *ret TSRMLS_DC) /* {{{ */
|
||||
efree(result);
|
||||
return FAILURE;
|
||||
}
|
||||
memcpy(ret, result, (int) length);
|
||||
memcpy(ret, result, length);
|
||||
efree(result);
|
||||
efree(buffer);
|
||||
ret[length] = 0;
|
||||
@ -182,11 +182,6 @@ PHP_FUNCTION(password_get_info)
|
||||
return;
|
||||
}
|
||||
|
||||
if (hash_len < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Supplied password hash too long to safely identify");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
array_init(&options);
|
||||
|
||||
algo = php_password_determine_algo(hash, (size_t) hash_len);
|
||||
@ -225,11 +220,6 @@ PHP_FUNCTION(password_needs_rehash)
|
||||
return;
|
||||
}
|
||||
|
||||
if (hash_len < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Supplied password hash too long to safely identify");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
algo = php_password_determine_algo(hash, (size_t) hash_len);
|
||||
|
||||
if (algo != new_algo) {
|
||||
@ -409,7 +399,7 @@ PHP_FUNCTION(password_hash)
|
||||
salt_len = required_salt_len;
|
||||
} else {
|
||||
salt = safe_emalloc(required_salt_len, 1, 1);
|
||||
memcpy(salt, buffer, (int) required_salt_len);
|
||||
memcpy(salt, buffer, required_salt_len);
|
||||
salt_len = required_salt_len;
|
||||
}
|
||||
efree(buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user