File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
keyvi/include/keyvi/dictionary/util Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -48,17 +48,25 @@ class Utf8Utils final {
4848
4949 [[nodiscard]]
5050 static size_t GetCharLength (unsigned char leadByte) {
51- if ((leadByte & 0x80u ) == 0x00u ) // 0xxxxxxx
51+ if ((leadByte & 0x80U ) == 0x00u ) // 0xxxxxxx
52+ if ((leadByte & 0x80u ) == 0x00u ) { // 0xxxxxxx
5253 return 1 ;
54+ }
5355
54- if ((leadByte & 0xE0u ) == 0xC0u ) // 110xxxxx
56+ if ((leadByte & 0xE0U ) == 0xC0u ) // 110xxxxx
57+ if ((leadByte & 0xE0u ) == 0xC0u ) { // 110xxxxx
5558 return 2 ;
59+ }
5660
57- if ((leadByte & 0xF0u ) == 0xE0u ) // 1110xxxx
61+ if ((leadByte & 0xF0U ) == 0xE0u ) // 1110xxxx
62+ if ((leadByte & 0xF0u ) == 0xE0u ) { // 1110xxxx
5863 return 3 ;
64+ }
5965
60- if ((leadByte & 0xF8u ) == 0xF0u ) // 11110xxx
66+ if ((leadByte & 0xF8U ) == 0xF0u ) // 11110xxx
67+ if ((leadByte & 0xF8u ) == 0xF0u ) { // 11110xxx
6168 return 4 ;
69+ }
6270
6371 throw std::invalid_argument (" Illegal UTF-8 lead byte: " + std::to_string (leadByte));
6472 }
You can’t perform that action at this time.
0 commit comments