Fix MPFR Flog implementation
[sxemacs] / src / md5.c
index 0fc8a5e..8824bfe 100644 (file)
--- a/src/md5.c
+++ b/src/md5.c
@@ -69,7 +69,7 @@ typedef unsigned short md5_uint32;
 typedef unsigned long md5_uint32;
 #   else
      /* The following line is intended to evoke an error.
-        Using #error is not portable enough.  */
+       Using #error is not portable enough.  */
 "Cannot determine unsigned 32-bit data type."
 #   endif
 #  endif
@@ -324,12 +324,12 @@ md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
 
 #define OP(a, b, c, d, s, T)                                           \
       do                                                               \
-        {                                                              \
+                                                                     \
          a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;             \
          ++words;                                                      \
          CYCLIC (a, s);                                                \
          a += b;                                                       \
-        }                                                              \
+                                                                     \
       while (0)
 
                /* It is unfortunate that C does not provide an operator for
@@ -365,7 +365,7 @@ md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
                   argument specifying the function to use.  */
 #undef OP
 #define OP(f, a, b, c, d, k, s, T)                                     \
-      do                                                               \
+      do                                                               \
        {                                                               \
          a += f (b, c, d) + correct_words[k] + T;                      \
          CYCLIC (a, s);                                                \
@@ -570,8 +570,10 @@ file-coding or Mule support.  Otherwise, they are ignored.
        UNGCPRO;
 
        md5_finish_ctx(&ctx, digest);
-       for (i = 0; i < 16; i++)
-               sprintf((char *)(thehash + (i * 2)), "%02x", digest[i]);
+       for (i = 0; i < 16; i++) {
+               int n = snprintf((char *)(thehash + (i * 2)), 3, "%02x", digest[i]);
+               assert(n>=0 && n < 3);
+       }
 
        return make_string(thehash, 32);
 }