diff src/md5.c @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents b8cc9ab3f761
children
line wrap: on
line diff
--- a/src/md5.c	Mon Aug 13 11:19:22 2007 +0200
+++ b/src/md5.c	Mon Aug 13 11:20:41 2007 +0200
@@ -29,7 +29,10 @@
 #include <sys/types.h>
 #include <string.h>
 #include <stdio.h>
-#include <limits.h>
+
+#if defined HAVE_LIMITS_H || _LIBC
+# include <limits.h>
+#endif
 
 /* The following contortions are an attempt to use the C preprocessor
    to determine an unsigned integral type that is 32 bits wide.  An
@@ -107,7 +110,7 @@
 static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */ };
 
 
-static void md5_process_block (const void *, size_t, struct md5_ctx *);
+static void md5_process_block (CONST void *, size_t, struct md5_ctx *);
 
 
 /* Initialize structure containing state of computation.
@@ -130,7 +133,7 @@
    IMPORTANT: On some systems it is required that RESBUF is correctly
    aligned for a 32 bits value.  */
 static void *
-md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
+md5_read_ctx (CONST struct md5_ctx *ctx, void *resbuf)
 {
   ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
   ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
@@ -248,7 +251,7 @@
 
 
 static void
-md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
+md5_process_bytes (CONST void *buffer, size_t len, struct md5_ctx *ctx)
 {
   /* When we already have some bits in our internal buffer concatenate
      both inputs first.  */
@@ -303,7 +306,7 @@
    It is assumed that LEN % 64 == 0.  */
 
 static void
-md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
+md5_process_block (CONST void *buffer, size_t len, struct md5_ctx *ctx)
 {
   md5_uint32 correct_words[16];
   const md5_uint32 *words = (const md5_uint32 *) buffer;
@@ -479,7 +482,7 @@
 	{
 	  /* Attempt to autodetect the coding of the string.  This is
              VERY hit-and-miss.  */
-	  eol_type_t eol = EOL_AUTODETECT;
+	  enum eol_type eol = EOL_AUTODETECT;
 	  coding_system = Fget_coding_system (Qundecided);
 	  determine_real_coding_system (XLSTREAM (istream),
 					&coding_system, &eol);
@@ -579,8 +582,8 @@
   while (1)
     {
       Bufbyte tempbuf[1024];	/* some random amount */
-      ssize_t size_in_bytes =
-	Lstream_read (XLSTREAM (instream), tempbuf, sizeof (tempbuf));
+      int size_in_bytes = Lstream_read (XLSTREAM (instream),
+					tempbuf, sizeof (tempbuf));
       if (!size_in_bytes)
 	break;