From: Michael Wallner Date: Sat, 26 Nov 2005 14:17:09 +0000 (+0000) Subject: - ditch warnings X-Git-Tag: RELEASE_2_0_2~69 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2563c1355386c832255b1a867429d5573bea5150;p=php - ditch warnings --- diff --git a/ext/hash/hash_ripemd.c b/ext/hash/hash_ripemd.c index bccbe1fdd7..c0ac60dba8 100644 --- a/ext/hash/hash_ripemd.c +++ b/ext/hash/hash_ripemd.c @@ -359,14 +359,14 @@ PHP_HASH_API void PHP_RIPEMD128Final(unsigned char digest[16], PHP_RIPEMD128_CTX unsigned int index, padLen; /* Save number of bits */ - bits[0] = context->count[0] & 0xFF; - bits[1] = (context->count[0] >> 8) & 0xFF; - bits[2] = (context->count[0] >> 16) & 0xFF; - bits[3] = (context->count[0] >> 24) & 0xFF; - bits[4] = context->count[1] & 0xFF; - bits[5] = (context->count[1] >> 8) & 0xFF; - bits[6] = (context->count[1] >> 16) & 0xFF; - bits[7] = (context->count[1] >> 24) & 0xFF; + bits[0] = (unsigned char) (context->count[0] & 0xFF); + bits[1] = (unsigned char) ((context->count[0] >> 8) & 0xFF); + bits[2] = (unsigned char) ((context->count[0] >> 16) & 0xFF); + bits[3] = (unsigned char) ((context->count[0] >> 24) & 0xFF); + bits[4] = (unsigned char) (context->count[1] & 0xFF); + bits[5] = (unsigned char) ((context->count[1] >> 8) & 0xFF); + bits[6] = (unsigned char) ((context->count[1] >> 16) & 0xFF); + bits[7] = (unsigned char) ((context->count[1] >> 24) & 0xFF); /* Pad out to 56 mod 64. */ @@ -396,14 +396,14 @@ PHP_HASH_API void PHP_RIPEMD160Final(unsigned char digest[20], PHP_RIPEMD160_CTX unsigned int index, padLen; /* Save number of bits */ - bits[0] = context->count[0] & 0xFF; - bits[1] = (context->count[0] >> 8) & 0xFF; - bits[2] = (context->count[0] >> 16) & 0xFF; - bits[3] = (context->count[0] >> 24) & 0xFF; - bits[4] = context->count[1] & 0xFF; - bits[5] = (context->count[1] >> 8) & 0xFF; - bits[6] = (context->count[1] >> 16) & 0xFF; - bits[7] = (context->count[1] >> 24) & 0xFF; + bits[0] = (unsigned char) (context->count[0] & 0xFF); + bits[1] = (unsigned char) ((context->count[0] >> 8) & 0xFF); + bits[2] = (unsigned char) ((context->count[0] >> 16) & 0xFF); + bits[3] = (unsigned char) ((context->count[0] >> 24) & 0xFF); + bits[4] = (unsigned char) (context->count[1] & 0xFF); + bits[5] = (unsigned char) ((context->count[1] >> 8) & 0xFF); + bits[6] = (unsigned char) ((context->count[1] >> 16) & 0xFF); + bits[7] = (unsigned char) ((context->count[1] >> 24) & 0xFF); /* Pad out to 56 mod 64. */ diff --git a/ext/hash/hash_sha.c b/ext/hash/hash_sha.c index b6d9e89bcb..25d69887a0 100644 --- a/ext/hash/hash_sha.c +++ b/ext/hash/hash_sha.c @@ -553,14 +553,14 @@ PHP_HASH_API void PHP_SHA256Final(unsigned char digest[32], PHP_SHA256_CTX * con unsigned int index, padLen; /* Save number of bits */ - bits[7] = context->count[0] & 0xFF; - bits[6] = (context->count[0] >> 8) & 0xFF; - bits[5] = (context->count[0] >> 16) & 0xFF; - bits[4] = (context->count[0] >> 24) & 0xFF; - bits[3] = context->count[1] & 0xFF; - bits[2] = (context->count[1] >> 8) & 0xFF; - bits[1] = (context->count[1] >> 16) & 0xFF; - bits[0] = (context->count[1] >> 24) & 0xFF; + bits[7] = (unsigned char) (context->count[0] & 0xFF); + bits[6] = (unsigned char) ((context->count[0] >> 8) & 0xFF); + bits[5] = (unsigned char) ((context->count[0] >> 16) & 0xFF); + bits[4] = (unsigned char) ((context->count[0] >> 24) & 0xFF); + bits[3] = (unsigned char) (context->count[1] & 0xFF); + bits[2] = (unsigned char) ((context->count[1] >> 8) & 0xFF); + bits[1] = (unsigned char) ((context->count[1] >> 16) & 0xFF); + bits[0] = (unsigned char) ((context->count[1] >> 24) & 0xFF); /* Pad out to 56 mod 64. */ diff --git a/ext/hash/hash_whirlpool.c b/ext/hash/hash_whirlpool.c index 2646560715..f5f8e81bd5 100644 --- a/ext/hash/hash_whirlpool.c +++ b/ext/hash/hash_whirlpool.c @@ -321,7 +321,7 @@ PHP_HASH_API void PHP_WHIRLPOOLUpdate(PHP_WHIRLPOOL_CTX *context, const unsigned */ bufferBits = bufferPos = 0; } - buffer[bufferPos] = b << (8 - bufferRem); + buffer[bufferPos] = (unsigned char) (b << (8 - bufferRem)); bufferBits += bufferRem; /* * proceed to remaining data: @@ -346,7 +346,7 @@ PHP_HASH_API void PHP_WHIRLPOOLUpdate(PHP_WHIRLPOOL_CTX *context, const unsigned * all remaining data fits on buffer[bufferPos], * and there still remains some space. */ - bufferBits += sourceBits; + bufferBits += (int) sourceBits; } else { /* * buffer[bufferPos] is full: @@ -367,7 +367,7 @@ PHP_HASH_API void PHP_WHIRLPOOLUpdate(PHP_WHIRLPOOL_CTX *context, const unsigned */ bufferBits = bufferPos = 0; } - buffer[bufferPos] = b << (8 - bufferRem); + buffer[bufferPos] = (unsigned char) (b << (8 - bufferRem)); bufferBits += (int)sourceBits; } context->buffer.bits = bufferBits; diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h index 9e9a27ffaf..999cfc651b 100644 --- a/ext/hash/php_hash.h +++ b/ext/hash/php_hash.h @@ -30,9 +30,9 @@ #define PHP_HASH_HMAC 0x0001 -typedef int (*php_hash_init_func_t)(void *context); -typedef int (*php_hash_update_func_t)(void *context, const unsigned char *buf, unsigned int count); -typedef int (*php_hash_final_func_t)(unsigned char *digest, void *context); +typedef void (*php_hash_init_func_t)(void *context); +typedef void (*php_hash_update_func_t)(void *context, const unsigned char *buf, unsigned int count); +typedef void (*php_hash_final_func_t)(unsigned char *digest, void *context); typedef struct _php_hash_ops { php_hash_init_func_t hash_init; diff --git a/ext/hash/php_hash_types.h b/ext/hash/php_hash_types.h index 869a121c57..6d70fb1ff7 100644 --- a/ext/hash/php_hash_types.h +++ b/ext/hash/php_hash_types.h @@ -1,3 +1,20 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2005 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.0 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_0.txt. | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Michael Wallner | + +----------------------------------------------------------------------+ +*/ /* $Id$ */ @@ -8,7 +25,7 @@ #include "config.h" #endif -#ifndef _MSC_VER +#ifndef PHP_WIN32 #if SIZEOF_LONG == 8 #define L64(x) x typedef unsigned long php_hash_uint64; @@ -29,6 +46,8 @@ typedef unsigned long php_hash_uint32; #else #error "Need a 32bit integer type" #endif +#else +#error "Need a 64bit integer type" #endif #else #define L64(x) x##i64 @@ -38,3 +57,11 @@ typedef unsigned __int32 php_hash_uint32; #endif +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=4 fdm=marker + * vim<600: sw=4 ts=4 + */