aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorKenichi Handa2014-06-28 10:35:48 +0900
committerKenichi Handa2014-06-28 10:35:48 +0900
commitf036e167feaf875873636972b28a4adc12c32254 (patch)
tree440e45ae8951f7030393b130b184f2b1882070ee /src/coding.c
parent1fc00e5c9e87c88b4b253692d6ade822f6d74d3e (diff)
parent2c4e2e6fd3096eb615504e3cfc89c588ec620f78 (diff)
downloademacs-f036e167feaf875873636972b28a4adc12c32254.tar.gz
emacs-f036e167feaf875873636972b28a4adc12c32254.zip
merge trunk
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c51
1 files changed, 23 insertions, 28 deletions
diff --git a/src/coding.c b/src/coding.c
index fbe14f1695f..79f116fc618 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -1485,7 +1485,7 @@ decode_coding_utf_8 (struct coding_system *coding)
1485 src = src_base; 1485 src = src_base;
1486 consumed_chars = consumed_chars_base; 1486 consumed_chars = consumed_chars_base;
1487 ONE_MORE_BYTE (c); 1487 ONE_MORE_BYTE (c);
1488 *charbuf++ = ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); 1488 *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
1489 coding->errors++; 1489 coding->errors++;
1490 } 1490 }
1491 1491
@@ -1725,7 +1725,7 @@ decode_coding_utf_16 (struct coding_system *coding)
1725 ONE_MORE_BYTE (c2); 1725 ONE_MORE_BYTE (c2);
1726 if (c2 < 0) 1726 if (c2 < 0)
1727 { 1727 {
1728 *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1); 1728 *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1);
1729 *charbuf++ = -c2; 1729 *charbuf++ = -c2;
1730 continue; 1730 continue;
1731 } 1731 }
@@ -2108,7 +2108,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2108 2108
2109 case 1: 2109 case 1:
2110 code = c; 2110 code = c;
2111 charset_ID = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; 2111 charset_ID = ASCII_CHAR_P (code) ? charset_ascii : charset_eight_bit;
2112 break; 2112 break;
2113 2113
2114 default: 2114 default:
@@ -2596,7 +2596,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
2596 src = src_base; 2596 src = src_base;
2597 consumed_chars = consumed_chars_base; 2597 consumed_chars = consumed_chars_base;
2598 ONE_MORE_BYTE (c); 2598 ONE_MORE_BYTE (c);
2599 *charbuf++ = ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); 2599 *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
2600 char_offset++; 2600 char_offset++;
2601 coding->errors++; 2601 coding->errors++;
2602 } 2602 }
@@ -3573,7 +3573,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
3573 3573
3574 if (CODING_ISO_EXTSEGMENT_LEN (coding) > 0) 3574 if (CODING_ISO_EXTSEGMENT_LEN (coding) > 0)
3575 { 3575 {
3576 *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1); 3576 *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1);
3577 char_offset++; 3577 char_offset++;
3578 CODING_ISO_EXTSEGMENT_LEN (coding)--; 3578 CODING_ISO_EXTSEGMENT_LEN (coding)--;
3579 continue; 3579 continue;
@@ -3600,7 +3600,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
3600 } 3600 }
3601 else 3601 else
3602 { 3602 {
3603 *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1); 3603 *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1);
3604 char_offset++; 3604 char_offset++;
3605 } 3605 }
3606 continue; 3606 continue;
@@ -3974,7 +3974,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
3974 MAYBE_FINISH_COMPOSITION (); 3974 MAYBE_FINISH_COMPOSITION ();
3975 for (; src_base < src; src_base++, char_offset++) 3975 for (; src_base < src; src_base++, char_offset++)
3976 { 3976 {
3977 if (ASCII_BYTE_P (*src_base)) 3977 if (ASCII_CHAR_P (*src_base))
3978 *charbuf++ = *src_base; 3978 *charbuf++ = *src_base;
3979 else 3979 else
3980 *charbuf++ = BYTE8_TO_CHAR (*src_base); 3980 *charbuf++ = BYTE8_TO_CHAR (*src_base);
@@ -4004,7 +4004,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
4004 src = src_base; 4004 src = src_base;
4005 consumed_chars = consumed_chars_base; 4005 consumed_chars = consumed_chars_base;
4006 ONE_MORE_BYTE (c); 4006 ONE_MORE_BYTE (c);
4007 *charbuf++ = c < 0 ? -c : ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); 4007 *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
4008 char_offset++; 4008 char_offset++;
4009 coding->errors++; 4009 coding->errors++;
4010 /* Reset the invocation and designation status to the safest 4010 /* Reset the invocation and designation status to the safest
@@ -5640,7 +5640,7 @@ decode_coding_charset (struct coding_system *coding)
5640 src = src_base; 5640 src = src_base;
5641 consumed_chars = consumed_chars_base; 5641 consumed_chars = consumed_chars_base;
5642 ONE_MORE_BYTE (c); 5642 ONE_MORE_BYTE (c);
5643 *charbuf++ = c < 0 ? -c : ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); 5643 *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
5644 char_offset++; 5644 char_offset++;
5645 coding->errors++; 5645 coding->errors++;
5646 } 5646 }
@@ -9031,13 +9031,13 @@ DEFUN ("find-coding-systems-region-internal",
9031 p = pbeg = BYTE_POS_ADDR (start_byte); 9031 p = pbeg = BYTE_POS_ADDR (start_byte);
9032 pend = p + (end_byte - start_byte); 9032 pend = p + (end_byte - start_byte);
9033 9033
9034 while (p < pend && ASCII_BYTE_P (*p)) p++; 9034 while (p < pend && ASCII_CHAR_P (*p)) p++;
9035 while (p < pend && ASCII_BYTE_P (*(pend - 1))) pend--; 9035 while (p < pend && ASCII_CHAR_P (*(pend - 1))) pend--;
9036 9036
9037 work_table = Fmake_char_table (Qnil, Qnil); 9037 work_table = Fmake_char_table (Qnil, Qnil);
9038 while (p < pend) 9038 while (p < pend)
9039 { 9039 {
9040 if (ASCII_BYTE_P (*p)) 9040 if (ASCII_CHAR_P (*p))
9041 p++; 9041 p++;
9042 else 9042 else
9043 { 9043 {
@@ -9091,8 +9091,7 @@ DEFUN ("find-coding-systems-region-internal",
9091 9091
9092DEFUN ("unencodable-char-position", Funencodable_char_position, 9092DEFUN ("unencodable-char-position", Funencodable_char_position,
9093 Sunencodable_char_position, 3, 5, 0, 9093 Sunencodable_char_position, 3, 5, 0,
9094 doc: /* 9094 doc: /* Return position of first un-encodable character in a region.
9095Return position of first un-encodable character in a region.
9096START and END specify the region and CODING-SYSTEM specifies the 9095START and END specify the region and CODING-SYSTEM specifies the
9097encoding to check. Return nil if CODING-SYSTEM does encode the region. 9096encoding to check. Return nil if CODING-SYSTEM does encode the region.
9098 9097
@@ -9102,8 +9101,9 @@ list of positions.
9102 9101
9103If optional 5th argument STRING is non-nil, it is a string to search 9102If optional 5th argument STRING is non-nil, it is a string to search
9104for un-encodable characters. In that case, START and END are indexes 9103for un-encodable characters. In that case, START and END are indexes
9105to the string. */) 9104to the string and treated as in `substring'. */)
9106 (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object count, Lisp_Object string) 9105 (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system,
9106 Lisp_Object count, Lisp_Object string)
9107{ 9107{
9108 EMACS_INT n; 9108 EMACS_INT n;
9109 struct coding_system coding; 9109 struct coding_system coding;
@@ -9140,12 +9140,7 @@ to the string. */)
9140 else 9140 else
9141 { 9141 {
9142 CHECK_STRING (string); 9142 CHECK_STRING (string);
9143 CHECK_NATNUM (start); 9143 validate_subarray (string, start, end, SCHARS (string), &from, &to);
9144 CHECK_NATNUM (end);
9145 if (! (XINT (start) <= XINT (end) && XINT (end) <= SCHARS (string)))
9146 args_out_of_range_3 (string, start, end);
9147 from = XINT (start);
9148 to = XINT (end);
9149 if (! STRING_MULTIBYTE (string)) 9144 if (! STRING_MULTIBYTE (string))
9150 return Qnil; 9145 return Qnil;
9151 p = SDATA (string) + string_char_to_byte (string, from); 9146 p = SDATA (string) + string_char_to_byte (string, from);
@@ -9169,7 +9164,7 @@ to the string. */)
9169 int c; 9164 int c;
9170 9165
9171 if (ascii_compatible) 9166 if (ascii_compatible)
9172 while (p < stop && ASCII_BYTE_P (*p)) 9167 while (p < stop && ASCII_CHAR_P (*p))
9173 p++, from++; 9168 p++, from++;
9174 if (p >= stop) 9169 if (p >= stop)
9175 { 9170 {
@@ -9285,12 +9280,12 @@ is nil. */)
9285 p = pbeg = BYTE_POS_ADDR (start_byte); 9280 p = pbeg = BYTE_POS_ADDR (start_byte);
9286 pend = p + (end_byte - start_byte); 9281 pend = p + (end_byte - start_byte);
9287 9282
9288 while (p < pend && ASCII_BYTE_P (*p)) p++, pos++; 9283 while (p < pend && ASCII_CHAR_P (*p)) p++, pos++;
9289 while (p < pend && ASCII_BYTE_P (*(pend - 1))) pend--; 9284 while (p < pend && ASCII_CHAR_P (*(pend - 1))) pend--;
9290 9285
9291 while (p < pend) 9286 while (p < pend)
9292 { 9287 {
9293 if (ASCII_BYTE_P (*p)) 9288 if (ASCII_CHAR_P (*p))
9294 p++; 9289 p++;
9295 else 9290 else
9296 { 9291 {
@@ -9598,7 +9593,7 @@ Return the corresponding character. */)
9598 CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec); 9593 CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec);
9599 attrs = AREF (spec, 0); 9594 attrs = AREF (spec, 0);
9600 9595
9601 if (ASCII_BYTE_P (ch) 9596 if (ASCII_CHAR_P (ch)
9602 && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) 9597 && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
9603 return code; 9598 return code;
9604 9599
@@ -9679,7 +9674,7 @@ Return the corresponding character. */)
9679 CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec); 9674 CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec);
9680 attrs = AREF (spec, 0); 9675 attrs = AREF (spec, 0);
9681 9676
9682 if (ASCII_BYTE_P (ch) 9677 if (ASCII_CHAR_P (ch)
9683 && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) 9678 && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
9684 return code; 9679 return code;
9685 9680