]> granicus.if.org Git - php/commitdiff
- ditch warnings
authorMichael Wallner <mike@php.net>
Sat, 26 Nov 2005 14:17:09 +0000 (14:17 +0000)
committerMichael Wallner <mike@php.net>
Sat, 26 Nov 2005 14:17:09 +0000 (14:17 +0000)
ext/hash/hash_ripemd.c
ext/hash/hash_sha.c
ext/hash/hash_whirlpool.c
ext/hash/php_hash.h
ext/hash/php_hash_types.h

index bccbe1fdd7d8041997efb002a453c5c88aeaeaaf..c0ac60dba85f73da7ac3da62309010cbdab228bc 100644 (file)
@@ -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.
         */
index b6d9e89bcbe9df3526c68dc0342ee821b62bce4a..25d69887a056bfe038e3168634fba91d0ddb8b34 100644 (file)
@@ -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.
         */
index 2646560715ae1aa6bf593736d76afa525e83e001..f5f8e81bd57189ae6acf3eeab80f217bd11c80fe 100644 (file)
@@ -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;
index 9e9a27ffafb28856c3a220ac86c4c1662964e89c..999cfc651bf2fa2e7174aaa0cd27ff6fbf30207b 100644 (file)
@@ -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;
index 869a121c575fc27c83f667e9dc5aff74809f152e..6d70fb1ff7f12a87690b4872f3e76e8f3550df35 100644 (file)
@@ -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 <mike@php.net>                               |
+   +----------------------------------------------------------------------+
+*/
 
 /* $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
+ */