Commit 1658b401 authored by Paul Eggert's avatar Paul Eggert
Browse files

Merge from atest branch.

parents fe75f926 9a2c6e05
2011-03-27 Paul Eggert <eggert@cs.ucla.edu>
* xterm.c (x_make_frame_visible, same_x_server): Redo to avoid overflow
concerns.
* term.c (produce_glyphless_glyph): Remove unnecessary test.
* cm.c (calccost): Turn while-do into do-while, for clarity.
* keyboard.c (syms_of_keyboard): Use the same style as later
in this function when indexing through an array. This also
works around GCC bug 48267.
* image.c (tiff_load): Fix off-by-one image count (Bug#8336).
* xselect.c (x_check_property_data): Return correct size (Bug#8335).
* chartab.c (sub_char_table_ref_and_range): Redo for slight
efficiency gain, and to bypass a gcc -Wstrict-overflow warning.
......@@ -214,8 +214,9 @@ calccost (struct tty_display_info *tty,
}
totalcost = c * deltay;
if (doit)
while (--deltay >= 0)
do
emacs_tputs (tty, p, 1, cmputc);
while (0 < --deltay);
x:
if ((deltax = dstx - srcx) == 0)
goto done;
......@@ -296,8 +297,9 @@ calccost (struct tty_display_info *tty,
}
totalcost += c * deltax;
if (doit)
while (--deltax >= 0)
do
emacs_tputs (tty, p, 1, cmputc);
while (0 < --deltax);
done:
return totalcost;
}
......
......@@ -6753,7 +6753,7 @@ tiff_load (struct frame *f, struct image *img)
TIFF *tiff;
int width, height, x, y, count;
uint32 *buf;
int rc, rc2;
int rc;
XImagePtr ximg;
tiff_memory_source memsrc;
Lisp_Object image;
......@@ -6841,8 +6841,8 @@ tiff_load (struct frame *f, struct image *img)
rc = fn_TIFFReadRGBAImage (tiff, width, height, buf, 0);
/* Count the number of images in the file. */
for (count = 1, rc2 = 1; rc2; count++)
rc2 = fn_TIFFSetDirectory (tiff, count);
for (count = 1; fn_TIFFSetDirectory (tiff, count); count++)
continue;
if (count > 1)
img->data.lisp_val = Fcons (Qcount,
......
......@@ -11560,12 +11560,12 @@ syms_of_keyboard (void)
last_point_position_window = Qnil;
{
const struct event_head *p;
int i;
int len = sizeof (head_table) / sizeof (head_table[0]);
for (p = head_table;
p < head_table + (sizeof (head_table) / sizeof (head_table[0]));
p++)
for (i = 0; i < len; i++)
{
const struct event_head *p = &head_table[i];
*p->var = intern_c_string (p->name);
staticpro (p->var);
Fput (*p->var, Qevent_kind, *p->kind);
......
......@@ -1952,7 +1952,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
it->pixel_width = len;
it->nglyphs = len;
if (len > 0 && it->glyph_row)
if (it->glyph_row)
append_glyphless_glyph (it, face_id, str);
}
......
......@@ -2190,7 +2190,8 @@ and t is the same as `SECONDARY'. */)
***********************************************************************/
/* Check that lisp values are of correct type for x_fill_property_data.
That is, number, string or a cons with two numbers (low and high 16
bit parts of a 32 bit number). */
bit parts of a 32 bit number). Return the number of items in DATA,
or -1 if there is an error. */
int
x_check_property_data (Lisp_Object data)
......@@ -2198,15 +2199,16 @@ x_check_property_data (Lisp_Object data)
Lisp_Object iter;
int size = 0;
for (iter = data; CONSP (iter) && size != -1; iter = XCDR (iter), ++size)
for (iter = data; CONSP (iter); iter = XCDR (iter))
{
Lisp_Object o = XCAR (iter);
if (! NUMBERP (o) && ! STRINGP (o) && ! CONSP (o))
size = -1;
return -1;
else if (CONSP (o) &&
(! NUMBERP (XCAR (o)) || ! NUMBERP (XCDR (o))))
size = -1;
return -1;
size++;
}
return size;
......
......@@ -9121,7 +9121,7 @@ x_make_frame_visible (struct frame *f)
unknown reason, the call to XtMapWidget is completely ignored.
Mapping the widget a second time works. */
if (!FRAME_VISIBLE_P (f) && --retry_count > 0)
if (!FRAME_VISIBLE_P (f) && --retry_count != 0)
goto retry;
}
}
......@@ -9726,7 +9726,7 @@ same_x_server (const char *name1, const char *name2)
for (; *name1 != '\0' && *name1 == *name2; name1++, name2++)
{
if (*name1 == ':')
seen_colon++;
seen_colon = 1;
if (seen_colon && *name1 == '.')
return 1;
}
......
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