diff options
Diffstat (limited to 'src/editfns.c')
| -rw-r--r-- | src/editfns.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/editfns.c b/src/editfns.c index 5328b714b0f..b20c38faacd 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -194,8 +194,12 @@ DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0, | |||
| 194 | } | 194 | } |
| 195 | 195 | ||
| 196 | DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, | 196 | DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, |
| 197 | doc: /* Convert arg STRING to a character, the first character of that string. | 197 | doc: /* Return the first character in STRING. |
| 198 | A multibyte character is handled correctly. */) | 198 | A multibyte character is handled correctly. |
| 199 | The value returned is a Unicode codepoint if it is below #x110000 (in | ||
| 200 | hex). Codepoints beyond that are Emacs extensions of Unicode. In | ||
| 201 | particular, eight-bit characters are returned as codepoints in the | ||
| 202 | range #x3FFF80 through #x3FFFFF, inclusive. */) | ||
| 199 | (register Lisp_Object string) | 203 | (register Lisp_Object string) |
| 200 | { | 204 | { |
| 201 | register Lisp_Object val; | 205 | register Lisp_Object val; |
| @@ -1700,7 +1704,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) | |||
| 1700 | (Lisp_Object format_string, Lisp_Object timeval, Lisp_Object universal) | 1704 | (Lisp_Object format_string, Lisp_Object timeval, Lisp_Object universal) |
| 1701 | { | 1705 | { |
| 1702 | time_t value; | 1706 | time_t value; |
| 1703 | int size; | 1707 | ptrdiff_t size; |
| 1704 | int usec; | 1708 | int usec; |
| 1705 | int ns; | 1709 | int ns; |
| 1706 | struct tm *tm; | 1710 | struct tm *tm; |
| @@ -1717,7 +1721,9 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) | |||
| 1717 | Vlocale_coding_system, 1); | 1721 | Vlocale_coding_system, 1); |
| 1718 | 1722 | ||
| 1719 | /* This is probably enough. */ | 1723 | /* This is probably enough. */ |
| 1720 | size = SBYTES (format_string) * 6 + 50; | 1724 | size = SBYTES (format_string); |
| 1725 | if (size <= (STRING_BYTES_BOUND - 50) / 6) | ||
| 1726 | size = size * 6 + 50; | ||
| 1721 | 1727 | ||
| 1722 | BLOCK_INPUT; | 1728 | BLOCK_INPUT; |
| 1723 | tm = ut ? gmtime (&value) : localtime (&value); | 1729 | tm = ut ? gmtime (&value) : localtime (&value); |
| @@ -1730,7 +1736,7 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) | |||
| 1730 | while (1) | 1736 | while (1) |
| 1731 | { | 1737 | { |
| 1732 | char *buf = (char *) alloca (size + 1); | 1738 | char *buf = (char *) alloca (size + 1); |
| 1733 | int result; | 1739 | size_t result; |
| 1734 | 1740 | ||
| 1735 | buf[0] = '\1'; | 1741 | buf[0] = '\1'; |
| 1736 | BLOCK_INPUT; | 1742 | BLOCK_INPUT; |
| @@ -1749,6 +1755,8 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z". */) | |||
| 1749 | SBYTES (format_string), | 1755 | SBYTES (format_string), |
| 1750 | tm, ut, ns); | 1756 | tm, ut, ns); |
| 1751 | UNBLOCK_INPUT; | 1757 | UNBLOCK_INPUT; |
| 1758 | if (STRING_BYTES_BOUND <= result) | ||
| 1759 | string_overflow (); | ||
| 1752 | size = result + 1; | 1760 | size = result + 1; |
| 1753 | } | 1761 | } |
| 1754 | } | 1762 | } |
| @@ -3152,10 +3160,9 @@ It returns the number of characters changed. */) | |||
| 3152 | } | 3160 | } |
| 3153 | 3161 | ||
| 3154 | DEFUN ("delete-region", Fdelete_region, Sdelete_region, 2, 2, "r", | 3162 | DEFUN ("delete-region", Fdelete_region, Sdelete_region, 2, 2, "r", |
| 3155 | doc: /* Delete the text between point and mark. | 3163 | doc: /* Delete the text between START and END. |
| 3156 | 3164 | If called interactively, delete the region between point and mark. | |
| 3157 | When called from a program, expects two arguments, | 3165 | This command deletes buffer text without modifying the kill ring. */) |
| 3158 | positions (integers or markers) specifying the stretch to be deleted. */) | ||
| 3159 | (Lisp_Object start, Lisp_Object end) | 3166 | (Lisp_Object start, Lisp_Object end) |
| 3160 | { | 3167 | { |
| 3161 | validate_region (&start, &end); | 3168 | validate_region (&start, &end); |
| @@ -3557,7 +3564,8 @@ The width specifier supplies a lower limit for the length of the | |||
| 3557 | printed representation. The padding, if any, normally goes on the | 3564 | printed representation. The padding, if any, normally goes on the |
| 3558 | left, but it goes on the right if the - flag is present. The padding | 3565 | left, but it goes on the right if the - flag is present. The padding |
| 3559 | character is normally a space, but it is 0 if the 0 flag is present. | 3566 | character is normally a space, but it is 0 if the 0 flag is present. |
| 3560 | The - flag takes precedence over the 0 flag. | 3567 | The 0 flag is ignored if the - flag is present, or the format sequence |
| 3568 | is something other than %d, %e, %f, and %g. | ||
| 3561 | 3569 | ||
| 3562 | For %e, %f, and %g sequences, the number after the "." in the | 3570 | For %e, %f, and %g sequences, the number after the "." in the |
| 3563 | precision specifier says how many decimal places to show; if zero, the | 3571 | precision specifier says how many decimal places to show; if zero, the |