aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-05-27 12:30:12 -0700
committerPaul Eggert2011-05-27 12:30:12 -0700
commitf1b54466e9f3b0d0037f161157a8b27dd0fb283f (patch)
treec2c3d9c5d84d640fd6eb371ebbc309c5d823fb11 /src
parent842b28a0658be1d3afdf0dbda876c4c354d3672c (diff)
downloademacs-f1b54466e9f3b0d0037f161157a8b27dd0fb283f.tar.gz
emacs-f1b54466e9f3b0d0037f161157a8b27dd0fb283f.zip
* fns.c: Fix minor problems prompted by GCC 4.6.0 warnings.
(crypto_hash_function): Now static. Fix pointer signedness problems. Avoid unnecessary initializations.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/fns.c18
2 files changed, 14 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 93496a6cd86..2373dd81ad1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12011-05-27 Paul Eggert <eggert@cs.ucla.edu>
2
3 * fns.c: Fix minor problems prompted by GCC 4.6.0 warnings.
4 (crypto_hash_function): Now static.
5 Fix pointer signedness problems. Avoid unnecessary initializations.
6
12011-05-27 Chong Yidong <cyd@stupidchicken.com> 72011-05-27 Chong Yidong <cyd@stupidchicken.com>
2 8
3 * termhooks.h (Vselection_alist): Make it terminal-local. 9 * termhooks.h (Vselection_alist): Make it terminal-local.
diff --git a/src/fns.c b/src/fns.c
index 9d73e48b928..aee7281cf00 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -4522,7 +4522,7 @@ including negative integers. */)
4522 4522
4523/* TYPE: 0 for md5, 1 for sha1. */ 4523/* TYPE: 0 for md5, 1 for sha1. */
4524 4524
4525Lisp_Object 4525static Lisp_Object
4526crypto_hash_function (int type, Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object noerror, Lisp_Object binary) 4526crypto_hash_function (int type, Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object noerror, Lisp_Object binary)
4527{ 4527{
4528 int i; 4528 int i;
@@ -4708,17 +4708,16 @@ crypto_hash_function (int type, Lisp_Object object, Lisp_Object start, Lisp_Obje
4708 { 4708 {
4709 case 0: /* MD5 */ 4709 case 0: /* MD5 */
4710 { 4710 {
4711 unsigned char digest[16]; 4711 char digest[16];
4712 md5_buffer (SSDATA (object) + start_byte, 4712 md5_buffer (SSDATA (object) + start_byte,
4713 SBYTES (object) - (size_byte - end_byte), 4713 SBYTES (object) - (size_byte - end_byte),
4714 digest); 4714 digest);
4715 4715
4716 if (NILP(binary)) 4716 if (NILP (binary))
4717 { 4717 {
4718 unsigned char value[33]; 4718 char value[33];
4719 for (i = 0; i < 16; i++) 4719 for (i = 0; i < 16; i++)
4720 sprintf (&value[2 * i], "%02x", digest[i]); 4720 sprintf (&value[2 * i], "%02x", digest[i]);
4721 value[32] = '\0';
4722 res = make_string (value, 32); 4721 res = make_string (value, 32);
4723 } 4722 }
4724 else 4723 else
@@ -4728,16 +4727,15 @@ crypto_hash_function (int type, Lisp_Object object, Lisp_Object start, Lisp_Obje
4728 4727
4729 case 1: /* SHA1 */ 4728 case 1: /* SHA1 */
4730 { 4729 {
4731 unsigned char digest[20]; 4730 char digest[20];
4732 sha1_buffer (SDATA (object) + start_byte, 4731 sha1_buffer (SSDATA (object) + start_byte,
4733 SBYTES (object) - (size_byte - end_byte), 4732 SBYTES (object) - (size_byte - end_byte),
4734 digest); 4733 digest);
4735 if (NILP(binary)) 4734 if (NILP (binary))
4736 { 4735 {
4737 unsigned char value[41]; 4736 char value[41];
4738 for (i = 0; i < 20; i++) 4737 for (i = 0; i < 20; i++)
4739 sprintf (&value[2 * i], "%02x", digest[i]); 4738 sprintf (&value[2 * i], "%02x", digest[i]);
4740 value[40] = '\0';
4741 res = make_string (value, 40); 4739 res = make_string (value, 40);
4742 } 4740 }
4743 else 4741 else