aboutsummaryrefslogtreecommitdiff
path: root/cutl/details/boost/regex/src/w32_regex_traits.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-10-19 08:57:20 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-10-19 08:57:20 +0200
commited6115361006240e3c7b02295599e4534cc55a13 (patch)
tree612f12d6c7c49421102041fceb7609db8ab8257e /cutl/details/boost/regex/src/w32_regex_traits.cxx
parentaf8d1a0139ca105c6830f4ac7c320aca2e1c1f5e (diff)
Update internal Boost subset to 1.54.0
Diffstat (limited to 'cutl/details/boost/regex/src/w32_regex_traits.cxx')
-rw-r--r--cutl/details/boost/regex/src/w32_regex_traits.cxx12
1 files changed, 7 insertions, 5 deletions
diff --git a/cutl/details/boost/regex/src/w32_regex_traits.cxx b/cutl/details/boost/regex/src/w32_regex_traits.cxx
index d17db73..c9d29e8 100644
--- a/cutl/details/boost/regex/src/w32_regex_traits.cxx
+++ b/cutl/details/boost/regex/src/w32_regex_traits.cxx
@@ -283,9 +283,11 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, l
if (r == 0)
return def;
- LPSTR buf = (LPSTR)_alloca( (r + 1) * 2 );
- if (::WideCharToMultiByte(CP_ACP, 0, wbuf, r, buf, (r + 1) * 2, NULL, NULL) == 0)
- return def;
+
+ int buf_size = 1 + ::WideCharToMultiByte(CP_ACP, 0, wbuf, r, NULL, 0, NULL, NULL);
+ LPSTR buf = (LPSTR)_alloca(buf_size);
+ if (::WideCharToMultiByte(CP_ACP, 0, wbuf, r, buf, buf_size, NULL, NULL) == 0)
+ return def; // failed conversion.
#endif
return std::string(buf);
}
@@ -485,7 +487,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type idx)
return c;
if (::WideCharToMultiByte(code_page, 0, &wide_result, 1, result, 2, NULL, NULL) == 0)
- return c;
+ return c; // No single byte lower case equivalent available
#endif
return result[0];
}
@@ -556,7 +558,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type idx)
return c;
if (::WideCharToMultiByte(code_page, 0, &wide_result, 1, result, 2, NULL, NULL) == 0)
- return c;
+ return c; // No single byte upper case equivalent available.
#endif
return result[0];
}