summaryrefslogtreecommitdiff
path: root/ndk
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2014-06-10 10:50:38 +0800
committerAndrew Hsieh <andrewhsieh@google.com>2014-06-10 10:51:46 +0800
commit9983b467e539d40388880739fcf8a8becd459b26 (patch)
tree28cc3133fb9a6a368fe885cf6472cd4b21603f69 /ndk
parent0e85aa033e1d97ecd3578cf30f7c90028e1dcb91 (diff)
Fix ssize_t, WCHAR_MIN and WCHAR_MAX
1) ssize_t is int, instead of long int 2) WCHAR_MIN and WCHAR_MAX be consistent with bionic's: respond to __WCHAR_UNSIGNED__, work for both signed (X86/MIPS) and unsigned (ARM) wchar_t, and work for -fshort-wchar too Change-Id: Ief1be007571b50c5d63a819df489f9d3f9b47bc8
Diffstat (limited to 'ndk')
-rw-r--r--ndk/platforms/android-3/include/stdint.h2
-rw-r--r--ndk/platforms/android-3/include/sys/_wchar_limits.h21
-rw-r--r--ndk/platforms/android-3/include/sys/types.h2
3 files changed, 9 insertions, 16 deletions
diff --git a/ndk/platforms/android-3/include/stdint.h b/ndk/platforms/android-3/include/stdint.h
index 7ae2595b8..244dd4d5c 100644
--- a/ndk/platforms/android-3/include/stdint.h
+++ b/ndk/platforms/android-3/include/stdint.h
@@ -251,7 +251,7 @@ typedef int64_t intmax_t;
/* size_t is defined by the GCC-specific <stddef.h> */
#ifndef _SSIZE_T_DEFINED_
#define _SSIZE_T_DEFINED_
-typedef long int ssize_t;
+typedef int ssize_t;
#endif
#define _BITSIZE 32
diff --git a/ndk/platforms/android-3/include/sys/_wchar_limits.h b/ndk/platforms/android-3/include/sys/_wchar_limits.h
index 644792f77..12bc6b130 100644
--- a/ndk/platforms/android-3/include/sys/_wchar_limits.h
+++ b/ndk/platforms/android-3/include/sys/_wchar_limits.h
@@ -86,21 +86,14 @@
# else
/* Otherwise, the value is derived from the toolchain configuration.
* to avoid putting explicit CPU checks in this header. */
-# ifndef __WCHAR_MAX__
-# error "__WCHAR_MAX__ is not defined. Check your toolchain!"
+# define WCHAR_MAX __WCHAR_MAX__
+
+ /* Clang does not define __WCHAR_MIN__ */
+# if defined(__WCHAR_UNSIGNED__)
+# define WCHAR_MIN L'\0'
+# else
+# define WCHAR_MIN (-(WCHAR_MAX) - 1)
# endif
- /* Clang does define __WCHAR_MAX__, but not __WCHAR_MIN__ */
-# ifndef __WCHAR_MIN__
-# if __WCHAR_MAX__ == 4294967295
-# define __WCHAR_MIN__ (0U)
-# elif __WCHAR_MAX__ == 2147483647
-# define __WCHAR_MIN__ (-2147483647 - 1)
-# else
-# error "Invalid __WCHAR_MAX__ value. Check your toolchain!"
-# endif
-# endif /* !__WCHAR_MIN__ */
-# define WCHAR_MIN __WCHAR_MIN__
-# define WCHAR_MAX __WCHAR_MAX__
# endif /* !_WCHAR_IS_ALWAYS_SIGNED */
#endif /* !WCHAR_MIN */
diff --git a/ndk/platforms/android-3/include/sys/types.h b/ndk/platforms/android-3/include/sys/types.h
index 15ecb373a..f7f986c04 100644
--- a/ndk/platforms/android-3/include/sys/types.h
+++ b/ndk/platforms/android-3/include/sys/types.h
@@ -87,7 +87,7 @@ typedef .... pthread_t;
#ifndef _SSIZE_T_DEFINED_
#define _SSIZE_T_DEFINED_
-typedef long int ssize_t;
+typedef int ssize_t;
#endif
typedef __kernel_suseconds_t suseconds_t;