Make multibyte result constants public.
The magic numbers that C defines are obnoxious. We had partial
definitions for these internally. Add the missing one and move them to
a public header for anyone else that may want to use them.
Bug: None
Test: None
Change-Id: Ia6b8cff4310bcccb23078c52216528db668ac966
diff --git a/libc/bionic/wchar.cpp b/libc/bionic/wchar.cpp
index bb97b3e..b8c4432 100644
--- a/libc/bionic/wchar.cpp
+++ b/libc/bionic/wchar.cpp
@@ -27,10 +27,10 @@
*/
#include <errno.h>
-#include <sys/param.h>
#include <string.h>
-#include <wchar.h>
+#include <sys/param.h>
#include <uchar.h>
+#include <wchar.h>
#include "private/bionic_mbstate.h"
@@ -88,10 +88,10 @@
r = 1;
} else {
r = mbrtowc(nullptr, *src + i, nmc - i, state);
- if (r == __MB_ERR_ILLEGAL_SEQUENCE) {
+ if (r == BIONIC_MULTIBYTE_RESULT_ILLEGAL_SEQUENCE) {
return mbstate_reset_and_return_illegal(EILSEQ, state);
}
- if (r == __MB_ERR_INCOMPLETE_SEQUENCE) {
+ if (r == BIONIC_MULTIBYTE_RESULT_INCOMPLETE_SEQUENCE) {
return mbstate_reset_and_return_illegal(EILSEQ, state);
}
if (r == 0) {
@@ -114,11 +114,11 @@
}
} else {
r = mbrtowc(dst + o, *src + i, nmc - i, state);
- if (r == __MB_ERR_ILLEGAL_SEQUENCE) {
+ if (r == BIONIC_MULTIBYTE_RESULT_ILLEGAL_SEQUENCE) {
*src += i;
return mbstate_reset_and_return_illegal(EILSEQ, state);
}
- if (r == __MB_ERR_INCOMPLETE_SEQUENCE) {
+ if (r == BIONIC_MULTIBYTE_RESULT_INCOMPLETE_SEQUENCE) {
*src += nmc;
return mbstate_reset_and_return_illegal(EILSEQ, state);
}
@@ -166,7 +166,7 @@
r = 1;
} else {
r = wcrtomb(buf, wc, state);
- if (r == __MB_ERR_ILLEGAL_SEQUENCE) {
+ if (r == BIONIC_MULTIBYTE_RESULT_ILLEGAL_SEQUENCE) {
return r;
}
}
@@ -187,14 +187,14 @@
} else if (len - o >= sizeof(buf)) {
// Enough space to translate in-place.
r = wcrtomb(dst + o, wc, state);
- if (r == __MB_ERR_ILLEGAL_SEQUENCE) {
+ if (r == BIONIC_MULTIBYTE_RESULT_ILLEGAL_SEQUENCE) {
*src += i;
return r;
}
} else {
// May not be enough space; use temp buffer.
r = wcrtomb(buf, wc, state);
- if (r == __MB_ERR_ILLEGAL_SEQUENCE) {
+ if (r == BIONIC_MULTIBYTE_RESULT_ILLEGAL_SEQUENCE) {
*src += i;
return r;
}