diff options
| author | Stefan Monnier | 2011-03-21 12:42:16 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2011-03-21 12:42:16 -0400 |
| commit | cafdcef32d55cbb44389d7e322e7f973cbb72dfd (patch) | |
| tree | 7ee0c41ea8a589650ce6f4311fb10e61a63807b9 /src/charset.c | |
| parent | a08a25d7aaf251aa18f2ef747be53734bc55cae9 (diff) | |
| parent | 4e05e67e4cd0bc1b0a4ef3176a4d0d91c6b3738e (diff) | |
| download | emacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.tar.gz emacs-cafdcef32d55cbb44389d7e322e7f973cbb72dfd.zip | |
Merge from trunk
Diffstat (limited to 'src/charset.c')
| -rw-r--r-- | src/charset.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/charset.c b/src/charset.c index 3624e740acb..d82b29ae44b 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -29,6 +29,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 29 | #include <stdio.h> | 29 | #include <stdio.h> |
| 30 | #include <unistd.h> | 30 | #include <unistd.h> |
| 31 | #include <ctype.h> | 31 | #include <ctype.h> |
| 32 | #include <limits.h> | ||
| 32 | #include <sys/types.h> | 33 | #include <sys/types.h> |
| 33 | #include <setjmp.h> | 34 | #include <setjmp.h> |
| 34 | #include "lisp.h" | 35 | #include "lisp.h" |
| @@ -250,7 +251,7 @@ struct charset_map_entries | |||
| 250 | static void | 251 | static void |
| 251 | load_charset_map (struct charset *charset, struct charset_map_entries *entries, int n_entries, int control_flag) | 252 | load_charset_map (struct charset *charset, struct charset_map_entries *entries, int n_entries, int control_flag) |
| 252 | { | 253 | { |
| 253 | Lisp_Object vec, table; | 254 | Lisp_Object vec IF_LINT (= Qnil), table IF_LINT (= Qnil); |
| 254 | unsigned max_code = CHARSET_MAX_CODE (charset); | 255 | unsigned max_code = CHARSET_MAX_CODE (charset); |
| 255 | int ascii_compatible_p = charset->ascii_compatible_p; | 256 | int ascii_compatible_p = charset->ascii_compatible_p; |
| 256 | int min_char, max_char, nonascii_min_char; | 257 | int min_char, max_char, nonascii_min_char; |
| @@ -629,8 +630,12 @@ load_charset (struct charset *charset, int control_flag) | |||
| 629 | 630 | ||
| 630 | if (CHARSET_METHOD (charset) == CHARSET_METHOD_MAP) | 631 | if (CHARSET_METHOD (charset) == CHARSET_METHOD_MAP) |
| 631 | map = CHARSET_MAP (charset); | 632 | map = CHARSET_MAP (charset); |
| 632 | else if (CHARSET_UNIFIED_P (charset)) | 633 | else |
| 633 | map = CHARSET_UNIFY_MAP (charset); | 634 | { |
| 635 | if (! CHARSET_UNIFIED_P (charset)) | ||
| 636 | abort (); | ||
| 637 | map = CHARSET_UNIFY_MAP (charset); | ||
| 638 | } | ||
| 634 | if (STRINGP (map)) | 639 | if (STRINGP (map)) |
| 635 | load_charset_map_from_file (charset, map, control_flag); | 640 | load_charset_map_from_file (charset, map, control_flag); |
| 636 | else | 641 | else |
| @@ -668,9 +673,9 @@ map_charset_for_dump (void (*c_function) (Lisp_Object, Lisp_Object), Lisp_Object | |||
| 668 | 673 | ||
| 669 | while (1) | 674 | while (1) |
| 670 | { | 675 | { |
| 671 | int index = GET_TEMP_CHARSET_WORK_ENCODER (c); | 676 | int idx = GET_TEMP_CHARSET_WORK_ENCODER (c); |
| 672 | 677 | ||
| 673 | if (index >= from_idx && index <= to_idx) | 678 | if (idx >= from_idx && idx <= to_idx) |
| 674 | { | 679 | { |
| 675 | if (NILP (XCAR (range))) | 680 | if (NILP (XCAR (range))) |
| 676 | XSETCAR (range, make_number (c)); | 681 | XSETCAR (range, make_number (c)); |
| @@ -2066,10 +2071,10 @@ that case, find the charset from what supported by that coding system. */) | |||
| 2066 | 2071 | ||
| 2067 | for (; CONSP (restriction); restriction = XCDR (restriction)) | 2072 | for (; CONSP (restriction); restriction = XCDR (restriction)) |
| 2068 | { | 2073 | { |
| 2069 | struct charset *charset; | 2074 | struct charset *rcharset; |
| 2070 | 2075 | ||
| 2071 | CHECK_CHARSET_GET_CHARSET (XCAR (restriction), charset); | 2076 | CHECK_CHARSET_GET_CHARSET (XCAR (restriction), rcharset); |
| 2072 | if (ENCODE_CHAR (charset, c) != CHARSET_INVALID_CODE (charset)) | 2077 | if (ENCODE_CHAR (rcharset, c) != CHARSET_INVALID_CODE (rcharset)) |
| 2073 | return XCAR (restriction); | 2078 | return XCAR (restriction); |
| 2074 | } | 2079 | } |
| 2075 | return Qnil; | 2080 | return Qnil; |
| @@ -2250,7 +2255,7 @@ See also `charset-priority-list' and `set-charset-priority'. */) | |||
| 2250 | int n = XFASTINT (len), i, j, done; | 2255 | int n = XFASTINT (len), i, j, done; |
| 2251 | Lisp_Object tail, elt, attrs; | 2256 | Lisp_Object tail, elt, attrs; |
| 2252 | struct charset_sort_data *sort_data; | 2257 | struct charset_sort_data *sort_data; |
| 2253 | int id, min_id, max_id; | 2258 | int id, min_id = INT_MAX, max_id = INT_MIN; |
| 2254 | USE_SAFE_ALLOCA; | 2259 | USE_SAFE_ALLOCA; |
| 2255 | 2260 | ||
| 2256 | if (n == 0) | 2261 | if (n == 0) |
| @@ -2262,11 +2267,9 @@ See also `charset-priority-list' and `set-charset-priority'. */) | |||
| 2262 | CHECK_CHARSET_GET_ATTR (elt, attrs); | 2267 | CHECK_CHARSET_GET_ATTR (elt, attrs); |
| 2263 | sort_data[i].charset = elt; | 2268 | sort_data[i].charset = elt; |
| 2264 | sort_data[i].id = id = XINT (CHARSET_ATTR_ID (attrs)); | 2269 | sort_data[i].id = id = XINT (CHARSET_ATTR_ID (attrs)); |
| 2265 | if (i == 0) | 2270 | if (id < min_id) |
| 2266 | min_id = max_id = id; | ||
| 2267 | else if (id < min_id) | ||
| 2268 | min_id = id; | 2271 | min_id = id; |
| 2269 | else if (id > max_id) | 2272 | if (id > max_id) |
| 2270 | max_id = id; | 2273 | max_id = id; |
| 2271 | } | 2274 | } |
| 2272 | for (done = 0, tail = Vcharset_ordered_list, i = 0; | 2275 | for (done = 0, tail = Vcharset_ordered_list, i = 0; |