Here's some patchy goodness to constify the input args to the md5
functions.

xoxo,
Andy


-- 
Andy Lester => [EMAIL PROTECTED] => www.petdance.com => AIM:petdance
Index: ext/standard/md5.c
===================================================================
--- ext/standard/md5.c  (revision 1)
+++ ext/standard/md5.c  (working copy)
@@ -26,12 +26,12 @@
 #include "php.h"
 #include "md5.h"
 
-PHPAPI void make_digest(char *md5str, unsigned char *digest)
+PHPAPI void make_digest(char *md5str, const unsigned char *digest)
 {
        make_digest_ex(md5str, digest, 16);
 }
 
-PHPAPI void make_digest_ex(char *md5str, unsigned char *digest, int len)
+PHPAPI void make_digest_ex(char *md5str, const unsigned char *digest, int len)
 {
        static const char hexits[17] = "0123456789abcdef";
        int i;
@@ -168,8 +168,8 @@
 #define S44 21
 
 static void MD5Transform(php_uint32[4], const unsigned char[64]);
-static void Encode(unsigned char *, php_uint32 *, unsigned int);
-static void Decode(php_uint32 *, const unsigned char *, unsigned int);
+static void Encode(unsigned char *output, const php_uint32 *input, size_t len);
+static void Decode(php_uint32 *output, const unsigned char *input, size_t len);
 
 static unsigned char PADDING[64] =
 {
@@ -397,10 +397,7 @@
    Encodes input (php_uint32) into output (unsigned char). Assumes len is
    a multiple of 4.
  */
-static void Encode(output, input, len)
-unsigned char *output;
-php_uint32 *input;
-unsigned int len;
+static void Encode(unsigned char *output, const php_uint32 *input, size_t len)
 {
        unsigned int i, j;
 
@@ -417,10 +414,7 @@
    Decodes input (unsigned char) into output (php_uint32). Assumes len is
    a multiple of 4.
  */
-static void Decode(output, input, len)
-php_uint32 *output;
-const unsigned char *input;
-unsigned int len;
+static void Decode(php_uint32 *output, const unsigned char *input, size_t len)
 {
        unsigned int i, j;
 
Index: ext/standard/md5.h
===================================================================
--- ext/standard/md5.h  (revision 1)
+++ ext/standard/md5.h  (working copy)
@@ -54,8 +54,8 @@
        unsigned char buffer[64];       /* input buffer */
 } PHP_MD5_CTX;
 
-PHPAPI void make_digest(char *md5str, unsigned char *digest);
-PHPAPI void make_digest_ex(char *md5str, unsigned char *digest, int len);
+PHPAPI void make_digest(char *md5str, const unsigned char *digest);
+PHPAPI void make_digest_ex(char *md5str, const unsigned char *digest, int len);
 PHPAPI void PHP_MD5Init(PHP_MD5_CTX *);
 PHPAPI void PHP_MD5Update(PHP_MD5_CTX *, const unsigned char *, unsigned int);
 PHPAPI void PHP_MD5Final(unsigned char[16], PHP_MD5_CTX *);

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to