nlopess         Mon Jan  8 22:29:26 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/hash   hash.c hash_adler32.c hash_crc32.c hash_gost.c 
                        hash_haval.c hash_md.c hash_ripemd.c hash_salsa.c 
                        hash_sha.c hash_snefru.c hash_tiger.c 
                        hash_whirlpool.c php_hash.h 
  Log:
  make the hash_ops structures const and save some memory
  # ram memory is so expensive these days...
  
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash.c?r1=1.18.2.5.2.5&r2=1.18.2.5.2.6&diff_format=u
Index: php-src/ext/hash/hash.c
diff -u php-src/ext/hash/hash.c:1.18.2.5.2.5 
php-src/ext/hash/hash.c:1.18.2.5.2.6
--- php-src/ext/hash/hash.c:1.18.2.5.2.5        Mon Jan  1 09:36:01 2007
+++ php-src/ext/hash/hash.c     Mon Jan  8 22:29:25 2007
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: hash.c,v 1.18.2.5.2.5 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: hash.c,v 1.18.2.5.2.6 2007/01/08 22:29:25 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -37,7 +37,7 @@
 
 /* Hash Registry Access */
 
-PHP_HASH_API php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len)
+PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int 
algo_len)
 {
        php_hash_ops *ops;
        char *lower = estrndup(algo, algo_len);
@@ -51,13 +51,13 @@
        return ops;
 }
 
-PHP_HASH_API void php_hash_register_algo(const char *algo, php_hash_ops *ops)
+PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops 
*ops)
 {
        int algo_len = strlen(algo);
        char *lower = estrndup(algo, algo_len);
        
        zend_str_tolower(lower, algo_len);
-       zend_hash_add(&php_hash_hashtable, lower, algo_len + 1, ops, 
sizeof(php_hash_ops), NULL);
+       zend_hash_add(&php_hash_hashtable, lower, algo_len + 1, (void*)ops, 
sizeof(php_hash_ops), NULL);
        efree(lower);
 }
 
@@ -68,7 +68,7 @@
        char *algo, *data, *digest;
        int algo_len, data_len;
        zend_bool raw_output = 0;
-       php_hash_ops *ops;
+       const php_hash_ops *ops;
        void *context;
        php_stream *stream = NULL;
 
@@ -142,7 +142,7 @@
        char *algo, *data, *digest, *key, *K;
        int algo_len, data_len, key_len, i;
        zend_bool raw_output = 0;
-       php_hash_ops *ops;
+       const php_hash_ops *ops;
        void *context;
        php_stream *stream = NULL;
 
@@ -255,7 +255,7 @@
        int algo_len, key_len = 0, argc = ZEND_NUM_ARGS();
        long options = 0;
        void *context;
-       php_hash_ops *ops;
+       const php_hash_ops *ops;
        php_hash_data *hash;
 
        if (zend_parse_parameters(argc TSRMLS_CC, "s|ls", &algo, &algo_len, 
&options, &key, &key_len) == FAILURE) {
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_adler32.c?r1=1.3.2.4.2.1&r2=1.3.2.4.2.2&diff_format=u
Index: php-src/ext/hash/hash_adler32.c
diff -u php-src/ext/hash/hash_adler32.c:1.3.2.4.2.1 
php-src/ext/hash/hash_adler32.c:1.3.2.4.2.2
--- php-src/ext/hash/hash_adler32.c:1.3.2.4.2.1 Mon Jan  1 09:36:01 2007
+++ php-src/ext/hash/hash_adler32.c     Mon Jan  8 22:29:25 2007
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: hash_adler32.c,v 1.3.2.4.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: hash_adler32.c,v 1.3.2.4.2.2 2007/01/08 22:29:25 nlopess Exp $ */
 
 #include "php_hash.h"
 #include "php_hash_adler32.h"
@@ -49,7 +49,7 @@
        context->state = 0;
 }
 
-php_hash_ops php_hash_adler32_ops = {
+const php_hash_ops php_hash_adler32_ops = {
        (php_hash_init_func_t) PHP_ADLER32Init,
        (php_hash_update_func_t) PHP_ADLER32Update,
        (php_hash_final_func_t) PHP_ADLER32Final,
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_crc32.c?r1=1.2.2.3.2.1&r2=1.2.2.3.2.2&diff_format=u
Index: php-src/ext/hash/hash_crc32.c
diff -u php-src/ext/hash/hash_crc32.c:1.2.2.3.2.1 
php-src/ext/hash/hash_crc32.c:1.2.2.3.2.2
--- php-src/ext/hash/hash_crc32.c:1.2.2.3.2.1   Mon Jan  1 09:36:01 2007
+++ php-src/ext/hash/hash_crc32.c       Mon Jan  8 22:29:25 2007
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: hash_crc32.c,v 1.2.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: hash_crc32.c,v 1.2.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
 
 #include "php_hash.h"
 #include "php_hash_crc32.h"
@@ -56,7 +56,7 @@
        context->state = 0;
 }
 
-php_hash_ops php_hash_crc32_ops = {
+const php_hash_ops php_hash_crc32_ops = {
        (php_hash_init_func_t) PHP_CRC32Init,
        (php_hash_update_func_t) PHP_CRC32Update,
        (php_hash_final_func_t) PHP_CRC32Final,
@@ -65,7 +65,7 @@
        sizeof(PHP_CRC32_CTX)
 };
 
-php_hash_ops php_hash_crc32b_ops = {
+const php_hash_ops php_hash_crc32b_ops = {
        (php_hash_init_func_t) PHP_CRC32Init,
        (php_hash_update_func_t) PHP_CRC32BUpdate,
        (php_hash_final_func_t) PHP_CRC32Final,
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_gost.c?r1=1.2.2.3.2.1&r2=1.2.2.3.2.2&diff_format=u
Index: php-src/ext/hash/hash_gost.c
diff -u php-src/ext/hash/hash_gost.c:1.2.2.3.2.1 
php-src/ext/hash/hash_gost.c:1.2.2.3.2.2
--- php-src/ext/hash/hash_gost.c:1.2.2.3.2.1    Mon Jan  1 09:36:01 2007
+++ php-src/ext/hash/hash_gost.c        Mon Jan  8 22:29:25 2007
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: hash_gost.c,v 1.2.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: hash_gost.c,v 1.2.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
 
 #include "php_hash.h"
 #include "php_hash_gost.h"
@@ -302,7 +302,7 @@
        memset(context, 0, sizeof(*context));
 }
 
-php_hash_ops php_hash_gost_ops = {
+const php_hash_ops php_hash_gost_ops = {
        (php_hash_init_func_t) PHP_GOSTInit,
        (php_hash_update_func_t) PHP_GOSTUpdate,
        (php_hash_final_func_t) PHP_GOSTFinal,
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_haval.c?r1=1.4.2.3.2.1&r2=1.4.2.3.2.2&diff_format=u
Index: php-src/ext/hash/hash_haval.c
diff -u php-src/ext/hash/hash_haval.c:1.4.2.3.2.1 
php-src/ext/hash/hash_haval.c:1.4.2.3.2.2
--- php-src/ext/hash/hash_haval.c:1.4.2.3.2.1   Mon Jan  1 09:36:01 2007
+++ php-src/ext/hash/hash_haval.c       Mon Jan  8 22:29:25 2007
@@ -16,12 +16,12 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: hash_haval.c,v 1.4.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: hash_haval.c,v 1.4.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
 
 #include "php_hash.h"
 #include "php_hash_haval.h"
 
-static unsigned char PADDING[128] ={
+static const unsigned char PADDING[128] ={
        1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -31,67 +31,67 @@
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
 
-static php_hash_uint32 D0[8] = {
+static const php_hash_uint32 D0[8] = {
        0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344, 0xA4093822, 0x299F31D0, 
0x082EFA98, 0xEC4E6C89 };
 
-static php_hash_uint32 K2[32] = {
+static const php_hash_uint32 K2[32] = {
        0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C, 0xC0AC29B7, 0xC97C50DD, 
0x3F84D5B5, 0xB5470917,
        0x9216D5D9, 0x8979FB1B, 0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7, 
0xB8E1AFED, 0x6A267E96,
        0xBA7C9045, 0xF12C7F99, 0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16, 
0x636920D8, 0x71574E69,
        0xA458FEA3, 0xF4933D7E, 0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE, 
0x7B54A41D, 0xC25A59B5 };
 
-static php_hash_uint32 K3[32] = {
+static const php_hash_uint32 K3[32] = {
        0x9C30D539, 0x2AF26013, 0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF, 
0x8E79DCB0, 0x603A180E,
        0x6C9E0E8B, 0xB01E8A3E, 0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60, 
0xE65525F3, 0xAA55AB94,
        0x57489862, 0x63E81440, 0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE, 
0xA15486AF, 0x7C72E993,
        0xB3EE1411, 0x636FBC2A, 0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E, 
0xAFD6BA33, 0x6C24CF5C };
 
-static php_hash_uint32 K4[32] = {
+static const php_hash_uint32 K4[32] = {
        0x7A325381, 0x28958677, 0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193, 
0x61D809CC, 0xFB21A991,
        0x487CAC60, 0x5DEC8032, 0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88, 
0x23893E81, 0xD396ACC5,
        0x0F6D6FF3, 0x83F44239, 0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E, 
0x21C66842, 0xF6E96C9A,
        0x670C9C61, 0xABD388F0, 0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3, 
0x6EEF0B6C, 0x137A3BE4 };
 
-static php_hash_uint32 K5[32] = {
+static const php_hash_uint32 K5[32] = {
        0xBA3BF050, 0x7EFB2A98, 0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88, 
0x8CEE8619, 0x456F9FB4,
        0x7D84A5C3, 0x3B8B5EBE, 0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6, 
0x4ED3AA62, 0x363F7706,
        0x1BFEDF72, 0x429B023D, 0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B, 
0x075372C9, 0x80991B7B,
        0x25D479D8, 0xF6E8DEF7, 0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA, 
0xC1A94FB6, 0x409F60C4 };
 
-static short I2[32] = {         5, 14, 26, 18, 11, 28,  7, 16,  0, 23, 20, 22, 
 1, 10,  4,  8,
+static const short I2[32] = {   5, 14, 26, 18, 11, 28,  7, 16,  0, 23, 20, 22, 
 1, 10,  4,  8,
                                                30,  3, 21,  9, 17, 24, 29,  6, 
19, 12, 15, 13,  2, 25, 31, 27 };
 
-static short I3[32] = {        19,  9,  4, 20, 28, 17,  8, 22, 29, 14, 25, 12, 
24, 30, 16, 26,
+static const short I3[32] = {  19,  9,  4, 20, 28, 17,  8, 22, 29, 14, 25, 12, 
24, 30, 16, 26,
                                                31, 15,  7,  3,  1,  0, 18, 27, 
13,  6, 21, 10, 23, 11,  5,  2 };
 
-static short I4[32] = {        24,  4,  0, 14,  2,  7, 28, 23, 26,  6, 30, 20, 
18, 25, 19,  3,
+static const short I4[32] = {  24,  4,  0, 14,  2,  7, 28, 23, 26,  6, 30, 20, 
18, 25, 19,  3,
                                                22, 11, 31, 21,  8, 27, 12,  9, 
 1, 29,  5, 15, 17, 10, 16, 13 };
 
-static short I5[32] = {        27,  3, 21, 26, 17, 11, 20, 29, 19,  0, 12,  7, 
13,  8, 31, 10,
+static const short I5[32] = {  27,  3, 21, 26, 17, 11, 20, 29, 19,  0, 12,  7, 
13,  8, 31, 10,
                                                 5,  9, 14, 30, 18,  6, 28, 24, 
 2, 23, 16, 22,  4,  1, 25, 15 };
 
-static short M0[32] = {        0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1,
+static const short M0[32] = {  0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1,
                                                0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 
6, 5, 4, 3, 2, 1 };
 
-static short M1[32] = {        1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2,
+static const short M1[32] = {  1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2,
                                                1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 
7, 6, 5, 4, 3, 2 };
 
-static short M2[32] = {        2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3,
+static const short M2[32] = {  2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3,
                                                2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 
0, 7, 6, 5, 4, 3 };
 
-static short M3[32] = {        3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4,
+static const short M3[32] = {  3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4,
                                                3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 
1, 0, 7, 6, 5, 4 };
 
-static short M4[32] = {        4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5,
+static const short M4[32] = {  4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5,
                                                4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 
2, 1, 0, 7, 6, 5 };
 
-static short M5[32] = {        5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6,
+static const short M5[32] = {  5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7, 6,
                                                5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 
3, 2, 1, 0, 7, 6 };
 
-static short M6[32] = {        6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7,
+static const short M6[32] = {  6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0, 7,
                                                6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 
4, 3, 2, 1, 0, 7 };
 
-static short M7[32] = {        7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0,
+static const short M7[32] = {  7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 5, 4, 3, 2, 1, 0,
                                                7, 6, 5, 4, 3, 2, 1, 0, 7, 6, 
5, 4, 3, 2, 1, 0 };
 
 /* {{{ Encode
@@ -250,7 +250,7 @@
 /* }}} */
 
 #define PHP_HASH_HAVAL_INIT(p,b) \
-php_hash_ops php_hash_##p##haval##b##_ops = { \
+const php_hash_ops php_hash_##p##haval##b##_ops = { \
        (php_hash_init_func_t) PHP_##p##HAVAL##b##Init, \
        (php_hash_update_func_t) PHP_HAVALUpdate, \
        (php_hash_final_func_t) PHP_HAVAL##b##Final, \
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_md.c?r1=1.6.2.4.2.2&r2=1.6.2.4.2.3&diff_format=u
Index: php-src/ext/hash/hash_md.c
diff -u php-src/ext/hash/hash_md.c:1.6.2.4.2.2 
php-src/ext/hash/hash_md.c:1.6.2.4.2.3
--- php-src/ext/hash/hash_md.c:1.6.2.4.2.2      Mon Jan  1 09:36:01 2007
+++ php-src/ext/hash/hash_md.c  Mon Jan  8 22:29:25 2007
@@ -16,12 +16,12 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: hash_md.c,v 1.6.2.4.2.2 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: hash_md.c,v 1.6.2.4.2.3 2007/01/08 22:29:25 nlopess Exp $ */
 
 #include "php_hash.h"
 #include "php_hash_md.h"
 
-php_hash_ops php_hash_md5_ops = {
+const php_hash_ops php_hash_md5_ops = {
        (php_hash_init_func_t) PHP_MD5Init,
        (php_hash_update_func_t) PHP_MD5Update,
        (php_hash_final_func_t) PHP_MD5Final,
@@ -30,7 +30,7 @@
        sizeof(PHP_MD5_CTX)
 };
 
-php_hash_ops php_hash_md4_ops = {
+const php_hash_ops php_hash_md4_ops = {
        (php_hash_init_func_t) PHP_MD4Init,
        (php_hash_update_func_t) PHP_MD4Update,
        (php_hash_final_func_t) PHP_MD4Final,
@@ -39,7 +39,7 @@
        sizeof(PHP_MD4_CTX)
 };
 
-php_hash_ops php_hash_md2_ops = {
+const php_hash_ops php_hash_md2_ops = {
        (php_hash_init_func_t) PHP_MD2Init,
        (php_hash_update_func_t) PHP_MD2Update,
        (php_hash_final_func_t) PHP_MD2Final,
@@ -50,7 +50,7 @@
 
 /* MD common stuff */
 
-static unsigned char PADDING[64] =
+static const unsigned char PADDING[64] =
 {
        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -590,7 +590,7 @@
 
 /* MD2 */
 
-static unsigned char MD2_S[256] = {
+static const unsigned char MD2_S[256] = {
         41,  46,  67, 201, 162, 216, 124,   1,  61,  54,  84, 161, 236, 240,   
6,  19,
         98, 167,   5, 243, 192, 199, 115, 140, 152, 147,  43, 217, 188,  76, 
130, 202,
         30, 155,  87,  60, 253, 212, 224,  22, 103,  66, 111,  24, 138,  23, 
229,  18,
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_ripemd.c?r1=1.5.2.3.2.2&r2=1.5.2.3.2.3&diff_format=u
Index: php-src/ext/hash/hash_ripemd.c
diff -u php-src/ext/hash/hash_ripemd.c:1.5.2.3.2.2 
php-src/ext/hash/hash_ripemd.c:1.5.2.3.2.3
--- php-src/ext/hash/hash_ripemd.c:1.5.2.3.2.2  Mon Jan  1 09:36:01 2007
+++ php-src/ext/hash/hash_ripemd.c      Mon Jan  8 22:29:25 2007
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: hash_ripemd.c,v 1.5.2.3.2.2 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: hash_ripemd.c,v 1.5.2.3.2.3 2007/01/08 22:29:25 nlopess Exp $ */
 
 /* Heavily borrowed from md5.c & sha1.c of PHP archival fame
    Note that ripemd laughs in the face of logic and uses
@@ -25,7 +25,7 @@
 #include "php_hash.h"
 #include "php_hash_ripemd.h"
 
-php_hash_ops php_hash_ripemd128_ops = {
+const php_hash_ops php_hash_ripemd128_ops = {
        (php_hash_init_func_t) PHP_RIPEMD128Init,
        (php_hash_update_func_t) PHP_RIPEMD128Update,
        (php_hash_final_func_t) PHP_RIPEMD128Final,
@@ -34,7 +34,7 @@
        sizeof(PHP_RIPEMD128_CTX)
 };
 
-php_hash_ops php_hash_ripemd160_ops = {
+const php_hash_ops php_hash_ripemd160_ops = {
        (php_hash_init_func_t) PHP_RIPEMD160Init,
        (php_hash_update_func_t) PHP_RIPEMD160Update,
        (php_hash_final_func_t) PHP_RIPEMD160Final,
@@ -43,7 +43,7 @@
        sizeof(PHP_RIPEMD160_CTX)
 };
 
-php_hash_ops php_hash_ripemd256_ops = {
+const php_hash_ops php_hash_ripemd256_ops = {
        (php_hash_init_func_t) PHP_RIPEMD256Init,
        (php_hash_update_func_t) PHP_RIPEMD256Update,
        (php_hash_final_func_t) PHP_RIPEMD256Final,
@@ -52,7 +52,7 @@
        sizeof(PHP_RIPEMD256_CTX)
 };
 
-php_hash_ops php_hash_ripemd320_ops = {
+const php_hash_ops php_hash_ripemd320_ops = {
        (php_hash_init_func_t) PHP_RIPEMD320Init,
        (php_hash_update_func_t) PHP_RIPEMD320Update,
        (php_hash_final_func_t) PHP_RIPEMD320Final,
@@ -139,36 +139,36 @@
 #define F3(x,y,z)              (((x) & (z)) | ((y) & (~(z))))
 #define F4(x,y,z)              ((x) ^ ((y) | (~(z))))
 
-static php_hash_uint32 K_values[5]  = { 0x00000000, 0x5A827999, 0x6ED9EBA1, 
0x8F1BBCDC, 0xA953FD4E };    /* 128, 256, 160, 320 */
-static php_hash_uint32 KK_values[4] = { 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 
0x00000000 };                /* 128 & 256 */
-static php_hash_uint32 KK160_values[5] = { 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 
0x7A6D76E9, 0x00000000 }; /* 160 & 320 */
+static const php_hash_uint32 K_values[5]  = { 0x00000000, 0x5A827999, 
0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E };    /* 128, 256, 160, 320 */
+static const php_hash_uint32 KK_values[4] = { 0x50A28BE6, 0x5C4DD124, 
0x6D703EF3, 0x00000000 };                /* 128 & 256 */
+static const php_hash_uint32 KK160_values[5] = { 0x50A28BE6, 0x5C4DD124, 
0x6D703EF3, 0x7A6D76E9, 0x00000000 }; /* 160 & 320 */
 
 #define K(n)  K_values[ (n) >> 4]
 #define KK(n) KK_values[(n) >> 4]
 #define KK160(n) KK160_values[(n) >> 4]
 
-static unsigned char R[80] = {
+static const unsigned char R[80] = {
         0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
         7,  4, 13,  1, 10,  6, 15,  3, 12,  0,  9,  5,  2, 14, 11,  8,
         3, 10, 14,  4,  9, 15,  8,  1,  2,  7,  0,  6, 13, 11,  5, 12,
         1,  9, 11, 10,  0,  8, 12,  4, 13,  3,  7, 15, 14,  5,  6,  2,
         4,  0,  5,  9,  7, 12,  2, 10, 14,  1,  3,  8, 11,  6, 15, 13 };
 
-static unsigned char RR[80] = {
+static const unsigned char RR[80] = {
         5, 14,  7,  0,  9,  2, 11,  4, 13,  6, 15,  8,  1, 10,  3, 12,
         6, 11,  3,  7,  0, 13,  5, 10, 14, 15,  8, 12,  4,  9,  1,  2,
        15,  5,  1,  3,  7, 14,  6,  9, 11,  8, 12,  2, 10,  0,  4, 13,
         8,  6,  4,  1,  3, 11, 15,  0,  5, 12,  2, 13,  9,  7, 10, 14,
        12, 15, 10,  4,  1,  5,  8,  7,  6,  2, 13, 14,  0,  3,  9, 11 };
 
-static unsigned char S[80] = {
+static const unsigned char S[80] = {
        11, 14, 15, 12,  5,  8,  7,  9, 11, 13, 14, 15,  6,  7,  9,  8,
         7,  6,  8, 13, 11,  9,  7, 15,  7, 12, 15,  9, 11,  7, 13, 12,
        11, 13,  6,  7, 14,  9, 13, 15, 14,  8, 13,  6,  5, 12,  7,  5,
        11, 12, 14, 15, 14, 15,  9,  8,  9, 14,  5,  6,  8,  6,  5, 12,
         9, 15,  5, 11,  6,  8, 13, 12,  5, 12, 13, 14, 11,  8,  5,  6 };
 
-static unsigned char SS[80] = {
+static const unsigned char SS[80] = {
         8,  9,  9, 11, 13, 15, 15,  5,  7,  7,  8, 11, 14, 14, 12,  6,
         9, 13, 15,  7, 12,  8,  9, 11,  7,  7, 12,  7,  6, 15, 13, 11,
         9,  7, 15, 11,  8,  6,  6, 14, 12, 13,  5, 14, 13, 13,  7,  5,
@@ -589,7 +589,7 @@
 }
 /* }}} */
 
-static unsigned char PADDING[64] =
+static const unsigned char PADDING[64] =
 {
        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_salsa.c?r1=1.3.2.3.2.1&r2=1.3.2.3.2.2&diff_format=u
Index: php-src/ext/hash/hash_salsa.c
diff -u php-src/ext/hash/hash_salsa.c:1.3.2.3.2.1 
php-src/ext/hash/hash_salsa.c:1.3.2.3.2.2
--- php-src/ext/hash/hash_salsa.c:1.3.2.3.2.1   Mon Jan  1 09:36:01 2007
+++ php-src/ext/hash/hash_salsa.c       Mon Jan  8 22:29:25 2007
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: hash_salsa.c,v 1.3.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: hash_salsa.c,v 1.3.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
 
 #include "php_hash.h"
 #include "php_hash_salsa.h"
@@ -194,7 +194,7 @@
        memset(context, 0, sizeof(*context));
 }
 
-php_hash_ops php_hash_salsa10_ops = {
+const php_hash_ops php_hash_salsa10_ops = {
        (php_hash_init_func_t) PHP_SALSA10Init,
        (php_hash_update_func_t) PHP_SALSAUpdate,
        (php_hash_final_func_t) PHP_SALSAFinal,
@@ -203,7 +203,7 @@
        sizeof(PHP_SALSA_CTX)
 };
 
-php_hash_ops php_hash_salsa20_ops = {
+const php_hash_ops php_hash_salsa20_ops = {
        (php_hash_init_func_t) PHP_SALSA20Init,
        (php_hash_update_func_t) PHP_SALSAUpdate,
        (php_hash_final_func_t) PHP_SALSAFinal,
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_sha.c?r1=1.10.2.3.2.1&r2=1.10.2.3.2.2&diff_format=u
Index: php-src/ext/hash/hash_sha.c
diff -u php-src/ext/hash/hash_sha.c:1.10.2.3.2.1 
php-src/ext/hash/hash_sha.c:1.10.2.3.2.2
--- php-src/ext/hash/hash_sha.c:1.10.2.3.2.1    Mon Jan  1 09:36:01 2007
+++ php-src/ext/hash/hash_sha.c Mon Jan  8 22:29:25 2007
@@ -17,12 +17,12 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: hash_sha.c,v 1.10.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: hash_sha.c,v 1.10.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
 
 #include "php_hash.h"
 #include "php_hash_sha.h"
 
-static unsigned char PADDING[128] =
+static const unsigned char PADDING[128] =
 {
        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -66,7 +66,7 @@
 }
 /* }}} */
 
-php_hash_ops php_hash_sha1_ops = {
+const php_hash_ops php_hash_sha1_ops = {
        (php_hash_init_func_t) PHP_SHA1Init,
        (php_hash_update_func_t) PHP_SHA1Update,
        (php_hash_final_func_t) PHP_SHA1Final,
@@ -407,7 +407,7 @@
 
 /* sha256 */
 
-php_hash_ops php_hash_sha256_ops = {
+const php_hash_ops php_hash_sha256_ops = {
        (php_hash_init_func_t) PHP_SHA256Init,
        (php_hash_update_func_t) PHP_SHA256Update,
        (php_hash_final_func_t) PHP_SHA256Final,
@@ -433,7 +433,7 @@
 /* OM1 */
 #define SHA256_F5(x)           (ROTR32(17,(x)) ^ ROTR32(19,(x)) ^ SHR(10,(x)))
 
-static php_hash_uint32 SHA256_K[64] = {
+static const php_hash_uint32 SHA256_K[64] = {
        0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 
0x923f82a4, 0xab1c5ed5,
        0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 
0x9bdc06a7, 0xc19bf174,
        0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 
0x5cb0a9dc, 0x76f988da,
@@ -595,7 +595,7 @@
 /* OM1 */
 #define SHA512_F5(x)                   (ROTR64(19, x) ^ ROTR64(61, x) ^ SHR(6, 
x))
 
-static php_hash_uint64 SHA512_K[128] = {
+static const php_hash_uint64 SHA512_K[128] = {
        L64(0x428a2f98d728ae22), L64(0x7137449123ef65cd), 
L64(0xb5c0fbcfec4d3b2f), L64(0xe9b5dba58189dbbc),
        L64(0x3956c25bf348b538), L64(0x59f111f1b605d019), 
L64(0x923f82a4af194f9b), L64(0xab1c5ed5da6d8118),
        L64(0xd807aa98a3030242), L64(0x12835b0145706fbe), 
L64(0x243185be4ee4b28c), L64(0x550c7dc3d5ffb4e2),
@@ -802,7 +802,7 @@
 }
 /* }}} */
 
-php_hash_ops php_hash_sha384_ops = {
+const php_hash_ops php_hash_sha384_ops = {
        (php_hash_init_func_t) PHP_SHA384Init,
        (php_hash_update_func_t) PHP_SHA384Update,
        (php_hash_final_func_t) PHP_SHA384Final,
@@ -915,7 +915,7 @@
 }
 /* }}} */
 
-php_hash_ops php_hash_sha512_ops = {
+const php_hash_ops php_hash_sha512_ops = {
        (php_hash_init_func_t) PHP_SHA512Init,
        (php_hash_update_func_t) PHP_SHA512Update,
        (php_hash_final_func_t) PHP_SHA512Final,
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_snefru.c?r1=1.3.2.3.2.1&r2=1.3.2.3.2.2&diff_format=u
Index: php-src/ext/hash/hash_snefru.c
diff -u php-src/ext/hash/hash_snefru.c:1.3.2.3.2.1 
php-src/ext/hash/hash_snefru.c:1.3.2.3.2.2
--- php-src/ext/hash/hash_snefru.c:1.3.2.3.2.1  Mon Jan  1 09:36:01 2007
+++ php-src/ext/hash/hash_snefru.c      Mon Jan  8 22:29:25 2007
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: hash_snefru.c,v 1.3.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: hash_snefru.c,v 1.3.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
 
 #include "php_hash.h"
 #include "php_hash_snefru.h"
@@ -193,7 +193,7 @@
        memset(context, 0, sizeof(*context));
 }
 
-php_hash_ops php_hash_snefru_ops = {
+const php_hash_ops php_hash_snefru_ops = {
        (php_hash_init_func_t) PHP_SNEFRUInit,
        (php_hash_update_func_t) PHP_SNEFRUUpdate,
        (php_hash_final_func_t) PHP_SNEFRUFinal,
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_tiger.c?r1=1.4.2.4.2.1&r2=1.4.2.4.2.2&diff_format=u
Index: php-src/ext/hash/hash_tiger.c
diff -u php-src/ext/hash/hash_tiger.c:1.4.2.4.2.1 
php-src/ext/hash/hash_tiger.c:1.4.2.4.2.2
--- php-src/ext/hash/hash_tiger.c:1.4.2.4.2.1   Mon Jan  1 09:36:01 2007
+++ php-src/ext/hash/hash_tiger.c       Mon Jan  8 22:29:25 2007
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: hash_tiger.c,v 1.4.2.4.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: hash_tiger.c,v 1.4.2.4.2.2 2007/01/08 22:29:25 nlopess Exp $ */
 
 #include "php_hash.h"
 #include "php_hash_tiger.h"
@@ -288,7 +288,7 @@
 }
 
 #define PHP_HASH_TIGER_OPS(p, b) \
-       php_hash_ops php_hash_##p##tiger##b##_ops = { \
+       const php_hash_ops php_hash_##p##tiger##b##_ops = { \
                (php_hash_init_func_t) PHP_##p##TIGERInit, \
                (php_hash_update_func_t) PHP_TIGERUpdate, \
                (php_hash_final_func_t) PHP_TIGER##b##Final, \
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/hash_whirlpool.c?r1=1.3.2.3.2.1&r2=1.3.2.3.2.2&diff_format=u
Index: php-src/ext/hash/hash_whirlpool.c
diff -u php-src/ext/hash/hash_whirlpool.c:1.3.2.3.2.1 
php-src/ext/hash/hash_whirlpool.c:1.3.2.3.2.2
--- php-src/ext/hash/hash_whirlpool.c:1.3.2.3.2.1       Mon Jan  1 09:36:01 2007
+++ php-src/ext/hash/hash_whirlpool.c   Mon Jan  8 22:29:25 2007
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: hash_whirlpool.c,v 1.3.2.3.2.1 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: hash_whirlpool.c,v 1.3.2.3.2.2 2007/01/08 22:29:25 nlopess Exp $ */
 
 #include "php_hash.h"
 
@@ -433,7 +433,7 @@
     memset(context, 0, sizeof(*context));
 }
 
-php_hash_ops php_hash_whirlpool_ops = {
+const php_hash_ops php_hash_whirlpool_ops = {
        (php_hash_init_func_t) PHP_WHIRLPOOLInit,
        (php_hash_update_func_t) PHP_WHIRLPOOLUpdate,
        (php_hash_final_func_t) PHP_WHIRLPOOLFinal,
http://cvs.php.net/viewvc.cgi/php-src/ext/hash/php_hash.h?r1=1.13.2.7.2.2&r2=1.13.2.7.2.3&diff_format=u
Index: php-src/ext/hash/php_hash.h
diff -u php-src/ext/hash/php_hash.h:1.13.2.7.2.2 
php-src/ext/hash/php_hash.h:1.13.2.7.2.3
--- php-src/ext/hash/php_hash.h:1.13.2.7.2.2    Mon Jan  1 09:36:01 2007
+++ php-src/ext/hash/php_hash.h Mon Jan  8 22:29:25 2007
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_hash.h,v 1.13.2.7.2.2 2007/01/01 09:36:01 sebastian Exp $ */
+/* $Id: php_hash.h,v 1.13.2.7.2.3 2007/01/08 22:29:25 nlopess Exp $ */
 
 #ifndef PHP_HASH_H
 #define PHP_HASH_H
@@ -45,38 +45,38 @@
 } php_hash_ops;
 
 typedef struct _php_hash_data {
-       php_hash_ops *ops;
+       const php_hash_ops *ops;
        void *context;
 
        long options;
        unsigned char *key;
 } php_hash_data;
 
-extern php_hash_ops php_hash_md2_ops;
-extern php_hash_ops php_hash_md4_ops;
-extern php_hash_ops php_hash_md5_ops;
-extern php_hash_ops php_hash_sha1_ops;
-extern php_hash_ops php_hash_sha256_ops;
-extern php_hash_ops php_hash_sha384_ops;
-extern php_hash_ops php_hash_sha512_ops;
-extern php_hash_ops php_hash_ripemd128_ops;
-extern php_hash_ops php_hash_ripemd160_ops;
-extern php_hash_ops php_hash_ripemd256_ops;
-extern php_hash_ops php_hash_ripemd320_ops;
-extern php_hash_ops php_hash_whirlpool_ops;
-extern php_hash_ops php_hash_3tiger128_ops;
-extern php_hash_ops php_hash_3tiger160_ops;
-extern php_hash_ops php_hash_3tiger192_ops;
-extern php_hash_ops php_hash_4tiger128_ops;
-extern php_hash_ops php_hash_4tiger160_ops;
-extern php_hash_ops php_hash_4tiger192_ops;
-extern php_hash_ops php_hash_snefru_ops;
-extern php_hash_ops php_hash_gost_ops;
-extern php_hash_ops php_hash_adler32_ops;
-extern php_hash_ops php_hash_crc32_ops;
-extern php_hash_ops php_hash_crc32b_ops;
+extern const php_hash_ops php_hash_md2_ops;
+extern const php_hash_ops php_hash_md4_ops;
+extern const php_hash_ops php_hash_md5_ops;
+extern const php_hash_ops php_hash_sha1_ops;
+extern const php_hash_ops php_hash_sha256_ops;
+extern const php_hash_ops php_hash_sha384_ops;
+extern const php_hash_ops php_hash_sha512_ops;
+extern const php_hash_ops php_hash_ripemd128_ops;
+extern const php_hash_ops php_hash_ripemd160_ops;
+extern const php_hash_ops php_hash_ripemd256_ops;
+extern const php_hash_ops php_hash_ripemd320_ops;
+extern const php_hash_ops php_hash_whirlpool_ops;
+extern const php_hash_ops php_hash_3tiger128_ops;
+extern const php_hash_ops php_hash_3tiger160_ops;
+extern const php_hash_ops php_hash_3tiger192_ops;
+extern const php_hash_ops php_hash_4tiger128_ops;
+extern const php_hash_ops php_hash_4tiger160_ops;
+extern const php_hash_ops php_hash_4tiger192_ops;
+extern const php_hash_ops php_hash_snefru_ops;
+extern const php_hash_ops php_hash_gost_ops;
+extern const php_hash_ops php_hash_adler32_ops;
+extern const php_hash_ops php_hash_crc32_ops;
+extern const php_hash_ops php_hash_crc32b_ops;
 
-#define PHP_HASH_HAVAL_OPS(p,b)        extern php_hash_ops 
php_hash_##p##haval##b##_ops;
+#define PHP_HASH_HAVAL_OPS(p,b)        extern const php_hash_ops 
php_hash_##p##haval##b##_ops;
 
 PHP_HASH_HAVAL_OPS(3,128)
 PHP_HASH_HAVAL_OPS(3,160)
@@ -120,8 +120,8 @@
 PHP_FUNCTION(hash_final);
 PHP_FUNCTION(hash_algos);
 
-PHP_HASH_API php_hash_ops *php_hash_fetch_ops(const char *algo, int algo_len);
-PHP_HASH_API void php_hash_register_algo(const char *algo, php_hash_ops *ops);
+PHP_HASH_API const php_hash_ops *php_hash_fetch_ops(const char *algo, int 
algo_len);
+PHP_HASH_API void php_hash_register_algo(const char *algo, const php_hash_ops 
*ops);
 
 static inline void php_hash_bin2hex(char *out, const unsigned char *in, int 
in_len)
 {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to