Increase 'level' in glyph struct; convert bad type aborts into assertions.

This commit is contained in:
Eli Zaretskii 2014-10-14 12:16:02 +03:00
parent a3c88bc624
commit c1621a49bd
4 changed files with 13 additions and 18 deletions

View file

@ -3161,6 +3161,9 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
bidi_cache_iterator_state (bidi_it, 1, 0);
}
eassert (bidi_it->resolved_level >= 0
&& bidi_it->resolved_level <= BIDI_MAXDEPTH + 2);
if (STRINGP (bidi_it->string.lstring))
UNGCPRO;
}

View file

@ -445,8 +445,8 @@ struct glyph
/* True means don't display cursor here. */
bool_bf avoid_cursor_p : 1;
/* Resolved bidirectional level of this character [0..63]. */
unsigned resolved_level : 5;
/* Resolved bidirectional level of this character [0..127]. */
unsigned resolved_level : 7;
/* Resolved bidirectional type of this character, see enum
bidi_type_t below. Note that according to UAX#9, only some

View file

@ -1514,8 +1514,7 @@ append_glyph (struct it *it)
if (it->bidi_p)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
emacs_abort ();
eassert ((it->bidi_it.type & 7) == it->bidi_it.type);
glyph->bidi_type = it->bidi_it.type;
}
else
@ -1711,8 +1710,7 @@ append_composite_glyph (struct it *it)
if (it->bidi_p)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
emacs_abort ();
eassert ((it->bidi_it.type & 7) == it->bidi_it.type);
glyph->bidi_type = it->bidi_it.type;
}
else
@ -1796,8 +1794,7 @@ append_glyphless_glyph (struct it *it, int face_id, const char *str)
if (it->bidi_p)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
emacs_abort ();
eassert ((it->bidi_it.type & 7) == it->bidi_it.type);
glyph->bidi_type = it->bidi_it.type;
}
else

View file

@ -25166,8 +25166,7 @@ append_glyph (struct it *it)
if (it->bidi_p)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
emacs_abort ();
eassert ((it->bidi_it.type & 7) == it->bidi_it.type);
glyph->bidi_type = it->bidi_it.type;
}
else
@ -25250,8 +25249,7 @@ append_composite_glyph (struct it *it)
if (it->bidi_p)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
emacs_abort ();
eassert ((it->bidi_it.type & 7) == it->bidi_it.type);
glyph->bidi_type = it->bidi_it.type;
}
++it->glyph_row->used[area];
@ -25439,8 +25437,7 @@ produce_image_glyph (struct it *it)
if (it->bidi_p)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
emacs_abort ();
eassert ((it->bidi_it.type & 7) == it->bidi_it.type);
glyph->bidi_type = it->bidi_it.type;
}
++it->glyph_row->used[area];
@ -25528,8 +25525,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
if (it->bidi_p)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
emacs_abort ();
eassert ((it->bidi_it.type & 7) == it->bidi_it.type);
glyph->bidi_type = it->bidi_it.type;
}
else
@ -25989,8 +25985,7 @@ append_glyphless_glyph (struct it *it, int face_id, int for_no_font, int len,
if (it->bidi_p)
{
glyph->resolved_level = it->bidi_it.resolved_level;
if ((it->bidi_it.type & 7) != it->bidi_it.type)
emacs_abort ();
eassert ((it->bidi_it.type & 7) == it->bidi_it.type);
glyph->bidi_type = it->bidi_it.type;
}
++it->glyph_row->used[area];