summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/libs/detail/utf8_codecvt_facet.cpp')
-rw-r--r--3rdParty/Boost/src/libs/detail/utf8_codecvt_facet.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/3rdParty/Boost/src/libs/detail/utf8_codecvt_facet.cpp b/3rdParty/Boost/src/libs/detail/utf8_codecvt_facet.cpp
index 658ab6a..7ea5eeb 100644
--- a/3rdParty/Boost/src/libs/detail/utf8_codecvt_facet.cpp
+++ b/3rdParty/Boost/src/libs/detail/utf8_codecvt_facet.cpp
@@ -159,7 +159,7 @@ std::codecvt_base::result utf8_codecvt_facet::do_out(
to_next = to - (i+1);
return std::codecvt_base::partial;
}
- *from++;
+ ++from;
}
from_next = from;
to_next = to;
@@ -231,9 +231,6 @@ int get_cont_octet_out_count_impl(wchar_t word){
return 2;
}
-// note the following code will generate on some platforms where
-// wchar_t is defined as UCS2. The warnings are superfluous as
-// the specialization is never instantitiated with such compilers.
template<>
int get_cont_octet_out_count_impl<4>(wchar_t word){
if (word < 0x80) {
@@ -242,7 +239,22 @@ int get_cont_octet_out_count_impl<4>(wchar_t word){
if (word < 0x800) {
return 1;
}
- if (word < 0x10000) {
+
+ // Note that the following code will generate warnings on some platforms
+ // where wchar_t is defined as UCS2. The warnings are superfluous as the
+ // specialization is never instantitiated with such compilers, but this
+ // can cause problems if warnings are being treated as errors, so we guard
+ // against that. Including <boost/detail/utf8_codecvt_facet.hpp> as we do
+ // should be enough to get WCHAR_MAX defined.
+#if !defined(WCHAR_MAX)
+# error WCHAR_MAX not defined!
+#endif
+ // cope with VC++ 7.1 or earlier having invalid WCHAR_MAX
+#if defined(_MSC_VER) && _MSC_VER <= 1310 // 7.1 or earlier
+ return 2;
+#elif WCHAR_MAX > 0x10000
+
+ if (word < 0x10000) {
return 2;
}
if (word < 0x200000) {
@@ -252,6 +264,10 @@ int get_cont_octet_out_count_impl<4>(wchar_t word){
return 4;
}
return 5;
+
+#else
+ return 2;
+#endif
}
} // namespace anonymous