summaryrefslogtreecommitdiff
path: root/zen/utf.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-08-31 20:07:13 -0400
committerB Stack <bgstack15@gmail.com>2020-08-31 20:07:13 -0400
commit8a27fa9c617533e76673ce61a65e2ba869b52208 (patch)
treeacfdfb3e1046db87040477033fda0df76d92916a /zen/utf.h
parentMerge branch '11.0' into 'master' (diff)
downloadFreeFileSync-8a27fa9c617533e76673ce61a65e2ba869b52208.tar.gz
FreeFileSync-8a27fa9c617533e76673ce61a65e2ba869b52208.tar.bz2
FreeFileSync-8a27fa9c617533e76673ce61a65e2ba869b52208.zip
add upstream 11.1
Diffstat (limited to 'zen/utf.h')
-rw-r--r--zen/utf.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/zen/utf.h b/zen/utf.h
index 75bf7424..ced185fd 100644
--- a/zen/utf.h
+++ b/zen/utf.h
@@ -299,11 +299,10 @@ private:
const CodePoint* it_;
const CodePoint* last_;
};
-
+}
template <class CharType>
-using UtfDecoder = UtfDecoderImpl<CharType, sizeof(CharType)>;
-}
+using UtfDecoder = impl::UtfDecoderImpl<CharType, sizeof(CharType)>;
//-------------------------------------------------------------------------------------------
@@ -325,7 +324,7 @@ template <class UtfString> inline
size_t unicodeLength(const UtfString& str) //return number of code points (+ correctly handle broken UTF encoding)
{
size_t uniLen = 0;
- impl::UtfDecoder<GetCharTypeT<UtfString>> decoder(strBegin(str), strLength(str));
+ UtfDecoder<GetCharTypeT<UtfString>> decoder(strBegin(str), strLength(str));
while (decoder.getNext())
++uniLen;
return uniLen;
@@ -344,7 +343,7 @@ UtfString getUnicodeSubstring(const UtfString& str, size_t uniPosFirst, size_t u
UtfDecoder<CharType> decoder(strBegin(str), strLength(str));
for (size_t uniPos = 0; std::optional<CodePoint> cp = decoder.getNext(); ++uniPos) //[!] declaration in condition part of the for-loop
- if (uniPosFirst <= uniPos)
+ if (uniPos >= uniPosFirst)
{
if (uniPos >= uniPosLast)
break;
bgstack15