Commit da43f021 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Fix int/EMACS_INT use in lread.c, marker.c, minibuf.c, print.c

 print.c (print_object, print_string, strout): Use EMACS_INT for
 string indices.
 minibuf.c (string_to_object): Use EMACS_INT for string position
 and size.
 marker.c (verify_bytepos): Use EMACS_INT for buffer positions.
 lread.c <read_from_string_index, read_from_string_index_byte>
 <read_from_string_limit, readchar_count>: Define EMACS_INT.
 (readchar, unreadchar, read_internal_start): Use EMACS_INT for
 buffer positions and string length.
parent 41118bd3
2010-09-25 Eli Zaretskii <eliz@gnu.org> 2010-09-25 Eli Zaretskii <eliz@gnu.org>
   
* print.c (print_object, print_string, strout): Use EMACS_INT for
string indices.
* minibuf.c (string_to_object): Use EMACS_INT for string position
and size.
* marker.c (verify_bytepos): Use EMACS_INT for buffer positions.
* lread.c <read_from_string_index, read_from_string_index_byte>
<read_from_string_limit, readchar_count>: Define EMACS_INT.
(readchar, unreadchar, read_internal_start): Use EMACS_INT for
buffer positions and string length.
* keyboard.c <last_point_position, last_non_minibuf_size>: Declare * keyboard.c <last_point_position, last_non_minibuf_size>: Declare
EMACS_INT. EMACS_INT.
(echo_truncate, adjust_point_for_property, read_char) (echo_truncate, adjust_point_for_property, read_char)
......
...@@ -163,13 +163,13 @@ static FILE *instream; ...@@ -163,13 +163,13 @@ static FILE *instream;
static int read_pure; static int read_pure;
/* For use within read-from-string (this reader is non-reentrant!!) */ /* For use within read-from-string (this reader is non-reentrant!!) */
static int read_from_string_index; static EMACS_INT read_from_string_index;
static int read_from_string_index_byte; static EMACS_INT read_from_string_index_byte;
static int read_from_string_limit; static EMACS_INT read_from_string_limit;
/* Number of characters read in the current call to Fread or /* Number of characters read in the current call to Fread or
Fread_from_string. */ Fread_from_string. */
static int readchar_count; static EMACS_INT readchar_count;
/* This contains the last string skipped with #@. */ /* This contains the last string skipped with #@. */
static char *saved_doc_string; static char *saved_doc_string;
...@@ -276,7 +276,7 @@ readchar (Lisp_Object readcharfun, int *multibyte) ...@@ -276,7 +276,7 @@ readchar (Lisp_Object readcharfun, int *multibyte)
{ {
register struct buffer *inbuffer = XBUFFER (readcharfun); register struct buffer *inbuffer = XBUFFER (readcharfun);
int pt_byte = BUF_PT_BYTE (inbuffer); EMACS_INT pt_byte = BUF_PT_BYTE (inbuffer);
if (pt_byte >= BUF_ZV_BYTE (inbuffer)) if (pt_byte >= BUF_ZV_BYTE (inbuffer))
return -1; return -1;
...@@ -305,7 +305,7 @@ readchar (Lisp_Object readcharfun, int *multibyte) ...@@ -305,7 +305,7 @@ readchar (Lisp_Object readcharfun, int *multibyte)
{ {
register struct buffer *inbuffer = XMARKER (readcharfun)->buffer; register struct buffer *inbuffer = XMARKER (readcharfun)->buffer;
int bytepos = marker_byte_position (readcharfun); EMACS_INT bytepos = marker_byte_position (readcharfun);
if (bytepos >= BUF_ZV_BYTE (inbuffer)) if (bytepos >= BUF_ZV_BYTE (inbuffer))
return -1; return -1;
...@@ -439,7 +439,7 @@ unreadchar (Lisp_Object readcharfun, int c) ...@@ -439,7 +439,7 @@ unreadchar (Lisp_Object readcharfun, int c)
else if (BUFFERP (readcharfun)) else if (BUFFERP (readcharfun))
{ {
struct buffer *b = XBUFFER (readcharfun); struct buffer *b = XBUFFER (readcharfun);
int bytepos = BUF_PT_BYTE (b); EMACS_INT bytepos = BUF_PT_BYTE (b);
BUF_PT (b)--; BUF_PT (b)--;
if (! NILP (b->enable_multibyte_characters)) if (! NILP (b->enable_multibyte_characters))
...@@ -452,7 +452,7 @@ unreadchar (Lisp_Object readcharfun, int c) ...@@ -452,7 +452,7 @@ unreadchar (Lisp_Object readcharfun, int c)
else if (MARKERP (readcharfun)) else if (MARKERP (readcharfun))
{ {
struct buffer *b = XMARKER (readcharfun)->buffer; struct buffer *b = XMARKER (readcharfun)->buffer;
int bytepos = XMARKER (readcharfun)->bytepos; EMACS_INT bytepos = XMARKER (readcharfun)->bytepos;
XMARKER (readcharfun)->charpos--; XMARKER (readcharfun)->charpos--;
if (! NILP (b->enable_multibyte_characters)) if (! NILP (b->enable_multibyte_characters))
...@@ -1893,7 +1893,7 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) ...@@ -1893,7 +1893,7 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end)
if (STRINGP (stream) if (STRINGP (stream)
|| ((CONSP (stream) && STRINGP (XCAR (stream))))) || ((CONSP (stream) && STRINGP (XCAR (stream)))))
{ {
int startval, endval; EMACS_INT startval, endval;
Lisp_Object string; Lisp_Object string;
if (STRINGP (stream)) if (STRINGP (stream))
......
...@@ -247,11 +247,11 @@ buf_charpos_to_bytepos (struct buffer *b, EMACS_INT charpos) ...@@ -247,11 +247,11 @@ buf_charpos_to_bytepos (struct buffer *b, EMACS_INT charpos)
/* Used for debugging: recompute the bytepos corresponding to CHARPOS /* Used for debugging: recompute the bytepos corresponding to CHARPOS
in the simplest, most reliable way. */ in the simplest, most reliable way. */
int EMACS_INT
verify_bytepos (int charpos) verify_bytepos (EMACS_INT charpos)
{ {
int below = 1; EMACS_INT below = 1;
int below_byte = 1; EMACS_INT below_byte = 1;
while (below != charpos) while (below != charpos)
{ {
......
...@@ -236,7 +236,7 @@ string_to_object (Lisp_Object val, Lisp_Object defalt) ...@@ -236,7 +236,7 @@ string_to_object (Lisp_Object val, Lisp_Object defalt)
{ {
struct gcpro gcpro1, gcpro2; struct gcpro gcpro1, gcpro2;
Lisp_Object expr_and_pos; Lisp_Object expr_and_pos;
int pos; EMACS_INT pos;
GCPRO2 (val, defalt); GCPRO2 (val, defalt);
...@@ -254,7 +254,7 @@ string_to_object (Lisp_Object val, Lisp_Object defalt) ...@@ -254,7 +254,7 @@ string_to_object (Lisp_Object val, Lisp_Object defalt)
{ {
/* Ignore trailing whitespace; any other trailing junk /* Ignore trailing whitespace; any other trailing junk
is an error. */ is an error. */
int i; EMACS_INT i;
pos = string_char_to_byte (val, pos); pos = string_char_to_byte (val, pos);
for (i = pos; i < SBYTES (val); i++) for (i = pos; i < SBYTES (val); i++)
{ {
......
...@@ -395,7 +395,7 @@ strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte, ...@@ -395,7 +395,7 @@ strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte,
else else
{ {
/* PRINTCHARFUN is a Lisp function. */ /* PRINTCHARFUN is a Lisp function. */
int i = 0; EMACS_INT i = 0;
if (size == size_byte) if (size == size_byte)
{ {
...@@ -489,7 +489,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun) ...@@ -489,7 +489,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
{ {
/* Otherwise, string may be relocated by printing one char. /* Otherwise, string may be relocated by printing one char.
So re-fetch the string address for each character. */ So re-fetch the string address for each character. */
int i; EMACS_INT i;
EMACS_INT size = SCHARS (string); EMACS_INT size = SCHARS (string);
EMACS_INT size_byte = SBYTES (string); EMACS_INT size_byte = SBYTES (string);
struct gcpro gcpro1; struct gcpro gcpro1;
...@@ -1563,7 +1563,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag ...@@ -1563,7 +1563,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
print_string (obj, printcharfun); print_string (obj, printcharfun);
else else
{ {
register int i, i_byte; register EMACS_INT i, i_byte;
struct gcpro gcpro1; struct gcpro gcpro1;
unsigned char *str; unsigned char *str;
EMACS_INT size_byte; EMACS_INT size_byte;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment