From: Paul Eggert Date: Sun, 1 May 2011 16:27:34 +0000 (-0700) Subject: * charset.h (struct charset.code_space): Now has 15 elements, not 16. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~92^2~22^2~2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c032b5f8c03c4cd94239074dc9fd682bc3e2f3a1;p=emacs.git * charset.h (struct charset.code_space): Now has 15 elements, not 16. * charset.c (Fdefine_charset_internal): Don't initialize charset.code_space[15]. The value was garbage, on hosts with 32-bit int. --- diff --git a/src/ChangeLog b/src/ChangeLog index 7b54b1e521c..93af816947c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2011-05-01 Paul Eggert + + * charset.h (struct charset.code_space): Now has 15 elements, not 16. + * charset.c (Fdefine_charset_internal): Don't initialize + charset.code_space[15]. The value was garbage, on hosts with + 32-bit int. + 2011-04-30 Eli Zaretskii * dosfns.c (Fint86, Fdos_memget, Fdos_memput): Use `ASIZE (FOO)' diff --git a/src/charset.c b/src/charset.c index 52c2ebdcc4e..55fd57031ac 100644 --- a/src/charset.c +++ b/src/charset.c @@ -869,7 +869,7 @@ usage: (define-charset-internal ...) */) ASET (attrs, charset_name, args[charset_arg_name]); val = args[charset_arg_code_space]; - for (i = 0, dimension = 0, nchars = 1; i < 4; i++) + for (i = 0, dimension = 0, nchars = 1; ; i++) { int min_byte, max_byte; @@ -880,10 +880,12 @@ usage: (define-charset-internal ...) */) charset.code_space[i * 4] = min_byte; charset.code_space[i * 4 + 1] = max_byte; charset.code_space[i * 4 + 2] = max_byte - min_byte + 1; - nchars *= charset.code_space[i * 4 + 2]; - charset.code_space[i * 4 + 3] = nchars; if (max_byte > 0) dimension = i + 1; + if (i == 3) + break; + nchars *= charset.code_space[i * 4 + 2]; + charset.code_space[i * 4 + 3] = nchars; } val = args[charset_arg_dimension]; diff --git a/src/charset.h b/src/charset.h index 74d55a31b43..53784bf8455 100644 --- a/src/charset.h +++ b/src/charset.h @@ -155,10 +155,11 @@ struct charset byte code of the (N+1)th dimension, [4N+1] is a maximum byte code of the (N+1)th dimension, [4N+2] is ([4N+1] - [4N] + 1), [4N+3] - is a number of characters containd in the first to (N+1)th - dismesions. We get `char-index' of a `code-point' from this + is the number of characters contained in the first through (N+1)th + dimensions, except that there is no [15]. + We get `char-index' of a `code-point' from this information. */ - int code_space[16]; + int code_space[15]; /* If B is a byte of Nth dimension of a code-point, the (N-1)th bit of code_space_mask[B] is set. This array is used to quickly