]> code.delx.au - gnu-emacs/commitdiff
Increase 'level' in glyph struct; convert bad type aborts into assertions.
authorEli Zaretskii <eliz@gnu.org>
Tue, 14 Oct 2014 09:16:02 +0000 (12:16 +0300)
committerEli Zaretskii <eliz@gnu.org>
Tue, 14 Oct 2014 09:16:02 +0000 (12:16 +0300)
src/bidi.c
src/dispextern.h
src/term.c
src/xdisp.c

index d03aa4e3e103d5ea338facc6e0eae8b6470daf4d..fc47a583cfedc9fe51d5d03766b6bf1b3ea6f3cd 100644 (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;
 }
index 9d7eb57fc8c861d50437e8c0d39b213378139e87..b87ae891a375efa191e8e7272147f82e9fdede57 100644 (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
index af1b62ccaaff611049c60657289cf7923a4802a0..c8ff6f315757263dae9e9b66729ccd5121a800f2 100644 (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
index 7cf1782b83f033eb628a52d8537f32362680e237..70a1a2b870321cd6dce775f4deede0e22aefc3ee 100644 (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];