Use ptrdiff_t for composition IDs.
[bpt/emacs.git] / src / character.c
index 7fc5d64..5e2eccf 100644 (file)
@@ -258,7 +258,8 @@ multibyte_char_to_unibyte_safe (int c)
 }
 
 DEFUN ("characterp", Fcharacterp, Scharacterp, 1, 2, 0,
-       doc: /* Return non-nil if OBJECT is a character.  */)
+       doc: /* Return non-nil if OBJECT is a character.
+usage: (characterp OBJECT)  */)
   (Lisp_Object object, Lisp_Object ignore)
 {
   return (CHARACTERP (object) ? Qt : Qnil);
@@ -325,7 +326,7 @@ usage: (char-width CHAR)  */)
   disp = dp ? DISP_CHAR_VECTOR (dp, c) : Qnil;
 
   if (VECTORP (disp))
-    width = ASIZE (disp);
+    width = sanitize_char_width (ASIZE (disp));
   else
     width = CHAR_WIDTH (c);
 
@@ -357,7 +358,7 @@ c_string_width (const unsigned char *str, EMACS_INT len, int precision,
        {
          val = DISP_CHAR_VECTOR (dp, c);
          if (VECTORP (val))
-           thiswidth = ASIZE (val);
+           thiswidth = sanitize_char_width (ASIZE (val));
          else
            thiswidth = CHAR_WIDTH (c);
        }
@@ -422,7 +423,7 @@ lisp_string_width (Lisp_Object string, EMACS_INT precision,
     {
       EMACS_INT chars, bytes, thiswidth;
       Lisp_Object val;
-      int cmp_id;
+      ptrdiff_t cmp_id;
       EMACS_INT ignore, end;
 
       if (find_composition (i, -1, &ignore, &end, &val, string)
@@ -450,7 +451,7 @@ lisp_string_width (Lisp_Object string, EMACS_INT precision,
            {
              val = DISP_CHAR_VECTOR (dp, c);
              if (VECTORP (val))
-               thiswidth = ASIZE (val);
+               thiswidth = sanitize_char_width (ASIZE (val));
              else
                thiswidth = CHAR_WIDTH (c);
            }