Spelling fixes.
[bpt/emacs.git] / src / character.c
index aae3e3c..88b1f11 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);
            }
@@ -587,7 +588,7 @@ parse_str_as_multibyte (const unsigned char *str, EMACS_INT len,
 }
 
 /* Arrange unibyte text at STR of NBYTES bytes as a multibyte text.
-   It actually converts only such 8-bit characters that don't contruct
+   It actually converts only such 8-bit characters that don't construct
    a multibyte sequence to multibyte forms of Latin-1 characters.  If
    NCHARS is nonzero, set *NCHARS to the number of characters in the
    text.  It is assured that we can use LEN bytes at STR as a work
@@ -668,7 +669,7 @@ str_as_multibyte (unsigned char *str, EMACS_INT len, EMACS_INT nbytes,
 }
 
 /* Parse unibyte string at STR of LEN bytes, and return the number of
-   bytes it may ocupy when converted to multibyte string by
+   bytes it may occupy when converted to multibyte string by
    `str_to_multibyte'.  */
 
 EMACS_INT
@@ -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;
@@ -968,7 +969,7 @@ character is a target to get a byte value.  In this case, POSITION, if
 non-nil, is an index of a target character in the string.
 
 If the current buffer (or STRING) is multibyte, and the target
-character is not ASCII nor 8-bit character, an error is signalled.  */)
+character is not ASCII nor 8-bit character, an error is signaled.  */)
   (Lisp_Object position, Lisp_Object string)
 {
   int c;