From: Ken Raeburn Date: Sat, 1 Apr 2000 12:59:53 +0000 (+0000) Subject: Fix Lisp_Object/int type confusion revealed by making Lisp_Object a union type: X-Git-Tag: emacs-pretest-21.0.90~4364 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6fc556fdb41c112247d113d46cc215e73c9e2b3c;p=emacs.git Fix Lisp_Object/int type confusion revealed by making Lisp_Object a union type: * xdisp.c (compute_string_pos): Fix order of arguments to string_pos_nchars_ahead. (handle_fontified_prop, add_to_log): Pass int, not Lisp_Object, as count arg to variable-arg routines like Frun_hook_with_args and Fformat. (back_to_previous_visible_line_start, build_desired_tool_bar_string): Pass Lisp_Object, not int, to fixed-arg routines like Fget_char_property and Fmake_string. (reconsider_clip_changes): Use XINT when comparing integer lisp objects, or passing them as int arguments. (mark_window_display_accurate, insert_left_trunc_glyphs, append_space, extend_face_to_end_of_line): Use make_number when storing or passing integer values as lisp objects. (set_cursor_from_row, highlight_trailing_whitespace): Use INTEGERP, not implicit test against zero, for glyph object. (try_window_id): Don't use make_number when we want an int value. * xfaces.c (xlfd_symbolic_value): Make last argument a Lisp_Object, to be consistent with callers. (Fbitmap_spec_p): Use XINT to get numeric value of height. (lface_hash): Apply XFASTINT to lisp values before folding in. * xfns.c (Fx_show_tip): Use make_number to get lisp objects to fill in window width and height. Pass an int, not a lisp object, as first arg to Finsert. --- diff --git a/src/ChangeLog b/src/ChangeLog index 4d493cc7ae1..1bfc02e5d8b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -8,6 +8,32 @@ (shrink_window_lowest_first): w->top is Lisp_Object; use XINT. (grow_mini_window): Fix typo getting int value of root->height. + * xdisp.c (compute_string_pos): Fix order of arguments to + string_pos_nchars_ahead. + (handle_fontified_prop, add_to_log): Pass int, not Lisp_Object, as + count arg to variable-arg routines like Frun_hook_with_args and + Fformat. + (back_to_previous_visible_line_start, + build_desired_tool_bar_string): Pass Lisp_Object, not int, to + fixed-arg routines like Fget_char_property and Fmake_string. + (reconsider_clip_changes): Use XINT when comparing integer lisp + objects, or passing them as int arguments. + (mark_window_display_accurate, insert_left_trunc_glyphs, + append_space, extend_face_to_end_of_line): Use make_number when + storing or passing integer values as lisp objects. + (set_cursor_from_row, highlight_trailing_whitespace): Use + INTEGERP, not implicit test against zero, for glyph object. + (try_window_id): Don't use make_number when we want an int value. + + * xfaces.c (xlfd_symbolic_value): Make last argument a + Lisp_Object, to be consistent with callers. + (Fbitmap_spec_p): Use XINT to get numeric value of height. + (lface_hash): Apply XFASTINT to lisp values before folding in. + + * xfns.c (Fx_show_tip): Use make_number to get lisp objects to + fill in window width and height. Pass an int, not a lisp object, + as first arg to Finsert. + 2000-04-01 Gerd Moellmann * xfaces.c (realize_basic_faces): Block input while realizing diff --git a/src/xdisp.c b/src/xdisp.c index 16ab84c9cb7..975a431dd8c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -1021,8 +1021,8 @@ compute_string_pos (newpos, pos, string) xassert (CHARPOS (*newpos) >= CHARPOS (pos)); if (STRING_MULTIBYTE (string)) - *newpos = string_pos_nchars_ahead (pos, CHARPOS (*newpos) - CHARPOS (pos), - string); + *newpos = string_pos_nchars_ahead (pos, string, + CHARPOS (*newpos) - CHARPOS (pos)); else BYTEPOS (*newpos) = CHARPOS (*newpos); } @@ -1786,7 +1786,7 @@ handle_fontified_prop (it) /* Run the hook functions. */ args[0] = Qfontification_functions; args[1] = pos; - Frun_hook_with_args (make_number (2), args); + Frun_hook_with_args (2, args); /* Return HANDLED_RECOMPUTE_PROPS only if function fontified something. This avoids an endless loop if they failed to @@ -3033,7 +3033,8 @@ back_to_previous_visible_line_start (it) { Lisp_Object prop; - prop = Fget_char_property (IT_CHARPOS (*it), Qinvisible, it->window); + prop = Fget_char_property (make_number (IT_CHARPOS (*it)), + Qinvisible, it->window); if (TEXT_PROP_MEANS_INVISIBLE (prop)) visible_p = 0; } @@ -4669,7 +4670,7 @@ add_to_log (format, arg1, arg2) args[0] = fmt = build_string (format); args[1] = arg1; args[2] = arg2; - msg = Fformat (make_number (3), args); + msg = Fformat (3, args); len = STRING_BYTES (XSTRING (msg)) + 1; buffer = (char *) alloca (len); @@ -6463,7 +6464,8 @@ build_desired_tool_bar_string (f) /* Reuse f->desired_tool_bar_string, if possible. */ if (size < size_needed) - f->desired_tool_bar_string = Fmake_string (make_number (size_needed), ' '); + f->desired_tool_bar_string = Fmake_string (make_number (size_needed), + make_number (' ')); else { props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil); @@ -7115,9 +7117,9 @@ reconsider_clip_changes (w, b) pt = marker_position (w->pointm); if ((w->current_matrix->buffer != XBUFFER (w->buffer) - || pt != w->last_point) + || pt != XINT (w->last_point)) && check_point_in_composition (w->current_matrix->buffer, - w->last_point, + XINT (w->last_point), XBUFFER (w->buffer), pt)) b->clip_changed = 1; } @@ -7893,9 +7895,9 @@ mark_window_display_accurate (window, accurate_p) w->last_cursor = w->cursor; w->last_cursor_off_p = w->cursor_off_p; if (w == XWINDOW (selected_window)) - w->last_point = BUF_PT (b); + w->last_point = make_number (BUF_PT (b)); else - w->last_point = XMARKER (w->pointm)->charpos; + w->last_point = make_number (XMARKER (w->pointm)->charpos); } } @@ -8014,7 +8016,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) frames. */ if (row->displays_text_p) while (glyph < end - && !glyph->object + && INTEGERP (glyph->object) && glyph->charpos < 0) { x += glyph->pixel_width; @@ -8022,7 +8024,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) } while (glyph < end - && glyph->object + && !INTEGERP (glyph->object) && (!BUFFERP (glyph->object) || glyph->charpos < pt_old)) { @@ -10033,7 +10035,7 @@ try_window_id (w) w->window_end_pos = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); w->window_end_bytepos - = make_number (Z_BYTE - MATRIX_ROW_END_BYTEPOS (row)); + = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); return 1; } @@ -10047,7 +10049,7 @@ try_window_id (w) w->window_end_pos = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); w->window_end_bytepos - = make_number (Z_BYTE - MATRIX_ROW_END_BYTEPOS (row)); + = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); return 1; } @@ -10778,7 +10780,7 @@ insert_left_trunc_glyphs (it) truncate_it.glyph_row = &scratch_glyph_row; truncate_it.glyph_row->used[TEXT_AREA] = 0; CHARPOS (truncate_it.position) = BYTEPOS (truncate_it.position) = -1; - truncate_it.object = 0; + truncate_it.object = make_number (0); produce_special_glyphs (&truncate_it, IT_TRUNCATION); /* Overwrite glyphs from IT with truncation glyphs. */ @@ -10936,7 +10938,7 @@ append_space (it, default_face_p) it->what = IT_CHARACTER; bzero (&it->position, sizeof it->position); - it->object = 0; + it->object = make_number (0); it->c = ' '; it->len = 1; @@ -11023,7 +11025,7 @@ extend_face_to_end_of_line (it) it->what = IT_CHARACTER; bzero (&it->position, sizeof it->position); - it->object = 0; + it->object = make_number (0); it->c = ' '; it->len = 1; @@ -11084,7 +11086,7 @@ highlight_trailing_whitespace (f, row) cursor at the end of a line. */ if (glyph->type == CHAR_GLYPH && glyph->u.ch == ' ' - && glyph->object == 0) + && INTEGERP (glyph->object)) --glyph; /* If last glyph is a space or stretch, and it's trailing diff --git a/src/xfaces.c b/src/xfaces.c index c585515497a..00697cdee29 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -499,7 +499,8 @@ static int xlfd_fixed_p P_ ((struct font_name *)); static int xlfd_numeric_value P_ ((struct table_entry *, int, struct font_name *, int, int)); static Lisp_Object xlfd_symbolic_value P_ ((struct table_entry *, int, - struct font_name *, int, int)); + struct font_name *, int, + Lisp_Object)); static struct table_entry *xlfd_lookup_field_contents P_ ((struct table_entry *, int, struct font_name *, int)); @@ -1008,7 +1009,7 @@ the pixmap. Bits are stored row by row, each row occupies\n\ { int bytes_per_row = ((XFASTINT (width) + BITS_PER_CHAR - 1) / BITS_PER_CHAR); - if (STRING_BYTES (XSTRING (data)) >= bytes_per_row * height) + if (STRING_BYTES (XSTRING (data)) >= bytes_per_row * XINT (height)) pixmap_p = 1; } } @@ -1824,7 +1825,7 @@ xlfd_symbolic_value (table, dim, font, field_index, dflt) int dim; struct font_name *font; int field_index; - int dflt; + Lisp_Object dflt; { struct table_entry *p; p = xlfd_lookup_field_contents (table, dim, font, field_index); @@ -4455,9 +4456,9 @@ lface_hash (v) return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX]) ^ hash_string_case_insensitive (v[LFACE_FOREGROUND_INDEX]) ^ hash_string_case_insensitive (v[LFACE_BACKGROUND_INDEX]) - ^ (unsigned) v[LFACE_WEIGHT_INDEX] - ^ (unsigned) v[LFACE_SLANT_INDEX] - ^ (unsigned) v[LFACE_SWIDTH_INDEX] + ^ XFASTINT (v[LFACE_WEIGHT_INDEX]) + ^ XFASTINT (v[LFACE_SLANT_INDEX]) + ^ XFASTINT (v[LFACE_SWIDTH_INDEX]) ^ XFASTINT (v[LFACE_HEIGHT_INDEX])); } diff --git a/src/xfns.c b/src/xfns.c index d23d4f0f384..9bc400627ec 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -9727,8 +9727,8 @@ TIMEOUT nil means use the default timeout of 5 seconds.") will loose. I don't think this is a realistic case. */ w = XWINDOW (FRAME_ROOT_WINDOW (f)); w->left = w->top = make_number (0); - w->width = 80; - w->height = 40; + w->width = make_number (80); + w->height = make_number (40); adjust_glyphs (f); w->pseudo_window_p = 1; @@ -9738,7 +9738,7 @@ TIMEOUT nil means use the default timeout of 5 seconds.") old_buffer = current_buffer; set_buffer_internal_1 (XBUFFER (buffer)); Ferase_buffer (); - Finsert (make_number (1), &string); + Finsert (1, &string); clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); SET_TEXT_POS (pos, BEGV, BEGV_BYTE);