aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c28
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
196DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, 196DEFUN ("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.
198A multibyte character is handled correctly. */) 198A multibyte character is handled correctly.
199The value returned is a Unicode codepoint if it is below #x110000 (in
200hex). Codepoints beyond that are Emacs extensions of Unicode. In
201particular, eight-bit characters are returned as codepoints in the
202range #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
3154DEFUN ("delete-region", Fdelete_region, Sdelete_region, 2, 2, "r", 3162DEFUN ("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 3164If called interactively, delete the region between point and mark.
3157When called from a program, expects two arguments, 3165This command deletes buffer text without modifying the kill ring. */)
3158positions (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
3557printed representation. The padding, if any, normally goes on the 3564printed representation. The padding, if any, normally goes on the
3558left, but it goes on the right if the - flag is present. The padding 3565left, but it goes on the right if the - flag is present. The padding
3559character is normally a space, but it is 0 if the 0 flag is present. 3566character is normally a space, but it is 0 if the 0 flag is present.
3560The - flag takes precedence over the 0 flag. 3567The 0 flag is ignored if the - flag is present, or the format sequence
3568is something other than %d, %e, %f, and %g.
3561 3569
3562For %e, %f, and %g sequences, the number after the "." in the 3570For %e, %f, and %g sequences, the number after the "." in the
3563precision specifier says how many decimal places to show; if zero, the 3571precision specifier says how many decimal places to show; if zero, the