* fns.c: Fix minor problems prompted by GCC 4.6.0 warnings.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 27 May 2011 19:30:12 +0000 (12:30 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 27 May 2011 19:30:12 +0000 (12:30 -0700)
(crypto_hash_function): Now static.
Fix pointer signedness problems.  Avoid unnecessary initializations.

src/ChangeLog
src/fns.c

index 93496a6..2373dd8 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-27  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * fns.c: Fix minor problems prompted by GCC 4.6.0 warnings.
+       (crypto_hash_function): Now static.
+       Fix pointer signedness problems.  Avoid unnecessary initializations.
+
 2011-05-27  Chong Yidong  <cyd@stupidchicken.com>
 
        * termhooks.h (Vselection_alist): Make it terminal-local.
index 9d73e48..aee7281 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -4522,7 +4522,7 @@ including negative integers.  */)
 
 /* TYPE: 0 for md5, 1 for sha1. */
 
-Lisp_Object
+static Lisp_Object
 crypto_hash_function (int type, Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object noerror, Lisp_Object binary)
 {
   int i;
@@ -4708,17 +4708,16 @@ crypto_hash_function (int type, Lisp_Object object, Lisp_Object start, Lisp_Obje
     {
     case 0:                    /* MD5 */
       {
-       unsigned char digest[16];
+       char digest[16];
        md5_buffer (SSDATA (object) + start_byte,
                    SBYTES (object) - (size_byte - end_byte),
                    digest);
 
-       if (NILP(binary))
+       if (NILP (binary))
          {
-           unsigned char value[33];
+           char value[33];
            for (i = 0; i < 16; i++)
              sprintf (&value[2 * i], "%02x", digest[i]);
-           value[32] = '\0';
            res = make_string (value, 32);
          }
        else
@@ -4728,16 +4727,15 @@ crypto_hash_function (int type, Lisp_Object object, Lisp_Object start, Lisp_Obje
 
     case 1:                    /* SHA1 */
       {
-       unsigned char digest[20];
-       sha1_buffer (SDATA (object) + start_byte,
+       char digest[20];
+       sha1_buffer (SSDATA (object) + start_byte,
                     SBYTES (object) - (size_byte - end_byte),
                     digest);
-       if (NILP(binary))
+       if (NILP (binary))
          {
-           unsigned char value[41];
+           char value[41];
            for (i = 0; i < 20; i++)
              sprintf (&value[2 * i], "%02x", digest[i]);
-           value[40] = '\0';
            res = make_string (value, 40);
          }
        else