From 58a7b18ba7d593b52521e4d70b4c1b546876c678 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 2 Jan 2022 18:18:15 +0100 Subject: Bugfix for C++17, fix comments, fix GCC warnings --- include/unicode.h | 5 ++--- include/unicode/iso.h | 1 + include/unicode/utf.h | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/unicode.h b/include/unicode.h index 34812df..feb012a 100644 --- a/include/unicode.h +++ b/include/unicode.h @@ -235,8 +235,7 @@ namespace unicode { }); accu = 0; bytes_in_accu = 0; - } else - if ((accu & 0x80) == 0) { // 1 byte sequence + } else if ((accu & 0x80) == 0) { // 1 byte sequence append_utf<7>(result, static_cast(accu & 0x7F)); accu >>= 8; bytes_in_accu -= 1; @@ -307,7 +306,7 @@ namespace unicode { while (s_index < s_size || bytes_in_accu > 0) { while (s_index < s_size && bytes_in_accu < 8) { - accu |= static_cast(*reinterpret_cast(&(s.data()[s_index]))) << (bytes_in_accu * 8); + accu |= static_cast(*reinterpret_cast(&(s.data()[s_index]))) << (bytes_in_accu * 8); ++s_index; bytes_in_accu += sizeof(typename From::value_type); } diff --git a/include/unicode/iso.h b/include/unicode/iso.h index 9b20afd..1f5f007 100644 --- a/include/unicode/iso.h +++ b/include/unicode/iso.h @@ -2,6 +2,7 @@ #include "types.h" +#include #include #include #include diff --git a/include/unicode/utf.h b/include/unicode/utf.h index 6d7c2f7..1d2f28e 100644 --- a/include/unicode/utf.h +++ b/include/unicode/utf.h @@ -43,8 +43,8 @@ namespace unicode::detail { template, bool> = true> inline bool validate_utf(const std::basic_string& s) { - int i{}; - auto size{s.size()}; + size_t i{}; + size_t size{s.size()}; while (i < size) { if (is_utf8_sequence(s[i])) { i++; @@ -86,8 +86,8 @@ namespace unicode::detail { template, bool> = true> inline bool validate_utf(const std::basic_string& s) { - int i{}; - auto size{s.size()}; + size_t i{}; + size_t size{s.size()}; while (i < size) { if (is_utf16_sequence(s[i])) { i++; -- cgit v1.2.3