changeset 110504:0fdd992ff057

Fix more uses of int instead of EMACS_INT. xdisp.c (check_point_in_composition, reconsider_clip_changes): Use EMACS_INT for buffer position variables and arguments. composite.c (get_composition_id, find_composition) (run_composition_function, compose_text) (composition_gstring_width, autocmp_chars) (composition_update_it, Ffind_composition_internal): Use EMACS_INT for buffer positions and string length variables and arguments. composite.h (get_composition_id, find_composition, compose_text) (composition_gstring_width): Adjust prototypes. editfns.c (Fformat): Use EMACS_INT for string size variables. xdisp.c (store_mode_line_noprop, display_mode_element): Use EMACS_INT for string positions. intervals.c (get_property_and_range): Use EMACS_INT for buffer position arguments. intervals.h (get_property_and_range): Adjust prototype. character.c (parse_str_as_multibyte, str_as_multibyte) (parse_str_to_multibyte, str_to_multibyte, str_as_unibyte) (string_count_byte8, string_escape_byte8, c_string_width) (strwidth, lisp_string_width, multibyte_chars_in_text): Use EMACS_INT for string length variables and arguments. (string_escape_byte8): Protect against too long strings. character.h (parse_str_as_multibyte, str_as_multibyte) (parse_str_to_multibyte, str_to_multibyte, str_as_unibyte) (c_string_width, strwidth, lisp_string_width): Adjust prototypes. lisp.h (check_point_in_composition): Adjust prototype.
author Eli Zaretskii <eliz@gnu.org>
date Thu, 23 Sep 2010 10:32:38 -0400
parents fda36a325177
children e67da919e2b5
files src/ChangeLog src/character.c src/character.h src/composite.c src/composite.h src/editfns.c src/intervals.c src/intervals.h src/lisp.h src/xdisp.c
diffstat 10 files changed, 103 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Sep 23 08:09:12 2010 -0400
+++ b/src/ChangeLog	Thu Sep 23 10:32:38 2010 -0400
@@ -1,17 +1,44 @@
 2010-09-23  Eli Zaretskii  <eliz@gnu.org>
 
-	* font.c (font_intern_prop): Use EMACS_INT for string length
-	variables.
+	* xdisp.c (check_point_in_composition, reconsider_clip_changes):
+	Use EMACS_INT for buffer position variables and arguments.
+
+	* composite.c (get_composition_id, find_composition)
+	(run_composition_function, compose_text)
+	(composition_gstring_width, autocmp_chars)
+	(composition_update_it, Ffind_composition_internal): Use EMACS_INT
+	for buffer positions and string length variables and arguments.
+
+	* composite.h (get_composition_id, find_composition, compose_text)
+	(composition_gstring_width): Adjust prototypes.
+
+	* editfns.c (Fformat): Use EMACS_INT for string size variables.
+
+	* xdisp.c (store_mode_line_noprop, display_mode_element): Use
+	EMACS_INT for string positions.
+
+	* intervals.c (get_property_and_range): Use EMACS_INT for buffer
+	position arguments.
+
+	* intervals.h (get_property_and_range): Adjust prototype.
 
 	* character.c (parse_str_as_multibyte, str_as_multibyte)
 	(parse_str_to_multibyte, str_to_multibyte, str_as_unibyte)
-	(string_count_byte8, string_escape_byte8): Use EMACS_INT for
-	string length arguments, variables, and return values.
+	(string_count_byte8, string_escape_byte8, c_string_width)
+	(strwidth, lisp_string_width, multibyte_chars_in_text): Use
+	EMACS_INT for string length variables and arguments.
 
 	* character.h (parse_str_as_multibyte, str_as_multibyte)
-	(parse_str_to_multibyte, str_to_multibyte, str_as_unibyte): Adjust
+	(parse_str_to_multibyte, str_to_multibyte, str_as_unibyte)
+	(c_string_width, strwidth, lisp_string_width): Adjust
 	prototypes.
 
+	* font.c (font_intern_prop): Use EMACS_INT for string length
+	variables.
+
+	* font.c (font_intern_prop): Use EMACS_INT for string length
+	variables.
+
 	* fns.c (Fstring_as_multibyte): Use EMACS_INT for string length
 	variables.
 
@@ -33,7 +60,8 @@
 
 	* lisp.h (make_string, make_unibyte_string, make_multibyte_string)
 	(make_string_from_bytes, make_specified_string_string)
-	(make_pure_string, string_bytes): Adjust prototypes.
+	(make_pure_string, string_bytes, check_point_in_composition):
+	Adjust prototypes.
 
 2010-09-22  Eli Zaretskii  <eliz@gnu.org>
 
--- a/src/character.c	Thu Sep 23 08:09:12 2010 -0400
+++ b/src/character.c	Thu Sep 23 10:32:38 2010 -0400
@@ -378,11 +378,12 @@
    characters and bytes of the substring in *NCHARS and *NBYTES
    respectively.  */
 
-int
-c_string_width (const unsigned char *str, int len, int precision, int *nchars, int *nbytes)
+EMACS_INT
+c_string_width (const unsigned char *str, EMACS_INT len, int precision,
+		EMACS_INT *nchars, EMACS_INT *nbytes)
 {
-  int i = 0, i_byte = 0;
-  int width = 0;
+  EMACS_INT i = 0, i_byte = 0;
+  EMACS_INT width = 0;
   struct Lisp_Char_Table *dp = buffer_display_table ();
 
   while (i_byte < len)
@@ -429,8 +430,8 @@
    current buffer.  The width is measured by how many columns it
    occupies on the screen.  */
 
-int
-strwidth (const unsigned char *str, int len)
+EMACS_INT
+strwidth (const unsigned char *str, EMACS_INT len)
 {
   return c_string_width (str, len, -1, NULL, NULL);
 }
@@ -442,17 +443,18 @@
    PRECISION, and set number of characters and bytes of the substring
    in *NCHARS and *NBYTES respectively.  */
 
-int
-lisp_string_width (Lisp_Object string, int precision, int *nchars, int *nbytes)
+EMACS_INT
+lisp_string_width (Lisp_Object string, int precision,
+		   EMACS_INT *nchars, EMACS_INT *nbytes)
 {
-  int len = SCHARS (string);
+  EMACS_INT len = SCHARS (string);
   /* This set multibyte to 0 even if STRING is multibyte when it
      contains only ascii and eight-bit-graphic, but that's
      intentional.  */
   int multibyte = len < SBYTES (string);
   unsigned char *str = SDATA (string);
-  int i = 0, i_byte = 0;
-  int width = 0;
+  EMACS_INT i = 0, i_byte = 0;
+  EMACS_INT width = 0;
   struct Lisp_Char_Table *dp = buffer_display_table ();
 
   while (i < len)
@@ -570,11 +572,11 @@
 multibyte_chars_in_text (const unsigned char *ptr, EMACS_INT nbytes)
 {
   const unsigned char *endp = ptr + nbytes;
-  int chars = 0;
+  EMACS_INT chars = 0;
 
   while (ptr < endp)
     {
-      int len = MULTIBYTE_LENGTH (ptr, endp);
+      EMACS_INT len = MULTIBYTE_LENGTH (ptr, endp);
 
       if (len == 0)
 	abort ();
--- a/src/character.h	Thu Sep 23 08:09:12 2010 -0400
+++ b/src/character.h	Thu Sep 23 10:32:38 2010 -0400
@@ -612,9 +612,11 @@
 extern EMACS_INT str_as_unibyte (unsigned char *, EMACS_INT);
 extern EMACS_INT str_to_unibyte (const unsigned char *, unsigned char *,
                                  EMACS_INT, int);
-extern int strwidth (const unsigned char *, int);
-extern int c_string_width (const unsigned char *, int, int, int *, int *);
-extern int lisp_string_width (Lisp_Object, int, int *, int *);
+extern EMACS_INT strwidth (const unsigned char *, EMACS_INT);
+extern EMACS_INT c_string_width (const unsigned char *, EMACS_INT, int,
+				 EMACS_INT *, EMACS_INT *);
+extern EMACS_INT lisp_string_width (Lisp_Object, int,
+				    EMACS_INT *, EMACS_INT *);
 
 extern Lisp_Object Vprintable_chars;
 
--- a/src/composite.c	Thu Sep 23 08:09:12 2010 -0400
+++ b/src/composite.c	Thu Sep 23 10:32:38 2010 -0400
@@ -180,7 +180,8 @@
    If the composition is invalid, return -1.  */
 
 int
-get_composition_id (int charpos, int bytepos, int nchars, Lisp_Object prop, Lisp_Object string)
+get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
+		    Lisp_Object prop, Lisp_Object string)
 {
   Lisp_Object id, length, components, key, *key_contents;
   int glyph_len;
@@ -188,7 +189,8 @@
   int hash_index;
   unsigned hash_code;
   struct composition *cmp;
-  int i, ch;
+  EMACS_INT i;
+  int ch;
 
   /* PROP should be
 	Form-A: ((LENGTH . COMPONENTS) . MODIFICATION-FUNC)
@@ -290,7 +292,7 @@
       && VECTORP (AREF (components, 0)))
     {
       /* COMPONENTS is a glyph-string.  */
-      int len = ASIZE (key);
+      EMACS_UINT len = ASIZE (key);
 
       for (i = 1; i < len; i++)
 	if (! VECTORP (AREF (key, i)))
@@ -298,7 +300,7 @@
     }
   else if (VECTORP (components) || CONSP (components))
     {
-      int len = XVECTOR (key)->size;
+      EMACS_UINT len = XVECTOR (key)->size;
 
       /* The number of elements should be odd.  */
       if ((len % 2) == 0)
@@ -427,7 +429,9 @@
    This doesn't check the validity of composition.  */
 
 int
-find_composition (int pos, int limit, EMACS_INT *start, EMACS_INT *end, Lisp_Object *prop, Lisp_Object object)
+find_composition (EMACS_INT pos, EMACS_INT limit,
+		  EMACS_INT *start, EMACS_INT *end,
+		  Lisp_Object *prop, Lisp_Object object)
 {
   Lisp_Object val;
 
@@ -465,7 +469,7 @@
    FROM and TO with property PROP.  */
 
 static void
-run_composition_function (int from, int to, Lisp_Object prop)
+run_composition_function (EMACS_INT from, EMACS_INT to, Lisp_Object prop)
 {
   Lisp_Object func;
   EMACS_INT start, end;
@@ -628,7 +632,8 @@
    indices START and END in STRING.  */
 
 void
-compose_text (int start, int end, Lisp_Object components, Lisp_Object modification_func, Lisp_Object string)
+compose_text (EMACS_INT start, EMACS_INT end, Lisp_Object components,
+	      Lisp_Object modification_func, Lisp_Object string)
 {
   Lisp_Object prop;
 
@@ -735,7 +740,8 @@
 }
 
 int
-composition_gstring_width (Lisp_Object gstring, int from, int to, struct font_metrics *metrics)
+composition_gstring_width (Lisp_Object gstring, EMACS_INT from, EMACS_INT to,
+			   struct font_metrics *metrics)
 {
   Lisp_Object *glyph;
   int width = 0;
@@ -907,7 +913,7 @@
   EMACS_INT to;
   EMACS_INT pt = PT, pt_byte = PT_BYTE;
   Lisp_Object re, font_object, lgstring;
-  int len;
+  EMACS_INT len;
 
   record_unwind_save_match_data ();
   re = AREF (rule, 0);
@@ -1397,7 +1403,7 @@
       /* automatic composition */
       Lisp_Object gstring = composition_gstring_from_id (cmp_it->id);
       Lisp_Object glyph;
-      int from, to;
+      EMACS_INT from;
 
       if (cmp_it->nglyphs == 0)
 	{
@@ -1879,9 +1885,9 @@
     id = COMPOSITION_ID (prop);
   else
     {
-      int start_byte = (NILP (string)
-			? CHAR_TO_BYTE (start)
-			: string_char_to_byte (string, start));
+      EMACS_INT start_byte = (NILP (string)
+			      ? CHAR_TO_BYTE (start)
+			      : string_char_to_byte (string, start));
       id = get_composition_id (start, start_byte, end - start, prop, string);
     }
 
--- a/src/composite.h	Thu Sep 23 08:09:12 2010 -0400
+++ b/src/composite.h	Thu Sep 23 10:32:38 2010 -0400
@@ -212,15 +212,16 @@
 extern Lisp_Object Qauto_composition_function;
 extern Lisp_Object Vcomposition_function_table;
 
-extern int get_composition_id (int, int, int, Lisp_Object, Lisp_Object);
-extern int find_composition (int, int, EMACS_INT *, EMACS_INT *, Lisp_Object *,
-                             Lisp_Object);
+extern int get_composition_id (EMACS_INT, EMACS_INT, EMACS_INT,
+			       Lisp_Object, Lisp_Object);
+extern int find_composition (EMACS_INT, EMACS_INT, EMACS_INT *, EMACS_INT *,
+			     Lisp_Object *, Lisp_Object);
 extern void update_compositions (EMACS_INT, EMACS_INT, int);
 extern void make_composition_value_copy (Lisp_Object);
 extern void compose_region (int, int, Lisp_Object, Lisp_Object,
                             Lisp_Object);
 extern void syms_of_composite (void);
-extern void compose_text (int, int, Lisp_Object, Lisp_Object,
+extern void compose_text (EMACS_INT, EMACS_INT, Lisp_Object, Lisp_Object,
                           Lisp_Object);
 
 /* Macros for lispy glyph-string.  This is completely different from
@@ -306,7 +307,7 @@
 extern Lisp_Object composition_gstring_put_cache (Lisp_Object, int);
 extern Lisp_Object composition_gstring_from_id (int);
 extern int composition_gstring_p (Lisp_Object);
-extern int composition_gstring_width (Lisp_Object, int, int,
+extern int composition_gstring_width (Lisp_Object, EMACS_INT, EMACS_INT,
                                       struct font_metrics *);
 
 extern void composition_compute_stop_pos (struct composition_it *,
--- a/src/editfns.c	Thu Sep 23 08:09:12 2010 -0400
+++ b/src/editfns.c	Thu Sep 23 10:32:38 2010 -0400
@@ -3609,7 +3609,7 @@
     if (*format++ == '%')
       {
 	int thissize = 0;
-	int actual_width = 0;
+	EMACS_INT actual_width = 0;
 	unsigned char *this_format_start = format - 1;
 	int field_width = 0;
 
@@ -3851,8 +3851,8 @@
 	      /* handle case (precision[n] >= 0) */
 
 	      int width, padding;
-	      int nbytes, start, end;
-	      int nchars_string;
+	      EMACS_INT nbytes, start, end;
+	      EMACS_INT nchars_string;
 
 	      /* lisp_string_width ignores a precision of 0, but GNU
 		 libc functions print 0 characters when the precision
@@ -3863,7 +3863,8 @@
 	      if (precision[n] == 0)
 		width = nchars_string = nbytes = 0;
 	      else if (precision[n] > 0)
-		width = lisp_string_width (args[n], precision[n], &nchars_string, &nbytes);
+		width = lisp_string_width (args[n], precision[n],
+					   &nchars_string, &nbytes);
 	      else
 		{		/* no precision spec given for this argument */
 		  width = lisp_string_width (args[n], -1, NULL, NULL);
--- a/src/intervals.c	Thu Sep 23 08:09:12 2010 -0400
+++ b/src/intervals.c	Thu Sep 23 10:32:38 2010 -0400
@@ -2246,7 +2246,8 @@
    nil means the current buffer. */
 
 int
-get_property_and_range (int pos, Lisp_Object prop, Lisp_Object *val, EMACS_INT *start, EMACS_INT *end, Lisp_Object object)
+get_property_and_range (EMACS_INT pos, Lisp_Object prop, Lisp_Object *val,
+			EMACS_INT *start, EMACS_INT *end, Lisp_Object object)
 {
   INTERVAL i, prev, next;
 
--- a/src/intervals.h	Thu Sep 23 08:09:12 2010 -0400
+++ b/src/intervals.h	Thu Sep 23 10:32:38 2010 -0400
@@ -276,7 +276,7 @@
 extern Lisp_Object textget (Lisp_Object, Lisp_Object);
 extern Lisp_Object lookup_char_property (Lisp_Object, Lisp_Object, int);
 extern void move_if_not_intangible (int);
-extern int get_property_and_range (int, Lisp_Object, Lisp_Object *,
+extern int get_property_and_range (EMACS_INT, Lisp_Object, Lisp_Object *,
                                    EMACS_INT *, EMACS_INT *, Lisp_Object);
 extern Lisp_Object get_local_map (int, struct buffer *, Lisp_Object);
 extern INTERVAL update_interval (INTERVAL, int);
--- a/src/lisp.h	Thu Sep 23 08:09:12 2010 -0400
+++ b/src/lisp.h	Thu Sep 23 10:32:38 2010 -0400
@@ -2673,7 +2673,7 @@
 extern void truncate_echo_area (int);
 extern void redisplay (void);
 extern int check_point_in_composition
-        (struct buffer *, int, struct buffer *, int);
+        (struct buffer *, EMACS_INT, struct buffer *, EMACS_INT);
 extern void redisplay_preserve_echo_area (int);
 extern void prepare_menu_bars (void);
 
--- a/src/xdisp.c	Thu Sep 23 08:09:12 2010 -0400
+++ b/src/xdisp.c	Thu Sep 23 10:32:38 2010 -0400
@@ -9628,7 +9628,7 @@
 store_mode_line_noprop (const unsigned char *str, int field_width, int precision)
 {
   int n = 0;
-  int dummy, nbytes;
+  EMACS_INT dummy, nbytes;
 
   /* Copy at most PRECISION chars from STR.  */
   nbytes = strlen (str);
@@ -11378,8 +11378,8 @@
    position.  BUF and PT are the current point buffer and position.  */
 
 int
-check_point_in_composition (struct buffer *prev_buf, int prev_pt,
-			    struct buffer *buf, int pt)
+check_point_in_composition (struct buffer *prev_buf, EMACS_INT prev_pt,
+			    struct buffer *buf, EMACS_INT pt)
 {
   EMACS_INT start, end;
   Lisp_Object prop;
@@ -11432,7 +11432,7 @@
   if (!b->clip_changed
       && BUFFERP (w->buffer) && !NILP (w->window_end_valid))
     {
-      int pt;
+      EMACS_INT pt;
 
       if (w == XWINDOW (selected_window))
 	pt = BUF_PT (current_buffer);
@@ -18377,7 +18377,7 @@
       {
 	/* A string: output it and check for %-constructs within it.  */
 	unsigned char c;
-	int offset = 0;
+	EMACS_INT offset = 0;
 
 	if (SCHARS (elt) > 0
 	    && (!NILP (props) || risky))
@@ -18474,7 +18474,7 @@
 	       && (mode_line_target != MODE_LINE_DISPLAY
 		   || it->current_x < it->last_visible_x))
 	  {
-	    int last_offset = offset;
+	    EMACS_INT last_offset = offset;
 
 	    /* Advance to end of string or next format specifier.  */
 	    while ((c = SREF (elt, offset++)) != '\0' && c != '%')
@@ -18482,7 +18482,7 @@
 
 	    if (offset - 1 != last_offset)
 	      {
-		int nchars, nbytes;
+		EMACS_INT nchars, nbytes;
 
 		/* Output to end of string or up to '%'.  Field width
 		   is length of string.  Don't output more than
@@ -18501,11 +18501,11 @@
 		    break;
 		  case MODE_LINE_STRING:
 		    {
-		      int bytepos = last_offset;
-		      int charpos = string_byte_to_char (elt, bytepos);
-		      int endpos = (precision <= 0
-				    ? string_byte_to_char (elt, offset)
-				    : charpos + nchars);
+		      EMACS_INT bytepos = last_offset;
+		      EMACS_INT charpos = string_byte_to_char (elt, bytepos);
+		      EMACS_INT endpos = (precision <= 0
+					  ? string_byte_to_char (elt, offset)
+					  : charpos + nchars);
 
 		      n += store_mode_line_string (NULL,
 						   Fsubstring (elt, make_number (charpos),
@@ -18515,8 +18515,8 @@
 		    break;
 		  case MODE_LINE_DISPLAY:
 		    {
-		      int bytepos = last_offset;
-		      int charpos = string_byte_to_char (elt, bytepos);
+		      EMACS_INT bytepos = last_offset;
+		      EMACS_INT charpos = string_byte_to_char (elt, bytepos);
 
 		      if (precision <= 0)
 			nchars = string_byte_to_char (elt, offset) - charpos;
@@ -18529,7 +18529,7 @@
 	      }
 	    else /* c == '%' */
 	      {
-		int percent_position = offset;
+		EMACS_INT percent_position = offset;
 
 		/* Get the specified minimum width.  Zero means
 		   don't pad.  */