From 3fd3e736934750c8b0e73b8327f0b75d3b09bf78 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 26 Mar 2014 10:55:31 -0700 Subject: More backward-compatible fix to char-equal core dump. * editfns.c (Fchar_equal): In unibyte buffers, assume values in range 128-255 are raw bytes. Suggested by Eli Zaretskii. Fixes: debbugs:17011 --- src/ChangeLog | 6 +++++- src/editfns.c | 20 +++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index bf27ece6af7..025ea45b23b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,4 +1,8 @@ -2014-03-26 Paul Eggert +2014-03-26 Paul Eggert + + More backward-compatible fix to char-equal core dump (Bug#17011). + * editfns.c (Fchar_equal): In unibyte buffers, assume values in + range 128-255 are raw bytes. Suggested by Eli Zaretskii. Fix core dump in char-equal (Bug#17011). * editfns.c (Fchar_equal): Do not use MAKE_CHAR_MULTIBYTE in diff --git a/src/editfns.c b/src/editfns.c index 1986ee53d23..9c1fcb0b790 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -4377,13 +4377,23 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) if (NILP (BVAR (current_buffer, case_fold_search))) return Qnil; - /* FIXME: When enable-multibyte-characters is nil, it's still possible - to manipulate multibyte chars, which means there is a bug for chars - in the range 128-255 as we can't tell whether they are eight-bit - bytes or Latin-1 chars. For now, assume the latter. See Bug#17011. - Also see casefiddle.c's casify_object, which has a similar problem. */ i1 = XFASTINT (c1); i2 = XFASTINT (c2); + + /* FIXME: It is possible to compare multibyte characters even when + the current buffer is unibyte. Unfortunately this is ambiguous + for characters between 128 and 255, as they could be either + eight-bit raw bytes or Latin-1 characters. Assume the former for + now. See Bug#17011, and also see casefiddle.c's casify_object, + which has a similar problem. */ + if (NILP (BVAR (current_buffer, enable_multibyte_characters))) + { + if (SINGLE_BYTE_CHAR_P (i1)) + i1 = UNIBYTE_TO_CHAR (i1); + if (SINGLE_BYTE_CHAR_P (i2)) + i2 = UNIBYTE_TO_CHAR (i2); + } + return (downcase (i1) == downcase (i2) ? Qt : Qnil); } -- cgit v1.2.1 From 0c4e715c98919593413a76a0ab1458b0d10ea287 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Thu, 27 Mar 2014 18:25:17 +0200 Subject: Fix bug #17115 with displaying on w32 images that have 'box' face. src/w32term.c (x_draw_image_glyph_string): Fix computation of height and width of image background when it is displayed with a 'box' face. --- src/ChangeLog | 6 ++++++ src/w32term.c | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 025ea45b23b..0c24451c459 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2014-03-27 YAMAMOTO Mitsuharu + + * w32term.c (x_draw_image_glyph_string): Fix computation of height + and width of image background when it is displayed with a 'box' + face. (Bug#17115) + 2014-03-26 Paul Eggert More backward-compatible fix to char-equal core dump (Bug#17011). diff --git a/src/w32term.c b/src/w32term.c index 4c426aca921..2fe73a3eb48 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2085,10 +2085,14 @@ x_draw_image_glyph_string (struct glyph_string *s) int x, y; int box_line_hwidth = eabs (s->face->box_line_width); int box_line_vwidth = max (s->face->box_line_width, 0); - int height; + int height, width; HBITMAP pixmap = 0; - height = s->height - 2 * box_line_vwidth; + height = s->height; + if (s->slice.y == 0) + height -= box_line_vwidth; + if (s->slice.y + s->slice.height >= s->img->height) + height -= box_line_vwidth; /* Fill background with face under the image. Do it only if row is taller than image or if image has a clip mask to reduce @@ -2101,10 +2105,14 @@ x_draw_image_glyph_string (struct glyph_string *s) || s->img->pixmap == 0 || s->width != s->background_width) { + width = s->background_width; x = s->x; if (s->first_glyph->left_box_line_p && s->slice.x == 0) - x += box_line_hwidth; + { + x += box_line_hwidth; + width -= box_line_hwidth; + } y = s->y; if (s->slice.y == 0) @@ -2150,7 +2158,7 @@ x_draw_image_glyph_string (struct glyph_string *s) } else #endif - x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height); + x_draw_glyph_string_bg_rect (s, x, y, width, height); s->background_filled_p = 1; } -- cgit v1.2.1