[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/src coding.c
From: |
Kenichi Handa |
Subject: |
[Emacs-diffs] emacs/src coding.c |
Date: |
Tue, 21 Apr 2009 06:36:03 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Changes by: Kenichi Handa <handa> 09/04/21 06:36:03
Modified files:
src : coding.c
Log message:
(decode_coding_utf_16): Reduce charbuf_end for the
worst case.
(decode_coding_emacs_mule, decode_coding_iso_2022)
(decode_coding_sjis, decode_coding_big5, decode_coding_charset):
Likewise.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/coding.c?cvsroot=emacs&r1=1.426&r2=1.427
Patches:
Index: coding.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/coding.c,v
retrieving revision 1.426
retrieving revision 1.427
diff -u -b -r1.426 -r1.427
--- coding.c 27 Mar 2009 07:26:37 -0000 1.426
+++ coding.c 21 Apr 2009 06:36:03 -0000 1.427
@@ -1703,7 +1703,8 @@
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base;
int *charbuf = coding->charbuf + coding->charbuf_used;
- int *charbuf_end = coding->charbuf + coding->charbuf_size;
+ /* We may produces at most 3 chars in one loop. */
+ int *charbuf_end = coding->charbuf + coding->charbuf_size - 2;
int consumed_chars = 0, consumed_chars_base = 0;
int multibytep = coding->src_multibyte;
enum utf_bom_type bom = CODING_UTF_16_BOM (coding);
@@ -1749,7 +1750,7 @@
src_base = src;
consumed_chars_base = consumed_chars;
- if (charbuf + 2 >= charbuf_end)
+ if (charbuf >= charbuf_end)
{
if (byte_after_cr1 >= 0)
src_base -= 2;
@@ -2442,8 +2443,10 @@
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base;
int *charbuf = coding->charbuf + coding->charbuf_used;
+ /* We may produce two annocations (charset and composition) in one
+ loop and one more charset annocation at the end. */
int *charbuf_end
- = coding->charbuf + coding->charbuf_size - MAX_ANNOTATION_LENGTH;
+ = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3);
int consumed_chars = 0, consumed_chars_base;
int multibytep = coding->src_multibyte;
Lisp_Object attrs, charset_list;
@@ -3558,8 +3561,10 @@
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base;
int *charbuf = coding->charbuf + coding->charbuf_used;
+ /* We may produce two annocations (charset and composition) in one
+ loop and one more charset annocation at the end. */
int *charbuf_end
- = coding->charbuf + coding->charbuf_size - MAX_ANNOTATION_LENGTH;
+ = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3);
int consumed_chars = 0, consumed_chars_base;
int multibytep = coding->src_multibyte;
/* Charsets invoked to graphic plane 0 and 1 respectively. */
@@ -4758,8 +4763,10 @@
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base;
int *charbuf = coding->charbuf + coding->charbuf_used;
+ /* We may produce one charset annocation in one loop and one more at
+ the end. */
int *charbuf_end
- = coding->charbuf + coding->charbuf_size - MAX_ANNOTATION_LENGTH;
+ = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
int consumed_chars = 0, consumed_chars_base;
int multibytep = coding->src_multibyte;
struct charset *charset_roman, *charset_kanji, *charset_kana;
@@ -4875,8 +4882,10 @@
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base;
int *charbuf = coding->charbuf + coding->charbuf_used;
+ /* We may produce one charset annocation in one loop and one more at
+ the end. */
int *charbuf_end
- = coding->charbuf + coding->charbuf_size - MAX_ANNOTATION_LENGTH;
+ = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
int consumed_chars = 0, consumed_chars_base;
int multibytep = coding->src_multibyte;
struct charset *charset_roman, *charset_big5;
@@ -5549,8 +5558,10 @@
const unsigned char *src_end = coding->source + coding->src_bytes;
const unsigned char *src_base;
int *charbuf = coding->charbuf + coding->charbuf_used;
+ /* We may produce one charset annocation in one loop and one more at
+ the end. */
int *charbuf_end
- = coding->charbuf + coding->charbuf_size - MAX_ANNOTATION_LENGTH;
+ = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
int consumed_chars = 0, consumed_chars_base;
int multibytep = coding->src_multibyte;
Lisp_Object attrs, charset_list, valids;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs/src coding.c,
Kenichi Handa <=