summaryrefslogtreecommitdiff
path: root/ext/standard/sha1.c
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2014-09-28 21:30:49 +0200
committerNikita Popov <nikic@php.net>2014-09-29 20:57:17 +0200
commit142a01db92100f65ab13995236b327e71eaa39b2 (patch)
treebfbc1d0b88c825a0d85f54e4d0f4690294476473 /ext/standard/sha1.c
parente46187daf57f02bceeb8fd56abdd8c8f185cc9aa (diff)
downloadphp-git-142a01db92100f65ab13995236b327e71eaa39b2.tar.gz
Fix a couple compile warnings
Diffstat (limited to 'ext/standard/sha1.c')
-rw-r--r--ext/standard/sha1.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/ext/standard/sha1.c b/ext/standard/sha1.c
index cd8b82f5e1..249828fb3d 100644
--- a/ext/standard/sha1.c
+++ b/ext/standard/sha1.c
@@ -46,10 +46,10 @@ PHP_FUNCTION(sha1)
sha1str[0] = '\0';
PHP_SHA1Init(&context);
- PHP_SHA1Update(&context, arg->val, arg->len);
+ PHP_SHA1Update(&context, (unsigned char *) arg->val, arg->len);
PHP_SHA1Final(digest, &context);
if (raw_output) {
- RETURN_STRINGL(digest, 20);
+ RETURN_STRINGL((char *) digest, 20);
} else {
make_digest_ex(sha1str, digest, 20);
RETVAL_STRING(sha1str);
@@ -71,7 +71,7 @@ PHP_FUNCTION(sha1_file)
unsigned char buf[1024];
unsigned char digest[20];
PHP_SHA1_CTX context;
- int n;
+ size_t n;
php_stream *stream;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|b", &arg, &arg_len, &raw_output) == FAILURE) {
@@ -85,7 +85,7 @@ PHP_FUNCTION(sha1_file)
PHP_SHA1Init(&context);
- while ((n = php_stream_read(stream, buf, sizeof(buf))) > 0) {
+ while ((n = php_stream_read(stream, (char *) buf, sizeof(buf))) > 0) {
PHP_SHA1Update(&context, buf, n);
}
@@ -93,12 +93,8 @@ PHP_FUNCTION(sha1_file)
php_stream_close(stream);
- if (n<0) {
- RETURN_FALSE;
- }
-
if (raw_output) {
- RETURN_STRINGL(digest, 20);
+ RETURN_STRINGL((char *) digest, 20);
} else {
make_digest_ex(sha1str, digest, 20);
RETVAL_STRING(sha1str);