Patch stdlib.h to have MB_CUR_MAX=4

We always want to use utf-8 so let's try this.
This commit is contained in:
Fredrik Fornwall 2016-03-22 16:58:15 -04:00
parent 8cd4ab4e6f
commit e802a5e7cc
2 changed files with 14 additions and 19 deletions

View File

@ -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

View File

@ -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 <xlocale.h>
+#undef MB_CUR_MAX
+#define MB_CUR_MAX 4
+
#ifdef __cplusplus
extern "C" {
#endif