Merge "Switch to upstream OpenBSD fread/fvwrite."
diff --git a/libc/bionic/wchar.cpp b/libc/bionic/wchar.cpp
index a507808..021d14b 100644
--- a/libc/bionic/wchar.cpp
+++ b/libc/bionic/wchar.cpp
@@ -250,6 +250,9 @@
// TODO: UTF-8 support.
if ((*src)[i] > 0x7f) {
errno = EILSEQ;
+ if (dst != NULL) {
+ *src = &(*src)[i];
+ }
return static_cast<size_t>(-1);
}
if (dst != NULL) {
diff --git a/libc/include/locale.h b/libc/include/locale.h
index 6989851..7fd8c2c 100644
--- a/libc/include/locale.h
+++ b/libc/include/locale.h
@@ -33,21 +33,19 @@
__BEGIN_DECLS
-enum {
- LC_CTYPE = 0,
- LC_NUMERIC = 1,
- LC_TIME = 2,
- LC_COLLATE = 3,
- LC_MONETARY = 4,
- LC_MESSAGES = 5,
- LC_ALL = 6,
- LC_PAPER = 7,
- LC_NAME = 8,
- LC_ADDRESS = 9,
- LC_TELEPHONE = 10,
- LC_MEASUREMENT = 11,
- LC_IDENTIFICATION = 12
-};
+#define LC_CTYPE 0
+#define LC_NUMERIC 1
+#define LC_TIME 2
+#define LC_COLLATE 3
+#define LC_MONETARY 4
+#define LC_MESSAGES 5
+#define LC_ALL 6
+#define LC_PAPER 7
+#define LC_NAME 8
+#define LC_ADDRESS 9
+#define LC_TELEPHONE 10
+#define LC_MEASUREMENT 11
+#define LC_IDENTIFICATION 12
#define LC_CTYPE_MASK (1 << LC_CTYPE)
#define LC_NUMERIC_MASK (1 << LC_NUMERIC)
diff --git a/tests/wchar_test.cpp b/tests/wchar_test.cpp
index 0a63b00..d5d27ed 100644
--- a/tests/wchar_test.cpp
+++ b/tests/wchar_test.cpp
@@ -58,8 +58,8 @@
}
TEST(wchar, wcstombs_wcrtombs) {
- wchar_t chars[] = { L'h', L'e', L'l', L'l', L'o', 0 };
- wchar_t bad_chars[] = { L'h', L'i', 666, 0 };
+ const wchar_t chars[] = { L'h', L'e', L'l', L'l', L'o', 0 };
+ const wchar_t bad_chars[] = { L'h', L'i', 666, 0 };
const wchar_t* src;
char bytes[BUFSIZ];