aboutsummaryrefslogtreecommitdiffstats
path: root/util/charset
diff options
context:
space:
mode:
authorRuslan Kovalev <ruslan.a.kovalev@gmail.com>2022-02-10 16:46:45 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:45 +0300
commit9123176b341b6f2658cff5132482b8237c1416c8 (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /util/charset
parent59e19371de37995fcb36beb16cd6ec030af960bc (diff)
downloadydb-9123176b341b6f2658cff5132482b8237c1416c8.tar.gz
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'util/charset')
-rw-r--r--util/charset/recode_result.h2
-rw-r--r--util/charset/unidata.h2
-rw-r--r--util/charset/wide.h32
-rw-r--r--util/charset/wide_ut.cpp2
4 files changed, 19 insertions, 19 deletions
diff --git a/util/charset/recode_result.h b/util/charset/recode_result.h
index 2f5cc86634..2c7366e7b2 100644
--- a/util/charset/recode_result.h
+++ b/util/charset/recode_result.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
enum RECODE_RESULT {
RECODE_OK,
diff --git a/util/charset/unidata.h b/util/charset/unidata.h
index 9bd48fe4c5..400d314186 100644
--- a/util/charset/unidata.h
+++ b/util/charset/unidata.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "unicode_table.h"
diff --git a/util/charset/wide.h b/util/charset/wide.h
index 6470fd0172..04e6928aab 100644
--- a/util/charset/wide.h
+++ b/util/charset/wide.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "recode_result.h"
#include "unidata.h"
@@ -298,7 +298,7 @@ namespace NDetail {
void UTF8ToWideImplSSE41(const unsigned char*& cur, const unsigned char* last, wchar32*& dest) noexcept;
}
-//! @return len if robust and position where encoding stopped if not
+//! @return len if robust and position where encoding stopped if not
template <bool robust, typename TCharType>
inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size_t& written) noexcept {
const unsigned char* cur = reinterpret_cast<const unsigned char*>(text);
@@ -309,7 +309,7 @@ inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size
::NDetail::UTF8ToWideImplSSE41(cur, last, p);
}
#endif
-
+
::NDetail::UTF8ToWideImplScalar<robust>(cur, last, p);
written = p - dest;
return cur - reinterpret_cast<const unsigned char*>(text);
@@ -317,9 +317,9 @@ inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size
template <typename TCharType>
inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size_t& written) {
- return UTF8ToWideImpl<false>(text, len, dest, written);
-}
-
+ return UTF8ToWideImpl<false>(text, len, dest, written);
+}
+
template <bool robust>
inline TUtf16String UTF8ToWide(const char* text, size_t len) {
TUtf16String w = TUtf16String::Uninitialized(len);
@@ -334,19 +334,19 @@ inline TUtf16String UTF8ToWide(const char* text, size_t len) {
template <bool robust, typename TCharType>
inline bool UTF8ToWide(const char* text, size_t len, TCharType* dest, size_t& written) noexcept {
- return UTF8ToWideImpl<robust>(text, len, dest, written) == len;
-}
-
+ return UTF8ToWideImpl<robust>(text, len, dest, written) == len;
+}
+
//! converts text from UTF8 to unicode, stops immediately it UTF8 byte sequence is wrong
//! @attention destination buffer must be long enough to fit all characters of the text,
//! conversion stops if a broken symbol is met
//! @return @c true if all the text converted successfully, @c false - a broken symbol was found
template <typename TCharType>
inline bool UTF8ToWide(const char* text, size_t len, TCharType* dest, size_t& written) noexcept {
- return UTF8ToWide<false>(text, len, dest, written);
+ return UTF8ToWide<false>(text, len, dest, written);
}
-template <bool robust>
+template <bool robust>
inline TWtringBuf UTF8ToWide(const TStringBuf src, TUtf16String& dst) {
dst.ReserveAndResize(src.size());
size_t written = 0;
@@ -367,17 +367,17 @@ inline TUtf32StringBuf UTF8ToUTF32(const TStringBuf src, TUtf32String& dst) {
inline TWtringBuf UTF8ToWide(const TStringBuf src, TUtf16String& dst) {
return UTF8ToWide<false>(src, dst);
-}
-
+}
+
inline TUtf16String UTF8ToWide(const char* text, size_t len) {
return UTF8ToWide<false>(text, len);
}
-template <bool robust>
+template <bool robust>
inline TUtf16String UTF8ToWide(const TStringBuf s) {
return UTF8ToWide<robust>(s.data(), s.size());
-}
-
+}
+
template <bool robust>
inline TUtf32String UTF8ToUTF32(const TStringBuf s) {
TUtf32String r;
diff --git a/util/charset/wide_ut.cpp b/util/charset/wide_ut.cpp
index bf06cf2b5c..d8f3233e73 100644
--- a/util/charset/wide_ut.cpp
+++ b/util/charset/wide_ut.cpp
@@ -509,7 +509,7 @@ void TConversionTest::TestUTF8ToWide() {
wchar16 wNonBMPDummy2[] = {'a', 'b', 0xDBC0, 0xDE47, 'n'};
TestSurrogates(utf8NonBMP2, wNonBMPDummy2, Y_ARRAY_SIZE(wNonBMPDummy2));
- UNIT_ASSERT_VALUES_EQUAL(WideToUTF8(UTF8ToWide(WideToUTF8(UTF8ToWide<true>(
+ UNIT_ASSERT_VALUES_EQUAL(WideToUTF8(UTF8ToWide(WideToUTF8(UTF8ToWide<true>(
"m\xFB\xB2\xA5\xAA\xAFyeuse.sexwebcamz.com")))),
TString(
"m\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBDyeuse.sexwebcamz.com"));