From xemacs-m  Sun Jul 20 18:20:15 1997
Received: from sandy.calag.com (root@sandy.calag.com [206.190.83.128])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id SAA01798
	for <xemacs-beta@xemacs.org>; Sun, 20 Jul 1997 18:20:13 -0500 (CDT)
Received: from altair.xemacs.org (steve@xemacs.miranova.com [206.190.83.19])
	by sandy.calag.com (8.8.6/8.8.6) with SMTP id QAA30984
	for <xemacs-beta@xemacs.org>; Sun, 20 Jul 1997 16:21:34 -0700
Mail-Copies-To: never
To: xemacs-beta@xemacs.org
Subject: `string-to-char' is broken (was Re: ebola warnings)
References: <rwxiuz14e1j.fsf@kopernik.npac.syr.edu>
X-Face: `'%\i;ySOu]g?NlziJSk_$&@]KP`}~PEQPjZ5;nxSaDW_o$4+4%Ab]%Ifw3ZR;7TIT3,O,'
 @2{L;]ox6kc;$_5kU'n**9vFg-]eV~GbxSVCx|(s%uR[],*:^WKmC`B}(;|k9/m]gwt?&`t;^rfCJg
 khHH>pP1W\)xM0U@!FNDD72{3fDP$PkBhx^7Z?-WxH6DbFN:QOnT`llzW}VGdYv;n9lzljQvKTIBhQ
 YuV
X-Attribution: sb
From: SL Baur <steve@xemacs.org>
In-Reply-To: Remigiusz Trzaska's message of "26 Jun 1997 10:47:04 -0400"
Mime-Version: 1.0 (generated by tm-edit 7.108)
Content-Type: text/plain; charset=US-ASCII
Date: 20 Jul 1997 16:23:42 -0700
Message-ID: <m2oh7x9ukh.fsf@altair.xemacs.org>
Lines: 48
X-Mailer: Gnus v5.4.64/XEmacs 20.3(beta15) - "Berlin"

Remigiusz Trzaska <remek@npac.syr.edu> writes:

> when I send a message I get lots of this stuff on stderr:
> Comparison between integer and character is constant nil (?\. and 0)
>    [smtpmail-send-data-1, smtpmail-send-data, byte-code, smtpmail-via-smtp, smtpmail-send-it, message-send-mail, message-send-via-mail, message-send, message-send-and-exit, call-interactively]

> should I just ignore it?

It's probably O.K. to ignore it.

The real problem is the highly broken function string-to-char which
returns `0' when passed the empty string.  Yuck!

Who's going to scream first with the following patch?

1997-07-20  SL Baur  <steve@altair.xemacs.org>

	* editfns.c (Fstring_to_char): Return nil instead of `0' for
	  the empty string.

Index: src/editfns.c
===================================================================
RCS file: /usr/local/xemacs/xemacs-20.0/src/editfns.c,v
retrieving revision 1.10
diff -u -r1.10 editfns.c
--- editfns.c	1997/07/07 00:54:01	1.10
+++ editfns.c	1997/07/20 23:19:54
@@ -194,6 +194,7 @@
 
 DEFUN ("string-to-char", Fstring_to_char, 1, 1, 0, /*
 Convert arg STRING to a character, the first character of that string.
+An empty string will return the constant `nil'.
 */
        (str))
 {
@@ -203,8 +204,10 @@
   p = XSTRING (str);
   if (string_length (p) != 0)
     return make_char (string_char (p, 0));
-  else                          /* #### Gag me! */
-    return Qzero;
+  else
+    /* This used to return Qzero.  That is broken, broken, broken. */
+    /* It might be kinder to signal an error directly. -slb */
+    return Qnil;
 }
 
 

