changeset 90797:b74794d7f11a

(char_string): Type of arg C changed to unsigned. Signal an error if C is an invalid character code.
author Kenichi Handa <handa@m17n.org>
date Wed, 11 Apr 2007 11:52:06 +0000
parents 4ef881a120fe
children ad70c7654800
files src/character.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/character.c	Wed Apr 11 00:17:47 2007 +0000
+++ b/src/character.c	Wed Apr 11 11:52:06 2007 +0000
@@ -100,7 +100,7 @@
 
 int
 char_string (c, p)
-     int c;
+     unsigned c;
      unsigned char *p;
 {
   int bytes;
@@ -169,11 +169,13 @@
       p[4] = (0x80 | (c & 0x3F));
       bytes = 5;
     }
-  else
+  else if (c <= MAX_CHAR)
     {
       c = CHAR_TO_BYTE8 (c);
       bytes = BYTE8_STRING (c, p);
     }
+  else
+    error ("Invalid character: %d", c);
 
   return bytes;
 }