Fix bug 19740; round-tripping a pointer through a stream doesn't work
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@209305 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/locale b/include/locale
index 5d59022..7191290 100644
--- a/include/locale
+++ b/include/locale
@@ -1180,11 +1180,11 @@
break;
}
// Stage 3
- __a[sizeof(__a)-1] = 0;
+ __buf.resize(__a_end - __a);
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- if (sscanf_l(__a, _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
+ if (sscanf_l(__buf.c_str(), _LIBCPP_GET_C_LOCALE, "%p", &__v) != 1)
#else
- if (__sscanf_l(__a, __cloc(), "%p", &__v) != 1)
+ if (__sscanf_l(__buf.c_str(), __cloc(), "%p", &__v) != 1)
#endif
__err = ios_base::failbit;
// EOF checked