Merge from savannah/emacs-30

8b1841021c Avert crash in store_mode_line_string on Android 5.0 and ...
e7c85f9235 Use HarfBuzz in Cygwin-w32 build
8e3e206bd3 ; * src/buffer.c (syms_of_buffer) <mode-line-format>: ASC...
This commit is contained in:
Po Lu 2024-06-26 12:13:52 +08:00
commit f8399633b4
3 changed files with 19 additions and 3 deletions

View file

@ -5183,7 +5183,7 @@ A string is printed verbatim in the mode line except for %-constructs:
%P -- print percent of buffer above bottom of window, perhaps plus Top,
or print Bottom or All.
%q -- print percent of buffer above both the top and the bottom of the
window, separated by -, or All.
window, separated by `-', or `All'.
%s -- print process status.
%z -- print mnemonics of keyboard, terminal, and buffer coding systems.
%Z -- like %z, but including the end-of-line format.

View file

@ -1527,12 +1527,17 @@ syms_of_w32uniscribe_for_pdumper (void)
uniscribe_new_apis = false;
#ifdef HAVE_HARFBUZZ
/* Currently, HarfBuzz DLLs are always named libharfbuzz-0.dll, as
/* Currently, HarfBuzz DLLs are always named libharfbuzz-0.dll on
MS-Windows and cygharfbuzz-0.dll on Cygwin, as
the project keeps the ABI backward-compatible. So we can
hard-code the name of the library here, for now. If they ever
break ABI compatibility, we may need to load the DLL that
corresponds to the HarfBuzz version for which Emacs was built. */
# ifdef WINDOWSNT
HMODULE harfbuzz = LoadLibrary ("libharfbuzz-0.dll");
# else /* CYGWIN */
HMODULE harfbuzz = LoadLibrary ("cygharfbuzz-0.dll");
# endif /* CYGWIN */
/* Don't register if HarfBuzz is not available. */
if (!harfbuzz)
return;

View file

@ -28065,7 +28065,18 @@ store_mode_line_string (const char *string, Lisp_Object lisp_string,
if (string != NULL)
{
len = strnlen (string, precision <= 0 ? SIZE_MAX : precision);
#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY \
&& __ANDROID_API__ < 22
/* Circumvent a bug in memchr preventing strnlen from returning
valid values when a large limit is specified.
https://issuetracker.google.com/issues/37020957 */
if (precision <= 0 || ((uintptr_t) string
> (UINTPTR_MAX - precision)))
len = strlen (string);
else
#endif /* HAVE_ANDROID && !ANDROID_STUBIFY && __ANDROID_API__ < 22 */
len = strnlen (string, precision <= 0 ? SIZE_MAX : precision);
lisp_string = make_string (string, len);
if (NILP (props))
props = mode_line_string_face_prop;