OSDN Git Service

Reserve space in mbstate to allow for proper wchar support
authorCalin Juravle <calin@google.com>
Tue, 29 Apr 2014 14:48:34 +0000 (15:48 +0100)
committerCalin Juravle <calin@google.com>
Tue, 29 Apr 2014 19:28:29 +0000 (20:28 +0100)
Bug: 14382788
Change-Id: If023ac9bb65f95135cae7ebe89147e3985a69a96

libc/include/limits.h
libc/include/wchar.h

index a70021a..dc45902 100644 (file)
 
 #define SSIZE_MAX LONG_MAX
 
-#define MB_LEN_MAX 1 /* No multibyte characters. */
+#define MB_LEN_MAX 6
 
 /* New code should use sysconf(_SC_PAGE_SIZE) instead. */
 #ifndef PAGE_SIZE
index 0029a65..6251868 100644 (file)
 
 __BEGIN_DECLS
 
-typedef __WINT_TYPE__           wint_t;
-typedef struct { int  dummy; }  mbstate_t;
+typedef __WINT_TYPE__  wint_t;
+typedef struct {
+#ifdef __LP32__
+  int dummy;
+#else
+  // 8 bytes should be enough to support at least UTF-8
+  char __reserved[8];
+#endif
+} mbstate_t;
 
 typedef enum {
     WC_TYPE_INVALID = 0,