use a char32_t character as a main character when converting strings
Use a char32_t instead of a wchar_t type. This is needed on systems where sizeof(wchar_t) is equal to 2.
This commit is contained in:
@@ -596,11 +596,11 @@ void DbConnector::unescape_hex_char(const char * str, char & c)
|
||||
}
|
||||
|
||||
|
||||
void DbConnector::unescape_hex_char(const char * str, wchar_t & c)
|
||||
void DbConnector::unescape_hex_char(const char * str, char32_t & c)
|
||||
{
|
||||
unsigned int res = 0;
|
||||
unescape_hex_char(str, sizeof(wchar_t) * 2, res);
|
||||
c = (wchar_t)res;
|
||||
c = (char32_t)res;
|
||||
}
|
||||
|
||||
|
||||
@@ -610,7 +610,7 @@ void DbConnector::unescape_bin_char(const char * str, char & c)
|
||||
}
|
||||
|
||||
|
||||
void DbConnector::unescape_bin_char(const char * str, wchar_t & c)
|
||||
void DbConnector::unescape_bin_char(const char * str, char32_t & c)
|
||||
{
|
||||
unescape_hex_char(str, c);
|
||||
}
|
||||
@@ -680,8 +680,15 @@ void DbConnector::get_value(const char * value_str, unsigned char & field_value,
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DbConnector::get_value(const char * value_str, wchar_t & field_value, const FT & field_type)
|
||||
{
|
||||
char32_t tmp;
|
||||
get_value(value_str, tmp, field_type);
|
||||
field_value = static_cast<wchar_t>(tmp);
|
||||
}
|
||||
|
||||
|
||||
void DbConnector::get_value(const char * value_str, char32_t & field_value, const FT & field_type)
|
||||
{
|
||||
field_value = 0;
|
||||
|
||||
@@ -705,7 +712,7 @@ void DbConnector::get_value(const char * value_str, wchar_t & field_value, const
|
||||
|
||||
if( is_correct )
|
||||
{
|
||||
field_value = static_cast<wchar_t>(value_int);
|
||||
field_value = static_cast<char32_t>(value_int);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -714,13 +721,12 @@ void DbConnector::get_value(const char * value_str, wchar_t & field_value, const
|
||||
}
|
||||
else
|
||||
{
|
||||
field_value = static_cast<wchar_t>((unsigned char)*value_str);
|
||||
field_value = static_cast<char32_t>((unsigned char)*value_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DbConnector::get_value(const char * value_str, std::string & field_value, const FT & field_type)
|
||||
{
|
||||
if( field_type.is_hexadecimal() )
|
||||
|
Reference in New Issue
Block a user