cvs: php4 /ext/icap php_icap.c /ext/mcal php_mcal.c /ext/standard md5.c md5.h php_global.h
| From: | Sascha Schumann | Date: | Mon, 21 Aug 2000 10:10:32 +0000 |
| Subject: | cvs: php4 /ext/icap php_icap.c /ext/mcal php_mcal.c /ext/standard md5.c md5.h php_global.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-1286@lists.php.net to get a copy of this message | ||
sas Mon Aug 21 03:10:32 2000 EDT
Removed files:
/php4/ext/standard php_global.h
Modified files:
/php4/ext/icap php_icap.c
/php4/ext/mcal php_mcal.c
/php4/ext/standard md5.c md5.h
Log:
Get rid of php_global.h and the associated data types UINT4/_POINTER.
We use php_uint32 now globally.
Also removed K&R support from md5.[ch].
Index: php4/ext/icap/php_icap.c
diff -u php4/ext/icap/php_icap.c:1.18 php4/ext/icap/php_icap.c:1.19
--- php4/ext/icap/php_icap.c:1.18 Thu Jul 13 12:09:32 2000
+++ php4/ext/icap/php_icap.c Mon Aug 21 03:10:30 2000
@@ -47,7 +47,7 @@
#include "php_icap.h"
#include "modules.h"
#include "ext/standard/info.h"
-#include "ext/standard/php_global.h"
+#include "ext/standard/basic_functions.h"
#ifdef PHP_WIN32
#include "winsock.h"
#endif
@@ -64,7 +64,7 @@
typedef struct cal_list
{
-UINT4 uid;
+php_uint32 uid;
struct cal_list *next;
} cal_list_t;
@@ -904,7 +904,7 @@
}
-void cc_appended(UINT4 uid)
+void cc_appended(php_uint32 uid)
{
}
Index: php4/ext/mcal/php_mcal.c
diff -u php4/ext/mcal/php_mcal.c:1.30 php4/ext/mcal/php_mcal.c:1.31
--- php4/ext/mcal/php_mcal.c:1.30 Fri Jul 14 11:42:33 2000
+++ php4/ext/mcal/php_mcal.c Mon Aug 21 03:10:31 2000
@@ -47,7 +47,7 @@
#include "php_mcal.h"
#include "modules.h"
#include "ext/standard/info.h"
-#include "ext/standard/php_global.h"
+#include "ext/standard/basic_functions.h"
#ifdef PHP_WIN32
#include "winsock.h"
#endif
@@ -65,7 +65,7 @@
typedef struct cal_list {
- UINT4 uid;
+ php_uint32 uid;
struct cal_list *next;
} cal_list_t;
@@ -1595,7 +1595,7 @@
}
}
-void cc_appended(UINT4 uid)
+void cc_appended(php_uint32 uid)
{
}
Index: php4/ext/standard/md5.c
diff -u php4/ext/standard/md5.c:1.14 php4/ext/standard/md5.c:1.15
--- php4/ext/standard/md5.c:1.14 Sun Jul 23 18:39:49 2000
+++ php4/ext/standard/md5.c Mon Aug 21 03:10:31 2000
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: md5.c,v 1.14 2000/07/24 01:39:49 david Exp $ */
+/* $Id: md5.c,v 1.15 2000/08/21 10:10:31 sas Exp $ */
/*
* md5.c - Copyright 1997 Lachlan Roche
@@ -104,13 +104,9 @@
#define S43 15
#define S44 21
-static void MD5Transform PROTO_LIST((UINT4[4], const unsigned char[64]));
-static void Encode PROTO_LIST
- ((unsigned char *, UINT4 *, unsigned int));
-static void Decode PROTO_LIST
- ((UINT4 *, const unsigned char *, unsigned int));
-static void MD5_memcpy PROTO_LIST((_POINTER, _POINTER, unsigned int));
-static void MD5_memset PROTO_LIST((_POINTER, int, unsigned int));
+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 unsigned char PADDING[64] =
{
@@ -134,22 +130,22 @@
Rotation is separate from addition to prevent recomputation.
*/
#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
+ (a) += F ((b), (c), (d)) + (x) + (php_uint32)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
+ (a) += G ((b), (c), (d)) + (x) + (php_uint32)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
+ (a) += H ((b), (c), (d)) + (x) + (php_uint32)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
+ (a) += I ((b), (c), (d)) + (x) + (php_uint32)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
@@ -180,18 +176,18 @@
index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
- if ((context->count[0] += ((UINT4) inputLen << 3))
- < ((UINT4) inputLen << 3))
+ if ((context->count[0] += ((php_uint32) inputLen << 3))
+ < ((php_uint32) inputLen << 3))
context->count[1]++;
- context->count[1] += ((UINT4) inputLen >> 29);
+ context->count[1] += ((php_uint32) inputLen >> 29);
partLen = 64 - index;
/* Transform as many times as possible.
*/
if (inputLen >= partLen) {
- MD5_memcpy
- ((_POINTER) & context->buffer[index], (_POINTER) input, partLen);
+ memcpy
+ ((unsigned char*) & context->buffer[index], (unsigned char*) input, partLen);
MD5Transform(context->state, context->buffer);
for (i = partLen; i + 63 < inputLen; i += 64)
@@ -202,8 +198,8 @@
i = 0;
/* Buffer remaining input */
- MD5_memcpy
- ((_POINTER) & context->buffer[index], (_POINTER) & input[i],
+ memcpy
+ ((unsigned char*) & context->buffer[index], (unsigned char*) & input[i],
inputLen - i);
}
@@ -232,16 +228,16 @@
/* Zeroize sensitive information.
*/
- MD5_memset((_POINTER) context, 0, sizeof(*context));
+ memset((unsigned char*) context, 0, sizeof(*context));
}
/* MD5 basic transformation. Transforms state based on block.
*/
static void MD5Transform(state, block)
-UINT4 state[4];
+php_uint32 state[4];
const unsigned char block[64];
{
- UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
+ php_uint32 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
Decode(x, block, 64);
@@ -323,15 +319,15 @@
state[3] += d;
/* Zeroize sensitive information. */
- MD5_memset((_POINTER) x, 0, sizeof(x));
+ memset((unsigned char*) x, 0, sizeof(x));
}
-/* Encodes input (UINT4) into output (unsigned char). Assumes len is
+/* Encodes input (php_uint32) into output (unsigned char). Assumes len is
a multiple of 4.
*/
static void Encode(output, input, len)
unsigned char *output;
-UINT4 *input;
+php_uint32 *input;
unsigned int len;
{
unsigned int i, j;
@@ -344,46 +340,19 @@
}
}
-/* Decodes input (unsigned char) into output (UINT4). Assumes len is
+/* Decodes input (unsigned char) into output (php_uint32). Assumes len is
a multiple of 4.
*/
static void Decode(output, input, len)
-UINT4 *output;
+php_uint32 *output;
const unsigned char *input;
unsigned int len;
{
unsigned int i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
- output[i] = ((UINT4) input[j]) | (((UINT4) input[j + 1]) << 8) |
- (((UINT4) input[j + 2]) << 16) | (((UINT4) input[j + 3]) << 24);
-}
-
-/* Note: Replace "for loop" with standard memcpy if possible.
- */
-
-static void MD5_memcpy(output, input, len)
-_POINTER output;
-_POINTER input;
-unsigned int len;
-{
- unsigned int i;
-
- for (i = 0; i < len; i++)
- output[i] = input[i];
-}
-
-/* Note: Replace "for loop" with standard memset if possible.
- */
-static void MD5_memset(output, value, len)
-_POINTER output;
-int value;
-unsigned int len;
-{
- unsigned int i;
-
- for (i = 0; i < len; i++)
- ((char *) output)[i] = (char) value;
+ output[i] = ((php_uint32) input[j]) | (((php_uint32) input[j + 1]) << 8) |
+ (((php_uint32) input[j + 2]) << 16) | (((php_uint32) input[j + 3]) << 24);
}
/*
Index: php4/ext/standard/md5.h
diff -u php4/ext/standard/md5.h:1.7 php4/ext/standard/md5.h:1.8
--- php4/ext/standard/md5.h:1.7 Sun Jul 23 18:39:49 2000
+++ php4/ext/standard/md5.h Mon Aug 21 03:10:31 2000
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: md5.h,v 1.7 2000/07/24 01:39:49 david Exp $ */
+/* $Id: md5.h,v 1.8 2000/08/21 10:10:31 sas Exp $ */
#ifndef MD5_H
#define MD5_H
@@ -45,18 +45,18 @@
documentation and/or software.
*/
-#include "php_global.h"
+#include "ext/standard/basic_functions.h"
/* MD5 context. */
typedef struct {
- UINT4 state[4]; /* state (ABCD) */
- UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
+ php_uint32 state[4]; /* state (ABCD) */
+ php_uint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} PHP_MD5_CTX;
-void PHP_MD5Init PROTO_LIST((PHP_MD5_CTX *));
-void PHP_MD5Update PROTO_LIST((PHP_MD5_CTX *, const unsigned char *, unsigned int));
-void PHP_MD5Final PROTO_LIST((unsigned char[16], PHP_MD5_CTX *));
+void PHP_MD5Init(PHP_MD5_CTX *);
+void PHP_MD5Update(PHP_MD5_CTX *, const unsigned char *, unsigned int);
+void PHP_MD5Final(unsigned char[16], PHP_MD5_CTX *);
PHP_NAMED_FUNCTION(php_if_md5);