diff options
author | Po Lu <luangruo@yahoo.com> | 2023-03-02 18:31:35 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2023-03-02 18:31:35 +0800 |
commit | 960230d88d3c063ad51f91de076dd2b4a7b88ca1 (patch) | |
tree | 5a9c421aa3709a76e9351ba7c40ed0f52a2ab923 /src/coding.c | |
parent | 951bdd021f51959649bf0bff9b16fde00c23f1a7 (diff) | |
download | emacs-960230d88d3c063ad51f91de076dd2b4a7b88ca1.tar.gz |
Summary: Update Android port
* INSTALL: Document where to find Android installation
instructions.
* configure.ac (CHECK_LISP_OBJECT_TYPE): Pacify
-Wsuggest-attribute=noreturn only on Android.
* cross/ndk-build/README: New file.
* doc/emacs/android.texi (Android):
* doc/emacs/emacs.texi (Top):
* doc/emacs/input.texi (Other Input Devices): Untabify menus.
* etc/NEWS: Move INSTALL.android to java/INSTALL.
* java/INSTALL: New file.
* java/README:
* src/coding.c (from_unicode_buffer): Make Android specific code
only build on Android.
Diffstat (limited to 'src/coding.c')
-rw-r--r-- | src/coding.c | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/src/coding.c b/src/coding.c index 3ac4ada2939..fbf10188819 100644 --- a/src/coding.c +++ b/src/coding.c @@ -8513,34 +8513,31 @@ from_unicode (Lisp_Object str) Lisp_Object from_unicode_buffer (const wchar_t *wstr) { - if (sizeof (wchar_t) == 2) - { - /* We get one of the two final null bytes for free. */ - ptrdiff_t len = 1 + sizeof (wchar_t) * wcslen (wstr); - AUTO_STRING_WITH_LEN (str, (char *) wstr, len); - return from_unicode (str); - } - else - { - /* This code is used only on Android, where little endian UTF-16 - strings are extended to 32-bit wchar_t. */ +#if defined WINDOWSNT || defined CYGWIN + /* We get one of the two final null bytes for free. */ + ptrdiff_t len = 1 + sizeof (wchar_t) * wcslen (wstr); + AUTO_STRING_WITH_LEN (str, (char *) wstr, len); + return from_unicode (str); +#else + /* This code is used only on Android, where little endian UTF-16 + strings are extended to 32-bit wchar_t. */ - uint16_t *words; - size_t length, i; + uint16_t *words; + size_t length, i; - length = wcslen (wstr) + 1; + length = wcslen (wstr) + 1; - USE_SAFE_ALLOCA; - SAFE_NALLOCA (words, sizeof *words, length); + USE_SAFE_ALLOCA; + SAFE_NALLOCA (words, sizeof *words, length); - for (i = 0; i < length - 1; ++i) - words[i] = wstr[i]; + for (i = 0; i < length - 1; ++i) + words[i] = wstr[i]; - words[i] = '\0'; - AUTO_STRING_WITH_LEN (str, (char *) words, - (length - 1) * sizeof *words); - return unbind_to (sa_count, from_unicode (str)); - } + words[i] = '\0'; + AUTO_STRING_WITH_LEN (str, (char *) words, + (length - 1) * sizeof *words); + return unbind_to (sa_count, from_unicode (str)); +#endif } wchar_t * |