diff options
| author | Po Lu | 2023-03-02 18:31:35 +0800 |
|---|---|---|
| committer | Po Lu | 2023-03-02 18:31:35 +0800 |
| commit | 960230d88d3c063ad51f91de076dd2b4a7b88ca1 (patch) | |
| tree | 5a9c421aa3709a76e9351ba7c40ed0f52a2ab923 /src/coding.c | |
| parent | 951bdd021f51959649bf0bff9b16fde00c23f1a7 (diff) | |
| download | emacs-960230d88d3c063ad51f91de076dd2b4a7b88ca1.tar.gz emacs-960230d88d3c063ad51f91de076dd2b4a7b88ca1.zip | |
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) | |||
| 8513 | Lisp_Object | 8513 | Lisp_Object |
| 8514 | from_unicode_buffer (const wchar_t *wstr) | 8514 | from_unicode_buffer (const wchar_t *wstr) |
| 8515 | { | 8515 | { |
| 8516 | if (sizeof (wchar_t) == 2) | 8516 | #if defined WINDOWSNT || defined CYGWIN |
| 8517 | { | 8517 | /* We get one of the two final null bytes for free. */ |
| 8518 | /* We get one of the two final null bytes for free. */ | 8518 | ptrdiff_t len = 1 + sizeof (wchar_t) * wcslen (wstr); |
| 8519 | ptrdiff_t len = 1 + sizeof (wchar_t) * wcslen (wstr); | 8519 | AUTO_STRING_WITH_LEN (str, (char *) wstr, len); |
| 8520 | AUTO_STRING_WITH_LEN (str, (char *) wstr, len); | 8520 | return from_unicode (str); |
| 8521 | return from_unicode (str); | 8521 | #else |
| 8522 | } | 8522 | /* This code is used only on Android, where little endian UTF-16 |
| 8523 | else | 8523 | strings are extended to 32-bit wchar_t. */ |
| 8524 | { | ||
| 8525 | /* This code is used only on Android, where little endian UTF-16 | ||
| 8526 | strings are extended to 32-bit wchar_t. */ | ||
| 8527 | 8524 | ||
| 8528 | uint16_t *words; | 8525 | uint16_t *words; |
| 8529 | size_t length, i; | 8526 | size_t length, i; |
| 8530 | 8527 | ||
| 8531 | length = wcslen (wstr) + 1; | 8528 | length = wcslen (wstr) + 1; |
| 8532 | 8529 | ||
| 8533 | USE_SAFE_ALLOCA; | 8530 | USE_SAFE_ALLOCA; |
| 8534 | SAFE_NALLOCA (words, sizeof *words, length); | 8531 | SAFE_NALLOCA (words, sizeof *words, length); |
| 8535 | 8532 | ||
| 8536 | for (i = 0; i < length - 1; ++i) | 8533 | for (i = 0; i < length - 1; ++i) |
| 8537 | words[i] = wstr[i]; | 8534 | words[i] = wstr[i]; |
| 8538 | 8535 | ||
| 8539 | words[i] = '\0'; | 8536 | words[i] = '\0'; |
| 8540 | AUTO_STRING_WITH_LEN (str, (char *) words, | 8537 | AUTO_STRING_WITH_LEN (str, (char *) words, |
| 8541 | (length - 1) * sizeof *words); | 8538 | (length - 1) * sizeof *words); |
| 8542 | return unbind_to (sa_count, from_unicode (str)); | 8539 | return unbind_to (sa_count, from_unicode (str)); |
| 8543 | } | 8540 | #endif |
| 8544 | } | 8541 | } |
| 8545 | 8542 | ||
| 8546 | wchar_t * | 8543 | wchar_t * |