aboutsummaryrefslogtreecommitdiffstats
path: root/src/charset.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/charset.c')
-rw-r--r--src/charset.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/charset.c b/src/charset.c
index c9133c780e8..3d43d81877f 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1,5 +1,5 @@
1/* Basic character set support. 1/* Basic character set support.
2 Copyright (C) 2001-2012 Free Software Foundation, Inc. 2 Copyright (C) 2001-2013 Free Software Foundation, Inc.
3 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 2005, 2006, 2007, 2008, 2009, 2010, 2011 4 2005, 2006, 2007, 2008, 2009, 2010, 2011
5 National Institute of Advanced Industrial Science and Technology (AIST) 5 National Institute of Advanced Industrial Science and Technology (AIST)
@@ -447,7 +447,7 @@ read_hex (FILE *fp, bool *eof, bool *overflow)
447 n = 0; 447 n = 0;
448 while (c_isxdigit (c = getc (fp))) 448 while (c_isxdigit (c = getc (fp)))
449 { 449 {
450 if (UINT_MAX >> 4 < n) 450 if (n > UINT_MAX >> 4)
451 *overflow = 1; 451 *overflow = 1;
452 n = ((n << 4) 452 n = ((n << 4)
453 | (c - ('0' <= c && c <= '9' ? '0' 453 | (c - ('0' <= c && c <= '9' ? '0'
@@ -1053,7 +1053,7 @@ usage: (define-charset-internal ...) */)
1053 CHECK_NATNUM (parent_max_code); 1053 CHECK_NATNUM (parent_max_code);
1054 parent_code_offset = Fnth (make_number (3), val); 1054 parent_code_offset = Fnth (make_number (3), val);
1055 CHECK_NUMBER (parent_code_offset); 1055 CHECK_NUMBER (parent_code_offset);
1056 val = Fmake_vector (make_number (4), Qnil); 1056 val = make_uninit_vector (4);
1057 ASET (val, 0, make_number (parent_charset->id)); 1057 ASET (val, 0, make_number (parent_charset->id));
1058 ASET (val, 1, parent_min_code); 1058 ASET (val, 1, parent_min_code);
1059 ASET (val, 2, parent_max_code); 1059 ASET (val, 2, parent_max_code);
@@ -1142,12 +1142,14 @@ usage: (define-charset-internal ...) */)
1142 example, the IDs are stuffed into struct 1142 example, the IDs are stuffed into struct
1143 coding_system.charbuf[i] entries, which are 'int'. */ 1143 coding_system.charbuf[i] entries, which are 'int'. */
1144 int old_size = charset_table_size; 1144 int old_size = charset_table_size;
1145 ptrdiff_t new_size = old_size;
1145 struct charset *new_table = 1146 struct charset *new_table =
1146 xpalloc (0, &charset_table_size, 1, 1147 xpalloc (0, &new_size, 1,
1147 min (INT_MAX, MOST_POSITIVE_FIXNUM), 1148 min (INT_MAX, MOST_POSITIVE_FIXNUM),
1148 sizeof *charset_table); 1149 sizeof *charset_table);
1149 memcpy (new_table, charset_table, old_size * sizeof *new_table); 1150 memcpy (new_table, charset_table, old_size * sizeof *new_table);
1150 charset_table = new_table; 1151 charset_table = new_table;
1152 charset_table_size = new_size;
1151 /* FIXME: This leaks memory, as the old charset_table becomes 1153 /* FIXME: This leaks memory, as the old charset_table becomes
1152 unreachable. If the old charset table is charset_table_init 1154 unreachable. If the old charset table is charset_table_init
1153 then this leak is intentional; otherwise, it's unclear. 1155 then this leak is intentional; otherwise, it's unclear.
@@ -1257,7 +1259,7 @@ define_charset_internal (Lisp_Object name,
1257 1259
1258 args[charset_arg_name] = name; 1260 args[charset_arg_name] = name;
1259 args[charset_arg_dimension] = make_number (dimension); 1261 args[charset_arg_dimension] = make_number (dimension);
1260 val = Fmake_vector (make_number (8), make_number (0)); 1262 val = make_uninit_vector (8);
1261 for (i = 0; i < 8; i++) 1263 for (i = 0; i < 8; i++)
1262 ASET (val, i, make_number (code_space[i])); 1264 ASET (val, i, make_number (code_space[i]));
1263 args[charset_arg_code_space] = val; 1265 args[charset_arg_code_space] = val;