From e802a5e7cc7922d066965ddab73c63e739e62c02 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Tue, 22 Mar 2016 16:58:15 -0400 Subject: [PATCH] Patch stdlib.h to have MB_CUR_MAX=4 We always want to use utf-8 so let's try this. --- ndk_patches/stdlib.h.patch | 14 ++++++++++++++ packages/libandroid-support/stdlib.h.patch | 19 ------------------- 2 files changed, 14 insertions(+), 19 deletions(-) create mode 100644 ndk_patches/stdlib.h.patch delete mode 100644 packages/libandroid-support/stdlib.h.patch diff --git a/ndk_patches/stdlib.h.patch b/ndk_patches/stdlib.h.patch new file mode 100644 index 000000000..c48d874ab --- /dev/null +++ b/ndk_patches/stdlib.h.patch @@ -0,0 +1,14 @@ +diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/stdlib.h ./usr/include/stdlib.h +--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/stdlib.h 2016-03-03 16:54:24.000000000 -0500 ++++ ./usr/include/stdlib.h 2016-03-22 16:38:58.589340159 -0400 +@@ -161,8 +161,8 @@ + extern int wctomb(char *, wchar_t); + extern size_t wcstombs(char *, const wchar_t *, size_t); + +-extern size_t __ctype_get_mb_cur_max(void); +-#define MB_CUR_MAX __ctype_get_mb_cur_max() ++/* Termux modification: Always utf-8. */ ++#define MB_CUR_MAX 4 + + __END_DECLS + diff --git a/packages/libandroid-support/stdlib.h.patch b/packages/libandroid-support/stdlib.h.patch deleted file mode 100644 index b66371b39..000000000 --- a/packages/libandroid-support/stdlib.h.patch +++ /dev/null @@ -1,19 +0,0 @@ -From MB_CUR_MAX(3): "The MB_CUR_MAX macro defines an integer expression giving the maximum number of -bytes needed to represent a single wide character in the current locale. It is locale dependent and -therefore not a compile-time constant." - -Since libandroid-support.so supports multibyte characters we override the platform value of 1. - -diff -N -u -r /home/fornwall/lib/android-ndk/sources/android/support/include/stdlib.h ./include/stdlib.h ---- /home/fornwall/lib/android-ndk/sources/android/support/include/stdlib.h 2014-10-15 21:46:32.000000000 -0400 -+++ ./include/stdlib.h 2014-11-27 10:48:54.634215480 -0500 -@@ -36,6 +36,9 @@ - - #include - -+#undef MB_CUR_MAX -+#define MB_CUR_MAX 4 -+ - #ifdef __cplusplus - extern "C" { - #endif