integer->char: assure given integer range

This commit is contained in:
Yuichi Nishiwaki 2014-09-26 14:23:47 +09:00
parent ed354867a9
commit 32fa44db91
1 changed files with 5 additions and 1 deletions

6
char.c
View File

@ -31,7 +31,11 @@ pic_char_integer_to_char(pic_state *pic)
pic_get_args(pic, "i", &i); pic_get_args(pic, "i", &i);
return pic_char_value(i); if (i < 0 || i > 127) {
pic_errorf(pic, "integer->char: integer out of char range: %d", i);
}
return pic_char_value((char)i);
} }
#define DEFINE_CHAR_CMP(op, name) \ #define DEFINE_CHAR_CMP(op, name) \