aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Schwab2009-02-22 15:48:02 +0000
committerAndreas Schwab2009-02-22 15:48:02 +0000
commit1b3b981ba9f1781d3054f10e2fa9b1a330c68268 (patch)
tree3728d47b1f005a45a8092e5f9e6904d618e9d071 /src
parentb3b58c01900f2c028f00d4aa8d432cdc53f072be (diff)
downloademacs-1b3b981ba9f1781d3054f10e2fa9b1a330c68268.tar.gz
emacs-1b3b981ba9f1781d3054f10e2fa9b1a330c68268.zip
* coding.h (struct coding_system): Make safe_charsets a pointer to
unsigned char. * coding.c (CODING_ISO_REQUEST): Check for safe_charsets content being 255. (SAFE_CHARSET_P): Likewise. (setup_iso_safe_charsets): Properly setup safe_charsets. (Fdefine_coding_system_internal): Likewise. (setup_coding_system): Likewise. Remove unneeded casts. (detect_coding_iso_2022): Compare Viso_2022_charset_list with CODING_ATTR_CHARSET_LIST, not CODING_ATTR_SAFE_CHARSETS. Remove unneeded casts.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/coding.c36
-rw-r--r--src/coding.h2
3 files changed, 32 insertions, 18 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0e75c26a763..1f386d97797 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,17 @@
12009-02-22 Andreas Schwab <schwab@linux-m68k.org> 12009-02-22 Andreas Schwab <schwab@linux-m68k.org>
2 2
3 * coding.h (struct coding_system): Make safe_charsets a pointer to
4 unsigned char.
5 * coding.c (CODING_ISO_REQUEST): Check for safe_charsets content
6 being 255.
7 (SAFE_CHARSET_P): Likewise.
8 (setup_iso_safe_charsets): Properly setup safe_charsets.
9 (Fdefine_coding_system_internal): Likewise.
10 (setup_coding_system): Likewise. Remove unneeded casts.
11 (detect_coding_iso_2022): Compare Viso_2022_charset_list with
12 CODING_ATTR_CHARSET_LIST, not CODING_ATTR_SAFE_CHARSETS. Remove
13 unneeded casts.
14
3 * insdel.c (del_range_2): Don't modify gap contents when called 15 * insdel.c (del_range_2): Don't modify gap contents when called
4 from decode_coding_object. (Bug#1809) 16 from decode_coding_object. (Bug#1809)
5 17
diff --git a/src/coding.c b/src/coding.c
index 313e4021486..7438fc0d337 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -432,9 +432,11 @@ Lisp_Object Vbig5_coding_system;
432 reg))) 432 reg)))
433 433
434 434
435#define CODING_ISO_REQUEST(coding, charset_id) \ 435#define CODING_ISO_REQUEST(coding, charset_id) \
436 ((charset_id <= (coding)->max_charset_id \ 436 (((charset_id) <= (coding)->max_charset_id \
437 ? (coding)->safe_charsets[charset_id] \ 437 ? ((coding)->safe_charsets[charset_id] != 255 \
438 ? (coding)->safe_charsets[charset_id] \
439 : -1) \
438 : -1)) 440 : -1))
439 441
440 442
@@ -2729,7 +2731,7 @@ enum iso_code_class_type iso_code_class[256];
2729 2731
2730#define SAFE_CHARSET_P(coding, id) \ 2732#define SAFE_CHARSET_P(coding, id) \
2731 ((id) <= (coding)->max_charset_id \ 2733 ((id) <= (coding)->max_charset_id \
2732 && (coding)->safe_charsets[id] >= 0) 2734 && (coding)->safe_charsets[id] != 255)
2733 2735
2734 2736
2735#define SHIFT_OUT_OK(category) \ 2737#define SHIFT_OUT_OK(category) \
@@ -2767,8 +2769,8 @@ setup_iso_safe_charsets (attrs)
2767 max_charset_id = id; 2769 max_charset_id = id;
2768 } 2770 }
2769 2771
2770 safe_charsets = Fmake_string (make_number (max_charset_id + 1), 2772 safe_charsets = make_uninit_string (max_charset_id + 1);
2771 make_number (255)); 2773 memset (SDATA (safe_charsets), 255, max_charset_id + 1);
2772 request = AREF (attrs, coding_attr_iso_request); 2774 request = AREF (attrs, coding_attr_iso_request);
2773 reg_usage = AREF (attrs, coding_attr_iso_usage); 2775 reg_usage = AREF (attrs, coding_attr_iso_usage);
2774 reg94 = XINT (XCAR (reg_usage)); 2776 reg94 = XINT (XCAR (reg_usage));
@@ -2832,11 +2834,11 @@ detect_coding_iso_2022 (coding, detect_info)
2832 continue; 2834 continue;
2833 attrs = CODING_ID_ATTRS (this->id); 2835 attrs = CODING_ID_ATTRS (this->id);
2834 if (CODING_ISO_FLAGS (this) & CODING_ISO_FLAG_FULL_SUPPORT 2836 if (CODING_ISO_FLAGS (this) & CODING_ISO_FLAG_FULL_SUPPORT
2835 && ! EQ (CODING_ATTR_SAFE_CHARSETS (attrs), Viso_2022_charset_list)) 2837 && ! EQ (CODING_ATTR_CHARSET_LIST (attrs), Viso_2022_charset_list))
2836 setup_iso_safe_charsets (attrs); 2838 setup_iso_safe_charsets (attrs);
2837 val = CODING_ATTR_SAFE_CHARSETS (attrs); 2839 val = CODING_ATTR_SAFE_CHARSETS (attrs);
2838 this->max_charset_id = SCHARS (val) - 1; 2840 this->max_charset_id = SCHARS (val) - 1;
2839 this->safe_charsets = (char *) SDATA (val); 2841 this->safe_charsets = SDATA (val);
2840 } 2842 }
2841 2843
2842 /* A coding system of this category is always ASCII compatible. */ 2844 /* A coding system of this category is always ASCII compatible. */
@@ -3246,7 +3248,7 @@ decode_coding_iso_2022 (coding)
3246 setup_iso_safe_charsets (attrs); 3248 setup_iso_safe_charsets (attrs);
3247 /* Charset list may have been changed. */ 3249 /* Charset list may have been changed. */
3248 charset_list = CODING_ATTR_CHARSET_LIST (attrs); 3250 charset_list = CODING_ATTR_CHARSET_LIST (attrs);
3249 coding->safe_charsets = (char *) SDATA (CODING_ATTR_SAFE_CHARSETS(attrs)); 3251 coding->safe_charsets = SDATA (CODING_ATTR_SAFE_CHARSETS (attrs));
3250 3252
3251 while (1) 3253 while (1)
3252 { 3254 {
@@ -4133,7 +4135,7 @@ encode_coding_iso_2022 (coding)
4133 setup_iso_safe_charsets (attrs); 4135 setup_iso_safe_charsets (attrs);
4134 /* Charset list may have been changed. */ 4136 /* Charset list may have been changed. */
4135 charset_list = CODING_ATTR_CHARSET_LIST (attrs); 4137 charset_list = CODING_ATTR_CHARSET_LIST (attrs);
4136 coding->safe_charsets = (char *) SDATA (CODING_ATTR_SAFE_CHARSETS(attrs)); 4138 coding->safe_charsets = SDATA (CODING_ATTR_SAFE_CHARSETS (attrs));
4137 4139
4138 ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)); 4140 ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs));
4139 4141
@@ -5414,7 +5416,7 @@ setup_coding_system (coding_system, coding)
5414 5416
5415 val = CODING_ATTR_SAFE_CHARSETS (attrs); 5417 val = CODING_ATTR_SAFE_CHARSETS (attrs);
5416 coding->max_charset_id = SCHARS (val) - 1; 5418 coding->max_charset_id = SCHARS (val) - 1;
5417 coding->safe_charsets = (char *) SDATA (val); 5419 coding->safe_charsets = SDATA (val);
5418 coding->default_char = XINT (CODING_ATTR_DEFAULT_CHAR (attrs)); 5420 coding->default_char = XINT (CODING_ATTR_DEFAULT_CHAR (attrs));
5419 5421
5420 coding_type = CODING_ATTR_TYPE (attrs); 5422 coding_type = CODING_ATTR_TYPE (attrs);
@@ -5459,7 +5461,7 @@ setup_coding_system (coding_system, coding)
5459 setup_iso_safe_charsets (attrs); 5461 setup_iso_safe_charsets (attrs);
5460 val = CODING_ATTR_SAFE_CHARSETS (attrs); 5462 val = CODING_ATTR_SAFE_CHARSETS (attrs);
5461 coding->max_charset_id = SCHARS (val) - 1; 5463 coding->max_charset_id = SCHARS (val) - 1;
5462 coding->safe_charsets = (char *) SDATA (val); 5464 coding->safe_charsets = SDATA (val);
5463 } 5465 }
5464 CODING_ISO_FLAGS (coding) = flags; 5466 CODING_ISO_FLAGS (coding) = flags;
5465 } 5467 }
@@ -5529,13 +5531,13 @@ setup_coding_system (coding_system, coding)
5529 tail = XCDR (tail)) 5531 tail = XCDR (tail))
5530 if (max_charset_id < XFASTINT (XCAR (tail))) 5532 if (max_charset_id < XFASTINT (XCAR (tail)))
5531 max_charset_id = XFASTINT (XCAR (tail)); 5533 max_charset_id = XFASTINT (XCAR (tail));
5532 safe_charsets = Fmake_string (make_number (max_charset_id + 1), 5534 safe_charsets = make_uninit_string (max_charset_id + 1);
5533 make_number (255)); 5535 memset (SDATA (safe_charsets), 255, max_charset_id + 1);
5534 for (tail = Vemacs_mule_charset_list; CONSP (tail); 5536 for (tail = Vemacs_mule_charset_list; CONSP (tail);
5535 tail = XCDR (tail)) 5537 tail = XCDR (tail))
5536 SSET (safe_charsets, XFASTINT (XCAR (tail)), 0); 5538 SSET (safe_charsets, XFASTINT (XCAR (tail)), 0);
5537 coding->max_charset_id = max_charset_id; 5539 coding->max_charset_id = max_charset_id;
5538 coding->safe_charsets = (char *) SDATA (safe_charsets); 5540 coding->safe_charsets = SDATA (safe_charsets);
5539 } 5541 }
5540 } 5542 }
5541 else if (EQ (coding_type, Qshift_jis)) 5543 else if (EQ (coding_type, Qshift_jis))
@@ -9293,8 +9295,8 @@ usage: (define-coding-system-internal ...) */)
9293 } 9295 }
9294 CODING_ATTR_CHARSET_LIST (attrs) = charset_list; 9296 CODING_ATTR_CHARSET_LIST (attrs) = charset_list;
9295 9297
9296 safe_charsets = Fmake_string (make_number (max_charset_id + 1), 9298 safe_charsets = make_uninit_string (max_charset_id + 1);
9297 make_number (255)); 9299 memset (SDATA (safe_charsets), 255, max_charset_id + 1);
9298 for (tail = charset_list; CONSP (tail); tail = XCDR (tail)) 9300 for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
9299 SSET (safe_charsets, XFASTINT (XCAR (tail)), 0); 9301 SSET (safe_charsets, XFASTINT (XCAR (tail)), 0);
9300 CODING_ATTR_SAFE_CHARSETS (attrs) = safe_charsets; 9302 CODING_ATTR_SAFE_CHARSETS (attrs) = safe_charsets;
diff --git a/src/coding.h b/src/coding.h
index 544dd44bb93..3daf4a725f2 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -391,7 +391,7 @@ struct coding_system
391 } spec; 391 } spec;
392 392
393 int max_charset_id; 393 int max_charset_id;
394 char *safe_charsets; 394 unsigned char *safe_charsets;
395 395
396 /* The following two members specify how binary 8-bit code 128..255 396 /* The following two members specify how binary 8-bit code 128..255
397 are represented in source and destination text respectively. 1 397 are represented in source and destination text respectively. 1