Remove unneeded headers (cdef.h isn't available on all platforms) and change u_int32_t to unsigned int, since u_int32_t isn't available on all platforms. This fixes build issues on Solaris.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@942 632fc199-4ca6-4c93-a231-07263d6284db
diff --git a/md5/md5.c b/md5/md5.c
index 34e1658..7193e95 100644
--- a/md5/md5.c
+++ b/md5/md5.c
@@ -26,24 +26,12 @@
* edited for clarity and style only.
*/
-#include <sys/cdefs.h>
-
#include <sys/types.h>
-
-#ifdef _KERNEL
-#include <sys/systm.h>
-#else
#include <string.h>
-#endif
#include "./md5.h"
-static void MD5Transform(u_int32_t [4], const unsigned char [64]);
-
-#ifdef _KERNEL
-#define memset(x,y,z) bzero(x,z);
-#define memcpy(x,y,z) bcopy(y, x, z)
-#endif
+static void MD5Transform(unsigned int [4], const unsigned char [64]);
#if (BYTE_ORDER == LITTLE_ENDIAN)
#define Encode memcpy
@@ -51,30 +39,30 @@
#else
/*
- * Encodes input (u_int32_t) into output (unsigned char). Assumes len is
+ * Encodes input (unsigned int) into output (unsigned char). Assumes len is
* a multiple of 4.
*/
static void
-Encode (unsigned char *output, u_int32_t *input, unsigned int len)
+Encode (unsigned char *output, unsigned int *input, unsigned int len)
{
unsigned int i;
- u_int32_t *op = (u_int32_t *)output;
+ unsigned int *op = (unsigned int *)output;
for (i = 0; i < len / 4; i++)
op[i] = htole32(input[i]);
}
/*
- * Decodes input (unsigned char) into output (u_int32_t). Assumes len is
+ * Decodes input (unsigned char) into output (unsigned int). Assumes len is
* a multiple of 4.
*/
static void
-Decode (u_int32_t *output, const unsigned char *input, unsigned int len)
+Decode (unsigned int *output, const unsigned char *input, unsigned int len)
{
unsigned int i;
- const u_int32_t *ip = (const u_int32_t *)input;
+ const unsigned int *ip = (const unsigned int *)input;
for (i = 0; i < len / 4; i++)
output[i] = le32toh(ip[i]);
@@ -101,22 +89,22 @@
* Rotation is separate from addition to prevent recomputation.
*/
#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (u_int32_t)(ac); \
+ (a) += F ((b), (c), (d)) + (x) + (unsigned int)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (u_int32_t)(ac); \
+ (a) += G ((b), (c), (d)) + (x) + (unsigned int)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (u_int32_t)(ac); \
+ (a) += H ((b), (c), (d)) + (x) + (unsigned int)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (u_int32_t)(ac); \
+ (a) += I ((b), (c), (d)) + (x) + (unsigned int)(ac); \
(a) = ROTATE_LEFT ((a), (s)); \
(a) += (b); \
}
@@ -156,10 +144,10 @@
idx = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
- if ((context->count[0] += ((u_int32_t)inputLen << 3))
- < ((u_int32_t)inputLen << 3))
+ if ((context->count[0] += ((unsigned int)inputLen << 3))
+ < ((unsigned int)inputLen << 3))
context->count[1]++;
- context->count[1] += ((u_int32_t)inputLen >> 29);
+ context->count[1] += ((unsigned int)inputLen >> 29);
partLen = 64 - idx;
@@ -229,10 +217,10 @@
static void
MD5Transform (state, block)
- u_int32_t state[4];
+ unsigned int state[4];
const unsigned char block[64];
{
- u_int32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];
+ unsigned int a = state[0], b = state[1], c = state[2], d = state[3], x[16];
Decode (x, block, 64);
diff --git a/md5/md5.h b/md5/md5.h
index e7c294a..551e252 100644
--- a/md5/md5.h
+++ b/md5/md5.h
@@ -34,13 +34,11 @@
/* MD5 context. */
typedef struct MD5Context {
- u_int32_t state[4]; /* state (ABCD) */
- u_int32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
+ unsigned int state[4]; /* state (ABCD) */
+ unsigned int count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} MD5_CTX;
-#include <sys/cdefs.h>
-
void MD5Init (MD5_CTX *);
void MD5Update (MD5_CTX *, const void *, unsigned int);
void MD5Final (unsigned char [16], MD5_CTX *);
diff --git a/md5/md5hl.c b/md5/md5hl.c
index 530c513..eaa41e2 100644
--- a/md5/md5hl.c
+++ b/md5/md5hl.c
@@ -6,8 +6,6 @@
* ----------------------------------------------------------------------------
*/
-#include <sys/cdefs.h>
-
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>