mirror of
https://github.com/boostorg/regex.git
synced 2025-07-16 13:52:17 +02:00
Apply patches for building regex on WinCE see: http://lists.boost.org/Archives/boost/2007/11/130839.php
[SVN r41327]
This commit is contained in:
@ -354,7 +354,7 @@ void BuildFileList(std::list<std::string>* pl, const char* files, bool recurse)
|
||||
|
||||
while(dstart != dend)
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
(::sprintf_s)(buf, sizeof(buf), "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
|
||||
#else
|
||||
(std::sprintf)(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr);
|
||||
|
@ -86,7 +86,14 @@ const char* _fi_sep_alt = _fi_sep;
|
||||
|
||||
void mapfile::open(const char* file)
|
||||
{
|
||||
#if defined(__CYGWIN__)||defined(__CYGWIN32__)
|
||||
#if defined(BOOST_NO_ANSI_APIS)
|
||||
int filename_size = strlen(file);
|
||||
LPWSTR wide_file = (LPWSTR)_alloca( (filename_size + 1) * sizeof(WCHAR) );
|
||||
if(::MultiByteToWideChar(CP_ACP, 0, file, filename_size, wide_file, filename_size + 1) == 0)
|
||||
hfile = INVALID_HANDLE_VALUE;
|
||||
else
|
||||
hfile = CreateFileW(wide_file, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
#elif defined(__CYGWIN__)||defined(__CYGWIN32__)
|
||||
char win32file[ MAX_PATH ];
|
||||
cygwin_conv_to_win32_path( file, win32file );
|
||||
hfile = CreateFileA(win32file, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
@ -350,6 +357,48 @@ void mapfile::close()
|
||||
|
||||
#endif
|
||||
|
||||
inline _fi_find_handle find_first_file(const char* wild, _fi_find_data& data)
|
||||
{
|
||||
#ifdef BOOST_NO_ANSI_APIS
|
||||
std::size_t wild_size = std::strlen(wild);
|
||||
LPWSTR wide_wild = (LPWSTR)_alloca( (wild_size + 1) * sizeof(WCHAR) );
|
||||
if (::MultiByteToWideChar(CP_ACP, 0, wild, wild_size, wide_wild, wild_size + 1) == 0)
|
||||
return _fi_invalid_handle;
|
||||
|
||||
return FindFirstFileW(wide_wild, &data);
|
||||
#else
|
||||
return FindFirstFileA(wild, &data);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool find_next_file(_fi_find_handle hf, _fi_find_data& data)
|
||||
{
|
||||
#ifdef BOOST_NO_ANSI_APIS
|
||||
return FindNextFileW(hf, &data);
|
||||
#else
|
||||
return FindNextFileA(hf, &data);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void copy_find_file_result_with_overflow_check(const _fi_find_data& data, char* path, size_t max_size)
|
||||
{
|
||||
#ifdef BOOST_NO_ANSI_APIS
|
||||
if (::WideCharToMultiByte(CP_ACP, 0, data.cFileName, -1, path, max_size, NULL, NULL) == 0)
|
||||
re_detail::overflow_error_if_not_zero(1);
|
||||
#else
|
||||
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(path, max_size, data.cFileName));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool is_not_current_or_parent_path_string(const _fi_find_data& data)
|
||||
{
|
||||
#ifdef BOOST_NO_ANSI_APIS
|
||||
return (std::wcscmp(data.cFileName, L".") && std::wcscmp(data.cFileName, L".."));
|
||||
#else
|
||||
return (std::strcmp(data.cFileName, ".") && std::strcmp(data.cFileName, ".."));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
file_iterator::file_iterator()
|
||||
{
|
||||
@ -413,7 +462,7 @@ file_iterator::file_iterator(const char* wild)
|
||||
|
||||
ref = new file_iterator_ref();
|
||||
BOOST_REGEX_NOEH_ASSERT(ref)
|
||||
ref->hf = FindFirstFileA(wild, &(ref->_data));
|
||||
ref->hf = find_first_file(wild, ref->_data);
|
||||
ref->count = 1;
|
||||
|
||||
if(ref->hf == _fi_invalid_handle)
|
||||
@ -423,7 +472,7 @@ file_iterator::file_iterator(const char* wild)
|
||||
}
|
||||
else
|
||||
{
|
||||
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(ptr, (MAX_PATH - (ptr - _path)), ref->_data.cFileName));
|
||||
copy_find_file_result_with_overflow_check(ref->_data, ptr, (MAX_PATH - (ptr - _path)));
|
||||
if(ref->_data.dwFileAttributes & _fi_dir)
|
||||
next();
|
||||
}
|
||||
@ -510,7 +559,7 @@ void file_iterator::next()
|
||||
bool cont = true;
|
||||
while(cont)
|
||||
{
|
||||
cont = FindNextFileA(ref->hf, &(ref->_data));
|
||||
cont = find_next_file(ref->hf, ref->_data);
|
||||
if(cont && ((ref->_data.dwFileAttributes & _fi_dir) == 0))
|
||||
break;
|
||||
}
|
||||
@ -523,7 +572,7 @@ void file_iterator::next()
|
||||
ptr = _path;
|
||||
}
|
||||
else
|
||||
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(ptr, MAX_PATH - (ptr - _path), ref->_data.cFileName));
|
||||
copy_find_file_result_with_overflow_check(ref->_data, ptr, MAX_PATH - (ptr - _path));
|
||||
}
|
||||
}
|
||||
|
||||
@ -593,7 +642,7 @@ directory_iterator::directory_iterator(const char* wild)
|
||||
ref = new file_iterator_ref();
|
||||
BOOST_REGEX_NOEH_ASSERT(ref)
|
||||
ref->count = 1;
|
||||
ref->hf = FindFirstFileA(wild, &(ref->_data));
|
||||
ref->hf = find_first_file(wild, ref->_data);
|
||||
if(ref->hf == _fi_invalid_handle)
|
||||
{
|
||||
*_path = 0;
|
||||
@ -601,8 +650,8 @@ directory_iterator::directory_iterator(const char* wild)
|
||||
}
|
||||
else
|
||||
{
|
||||
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(ptr, MAX_PATH - (ptr - _path), ref->_data.cFileName));
|
||||
if(((ref->_data.dwFileAttributes & _fi_dir) == 0) || (std::strcmp(ref->_data.cFileName, ".") == 0) || (std::strcmp(ref->_data.cFileName, "..") == 0))
|
||||
copy_find_file_result_with_overflow_check(ref->_data, ptr, MAX_PATH - (ptr - _path));
|
||||
if(((ref->_data.dwFileAttributes & _fi_dir) == 0) || (std::strcmp(ptr, ".") == 0) || (std::strcmp(ptr, "..") == 0))
|
||||
next();
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
@ -686,10 +735,10 @@ void directory_iterator::next()
|
||||
bool cont = true;
|
||||
while(cont)
|
||||
{
|
||||
cont = FindNextFileA(ref->hf, &(ref->_data));
|
||||
cont = find_next_file(ref->hf, ref->_data);
|
||||
if(cont && (ref->_data.dwFileAttributes & _fi_dir))
|
||||
{
|
||||
if(std::strcmp(ref->_data.cFileName, ".") && std::strcmp(ref->_data.cFileName, ".."))
|
||||
if(is_not_current_or_parent_path_string(ref->_data))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -702,7 +751,7 @@ void directory_iterator::next()
|
||||
ptr = _path;
|
||||
}
|
||||
else
|
||||
re_detail::overflow_error_if_not_zero(re_detail::strcpy_s(ptr, MAX_PATH - (ptr - _path), ref->_data.cFileName));
|
||||
copy_find_file_result_with_overflow_check(ref->_data, ptr, MAX_PATH - (ptr - _path));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
|
||||
{
|
||||
if(std::strcmp(e->re_endp, names[i]) == 0)
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
(::sprintf_s)(localbuf, 5, "%d", i);
|
||||
#else
|
||||
(std::sprintf)(localbuf, "%d", i);
|
||||
@ -174,7 +174,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA*
|
||||
return std::strlen(localbuf) + 1;
|
||||
}
|
||||
}
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
(::sprintf_s)(localbuf, 5, "%d", 0);
|
||||
#else
|
||||
(std::sprintf)(localbuf, "%d", 0);
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define NOGDI
|
||||
#include <windows.h>
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_WIN32_WCE)
|
||||
#if defined(_MSC_VER) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
#pragma comment(lib, "user32.lib")
|
||||
#endif
|
||||
|
||||
@ -42,6 +42,18 @@ namespace std{
|
||||
|
||||
namespace boost{ namespace re_detail{
|
||||
|
||||
#ifdef BOOST_NO_ANSI_APIS
|
||||
UINT get_code_page_for_locale_id(lcid_type id)
|
||||
{
|
||||
WCHAR code_page_string[7];
|
||||
if (::GetLocaleInfoW(id, LOCALE_IDEFAULTANSICODEPAGE, code_page_string, 7) == 0)
|
||||
return 0;
|
||||
|
||||
return static_cast<UINT>(_wtol(code_page_string));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void w32_regex_traits_char_layer<char>::init()
|
||||
{
|
||||
// we need to start by initialising our syntax map so we know which
|
||||
@ -106,8 +118,24 @@ void w32_regex_traits_char_layer<char>::init()
|
||||
char char_map[1 << CHAR_BIT];
|
||||
for(int ii = 0; ii < (1 << CHAR_BIT); ++ii)
|
||||
char_map[ii] = static_cast<char>(ii);
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
int r = ::LCMapStringA(this->m_locale, LCMAP_LOWERCASE, char_map, 1 << CHAR_BIT, this->m_lower_map, 1 << CHAR_BIT);
|
||||
BOOST_ASSERT(r != 0);
|
||||
#else
|
||||
UINT code_page = get_code_page_for_locale_id(this->m_locale);
|
||||
BOOST_ASSERT(code_page != 0);
|
||||
|
||||
WCHAR wide_char_map[1 << CHAR_BIT];
|
||||
int conv_r = ::MultiByteToWideChar(code_page, 0, char_map, 1 << CHAR_BIT, wide_char_map, 1 << CHAR_BIT);
|
||||
BOOST_ASSERT(conv_r != 0);
|
||||
|
||||
WCHAR wide_lower_map[1 << CHAR_BIT];
|
||||
int r = ::LCMapStringW(this->m_locale, LCMAP_LOWERCASE, wide_char_map, 1 << CHAR_BIT, wide_lower_map, 1 << CHAR_BIT);
|
||||
BOOST_ASSERT(r != 0);
|
||||
|
||||
conv_r = ::WideCharToMultiByte(code_page, 0, wide_lower_map, r, this->m_lower_map, 1 << CHAR_BIT, NULL, NULL);
|
||||
BOOST_ASSERT(conv_r != 0);
|
||||
#endif
|
||||
if(r < (1 << CHAR_BIT))
|
||||
{
|
||||
// if we have multibyte characters then not all may have been given
|
||||
@ -115,7 +143,12 @@ void w32_regex_traits_char_layer<char>::init()
|
||||
for(int jj = r; jj < (1 << CHAR_BIT); ++jj)
|
||||
this->m_lower_map[jj] = static_cast<char>(jj);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
r = ::GetStringTypeExA(this->m_locale, CT_CTYPE1, char_map, 1 << CHAR_BIT, this->m_type_map);
|
||||
#else
|
||||
r = ::GetStringTypeExW(this->m_locale, CT_CTYPE1, wide_char_map, 1 << CHAR_BIT, this->m_type_map);
|
||||
#endif
|
||||
BOOST_ASSERT(0 != r);
|
||||
}
|
||||
|
||||
@ -126,18 +159,48 @@ BOOST_REGEX_DECL lcid_type BOOST_REGEX_CALL w32_get_default_locale()
|
||||
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(char c, lcid_type id)
|
||||
{
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
WORD mask;
|
||||
if(::GetStringTypeExA(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
|
||||
return true;
|
||||
return false;
|
||||
#else
|
||||
UINT code_page = get_code_page_for_locale_id(id);
|
||||
if (code_page == 0)
|
||||
return false;
|
||||
|
||||
WCHAR wide_c;
|
||||
if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0)
|
||||
return false;
|
||||
|
||||
WORD mask;
|
||||
if(::GetStringTypeExW(id, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_LOWER))
|
||||
return true;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(wchar_t c, lcid_type id)
|
||||
{
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
WORD mask;
|
||||
if(::GetStringTypeExW(id, CT_CTYPE1, &c, 1, &mask) && (mask & C1_LOWER))
|
||||
return true;
|
||||
return false;
|
||||
#else
|
||||
UINT code_page = get_code_page_for_locale_id(id);
|
||||
if (code_page == 0)
|
||||
return false;
|
||||
|
||||
WCHAR wide_c;
|
||||
if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0)
|
||||
return false;
|
||||
|
||||
WORD mask;
|
||||
if(::GetStringTypeExW(id, CT_CTYPE1, &wide_c, 1, &mask) && (mask & C1_UPPER))
|
||||
return true;
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#ifdef BOOST_REGEX_HAS_OTHER_WCHAR_T
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is_lower(unsigned short ca, lcid_type id)
|
||||
@ -183,12 +246,21 @@ void free_module(void* mod)
|
||||
|
||||
BOOST_REGEX_DECL cat_type BOOST_REGEX_CALL w32_cat_open(const std::string& name)
|
||||
{
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
cat_type result(::LoadLibraryA(name.c_str()), &free_module);
|
||||
return result;
|
||||
#else
|
||||
LPWSTR wide_name = (LPWSTR)_alloca( (name.size() + 1) * sizeof(WCHAR) );
|
||||
if (::MultiByteToWideChar(CP_ACP, 0, name.c_str(), name.size(), wide_name, name.size() + 1) == 0)
|
||||
return cat_type();
|
||||
|
||||
cat_type result(::LoadLibraryW(wide_name), &free_module);
|
||||
#endif
|
||||
}
|
||||
|
||||
BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, lcid_type, int i, const std::string& def)
|
||||
{
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
char buf[256];
|
||||
if(0 == ::LoadStringA(
|
||||
static_cast<HMODULE>(cat.get()),
|
||||
@ -199,6 +271,21 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_cat_get(const cat_type& cat, l
|
||||
{
|
||||
return def;
|
||||
}
|
||||
#else
|
||||
WCHAR wbuf[256];
|
||||
int r = ::LoadStringW(
|
||||
static_cast<HMODULE>(cat.get()),
|
||||
i,
|
||||
wbuf,
|
||||
256
|
||||
);
|
||||
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;
|
||||
#endif
|
||||
return std::string(buf);
|
||||
}
|
||||
|
||||
@ -236,6 +323,7 @@ BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_cat_get(
|
||||
#endif
|
||||
BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const char* p1, const char* p2)
|
||||
{
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
int bytes = ::LCMapStringA(
|
||||
id, // locale identifier
|
||||
LCMAP_SORTKEY, // mapping transformation type
|
||||
@ -255,6 +343,36 @@ BOOST_REGEX_DECL std::string BOOST_REGEX_CALL w32_transform(lcid_type id, const
|
||||
&*result.begin(), // destination buffer
|
||||
bytes // size of destination buffer
|
||||
);
|
||||
#else
|
||||
UINT code_page = get_code_page_for_locale_id(id);
|
||||
if(code_page == 0)
|
||||
return std::string(p1, p2);
|
||||
|
||||
int src_len = static_cast<int>(p2 - p1);
|
||||
LPWSTR wide_p1 = (LPWSTR)_alloca( (src_len + 1) * 2 );
|
||||
if(::MultiByteToWideChar(code_page, 0, p1, src_len, wide_p1, src_len + 1) == 0)
|
||||
return std::string(p1, p2);
|
||||
|
||||
int bytes = ::LCMapStringW(
|
||||
id, // locale identifier
|
||||
LCMAP_SORTKEY, // mapping transformation type
|
||||
wide_p1, // source string
|
||||
src_len, // number of characters in source string
|
||||
0, // destination buffer
|
||||
0 // size of destination buffer
|
||||
);
|
||||
if(!bytes)
|
||||
return std::string(p1, p2);
|
||||
std::string result(++bytes, '\0');
|
||||
bytes = ::LCMapStringW(
|
||||
id, // locale identifier
|
||||
LCMAP_SORTKEY, // mapping transformation type
|
||||
wide_p1, // source string
|
||||
src_len, // number of characters in source string
|
||||
(LPWSTR)&*result.begin(), // destination buffer
|
||||
bytes // size of destination buffer
|
||||
);
|
||||
#endif
|
||||
if(bytes > static_cast<int>(result.size()))
|
||||
return std::string(p1, p2);
|
||||
while(result.size() && result[result.size()-1] == '\0')
|
||||
@ -335,6 +453,7 @@ BOOST_REGEX_DECL std::basic_string<unsigned short> BOOST_REGEX_CALL w32_transfor
|
||||
BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type id)
|
||||
{
|
||||
char result[2];
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
int b = ::LCMapStringA(
|
||||
id, // locale identifier
|
||||
LCMAP_LOWERCASE, // mapping transformation type
|
||||
@ -344,6 +463,29 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_tolower(char c, lcid_type id)
|
||||
1); // size of destination buffer
|
||||
if(b == 0)
|
||||
return c;
|
||||
#else
|
||||
UINT code_page = get_code_page_for_locale_id(id);
|
||||
if (code_page == 0)
|
||||
return c;
|
||||
|
||||
WCHAR wide_c;
|
||||
if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0)
|
||||
return c;
|
||||
|
||||
WCHAR wide_result;
|
||||
int b = ::LCMapStringW(
|
||||
id, // locale identifier
|
||||
LCMAP_LOWERCASE, // mapping transformation type
|
||||
&wide_c, // source string
|
||||
1, // number of characters in source string
|
||||
&wide_result, // destination buffer
|
||||
1); // size of destination buffer
|
||||
if(b == 0)
|
||||
return c;
|
||||
|
||||
if (::WideCharToMultiByte(code_page, 0, &wide_result, 1, result, 2, NULL, NULL) == 0)
|
||||
return c;
|
||||
#endif
|
||||
return result[0];
|
||||
}
|
||||
|
||||
@ -382,6 +524,7 @@ BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_tolower(unsigned short c, l
|
||||
BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type id)
|
||||
{
|
||||
char result[2];
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
int b = ::LCMapStringA(
|
||||
id, // locale identifier
|
||||
LCMAP_UPPERCASE, // mapping transformation type
|
||||
@ -391,6 +534,29 @@ BOOST_REGEX_DECL char BOOST_REGEX_CALL w32_toupper(char c, lcid_type id)
|
||||
1); // size of destination buffer
|
||||
if(b == 0)
|
||||
return c;
|
||||
#else
|
||||
UINT code_page = get_code_page_for_locale_id(id);
|
||||
if(code_page == 0)
|
||||
return c;
|
||||
|
||||
WCHAR wide_c;
|
||||
if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0)
|
||||
return c;
|
||||
|
||||
WCHAR wide_result;
|
||||
int b = ::LCMapStringW(
|
||||
id, // locale identifier
|
||||
LCMAP_UPPERCASE, // mapping transformation type
|
||||
&wide_c, // source string
|
||||
1, // number of characters in source string
|
||||
&wide_result, // destination buffer
|
||||
1); // size of destination buffer
|
||||
if(b == 0)
|
||||
return c;
|
||||
|
||||
if (::WideCharToMultiByte(code_page, 0, &wide_result, 1, result, 2, NULL, NULL) == 0)
|
||||
return c;
|
||||
#endif
|
||||
return result[0];
|
||||
}
|
||||
|
||||
@ -429,8 +595,21 @@ BOOST_REGEX_DECL unsigned short BOOST_REGEX_CALL w32_toupper(unsigned short c, l
|
||||
BOOST_REGEX_DECL bool BOOST_REGEX_CALL w32_is(lcid_type id, boost::uint32_t m, char c)
|
||||
{
|
||||
WORD mask;
|
||||
#ifndef BOOST_NO_ANSI_APIS
|
||||
if(::GetStringTypeExA(id, CT_CTYPE1, &c, 1, &mask) && (mask & m & w32_regex_traits_implementation<char>::mask_base))
|
||||
return true;
|
||||
#else
|
||||
UINT code_page = get_code_page_for_locale_id(id);
|
||||
if(code_page == 0)
|
||||
return false;
|
||||
|
||||
WCHAR wide_c;
|
||||
if (::MultiByteToWideChar(code_page, 0, &c, 1, &wide_c, 1) == 0)
|
||||
return false;
|
||||
|
||||
if(::GetStringTypeExW(id, CT_CTYPE1, &wide_c, 1, &mask) && (mask & m & w32_regex_traits_implementation<char>::mask_base))
|
||||
return true;
|
||||
#endif
|
||||
if((m & w32_regex_traits_implementation<char>::mask_word) && (c == '_'))
|
||||
return true;
|
||||
return false;
|
||||
|
@ -157,7 +157,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
|
||||
{
|
||||
result = std::wcslen(wnames[code]) + 1;
|
||||
if(buf_size >= result)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
::wcscpy_s(buf, buf_size, wnames[code]);
|
||||
#else
|
||||
std::wcscpy(buf, wnames[code]);
|
||||
@ -176,13 +176,13 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
|
||||
{
|
||||
if(std::wcscmp(e->re_endp, wnames[i]) == 0)
|
||||
{
|
||||
#if defined(_WIN32_WCE)
|
||||
#if defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
(std::swprintf)(localbuf, L"%d", i);
|
||||
#else
|
||||
(std::swprintf)(localbuf, 5, L"%d", i);
|
||||
#endif
|
||||
if(std::wcslen(localbuf) < buf_size)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
::wcscpy_s(buf, buf_size, localbuf);
|
||||
#else
|
||||
std::wcscpy(buf, localbuf);
|
||||
@ -190,13 +190,13 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW*
|
||||
return std::wcslen(localbuf) + 1;
|
||||
}
|
||||
}
|
||||
#if defined(_WIN32_WCE)
|
||||
#if defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
(std::swprintf)(localbuf, L"%d", 0);
|
||||
#else
|
||||
(std::swprintf)(localbuf, 5, L"%d", 0);
|
||||
#endif
|
||||
if(std::wcslen(localbuf) < buf_size)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE)
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE)
|
||||
::wcscpy_s(buf, buf_size, localbuf);
|
||||
#else
|
||||
std::wcscpy(buf, localbuf);
|
||||
|
Reference in New Issue
Block a user