]> code.delx.au - gnu-emacs/blobdiff - src/dispnew.c
Remove now-inaccurate bytecode comments
[gnu-emacs] / src / dispnew.c
index a9f06eb3c123c7a1d82dfccab9fba4e1125f67b9..82d0b76a95f0a0b39f6516dc9546550346fdc4d9 100644 (file)
@@ -7,8 +7,8 @@ This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -321,7 +321,9 @@ margin_glyphs_to_reserve (struct window *w, int total_glyphs, int margin)
       int width = w->total_cols;
       double d = max (0, margin);
       d = min (width / 2 - 1, d);
-      return (int) ((double) total_glyphs / width * d);
+      /* Since MARGIN is positive, we cannot possibly have less than
+        one glyph for the marginal area.  */
+      return max (1, (int) ((double) total_glyphs / width * d));
     }
   return 0;
 }
@@ -5175,8 +5177,8 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
 #ifdef HAVE_WINDOW_SYSTEM
   if (it.what == IT_IMAGE)
     {
-      if ((img = IMAGE_FROM_ID (it.f, it.image_id)) != NULL
-         && !NILP (img->spec))
+      img = IMAGE_OPT_FROM_ID (it.f, it.image_id);
+      if (img && !NILP (img->spec))
        *object = img->spec;
     }
 #endif
@@ -5273,7 +5275,7 @@ mode_line_string (struct window *w, enum window_part part,
          if (glyph->type == IMAGE_GLYPH)
            {
              struct image *img;
-             img = IMAGE_FROM_ID (WINDOW_XFRAME (w), glyph->u.img_id);
+             img = IMAGE_OPT_FROM_ID (WINDOW_XFRAME (w), glyph->u.img_id);
              if (img != NULL)
                *object = img->spec;
              y0 -= row->ascent - glyph->ascent;
@@ -5360,7 +5362,7 @@ marginal_area_string (struct window *w, enum window_part part,
          if (glyph->type == IMAGE_GLYPH)
            {
              struct image *img;
-             img = IMAGE_FROM_ID (WINDOW_XFRAME (w), glyph->u.img_id);
+             img = IMAGE_OPT_FROM_ID (WINDOW_XFRAME (w), glyph->u.img_id);
              if (img != NULL)
                *object = img->spec;
              y0 -= row->ascent - glyph->ascent;
@@ -5669,7 +5671,7 @@ DEFUN ("sleep-for", Fsleep_for, Ssleep_for, 1, 2, 0,
 SECONDS may be a floating-point value, meaning that you can wait for a
 fraction of a second.  Optional second arg MILLISECONDS specifies an
 additional wait period, in milliseconds; this is for backwards compatibility.
-(Not all operating systems support waiting for a fraction of a second.)  */)
+\(Not all operating systems support waiting for a fraction of a second.)  */)
   (Lisp_Object seconds, Lisp_Object milliseconds)
 {
   double duration = extract_float (seconds);
@@ -6036,11 +6038,11 @@ init_display (void)
 #endif
 
   /* If no window system has been specified, try to use the terminal.  */
-  if (! isatty (0))
+  if (! isatty (STDIN_FILENO))
     fatal ("standard input is not a tty");
 
 #ifdef WINDOWSNT
-  terminal_type = "w32console";
+  terminal_type = (char *)"w32console";
 #else
   terminal_type = getenv ("TERM");
 #endif