aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-03-27 01:15:26 -0700
committerPaul Eggert2011-03-27 01:15:26 -0700
commit1658b4014f884a5bee07acdebc02774780957735 (patch)
treed7e01ecbf1633e76d9eedcef8bccf4c2ec694405 /src
parentfe75f92609a806701f8a4d0385f3a053bc00e63d (diff)
parent9a2c6e0545bc418137abab8fb675f53c4f461853 (diff)
downloademacs-1658b4014f884a5bee07acdebc02774780957735.tar.gz
emacs-1658b4014f884a5bee07acdebc02774780957735.zip
Merge from atest branch.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog15
-rw-r--r--src/cm.c6
-rw-r--r--src/image.c6
-rw-r--r--src/keyboard.c8
-rw-r--r--src/term.c2
-rw-r--r--src/xselect.c10
-rw-r--r--src/xterm.c4
7 files changed, 35 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6127bc0e8da..3d917d0e5a4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,20 @@
12011-03-27 Paul Eggert <eggert@cs.ucla.edu> 12011-03-27 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * xterm.c (x_make_frame_visible, same_x_server): Redo to avoid overflow
4 concerns.
5
6 * term.c (produce_glyphless_glyph): Remove unnecessary test.
7
8 * cm.c (calccost): Turn while-do into do-while, for clarity.
9
10 * keyboard.c (syms_of_keyboard): Use the same style as later
11 in this function when indexing through an array. This also
12 works around GCC bug 48267.
13
14 * image.c (tiff_load): Fix off-by-one image count (Bug#8336).
15
16 * xselect.c (x_check_property_data): Return correct size (Bug#8335).
17
3 * chartab.c (sub_char_table_ref_and_range): Redo for slight 18 * chartab.c (sub_char_table_ref_and_range): Redo for slight
4 efficiency gain, and to bypass a gcc -Wstrict-overflow warning. 19 efficiency gain, and to bypass a gcc -Wstrict-overflow warning.
5 20
diff --git a/src/cm.c b/src/cm.c
index 6379955b48c..42f855f1694 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -214,8 +214,9 @@ calccost (struct tty_display_info *tty,
214 } 214 }
215 totalcost = c * deltay; 215 totalcost = c * deltay;
216 if (doit) 216 if (doit)
217 while (--deltay >= 0) 217 do
218 emacs_tputs (tty, p, 1, cmputc); 218 emacs_tputs (tty, p, 1, cmputc);
219 while (0 < --deltay);
219x: 220x:
220 if ((deltax = dstx - srcx) == 0) 221 if ((deltax = dstx - srcx) == 0)
221 goto done; 222 goto done;
@@ -296,8 +297,9 @@ fail:
296 } 297 }
297 totalcost += c * deltax; 298 totalcost += c * deltax;
298 if (doit) 299 if (doit)
299 while (--deltax >= 0) 300 do
300 emacs_tputs (tty, p, 1, cmputc); 301 emacs_tputs (tty, p, 1, cmputc);
302 while (0 < --deltax);
301done: 303done:
302 return totalcost; 304 return totalcost;
303} 305}
diff --git a/src/image.c b/src/image.c
index 04c6b1a2ad5..25929d1004c 100644
--- a/src/image.c
+++ b/src/image.c
@@ -6753,7 +6753,7 @@ tiff_load (struct frame *f, struct image *img)
6753 TIFF *tiff; 6753 TIFF *tiff;
6754 int width, height, x, y, count; 6754 int width, height, x, y, count;
6755 uint32 *buf; 6755 uint32 *buf;
6756 int rc, rc2; 6756 int rc;
6757 XImagePtr ximg; 6757 XImagePtr ximg;
6758 tiff_memory_source memsrc; 6758 tiff_memory_source memsrc;
6759 Lisp_Object image; 6759 Lisp_Object image;
@@ -6841,8 +6841,8 @@ tiff_load (struct frame *f, struct image *img)
6841 rc = fn_TIFFReadRGBAImage (tiff, width, height, buf, 0); 6841 rc = fn_TIFFReadRGBAImage (tiff, width, height, buf, 0);
6842 6842
6843 /* Count the number of images in the file. */ 6843 /* Count the number of images in the file. */
6844 for (count = 1, rc2 = 1; rc2; count++) 6844 for (count = 1; fn_TIFFSetDirectory (tiff, count); count++)
6845 rc2 = fn_TIFFSetDirectory (tiff, count); 6845 continue;
6846 6846
6847 if (count > 1) 6847 if (count > 1)
6848 img->data.lisp_val = Fcons (Qcount, 6848 img->data.lisp_val = Fcons (Qcount,
diff --git a/src/keyboard.c b/src/keyboard.c
index 31bcfd3e2bc..28d65766664 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -11560,12 +11560,12 @@ syms_of_keyboard (void)
11560 last_point_position_window = Qnil; 11560 last_point_position_window = Qnil;
11561 11561
11562 { 11562 {
11563 const struct event_head *p; 11563 int i;
11564 int len = sizeof (head_table) / sizeof (head_table[0]);
11564 11565
11565 for (p = head_table; 11566 for (i = 0; i < len; i++)
11566 p < head_table + (sizeof (head_table) / sizeof (head_table[0]));
11567 p++)
11568 { 11567 {
11568 const struct event_head *p = &head_table[i];
11569 *p->var = intern_c_string (p->name); 11569 *p->var = intern_c_string (p->name);
11570 staticpro (p->var); 11570 staticpro (p->var);
11571 Fput (*p->var, Qevent_kind, *p->kind); 11571 Fput (*p->var, Qevent_kind, *p->kind);
diff --git a/src/term.c b/src/term.c
index b3392df76fd..fc7726298c5 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1952,7 +1952,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
1952 1952
1953 it->pixel_width = len; 1953 it->pixel_width = len;
1954 it->nglyphs = len; 1954 it->nglyphs = len;
1955 if (len > 0 && it->glyph_row) 1955 if (it->glyph_row)
1956 append_glyphless_glyph (it, face_id, str); 1956 append_glyphless_glyph (it, face_id, str);
1957} 1957}
1958 1958
diff --git a/src/xselect.c b/src/xselect.c
index 5254fa96838..451b2a0b13f 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -2190,7 +2190,8 @@ and t is the same as `SECONDARY'. */)
2190***********************************************************************/ 2190***********************************************************************/
2191/* Check that lisp values are of correct type for x_fill_property_data. 2191/* Check that lisp values are of correct type for x_fill_property_data.
2192 That is, number, string or a cons with two numbers (low and high 16 2192 That is, number, string or a cons with two numbers (low and high 16
2193 bit parts of a 32 bit number). */ 2193 bit parts of a 32 bit number). Return the number of items in DATA,
2194 or -1 if there is an error. */
2194 2195
2195int 2196int
2196x_check_property_data (Lisp_Object data) 2197x_check_property_data (Lisp_Object data)
@@ -2198,15 +2199,16 @@ x_check_property_data (Lisp_Object data)
2198 Lisp_Object iter; 2199 Lisp_Object iter;
2199 int size = 0; 2200 int size = 0;
2200 2201
2201 for (iter = data; CONSP (iter) && size != -1; iter = XCDR (iter), ++size) 2202 for (iter = data; CONSP (iter); iter = XCDR (iter))
2202 { 2203 {
2203 Lisp_Object o = XCAR (iter); 2204 Lisp_Object o = XCAR (iter);
2204 2205
2205 if (! NUMBERP (o) && ! STRINGP (o) && ! CONSP (o)) 2206 if (! NUMBERP (o) && ! STRINGP (o) && ! CONSP (o))
2206 size = -1; 2207 return -1;
2207 else if (CONSP (o) && 2208 else if (CONSP (o) &&
2208 (! NUMBERP (XCAR (o)) || ! NUMBERP (XCDR (o)))) 2209 (! NUMBERP (XCAR (o)) || ! NUMBERP (XCDR (o))))
2209 size = -1; 2210 return -1;
2211 size++;
2210 } 2212 }
2211 2213
2212 return size; 2214 return size;
diff --git a/src/xterm.c b/src/xterm.c
index 0b18356b0a3..dc1fd3cbbd1 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -9121,7 +9121,7 @@ x_make_frame_visible (struct frame *f)
9121 unknown reason, the call to XtMapWidget is completely ignored. 9121 unknown reason, the call to XtMapWidget is completely ignored.
9122 Mapping the widget a second time works. */ 9122 Mapping the widget a second time works. */
9123 9123
9124 if (!FRAME_VISIBLE_P (f) && --retry_count > 0) 9124 if (!FRAME_VISIBLE_P (f) && --retry_count != 0)
9125 goto retry; 9125 goto retry;
9126 } 9126 }
9127} 9127}
@@ -9726,7 +9726,7 @@ same_x_server (const char *name1, const char *name2)
9726 for (; *name1 != '\0' && *name1 == *name2; name1++, name2++) 9726 for (; *name1 != '\0' && *name1 == *name2; name1++, name2++)
9727 { 9727 {
9728 if (*name1 == ':') 9728 if (*name1 == ':')
9729 seen_colon++; 9729 seen_colon = 1;
9730 if (seen_colon && *name1 == '.') 9730 if (seen_colon && *name1 == '.')
9731 return 1; 9731 return 1;
9732 } 9732 }