👌 fixed compiler warnings #1031

This commit is contained in:
Niels Lohmann 2018-04-02 13:01:56 +02:00
parent 727dd4664b
commit 16c5bfeaad
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
2 changed files with 8 additions and 14 deletions

View file

@ -168,9 +168,6 @@ class input_buffer_adapter : public input_adapter_protocol
template<typename WideStringType> template<typename WideStringType>
class wide_string_input_adapter : public input_adapter_protocol class wide_string_input_adapter : public input_adapter_protocol
{ {
private:
using char_t = typename WideStringType::value_type;
public: public:
wide_string_input_adapter(const WideStringType& w) : str(w) {} wide_string_input_adapter(const WideStringType& w) : str(w) {}
@ -186,7 +183,7 @@ class wide_string_input_adapter : public input_adapter_protocol
// check if buffer needs to be filled // check if buffer needs to be filled
if (utf8_bytes_index == utf8_bytes_filled) if (utf8_bytes_index == utf8_bytes_filled)
{ {
if (sizeof(char_t) == 2) if (sizeof(typename WideStringType::value_type) == 2)
{ {
fill_buffer_utf16(); fill_buffer_utf16();
} }
@ -223,7 +220,7 @@ class wide_string_input_adapter : public input_adapter_protocol
else else
{ {
// get the current character // get the current character
const char_t wc = str[current_wchar++]; const int wc = static_cast<int>(str[current_wchar++]);
// UTF-16 to UTF-8 encoding // UTF-16 to UTF-8 encoding
if (wc < 0x80) if (wc < 0x80)
@ -248,7 +245,7 @@ class wide_string_input_adapter : public input_adapter_protocol
{ {
if (current_wchar < str.size()) if (current_wchar < str.size())
{ {
const char_t wc2 = str[current_wchar++]; const int wc2 = static_cast<int>(str[current_wchar++]);
const int charcode = 0x10000 + (((wc & 0x3FF) << 10) | (wc2 & 0x3FF)); const int charcode = 0x10000 + (((wc & 0x3FF) << 10) | (wc2 & 0x3FF));
utf8_bytes[0] = 0xf0 | (charcode >> 18); utf8_bytes[0] = 0xf0 | (charcode >> 18);
utf8_bytes[1] = 0x80 | ((charcode >> 12) & 0x3F); utf8_bytes[1] = 0x80 | ((charcode >> 12) & 0x3F);
@ -279,7 +276,7 @@ class wide_string_input_adapter : public input_adapter_protocol
else else
{ {
// get the current character // get the current character
const char_t wc = str[current_wchar++]; const int wc = static_cast<int>(str[current_wchar++]);
// UTF-32 to UTF-8 encoding // UTF-32 to UTF-8 encoding
if (wc < 0x80) if (wc < 0x80)

View file

@ -1741,9 +1741,6 @@ class input_buffer_adapter : public input_adapter_protocol
template<typename WideStringType> template<typename WideStringType>
class wide_string_input_adapter : public input_adapter_protocol class wide_string_input_adapter : public input_adapter_protocol
{ {
private:
using char_t = typename WideStringType::value_type;
public: public:
wide_string_input_adapter(const WideStringType& w) : str(w) {} wide_string_input_adapter(const WideStringType& w) : str(w) {}
@ -1759,7 +1756,7 @@ class wide_string_input_adapter : public input_adapter_protocol
// check if buffer needs to be filled // check if buffer needs to be filled
if (utf8_bytes_index == utf8_bytes_filled) if (utf8_bytes_index == utf8_bytes_filled)
{ {
if (sizeof(char_t) == 2) if (sizeof(typename WideStringType::value_type) == 2)
{ {
fill_buffer_utf16(); fill_buffer_utf16();
} }
@ -1796,7 +1793,7 @@ class wide_string_input_adapter : public input_adapter_protocol
else else
{ {
// get the current character // get the current character
const char_t wc = str[current_wchar++]; const int wc = static_cast<int>(str[current_wchar++]);
// UTF-16 to UTF-8 encoding // UTF-16 to UTF-8 encoding
if (wc < 0x80) if (wc < 0x80)
@ -1821,7 +1818,7 @@ class wide_string_input_adapter : public input_adapter_protocol
{ {
if (current_wchar < str.size()) if (current_wchar < str.size())
{ {
const char_t wc2 = str[current_wchar++]; const int wc2 = static_cast<int>(str[current_wchar++]);
const int charcode = 0x10000 + (((wc & 0x3FF) << 10) | (wc2 & 0x3FF)); const int charcode = 0x10000 + (((wc & 0x3FF) << 10) | (wc2 & 0x3FF));
utf8_bytes[0] = 0xf0 | (charcode >> 18); utf8_bytes[0] = 0xf0 | (charcode >> 18);
utf8_bytes[1] = 0x80 | ((charcode >> 12) & 0x3F); utf8_bytes[1] = 0x80 | ((charcode >> 12) & 0x3F);
@ -1852,7 +1849,7 @@ class wide_string_input_adapter : public input_adapter_protocol
else else
{ {
// get the current character // get the current character
const char_t wc = str[current_wchar++]; const int wc = static_cast<int>(str[current_wchar++]);
// UTF-32 to UTF-8 encoding // UTF-32 to UTF-8 encoding
if (wc < 0x80) if (wc < 0x80)