diff options
| author | Paul Eggert | 2011-03-13 10:28:15 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-03-13 10:28:15 -0700 |
| commit | 3eca4629203c3038f04db312999ca32d8e292e50 (patch) | |
| tree | 7dab20a2f6de3e300fd266f51b71efd1d9f52188 /src | |
| parent | 01e0b5adf4e35c2b00705c212b853936fe218cac (diff) | |
| parent | d32df629a23d0e04eb70df9c6e60e821d905c822 (diff) | |
| download | emacs-3eca4629203c3038f04db312999ca32d8e292e50.tar.gz emacs-3eca4629203c3038f04db312999ca32d8e292e50.zip | |
Merge from mainline.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 73 | ||||
| -rw-r--r-- | src/buffer.c | 3 | ||||
| -rw-r--r-- | src/deps.mk | 5 | ||||
| -rw-r--r-- | src/dired.c | 7 | ||||
| -rw-r--r-- | src/editfns.c | 133 | ||||
| -rw-r--r-- | src/fringe.c | 8 | ||||
| -rw-r--r-- | src/makefile.w32-in | 2 | ||||
| -rw-r--r-- | src/msdos.c | 7 | ||||
| -rw-r--r-- | src/msdos.h | 2 | ||||
| -rw-r--r-- | src/systime.h | 5 | ||||
| -rw-r--r-- | src/term.c | 2 | ||||
| -rw-r--r-- | src/termcap.c | 18 | ||||
| -rw-r--r-- | src/termhooks.h | 3 | ||||
| -rw-r--r-- | src/unexmacosx.c | 1 |
14 files changed, 206 insertions, 63 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0097626c463..e840bb3c036 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | 2011-03-13 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-03-13 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Fix more problems found by GCC 4.5.2's static checks. | ||
| 4 | |||
| 3 | * gtkutil.c (xg_get_pixbuf_from_pixmap): Add cast from char * | 5 | * gtkutil.c (xg_get_pixbuf_from_pixmap): Add cast from char * |
| 4 | to unsigned char * to avoid compiler diagnostic. | 6 | to unsigned char * to avoid compiler diagnostic. |
| 5 | (xg_free_frame_widgets): Make it clear that a local variable is | 7 | (xg_free_frame_widgets): Make it clear that a local variable is |
| @@ -22,8 +24,6 @@ | |||
| 22 | Mark another local as initialized. | 24 | Mark another local as initialized. |
| 23 | (my_png_error, my_error_exit): Mark with NO_RETURN. | 25 | (my_png_error, my_error_exit): Mark with NO_RETURN. |
| 24 | 26 | ||
| 25 | 2011-03-11 Paul Eggert <eggert@cs.ucla.edu> | ||
| 26 | |||
| 27 | * image.c (clear_image_cache): Now static. | 27 | * image.c (clear_image_cache): Now static. |
| 28 | (DIM, HAVE_STDLIB_H_1): Remove unused macros. | 28 | (DIM, HAVE_STDLIB_H_1): Remove unused macros. |
| 29 | (xpm_load): Redo to avoid "discards qualifiers" gcc warning. | 29 | (xpm_load): Redo to avoid "discards qualifiers" gcc warning. |
| @@ -35,6 +35,75 @@ | |||
| 35 | 35 | ||
| 36 | 2011-03-11 Paul Eggert <eggert@cs.ucla.edu> | 36 | 2011-03-11 Paul Eggert <eggert@cs.ucla.edu> |
| 37 | 37 | ||
| 38 | Improve quality of tests for time stamp overflow. | ||
| 39 | For example, without this patch (encode-time 0 0 0 1 1 | ||
| 40 | 1152921504606846976) returns the obviously-bogus value (-948597 | ||
| 41 | 62170) on my RHEL 5.5 x86-64 host. With the patch, it correctly | ||
| 42 | reports time overflow. See | ||
| 43 | <http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg00470.html>. | ||
| 44 | * deps.mk (editfns.o): Depend on ../lib/intprops.h. | ||
| 45 | * editfns.c: Include limits.h and intprops.h. | ||
| 46 | (TIME_T_MIN, TIME_T_MAX): New macros. | ||
| 47 | (time_overflow): Move earlier, to before first use. | ||
| 48 | (hi_time, lo_time): New functions, for an accurate test for | ||
| 49 | out-of-range times. | ||
| 50 | (Fcurrent_time, Fget_internal_run_time, make_time): Use them. | ||
| 51 | (Fget_internal_run_time): Don't assume time_t fits in int. | ||
| 52 | (make_time): Use list2 instead of Fcons twice. | ||
| 53 | (Fdecode_time): More accurate test for out-of-range times. | ||
| 54 | (check_tm_member): New function. | ||
| 55 | (Fencode_time): Use it, to test for out-of-range times. | ||
| 56 | (lisp_time_argument): Don't rely on undefined left-shift and | ||
| 57 | right-shift behavior when checking for time stamp overflow. | ||
| 58 | |||
| 59 | * editfns.c (time_overflow): New function, refactoring common code. | ||
| 60 | (Fformat_time_string, Fdecode_time, Fencode_time): | ||
| 61 | (Fcurrent_time_string): Use it. | ||
| 62 | |||
| 63 | Move 'make_time' to be next to its inverse 'lisp_time_argument'. | ||
| 64 | * dired.c (make_time): Move to ... | ||
| 65 | * editfns.c (make_time): ... here. | ||
| 66 | * systime.h: Note the move. | ||
| 67 | |||
| 68 | 2011-03-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 69 | |||
| 70 | * fringe.c (update_window_fringes): Remove unused variables. | ||
| 71 | |||
| 72 | * unexmacosx.c (copy_data_segment): Also copy __got section. | ||
| 73 | (Bug#8223) | ||
| 74 | |||
| 75 | 2011-03-12 Eli Zaretskii <eliz@gnu.org> | ||
| 76 | |||
| 77 | * termcap.c [MSDOS]: Include "msdos.h. | ||
| 78 | (find_capability, tgetnum, tgetflag, tgetstr, tputs, tgetent): | ||
| 79 | Constify `char *' arguments and their references according to | ||
| 80 | prototypes in tparam.h. | ||
| 81 | |||
| 82 | * deps.mk (termcap.o): Depend on tparam.h and msdos.h. | ||
| 83 | |||
| 84 | * msdos.c (XMenuAddPane): 3rd argument is `const char *' now. | ||
| 85 | Adapt all references accordingly. | ||
| 86 | |||
| 87 | * msdos.h (XMenuAddPane): 3rd argument is `const char *' now. | ||
| 88 | |||
| 89 | 2011-03-11 Tom Tromey <tromey@redhat.com> | ||
| 90 | |||
| 91 | * buffer.c (syms_of_buffer): Remove obsolete comment. | ||
| 92 | |||
| 93 | 2011-03-11 Eli Zaretskii <eliz@gnu.org> | ||
| 94 | |||
| 95 | * termhooks.h (encode_terminal_code): Declare prototype. | ||
| 96 | |||
| 97 | * msdos.c (encode_terminal_code): Don't declare prototype. | ||
| 98 | |||
| 99 | * term.c (encode_terminal_code): Now external again, used by | ||
| 100 | w32console.c and msdos.c. | ||
| 101 | |||
| 102 | * makefile.w32-in ($(BLD)/term.$(O), ($(BLD)/tparam.$(O)): Depend | ||
| 103 | on $(SRC)/tparam.h, see 2011-03-11T07:24:21Z!eggert@cs.ucla.edu. | ||
| 104 | |||
| 105 | 2011-03-11 Paul Eggert <eggert@cs.ucla.edu> | ||
| 106 | |||
| 38 | Fix some minor problems found by GCC 4.5.2's static checks. | 107 | Fix some minor problems found by GCC 4.5.2's static checks. |
| 39 | 108 | ||
| 40 | * fringe.c (update_window_fringes): Mark locals as initialized | 109 | * fringe.c (update_window_fringes): Mark locals as initialized |
diff --git a/src/buffer.c b/src/buffer.c index c95fbb5f516..448c9236387 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -5332,9 +5332,6 @@ syms_of_buffer (void) | |||
| 5332 | Fput (Qprotected_field, Qerror_message, | 5332 | Fput (Qprotected_field, Qerror_message, |
| 5333 | make_pure_c_string ("Attempt to modify a protected field")); | 5333 | make_pure_c_string ("Attempt to modify a protected field")); |
| 5334 | 5334 | ||
| 5335 | /* All these use DEFVAR_LISP_NOPRO because the slots in | ||
| 5336 | buffer_defaults will all be marked via Vbuffer_defaults. */ | ||
| 5337 | |||
| 5338 | DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format", | 5335 | DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format", |
| 5339 | mode_line_format, | 5336 | mode_line_format, |
| 5340 | doc: /* Default value of `mode-line-format' for buffers that don't override it. | 5337 | doc: /* Default value of `mode-line-format' for buffers that don't override it. |
diff --git a/src/deps.mk b/src/deps.mk index 2b162b07bb8..80a5721cf39 100644 --- a/src/deps.mk +++ b/src/deps.mk | |||
| @@ -87,7 +87,8 @@ dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \ | |||
| 87 | msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \ | 87 | msdos.h dosfns.h dispextern.h charset.h coding.h atimer.h systime.h \ |
| 88 | lisp.h $(config_h) | 88 | lisp.h $(config_h) |
| 89 | editfns.o: editfns.c window.h buffer.h systime.h $(INTERVALS_H) character.h \ | 89 | editfns.o: editfns.c window.h buffer.h systime.h $(INTERVALS_H) character.h \ |
| 90 | coding.h frame.h blockinput.h atimer.h ../lib/unistd.h ../lib/strftime.h \ | 90 | coding.h frame.h blockinput.h atimer.h \ |
| 91 | ../lib/intprops.h ../lib/strftime.h ../lib/unistd.h \ | ||
| 91 | lisp.h globals.h $(config_h) | 92 | lisp.h globals.h $(config_h) |
| 92 | emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \ | 93 | emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \ |
| 93 | termhooks.h buffer.h atimer.h systime.h $(INTERVALS_H) lisp.h $(config_h) \ | 94 | termhooks.h buffer.h atimer.h systime.h $(INTERVALS_H) lisp.h $(config_h) \ |
| @@ -191,7 +192,7 @@ term.o: term.c termchar.h termhooks.h termopts.h lisp.h globals.h $(config_h) \ | |||
| 191 | cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \ | 192 | cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \ |
| 192 | xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \ | 193 | xterm.h msdos.h window.h keymap.h blockinput.h atimer.h systime.h \ |
| 193 | systty.h syssignal.h tparam.h $(INTERVALS_H) buffer.h ../lib/unistd.h | 194 | systty.h syssignal.h tparam.h $(INTERVALS_H) buffer.h ../lib/unistd.h |
| 194 | termcap.o: termcap.c lisp.h $(config_h) | 195 | termcap.o: termcap.c lisp.h tparam.h msdos.h $(config_h) |
| 195 | terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ | 196 | terminal.o: terminal.c frame.h termchar.h termhooks.h charset.h coding.h \ |
| 196 | keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ | 197 | keyboard.h lisp.h globals.h $(config_h) dispextern.h composite.h systime.h \ |
| 197 | msdos.h | 198 | msdos.h |
diff --git a/src/dired.c b/src/dired.c index 96063680d4d..d201418d78b 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -848,13 +848,6 @@ file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_ad | |||
| 848 | return value; | 848 | return value; |
| 849 | } | 849 | } |
| 850 | 850 | ||
| 851 | Lisp_Object | ||
| 852 | make_time (time_t time) | ||
| 853 | { | ||
| 854 | return Fcons (make_number (time >> 16), | ||
| 855 | Fcons (make_number (time & 0177777), Qnil)); | ||
| 856 | } | ||
| 857 | |||
| 858 | static char * | 851 | static char * |
| 859 | stat_uname (struct stat *st) | 852 | stat_uname (struct stat *st) |
| 860 | { | 853 | { |
diff --git a/src/editfns.c b/src/editfns.c index 28690e7c76d..d92d3482d09 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -45,6 +45,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 45 | #endif | 45 | #endif |
| 46 | 46 | ||
| 47 | #include <ctype.h> | 47 | #include <ctype.h> |
| 48 | #include <limits.h> | ||
| 49 | #include <intprops.h> | ||
| 48 | #include <strftime.h> | 50 | #include <strftime.h> |
| 49 | 51 | ||
| 50 | #include "intervals.h" | 52 | #include "intervals.h" |
| @@ -87,6 +89,7 @@ extern char **environ; | |||
| 87 | extern Lisp_Object w32_get_internal_run_time (void); | 89 | extern Lisp_Object w32_get_internal_run_time (void); |
| 88 | #endif | 90 | #endif |
| 89 | 91 | ||
| 92 | static void time_overflow (void) NO_RETURN; | ||
| 90 | static int tm_diff (struct tm *, struct tm *); | 93 | static int tm_diff (struct tm *, struct tm *); |
| 91 | static void find_field (Lisp_Object, Lisp_Object, Lisp_Object, | 94 | static void find_field (Lisp_Object, Lisp_Object, Lisp_Object, |
| 92 | EMACS_INT *, Lisp_Object, EMACS_INT *); | 95 | EMACS_INT *, Lisp_Object, EMACS_INT *); |
| @@ -1414,6 +1417,49 @@ DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0, | |||
| 1414 | return make_number (getpid ()); | 1417 | return make_number (getpid ()); |
| 1415 | } | 1418 | } |
| 1416 | 1419 | ||
| 1420 | |||
| 1421 | |||
| 1422 | #ifndef TIME_T_MIN | ||
| 1423 | # define TIME_T_MIN TYPE_MINIMUM (time_t) | ||
| 1424 | #endif | ||
| 1425 | #ifndef TIME_T_MAX | ||
| 1426 | # define TIME_T_MAX TYPE_MAXIMUM (time_t) | ||
| 1427 | #endif | ||
| 1428 | |||
| 1429 | /* Report that a time value is out of range for Emacs. */ | ||
| 1430 | static void | ||
| 1431 | time_overflow (void) | ||
| 1432 | { | ||
| 1433 | error ("Specified time is not representable"); | ||
| 1434 | } | ||
| 1435 | |||
| 1436 | /* Return the upper part of the time T (everything but the bottom 16 bits), | ||
| 1437 | making sure that it is representable. */ | ||
| 1438 | static EMACS_INT | ||
| 1439 | hi_time (time_t t) | ||
| 1440 | { | ||
| 1441 | time_t hi = t >> 16; | ||
| 1442 | |||
| 1443 | /* Check for overflow, helping the compiler for common cases where | ||
| 1444 | no runtime check is needed, and taking care not to convert | ||
| 1445 | negative numbers to unsigned before comparing them. */ | ||
| 1446 | if (! ((! TYPE_SIGNED (time_t) | ||
| 1447 | || MOST_NEGATIVE_FIXNUM <= TIME_T_MIN >> 16 | ||
| 1448 | || MOST_NEGATIVE_FIXNUM <= hi) | ||
| 1449 | && (TIME_T_MAX >> 16 <= MOST_POSITIVE_FIXNUM | ||
| 1450 | || hi <= MOST_POSITIVE_FIXNUM))) | ||
| 1451 | time_overflow (); | ||
| 1452 | |||
| 1453 | return hi; | ||
| 1454 | } | ||
| 1455 | |||
| 1456 | /* Return the bottom 16 bits of the time T. */ | ||
| 1457 | static EMACS_INT | ||
| 1458 | lo_time (time_t t) | ||
| 1459 | { | ||
| 1460 | return t & ((1 << 16) - 1); | ||
| 1461 | } | ||
| 1462 | |||
| 1417 | DEFUN ("current-time", Fcurrent_time, Scurrent_time, 0, 0, 0, | 1463 | DEFUN ("current-time", Fcurrent_time, Scurrent_time, 0, 0, 0, |
| 1418 | doc: /* Return the current time, as the number of seconds since 1970-01-01 00:00:00. | 1464 | doc: /* Return the current time, as the number of seconds since 1970-01-01 00:00:00. |
| 1419 | The time is returned as a list of three integers. The first has the | 1465 | The time is returned as a list of three integers. The first has the |
| @@ -1428,8 +1474,8 @@ resolution finer than a second. */) | |||
| 1428 | EMACS_TIME t; | 1474 | EMACS_TIME t; |
| 1429 | 1475 | ||
| 1430 | EMACS_GET_TIME (t); | 1476 | EMACS_GET_TIME (t); |
| 1431 | return list3 (make_number ((EMACS_SECS (t) >> 16) & 0xffff), | 1477 | return list3 (make_number (hi_time (EMACS_SECS (t))), |
| 1432 | make_number ((EMACS_SECS (t) >> 0) & 0xffff), | 1478 | make_number (lo_time (EMACS_SECS (t))), |
| 1433 | make_number (EMACS_USECS (t))); | 1479 | make_number (EMACS_USECS (t))); |
| 1434 | } | 1480 | } |
| 1435 | 1481 | ||
| @@ -1448,7 +1494,8 @@ on systems that do not provide resolution finer than a second. */) | |||
| 1448 | { | 1494 | { |
| 1449 | #ifdef HAVE_GETRUSAGE | 1495 | #ifdef HAVE_GETRUSAGE |
| 1450 | struct rusage usage; | 1496 | struct rusage usage; |
| 1451 | int secs, usecs; | 1497 | time_t secs; |
| 1498 | int usecs; | ||
| 1452 | 1499 | ||
| 1453 | if (getrusage (RUSAGE_SELF, &usage) < 0) | 1500 | if (getrusage (RUSAGE_SELF, &usage) < 0) |
| 1454 | /* This shouldn't happen. What action is appropriate? */ | 1501 | /* This shouldn't happen. What action is appropriate? */ |
| @@ -1463,8 +1510,8 @@ on systems that do not provide resolution finer than a second. */) | |||
| 1463 | secs++; | 1510 | secs++; |
| 1464 | } | 1511 | } |
| 1465 | 1512 | ||
| 1466 | return list3 (make_number ((secs >> 16) & 0xffff), | 1513 | return list3 (make_number (hi_time (secs)), |
| 1467 | make_number ((secs >> 0) & 0xffff), | 1514 | make_number (lo_time (secs)), |
| 1468 | make_number (usecs)); | 1515 | make_number (usecs)); |
| 1469 | #else /* ! HAVE_GETRUSAGE */ | 1516 | #else /* ! HAVE_GETRUSAGE */ |
| 1470 | #ifdef WINDOWSNT | 1517 | #ifdef WINDOWSNT |
| @@ -1476,6 +1523,19 @@ on systems that do not provide resolution finer than a second. */) | |||
| 1476 | } | 1523 | } |
| 1477 | 1524 | ||
| 1478 | 1525 | ||
| 1526 | /* Make a Lisp list that represents the time T. */ | ||
| 1527 | Lisp_Object | ||
| 1528 | make_time (time_t t) | ||
| 1529 | { | ||
| 1530 | return list2 (make_number (hi_time (t)), | ||
| 1531 | make_number (lo_time (t))); | ||
| 1532 | } | ||
| 1533 | |||
| 1534 | /* Decode a Lisp list SPECIFIED_TIME that represents a time. | ||
| 1535 | If SPECIFIED_TIME is nil, use the current time. | ||
| 1536 | Set *RESULT to seconds since the Epoch. | ||
| 1537 | If USEC is not null, set *USEC to the microseconds component. | ||
| 1538 | Return nonzero if successful. */ | ||
| 1479 | int | 1539 | int |
| 1480 | lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) | 1540 | lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) |
| 1481 | { | 1541 | { |
| @@ -1496,6 +1556,7 @@ lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) | |||
| 1496 | else | 1556 | else |
| 1497 | { | 1557 | { |
| 1498 | Lisp_Object high, low; | 1558 | Lisp_Object high, low; |
| 1559 | EMACS_INT hi; | ||
| 1499 | high = Fcar (specified_time); | 1560 | high = Fcar (specified_time); |
| 1500 | CHECK_NUMBER (high); | 1561 | CHECK_NUMBER (high); |
| 1501 | low = Fcdr (specified_time); | 1562 | low = Fcdr (specified_time); |
| @@ -1519,8 +1580,21 @@ lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) | |||
| 1519 | else if (usec) | 1580 | else if (usec) |
| 1520 | *usec = 0; | 1581 | *usec = 0; |
| 1521 | CHECK_NUMBER (low); | 1582 | CHECK_NUMBER (low); |
| 1522 | *result = (XINT (high) << 16) + (XINT (low) & 0xffff); | 1583 | hi = XINT (high); |
| 1523 | return *result >> 16 == XINT (high); | 1584 | |
| 1585 | /* Check for overflow, helping the compiler for common cases | ||
| 1586 | where no runtime check is needed, and taking care not to | ||
| 1587 | convert negative numbers to unsigned before comparing them. */ | ||
| 1588 | if (! ((TYPE_SIGNED (time_t) | ||
| 1589 | ? (TIME_T_MIN >> 16 <= MOST_NEGATIVE_FIXNUM | ||
| 1590 | || TIME_T_MIN >> 16 <= hi) | ||
| 1591 | : 0 <= hi) | ||
| 1592 | && (MOST_POSITIVE_FIXNUM <= TIME_T_MAX >> 16 | ||
| 1593 | || hi <= TIME_T_MAX >> 16))) | ||
| 1594 | return 0; | ||
| 1595 | |||
| 1596 | *result = (hi << 16) + (XINT (low) & 0xffff); | ||
| 1597 | return 1; | ||
| 1524 | } | 1598 | } |
| 1525 | } | 1599 | } |
| 1526 | 1600 | ||
| @@ -1674,7 +1748,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) | |||
| 1674 | tm = ut ? gmtime (&value) : localtime (&value); | 1748 | tm = ut ? gmtime (&value) : localtime (&value); |
| 1675 | UNBLOCK_INPUT; | 1749 | UNBLOCK_INPUT; |
| 1676 | if (! tm) | 1750 | if (! tm) |
| 1677 | error ("Specified time is not representable"); | 1751 | time_overflow (); |
| 1678 | 1752 | ||
| 1679 | synchronize_system_time_locale (); | 1753 | synchronize_system_time_locale (); |
| 1680 | 1754 | ||
| @@ -1732,8 +1806,10 @@ DOW and ZONE.) */) | |||
| 1732 | BLOCK_INPUT; | 1806 | BLOCK_INPUT; |
| 1733 | decoded_time = localtime (&time_spec); | 1807 | decoded_time = localtime (&time_spec); |
| 1734 | UNBLOCK_INPUT; | 1808 | UNBLOCK_INPUT; |
| 1735 | if (! decoded_time) | 1809 | if (! (decoded_time |
| 1736 | error ("Specified time is not representable"); | 1810 | && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= decoded_time->tm_year |
| 1811 | && decoded_time->tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE)) | ||
| 1812 | time_overflow (); | ||
| 1737 | XSETFASTINT (list_args[0], decoded_time->tm_sec); | 1813 | XSETFASTINT (list_args[0], decoded_time->tm_sec); |
| 1738 | XSETFASTINT (list_args[1], decoded_time->tm_min); | 1814 | XSETFASTINT (list_args[1], decoded_time->tm_min); |
| 1739 | XSETFASTINT (list_args[2], decoded_time->tm_hour); | 1815 | XSETFASTINT (list_args[2], decoded_time->tm_hour); |
| @@ -1757,6 +1833,20 @@ DOW and ZONE.) */) | |||
| 1757 | return Flist (9, list_args); | 1833 | return Flist (9, list_args); |
| 1758 | } | 1834 | } |
| 1759 | 1835 | ||
| 1836 | /* Return OBJ - OFFSET, checking that OBJ is a valid fixnum and that | ||
| 1837 | the result is representable as an int. Assume OFFSET is small and | ||
| 1838 | nonnegative. */ | ||
| 1839 | static int | ||
| 1840 | check_tm_member (Lisp_Object obj, int offset) | ||
| 1841 | { | ||
| 1842 | EMACS_INT n; | ||
| 1843 | CHECK_NUMBER (obj); | ||
| 1844 | n = XINT (obj); | ||
| 1845 | if (! (INT_MIN + offset <= n && n - offset <= INT_MAX)) | ||
| 1846 | time_overflow (); | ||
| 1847 | return n - offset; | ||
| 1848 | } | ||
| 1849 | |||
| 1760 | DEFUN ("encode-time", Fencode_time, Sencode_time, 6, MANY, 0, | 1850 | DEFUN ("encode-time", Fencode_time, Sencode_time, 6, MANY, 0, |
| 1761 | doc: /* Convert SECOND, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time. | 1851 | doc: /* Convert SECOND, MINUTE, HOUR, DAY, MONTH, YEAR and ZONE to internal time. |
| 1762 | This is the reverse operation of `decode-time', which see. | 1852 | This is the reverse operation of `decode-time', which see. |
| @@ -1785,19 +1875,12 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) | |||
| 1785 | struct tm tm; | 1875 | struct tm tm; |
| 1786 | Lisp_Object zone = (nargs > 6 ? args[nargs - 1] : Qnil); | 1876 | Lisp_Object zone = (nargs > 6 ? args[nargs - 1] : Qnil); |
| 1787 | 1877 | ||
| 1788 | CHECK_NUMBER (args[0]); /* second */ | 1878 | tm.tm_sec = check_tm_member (args[0], 0); |
| 1789 | CHECK_NUMBER (args[1]); /* minute */ | 1879 | tm.tm_min = check_tm_member (args[1], 0); |
| 1790 | CHECK_NUMBER (args[2]); /* hour */ | 1880 | tm.tm_hour = check_tm_member (args[2], 0); |
| 1791 | CHECK_NUMBER (args[3]); /* day */ | 1881 | tm.tm_mday = check_tm_member (args[3], 0); |
| 1792 | CHECK_NUMBER (args[4]); /* month */ | 1882 | tm.tm_mon = check_tm_member (args[4], 1); |
| 1793 | CHECK_NUMBER (args[5]); /* year */ | 1883 | tm.tm_year = check_tm_member (args[5], TM_YEAR_BASE); |
| 1794 | |||
| 1795 | tm.tm_sec = XINT (args[0]); | ||
| 1796 | tm.tm_min = XINT (args[1]); | ||
| 1797 | tm.tm_hour = XINT (args[2]); | ||
| 1798 | tm.tm_mday = XINT (args[3]); | ||
| 1799 | tm.tm_mon = XINT (args[4]) - 1; | ||
| 1800 | tm.tm_year = XINT (args[5]) - TM_YEAR_BASE; | ||
| 1801 | tm.tm_isdst = -1; | 1884 | tm.tm_isdst = -1; |
| 1802 | 1885 | ||
| 1803 | if (CONSP (zone)) | 1886 | if (CONSP (zone)) |
| @@ -1846,7 +1929,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) | |||
| 1846 | } | 1929 | } |
| 1847 | 1930 | ||
| 1848 | if (time == (time_t) -1) | 1931 | if (time == (time_t) -1) |
| 1849 | error ("Specified time is not representable"); | 1932 | time_overflow (); |
| 1850 | 1933 | ||
| 1851 | return make_time (time); | 1934 | return make_time (time); |
| 1852 | } | 1935 | } |
| @@ -1881,7 +1964,7 @@ but this is considered obsolete. */) | |||
| 1881 | tm = localtime (&value); | 1964 | tm = localtime (&value); |
| 1882 | UNBLOCK_INPUT; | 1965 | UNBLOCK_INPUT; |
| 1883 | if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) && (tem = asctime (tm)))) | 1966 | if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) && (tem = asctime (tm)))) |
| 1884 | error ("Specified time is not representable"); | 1967 | time_overflow (); |
| 1885 | 1968 | ||
| 1886 | /* Remove the trailing newline. */ | 1969 | /* Remove the trailing newline. */ |
| 1887 | tem[strlen (tem) - 1] = '\0'; | 1970 | tem[strlen (tem) - 1] = '\0'; |
diff --git a/src/fringe.c b/src/fringe.c index 82fc38aee8a..ce75df766ee 100644 --- a/src/fringe.c +++ b/src/fringe.c | |||
| @@ -954,18 +954,10 @@ update_window_fringes (struct window *w, int keep_current_p) | |||
| 954 | y < yb && rn < nrows; | 954 | y < yb && rn < nrows; |
| 955 | y += row->height, ++rn) | 955 | y += row->height, ++rn) |
| 956 | { | 956 | { |
| 957 | unsigned indicate_bob_p, indicate_top_line_p; | ||
| 958 | unsigned indicate_eob_p, indicate_bottom_line_p; | ||
| 959 | |||
| 960 | row = w->desired_matrix->rows + rn; | 957 | row = w->desired_matrix->rows + rn; |
| 961 | if (!row->enabled_p) | 958 | if (!row->enabled_p) |
| 962 | row = w->current_matrix->rows + rn; | 959 | row = w->current_matrix->rows + rn; |
| 963 | 960 | ||
| 964 | indicate_bob_p = row->indicate_bob_p; | ||
| 965 | indicate_top_line_p = row->indicate_top_line_p; | ||
| 966 | indicate_eob_p = row->indicate_eob_p; | ||
| 967 | indicate_bottom_line_p = row->indicate_bottom_line_p; | ||
| 968 | |||
| 969 | row->indicate_bob_p = row->indicate_top_line_p = 0; | 961 | row->indicate_bob_p = row->indicate_top_line_p = 0; |
| 970 | row->indicate_eob_p = row->indicate_bottom_line_p = 0; | 962 | row->indicate_eob_p = row->indicate_bottom_line_p = 0; |
| 971 | 963 | ||
diff --git a/src/makefile.w32-in b/src/makefile.w32-in index 7a702fd45bf..81f758f1b5f 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in | |||
| @@ -1466,6 +1466,7 @@ $(BLD)/term.$(O) : \ | |||
| 1466 | $(SRC)/termchar.h \ | 1466 | $(SRC)/termchar.h \ |
| 1467 | $(SRC)/termhooks.h \ | 1467 | $(SRC)/termhooks.h \ |
| 1468 | $(SRC)/termopts.h \ | 1468 | $(SRC)/termopts.h \ |
| 1469 | $(SRC)/tparam.h \ | ||
| 1469 | $(SRC)/w32gui.h \ | 1470 | $(SRC)/w32gui.h \ |
| 1470 | $(SRC)/window.h | 1471 | $(SRC)/window.h |
| 1471 | 1472 | ||
| @@ -1498,6 +1499,7 @@ $(BLD)/textprop.$(O) : \ | |||
| 1498 | 1499 | ||
| 1499 | $(BLD)/tparam.$(O) : \ | 1500 | $(BLD)/tparam.$(O) : \ |
| 1500 | $(SRC)/tparam.c \ | 1501 | $(SRC)/tparam.c \ |
| 1502 | $(SRC)/tparam.h \ | ||
| 1501 | $(CONFIG_H) \ | 1503 | $(CONFIG_H) \ |
| 1502 | $(LISP_H) | 1504 | $(LISP_H) |
| 1503 | 1505 | ||
diff --git a/src/msdos.c b/src/msdos.c index 261a09ac859..b0bf5c4fdd9 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -844,6 +844,7 @@ IT_set_face (int face) | |||
| 844 | 844 | ||
| 845 | extern unsigned char *encode_terminal_code (struct glyph *, int, | 845 | extern unsigned char *encode_terminal_code (struct glyph *, int, |
| 846 | struct coding_system *); | 846 | struct coding_system *); |
| 847 | |||
| 847 | static void | 848 | static void |
| 848 | IT_write_glyphs (struct frame *f, struct glyph *str, int str_len) | 849 | IT_write_glyphs (struct frame *f, struct glyph *str, int str_len) |
| 849 | { | 850 | { |
| @@ -2998,17 +2999,17 @@ XMenuCreate (Display *foo1, Window foo2, char *foo3) | |||
| 2998 | to do. */ | 2999 | to do. */ |
| 2999 | 3000 | ||
| 3000 | int | 3001 | int |
| 3001 | XMenuAddPane (Display *foo, XMenu *menu, char *txt, int enable) | 3002 | XMenuAddPane (Display *foo, XMenu *menu, const char *txt, int enable) |
| 3002 | { | 3003 | { |
| 3003 | int len; | 3004 | int len; |
| 3004 | char *p; | 3005 | const char *p; |
| 3005 | 3006 | ||
| 3006 | if (!enable) | 3007 | if (!enable) |
| 3007 | abort (); | 3008 | abort (); |
| 3008 | 3009 | ||
| 3009 | IT_menu_make_room (menu); | 3010 | IT_menu_make_room (menu); |
| 3010 | menu->submenu[menu->count] = IT_menu_create (); | 3011 | menu->submenu[menu->count] = IT_menu_create (); |
| 3011 | menu->text[menu->count] = txt; | 3012 | menu->text[menu->count] = (char *)txt; |
| 3012 | menu->panenumber[menu->count] = ++menu->panecount; | 3013 | menu->panenumber[menu->count] = ++menu->panecount; |
| 3013 | menu->help_text[menu->count] = NULL; | 3014 | menu->help_text[menu->count] = NULL; |
| 3014 | menu->count++; | 3015 | menu->count++; |
diff --git a/src/msdos.h b/src/msdos.h index 4bbe9b134de..5051f2f3837 100644 --- a/src/msdos.h +++ b/src/msdos.h | |||
| @@ -105,7 +105,7 @@ typedef struct x_menu_struct | |||
| 105 | } XMenu; | 105 | } XMenu; |
| 106 | 106 | ||
| 107 | XMenu *XMenuCreate (Display *, Window, char *); | 107 | XMenu *XMenuCreate (Display *, Window, char *); |
| 108 | int XMenuAddPane (Display *, XMenu *, char *, int); | 108 | int XMenuAddPane (Display *, XMenu *, const char *, int); |
| 109 | int XMenuAddSelection (Display *, XMenu *, int, int, char *, int, char *); | 109 | int XMenuAddSelection (Display *, XMenu *, int, int, char *, int, char *); |
| 110 | void XMenuLocate (Display *, XMenu *, int, int, int, int, | 110 | void XMenuLocate (Display *, XMenu *, int, int, int, int, |
| 111 | int *, int *, int *, int *); | 111 | int *, int *, int *, int *); |
diff --git a/src/systime.h b/src/systime.h index eae302904fa..cb1ea230f7d 100644 --- a/src/systime.h +++ b/src/systime.h | |||
| @@ -144,10 +144,8 @@ extern void set_waiting_for_input (EMACS_TIME *); | |||
| 144 | happen when this files is used outside the src directory). | 144 | happen when this files is used outside the src directory). |
| 145 | Use GCPRO1 to determine if lisp.h was included. */ | 145 | Use GCPRO1 to determine if lisp.h was included. */ |
| 146 | #ifdef GCPRO1 | 146 | #ifdef GCPRO1 |
| 147 | /* defined in dired.c */ | ||
| 148 | extern Lisp_Object make_time (time_t); | ||
| 149 | |||
| 150 | /* defined in editfns.c*/ | 147 | /* defined in editfns.c*/ |
| 148 | extern Lisp_Object make_time (time_t); | ||
| 151 | extern int lisp_time_argument (Lisp_Object, time_t *, int *); | 149 | extern int lisp_time_argument (Lisp_Object, time_t *, int *); |
| 152 | #endif | 150 | #endif |
| 153 | 151 | ||
| @@ -172,4 +170,3 @@ extern int lisp_time_argument (Lisp_Object, time_t *, int *); | |||
| 172 | #define EMACS_TIME_LE(T1, T2) (EMACS_TIME_CMP (T1, T2) <= 0) | 170 | #define EMACS_TIME_LE(T1, T2) (EMACS_TIME_CMP (T1, T2) <= 0) |
| 173 | 171 | ||
| 174 | #endif /* EMACS_SYSTIME_H */ | 172 | #endif /* EMACS_SYSTIME_H */ |
| 175 | |||
diff --git a/src/term.c b/src/term.c index e78e2e68814..e84bbe125f8 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -501,7 +501,7 @@ static int encode_terminal_dst_size; | |||
| 501 | Set CODING->produced to the byte-length of the resulting byte | 501 | Set CODING->produced to the byte-length of the resulting byte |
| 502 | sequence, and return a pointer to that byte sequence. */ | 502 | sequence, and return a pointer to that byte sequence. */ |
| 503 | 503 | ||
| 504 | static unsigned char * | 504 | unsigned char * |
| 505 | encode_terminal_code (struct glyph *src, int src_len, struct coding_system *coding) | 505 | encode_terminal_code (struct glyph *src, int src_len, struct coding_system *coding) |
| 506 | { | 506 | { |
| 507 | struct glyph *src_end = src + src_len; | 507 | struct glyph *src_end = src + src_len; |
diff --git a/src/termcap.c b/src/termcap.c index 69ce56d93b3..27a20a67ae1 100644 --- a/src/termcap.c +++ b/src/termcap.c | |||
| @@ -25,6 +25,10 @@ Boston, MA 02110-1301, USA. */ | |||
| 25 | #include <unistd.h> | 25 | #include <unistd.h> |
| 26 | 26 | ||
| 27 | #include "lisp.h" | 27 | #include "lisp.h" |
| 28 | #include "tparam.h" | ||
| 29 | #ifdef MSDOS | ||
| 30 | #include "msdos.h" | ||
| 31 | #endif | ||
| 28 | 32 | ||
| 29 | #ifndef NULL | 33 | #ifndef NULL |
| 30 | #define NULL (char *) 0 | 34 | #define NULL (char *) 0 |
| @@ -65,7 +69,7 @@ static char *tgetst1 (char *ptr, char **area); | |||
| 65 | 0 if not found. */ | 69 | 0 if not found. */ |
| 66 | 70 | ||
| 67 | static char * | 71 | static char * |
| 68 | find_capability (register char *bp, register char *cap) | 72 | find_capability (register char *bp, register const char *cap) |
| 69 | { | 73 | { |
| 70 | for (; *bp; bp++) | 74 | for (; *bp; bp++) |
| 71 | if (bp[0] == ':' | 75 | if (bp[0] == ':' |
| @@ -76,7 +80,7 @@ find_capability (register char *bp, register char *cap) | |||
| 76 | } | 80 | } |
| 77 | 81 | ||
| 78 | int | 82 | int |
| 79 | tgetnum (char *cap) | 83 | tgetnum (const char *cap) |
| 80 | { | 84 | { |
| 81 | register char *ptr = find_capability (term_entry, cap); | 85 | register char *ptr = find_capability (term_entry, cap); |
| 82 | if (!ptr || ptr[-1] != '#') | 86 | if (!ptr || ptr[-1] != '#') |
| @@ -85,7 +89,7 @@ tgetnum (char *cap) | |||
| 85 | } | 89 | } |
| 86 | 90 | ||
| 87 | int | 91 | int |
| 88 | tgetflag (char *cap) | 92 | tgetflag (const char *cap) |
| 89 | { | 93 | { |
| 90 | register char *ptr = find_capability (term_entry, cap); | 94 | register char *ptr = find_capability (term_entry, cap); |
| 91 | return ptr && ptr[-1] == ':'; | 95 | return ptr && ptr[-1] == ':'; |
| @@ -97,7 +101,7 @@ tgetflag (char *cap) | |||
| 97 | If AREA is null, space is allocated with `malloc'. */ | 101 | If AREA is null, space is allocated with `malloc'. */ |
| 98 | 102 | ||
| 99 | char * | 103 | char * |
| 100 | tgetstr (char *cap, char **area) | 104 | tgetstr (const char *cap, char **area) |
| 101 | { | 105 | { |
| 102 | register char *ptr = find_capability (term_entry, cap); | 106 | register char *ptr = find_capability (term_entry, cap); |
| 103 | if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~')) | 107 | if (!ptr || (ptr[-1] != '=' && ptr[-1] != '~')) |
| @@ -263,7 +267,7 @@ tgetst1 (char *ptr, char **area) | |||
| 263 | char PC; | 267 | char PC; |
| 264 | 268 | ||
| 265 | void | 269 | void |
| 266 | tputs (register char *str, int nlines, register int (*outfun) (/* ??? */)) | 270 | tputs (register const char *str, int nlines, int (*outfun) (int)) |
| 267 | { | 271 | { |
| 268 | register int padcount = 0; | 272 | register int padcount = 0; |
| 269 | register int speed; | 273 | register int speed; |
| @@ -355,7 +359,7 @@ valid_filename_p (fn) | |||
| 355 | in it, and some other value otherwise. */ | 359 | in it, and some other value otherwise. */ |
| 356 | 360 | ||
| 357 | int | 361 | int |
| 358 | tgetent (char *bp, char *name) | 362 | tgetent (char *bp, const char *name) |
| 359 | { | 363 | { |
| 360 | register char *termcap_name; | 364 | register char *termcap_name; |
| 361 | register int fd; | 365 | register int fd; |
| @@ -442,7 +446,7 @@ tgetent (char *bp, char *name) | |||
| 442 | buf.size = BUFSIZE; | 446 | buf.size = BUFSIZE; |
| 443 | /* Add 1 to size to ensure room for terminating null. */ | 447 | /* Add 1 to size to ensure room for terminating null. */ |
| 444 | buf.beg = (char *) xmalloc (buf.size + 1); | 448 | buf.beg = (char *) xmalloc (buf.size + 1); |
| 445 | term = indirect ? indirect : name; | 449 | term = indirect ? indirect : (char *)name; |
| 446 | 450 | ||
| 447 | if (!bp) | 451 | if (!bp) |
| 448 | { | 452 | { |
diff --git a/src/termhooks.h b/src/termhooks.h index b147f6ed0a1..0ccd2dac9e1 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -654,6 +654,9 @@ extern void delete_terminal (struct terminal *); | |||
| 654 | /* The initial terminal device, created by initial_term_init. */ | 654 | /* The initial terminal device, created by initial_term_init. */ |
| 655 | extern struct terminal *initial_terminal; | 655 | extern struct terminal *initial_terminal; |
| 656 | 656 | ||
| 657 | extern unsigned char *encode_terminal_code (struct glyph *, int, | ||
| 658 | struct coding_system *); | ||
| 659 | |||
| 657 | #ifdef HAVE_GPM | 660 | #ifdef HAVE_GPM |
| 658 | extern void close_gpm (int gpm_fd); | 661 | extern void close_gpm (int gpm_fd); |
| 659 | #endif | 662 | #endif |
diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 7a55498085d..2e46c063e95 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c | |||
| @@ -828,6 +828,7 @@ copy_data_segment (struct load_command *lc) | |||
| 828 | } | 828 | } |
| 829 | else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0 | 829 | else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0 |
| 830 | || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0 | 830 | || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0 |
| 831 | || strncmp (sectp->sectname, "__got", 16) == 0 | ||
| 831 | || strncmp (sectp->sectname, "__la_sym_ptr2", 16) == 0 | 832 | || strncmp (sectp->sectname, "__la_sym_ptr2", 16) == 0 |
| 832 | || strncmp (sectp->sectname, "__dyld", 16) == 0 | 833 | || strncmp (sectp->sectname, "__dyld", 16) == 0 |
| 833 | || strncmp (sectp->sectname, "__const", 16) == 0 | 834 | || strncmp (sectp->sectname, "__const", 16) == 0 |