]> git.eshelyaron.com Git - emacs.git/commitdiff
(char_string): Type of arg C changed to unsigned.
authorKenichi Handa <handa@m17n.org>
Wed, 11 Apr 2007 11:52:06 +0000 (11:52 +0000)
committerKenichi Handa <handa@m17n.org>
Wed, 11 Apr 2007 11:52:06 +0000 (11:52 +0000)
Signal an error if C is an invalid character code.

src/character.c

index 29a7f80ae49b540dd1d7f1989f6d421d6e35f4eb..dd3771fc280d87a9da5668f026a61652c23a7c0b 100644 (file)
@@ -100,7 +100,7 @@ char unibyte_has_multibyte_table[256];
 
 int
 char_string (c, p)
-     int c;
+     unsigned c;
      unsigned char *p;
 {
   int bytes;
@@ -169,11 +169,13 @@ char_string (c, p)
       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;
 }