# HG changeset patch # User Kenichi Handa # Date 1176292326 0 # Node ID b74794d7f11ad8a1882965f74f311311d9e4223c # Parent 4ef881a120fe0ce78d4f99ac8f1b17492fa7426b (char_string): Type of arg C changed to unsigned. Signal an error if C is an invalid character code. diff -r 4ef881a120fe -r b74794d7f11a src/character.c --- 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; }