Now on revision 113991. ------------------------------------------------------------ revno: 113991 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2013-08-24 18:21:05 +0300 message: Add commentary for the last commit. diff: === modified file 'src/xdisp.c' --- src/xdisp.c 2013-08-24 12:59:13 +0000 +++ src/xdisp.c 2013-08-24 15:21:05 +0000 @@ -7050,6 +7050,8 @@ } } } + /* next_element_from_display_vector sets this flag according to + faces of the display vector glyphs, see there. */ else if (it->method != GET_FROM_DISPLAY_VECTOR) { int face_id = face_after_it_pos (it); ------------------------------------------------------------ revno: 113990 fixes bug: http://debbugs.gnu.org/15175 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2013-08-24 15:59:13 +0300 message: Fix bug #15175 with cursor on boxed characters from display tables. src/xdisp.c (get_next_display_element): Don't apply to characters from a display vector the logic of setting it->end_of_box_run_p suitable for characters from a buffer. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-08-24 10:15:01 +0000 +++ src/ChangeLog 2013-08-24 12:59:13 +0000 @@ -1,5 +1,9 @@ 2013-08-24 Eli Zaretskii + * xdisp.c (get_next_display_element): Don't apply to characters + from a display vector the logic of setting it->end_of_box_run_p + suitable for characters from a buffer. (Bug#15175) + * w32.c (fdutimens): Call 'utime', which is implemented on w32.c to handle directories, rather than '_utime' which doesn't. (Bug#15176) === modified file 'src/xdisp.c' --- src/xdisp.c 2013-08-23 14:25:39 +0000 +++ src/xdisp.c 2013-08-24 12:59:13 +0000 @@ -7050,7 +7050,7 @@ } } } - else + else if (it->method != GET_FROM_DISPLAY_VECTOR) { int face_id = face_after_it_pos (it); it->end_of_box_run_p ------------------------------------------------------------ revno: 113989 fixes bug: http://debbugs.gnu.org/15176 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2013-08-24 13:15:01 +0300 message: Fix bug #15176 with setting directory times on MS-Windows. src/w32.c (fdutimens): Call 'utime', which is implemented on w32.c to handle directories, rather than '_utime' which doesn't. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-08-24 08:43:36 +0000 +++ src/ChangeLog 2013-08-24 10:15:01 +0000 @@ -1,3 +1,9 @@ +2013-08-24 Eli Zaretskii + + * w32.c (fdutimens): Call 'utime', which is implemented on w32.c + to handle directories, rather than '_utime' which doesn't. + (Bug#15176) + 2013-08-24 Jan Djärv * gtkutil.c (x_wm_set_size_hint): Don't set hints when maximized === modified file 'src/w32.c' --- src/w32.c 2013-08-09 12:25:34 +0000 +++ src/w32.c 2013-08-24 10:15:01 +0000 @@ -2503,8 +2503,6 @@ int fdutimens (int fd, char const *file, struct timespec const timespec[2]) { - struct _utimbuf ut; - if (!timespec) { errno = ENOSYS; @@ -2515,12 +2513,28 @@ errno = EBADF; return -1; } - ut.actime = timespec[0].tv_sec; - ut.modtime = timespec[1].tv_sec; + /* _futime's prototype defines 2nd arg as having the type 'struct + _utimbuf', while utime needs to accept 'struct utimbuf' for + compatibility with Posix. So we need to use 2 different (but + equivalent) types to avoid compiler warnings, sigh. */ if (fd >= 0) - return _futime (fd, &ut); + { + struct _utimbuf _ut; + + _ut.actime = timespec[0].tv_sec; + _ut.modtime = timespec[1].tv_sec; + return _futime (fd, &_ut); + } else - return _utime (file, &ut); + { + struct utimbuf ut; + + ut.actime = timespec[0].tv_sec; + ut.modtime = timespec[1].tv_sec; + /* Call 'utime', which is implemented below, not the MS library + function, which fails on directories. */ + return utime (file, &ut); + } } @@ -4501,6 +4515,9 @@ return 0; } +/* A version of 'utime' which handles directories as well as + files. */ + int utime (const char *name, struct utimbuf *times) { ------------------------------------------------------------ revno: 113988 fixes bug: http://debbugs.gnu.org/14627 committer: Jan D. branch nick: trunk timestamp: Sat 2013-08-24 10:43:36 +0200 message: * gtkutil.c (x_wm_set_size_hint): Don't set hints when maximized or fullscreen. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-08-24 02:23:34 +0000 +++ src/ChangeLog 2013-08-24 08:43:36 +0000 @@ -1,3 +1,8 @@ +2013-08-24 Jan Djärv + + * gtkutil.c (x_wm_set_size_hint): Don't set hints when maximized + or fullscreen (Bug#14627). + 2013-08-24 Paul Eggert System-dependent integer overflow fixes. === modified file 'src/gtkutil.c' --- src/gtkutil.c 2013-08-11 01:30:20 +0000 +++ src/gtkutil.c 2013-08-24 08:43:36 +0000 @@ -1341,6 +1341,7 @@ int base_width, base_height; int min_rows = 0, min_cols = 0; int win_gravity = f->win_gravity; + Lisp_Object fs_state, frame; /* Don't set size hints during initialization; that apparently leads to a race condition. See the thread at @@ -1348,6 +1349,16 @@ if (NILP (Vafter_init_time) || !FRAME_GTK_OUTER_WIDGET (f)) return; + XSETFRAME (frame, f); + fs_state = Fframe_parameter (frame, Qfullscreen); + if (EQ (fs_state, Qmaximized) || EQ (fs_state, Qfullboth)) + { + /* Don't set hints when maximized or fullscreen. Apparently KWin and + Gtk3 don't get along and the frame shrinks (!). + */ + return; + } + if (flags) { memset (&size_hints, 0, sizeof (size_hints)); ------------------------------------------------------------ revno: 113987 committer: Paul Eggert branch nick: trunk timestamp: Fri 2013-08-23 19:23:34 -0700 message: System-dependent integer overflow fixes. * process.c (Fset_process_window_size): Signal an error if the window size is outside the range supported by the lower level. * sysdep.c (set_window_size): Return negative on error, nonnegative on success, rather than -1, 0, 1 on not in system, failure, success. This is simpler. Caller changed. (serial_configure): Remove unnecessary initialization of local. (procfs_get_total_memory) [GNU_LINUX]: Don't assume system memory size fits in unsigned long; this isn't true on some 32-bit hosts. Avoid buffer overrun if some future version of /proc/meminfo has a variable name longer than 20 bytes. (system_process_attributes) [__FreeBSD__]: Don't assume hw.availpages fits in 'int'. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-08-23 17:57:07 +0000 +++ src/ChangeLog 2013-08-24 02:23:34 +0000 @@ -1,3 +1,19 @@ +2013-08-24 Paul Eggert + + System-dependent integer overflow fixes. + * process.c (Fset_process_window_size): Signal an error if + the window size is outside the range supported by the lower level. + * sysdep.c (set_window_size): Return negative on error, + nonnegative on success, rather than -1, 0, 1 on not in system, + failure, success. This is simpler. Caller changed. + (serial_configure): Remove unnecessary initialization of local. + (procfs_get_total_memory) [GNU_LINUX]: Don't assume system memory + size fits in unsigned long; this isn't true on some 32-bit hosts. + Avoid buffer overrun if some future version of /proc/meminfo has a + variable name longer than 20 bytes. + (system_process_attributes) [__FreeBSD__]: + Don't assume hw.availpages fits in 'int'. + 2013-08-23 Paul Eggert Don't let very long directory names overrun the stack. === modified file 'src/process.c' --- src/process.c 2013-08-23 17:57:07 +0000 +++ src/process.c 2013-08-24 02:23:34 +0000 @@ -1140,15 +1140,18 @@ DEFUN ("set-process-window-size", Fset_process_window_size, Sset_process_window_size, 3, 3, 0, doc: /* Tell PROCESS that it has logical window size HEIGHT and WIDTH. */) - (register Lisp_Object process, Lisp_Object height, Lisp_Object width) + (Lisp_Object process, Lisp_Object height, Lisp_Object width) { CHECK_PROCESS (process); - CHECK_RANGED_INTEGER (height, 0, INT_MAX); - CHECK_RANGED_INTEGER (width, 0, INT_MAX); + + /* All known platforms store window sizes as 'unsigned short'. */ + CHECK_RANGED_INTEGER (height, 0, USHRT_MAX); + CHECK_RANGED_INTEGER (width, 0, USHRT_MAX); if (XPROCESS (process)->infd < 0 - || set_window_size (XPROCESS (process)->infd, - XINT (height), XINT (width)) <= 0) + || (set_window_size (XPROCESS (process)->infd, + XINT (height), XINT (width)) + < 0)) return Qnil; else return Qt; === modified file 'src/sysdep.c' --- src/sysdep.c 2013-08-23 17:57:07 +0000 +++ src/sysdep.c 2013-08-24 02:23:34 +0000 @@ -1170,7 +1170,8 @@ } /* Set the logical window size associated with descriptor FD - to HEIGHT and WIDTH. This is used mainly with ptys. */ + to HEIGHT and WIDTH. This is used mainly with ptys. + Return a negative value on failure. */ int set_window_size (int fd, int height, int width) @@ -1182,10 +1183,7 @@ size.ws_row = height; size.ws_col = width; - if (ioctl (fd, TIOCSWINSZ, &size) == -1) - return 0; /* error */ - else - return 1; + return ioctl (fd, TIOCSWINSZ, &size); #else #ifdef TIOCSSIZE @@ -1195,10 +1193,7 @@ size.ts_lines = height; size.ts_cols = width; - if (ioctl (fd, TIOCGSIZE, &size) == -1) - return 0; - else - return 1; + return ioctl (fd, TIOCGSIZE, &size); #else return -1; #endif /* not SunOS-style */ @@ -2459,7 +2454,7 @@ Lisp_Object childp2 = Qnil; Lisp_Object tem = Qnil; struct termios attr; - int err = -1; + int err; char summary[4] = "???"; /* This usually becomes "8N1". */ childp2 = Fcopy_sequence (p->childp); @@ -2826,29 +2821,41 @@ return build_string (name); } -static unsigned long +static uintmax_t procfs_get_total_memory (void) { FILE *fmem; - unsigned long retval = 2 * 1024 * 1024; /* default: 2GB */ + uintmax_t retval = 2 * 1024 * 1024; /* default: 2 GiB */ + int c; block_input (); fmem = emacs_fopen ("/proc/meminfo", "r"); if (fmem) { - unsigned long entry_value; - char entry_name[20]; /* the longest I saw is 13+1 */ - - while (!feof (fmem) && !ferror (fmem)) - { - if (fscanf (fmem, "%s %lu kB\n", entry_name, &entry_value) >= 2 - && strcmp (entry_name, "MemTotal:") == 0) - { - retval = entry_value; - break; - } - } + uintmax_t entry_value; + bool done; + + do + switch (fscanf (fmem, "MemTotal: %"SCNuMAX, &entry_value)) + { + case 1: + retval = entry_value; + done = 1; + break; + + case 0: + while ((c = getc (fmem)) != EOF && c != '\n') + continue; + done = c == EOF; + break; + + default: + done = 1; + break; + } + while (!done); + fclose (fmem); } unblock_input (); @@ -3249,7 +3256,7 @@ { int proc_id; int pagesize = getpagesize (); - int npages; + unsigned long npages; int fscale; struct passwd *pw; struct group *gr;