OSDN Git Service

Fix a wchar.wcstombs_wcrtombs test failure.
authorElliott Hughes <enh@google.com>
Fri, 18 Apr 2014 20:32:33 +0000 (13:32 -0700)
committerElliott Hughes <enh@google.com>
Fri, 18 Apr 2014 20:32:33 +0000 (13:32 -0700)
Looks like I screwed up a last-minute refactor and didn't re-run the tests.

Change-Id: I90a710ae66a313a9812859650aa0b4e8c6bc57f9

libc/bionic/wchar.cpp
tests/wchar_test.cpp

index a507808..021d14b 100644 (file)
@@ -250,6 +250,9 @@ size_t wcsrtombs(char* dst, const wchar_t** src, size_t n, mbstate_t* /*ps*/) {
     // 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) {
index 0a63b00..d5d27ed 100644 (file)
@@ -58,8 +58,8 @@ TEST(wchar, wctomb_wcrtomb) {
 }
 
 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];