mirror of
https://github.com/boostorg/regex.git
synced 2025-07-21 16:22:43 +02:00
@ -283,9 +283,11 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, l
|
|||||||
if (r == 0)
|
if (r == 0)
|
||||||
return def;
|
return def;
|
||||||
|
|
||||||
LPSTR buf = (LPSTR)_alloca( (r + 1) * 2 );
|
|
||||||
if (::WideCharToMultiByte(CP_ACP, 0, wbuf, r, buf, (r + 1) * 2, NULL, NULL) == 0)
|
int buf_size = 1 + ::WideCharToMultiByte(CP_ACP, 0, wbuf, r, NULL, 0, NULL, NULL);
|
||||||
return def;
|
LPSTR buf = (LPSTR)_alloca(buf_size);
|
||||||
|
if (::WideCharToMultiByte(CP_ACP, 0, wbuf, r, buf, buf_size, NULL, NULL) == 0)
|
||||||
|
return def; // failed conversion.
|
||||||
#endif
|
#endif
|
||||||
return std::string(buf);
|
return std::string(buf);
|
||||||
}
|
}
|
||||||
@ -485,7 +487,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type idx)
|
|||||||
return c;
|
return c;
|
||||||
|
|
||||||
if (::WideCharToMultiByte(code_page, 0, &wide_result, 1, result, 2, NULL, NULL) == 0)
|
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
|
#endif
|
||||||
return result[0];
|
return result[0];
|
||||||
}
|
}
|
||||||
@ -556,7 +558,7 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type idx)
|
|||||||
return c;
|
return c;
|
||||||
|
|
||||||
if (::WideCharToMultiByte(code_page, 0, &wide_result, 1, result, 2, NULL, NULL) == 0)
|
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
|
#endif
|
||||||
return result[0];
|
return result[0];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user