Spelling fixes.
[bpt/emacs.git] / src / character.c
index 34e69da..fb9b8a9 100644 (file)
@@ -123,7 +123,7 @@ char_string (unsigned int c, unsigned char *p)
 
   if (c & CHAR_MODIFIER_MASK)
     {
-      c = (unsigned) char_resolve_modifier_mask ((int) c);
+      c = char_resolve_modifier_mask (c);
       /* If C still has any modifier bits, just ignore it.  */
       c &= ~CHAR_MODIFIER_MASK;
     }
@@ -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);
            }
@@ -838,7 +839,7 @@ string_escape_byte8 (Lisp_Object string)
   if (multibyte)
     {
       if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count
-         || (MOST_POSITIVE_FIXNUM - nbytes) / 2 < byte8_count)
+         || (STRING_BYTES_BOUND - nbytes) / 2 < byte8_count)
        string_overflow ();
 
       /* Convert 2-byte sequence of byte8 chars to 4-byte octal.  */
@@ -847,7 +848,7 @@ string_escape_byte8 (Lisp_Object string)
     }
   else
     {
-      if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count)
+      if ((STRING_BYTES_BOUND - nbytes) / 3 < byte8_count)
        string_overflow ();
 
       /* Convert 1-byte sequence of byte8 chars to 4-byte octal.  */
@@ -893,15 +894,15 @@ DEFUN ("string", Fstring, Sstring, 0, MANY, 0,
        doc: /*
 Concatenate all the argument characters and make the result a string.
 usage: (string &rest CHARACTERS)  */)
-  (size_t n, Lisp_Object *args)
+  (ptrdiff_t n, Lisp_Object *args)
 {
-  size_t i;
+  ptrdiff_t i;
   int c;
   unsigned char *buf, *p;
   Lisp_Object str;
   USE_SAFE_ALLOCA;
 
-  SAFE_ALLOCA (buf, unsigned char *, MAX_MULTIBYTE_LENGTH * n);
+  SAFE_NALLOCA (buf, MAX_MULTIBYTE_LENGTH, n);
   p = buf;
 
   for (i = 0; i < n; i++)
@@ -919,9 +920,9 @@ usage: (string &rest CHARACTERS)  */)
 DEFUN ("unibyte-string", Funibyte_string, Sunibyte_string, 0, MANY, 0,
        doc: /* Concatenate all the argument bytes and make the result a unibyte string.
 usage: (unibyte-string &rest BYTES)  */)
-  (size_t n, Lisp_Object *args)
+  (ptrdiff_t n, Lisp_Object *args)
 {
-  size_t i;
+  ptrdiff_t i;
   int c;
   unsigned char *buf, *p;
   Lisp_Object str;