diff options
author | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:53:20 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:53:20 +0200 |
commit | 94db751716dd2851f99b5c4c2981da1d1f4780f8 (patch) | |
tree | e4ffc9f5ae2b2873f267a6e5d3d2092c8aad49a7 /zen/utf.h | |
parent | 6.10 (diff) | |
download | FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.tar.gz FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.tar.bz2 FreeFileSync-94db751716dd2851f99b5c4c2981da1d1f4780f8.zip |
6.11
Diffstat (limited to 'zen/utf.h')
-rw-r--r-- | zen/utf.h | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -104,7 +104,7 @@ size_t getUtf16Len(Char16 ch) //ch must be first code unit! returns 0 on error! template <class CharIterator, class Function> inline void utf16ToCodePoint(CharIterator first, CharIterator last, Function writeOutput) //"writeOutput" is a unary function taking a CodePoint { - assert_static(sizeof(typename std::iterator_traits<CharIterator>::value_type) == 2); + static_assert(sizeof(typename std::iterator_traits<CharIterator>::value_type) == 2, ""); for ( ; first != last; ++first) { @@ -201,7 +201,7 @@ bool decodeTrail(CharIterator& first, CharIterator last, CodePoint& cp) //decode template <class CharIterator, class Function> inline void utf8ToCodePoint(CharIterator first, CharIterator last, Function writeOutput) //"writeOutput" is a unary function taking a CodePoint { - assert_static(sizeof(typename std::iterator_traits<CharIterator>::value_type) == 1); + static_assert(sizeof(typename std::iterator_traits<CharIterator>::value_type) == 1, ""); for ( ; first != last; ++first) { @@ -337,12 +337,12 @@ size_t findUnicodePosWide(const WideString& str, size_t unicodePos, Int2Type<2>) if (utfPos >= strLen) return strLen; - size_t utf16len = getUtf16Len(strFirst[utfPos]); + size_t utf16len = getUtf16Len(strFirst[utfPos]); if (utf16len == 0) ++utf16len; //invalid utf16 character utfPos += utf16len; } - if (utfPos >= strLen) - return strLen; + if (utfPos >= strLen) + return strLen; return utfPos; } @@ -416,8 +416,8 @@ CharString wideToUtf8(const WideString& str, Int2Type<4>) //other OS: convert ut template <class WideString, class CharString> inline WideString utf8ToWide(const CharString& str) { - assert_static((IsSameType<typename GetCharType<CharString>::Type, char >::value)); - assert_static((IsSameType<typename GetCharType<WideString>::Type, wchar_t>::value)); + static_assert(IsSameType<typename GetCharType<CharString>::Type, char >::value, ""); + static_assert(IsSameType<typename GetCharType<WideString>::Type, wchar_t>::value, ""); return implementation::utf8ToWide<WideString>(str, Int2Type<sizeof(wchar_t)>()); } @@ -426,8 +426,8 @@ WideString utf8ToWide(const CharString& str) template <class CharString, class WideString> inline CharString wideToUtf8(const WideString& str) { - assert_static((IsSameType<typename GetCharType<CharString>::Type, char >::value)); - assert_static((IsSameType<typename GetCharType<WideString>::Type, wchar_t>::value)); + static_assert(IsSameType<typename GetCharType<CharString>::Type, char >::value, ""); + static_assert(IsSameType<typename GetCharType<WideString>::Type, wchar_t>::value, ""); return implementation::wideToUtf8<CharString>(str, Int2Type<sizeof(wchar_t)>()); } |