X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/edaa182249601b0f7ee36f9863243b6919943982..dbdb703130b27983c3848d2a10aa44bc5aa6526e:/src/character.c
diff --git a/src/character.c b/src/character.c
index cff00f4466..fb9b8a9b93 100644
--- a/src/character.c
+++ b/src/character.c
@@ -35,7 +35,7 @@ along with GNU Emacs. If not, see . */
#include
#include
-
+#include
#include "lisp.h"
#include "character.h"
#include "buffer.h"
@@ -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
- || (STRING_BYTES_MAX - 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 ((STRING_BYTES_MAX - 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;