aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/charset
diff options
context:
space:
mode:
authordanlark <danlark@yandex-team.ru>2022-02-10 16:46:08 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:08 +0300
commit3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (patch)
tree26154e1e9990f1bb4525d3e3fb5b6dac2c2c1da2 /library/cpp/charset
parentcb68f224c46a8ee52ac3fdd2a32534b8bb8dc134 (diff)
downloadydb-3426a9bc7f169ae9da54cef557ad2a33f6e8eee0.tar.gz
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/charset')
-rw-r--r--library/cpp/charset/ci_string.cpp2
-rw-r--r--library/cpp/charset/ci_string.h4
-rw-r--r--library/cpp/charset/codepage.cpp8
-rw-r--r--library/cpp/charset/codepage_ut.cpp8
-rw-r--r--library/cpp/charset/recyr.hh2
-rw-r--r--library/cpp/charset/wide.h16
-rw-r--r--library/cpp/charset/wide_ut.cpp28
7 files changed, 34 insertions, 34 deletions
diff --git a/library/cpp/charset/ci_string.cpp b/library/cpp/charset/ci_string.cpp
index 6097e40131..4ec5ea6ab9 100644
--- a/library/cpp/charset/ci_string.cpp
+++ b/library/cpp/charset/ci_string.cpp
@@ -37,5 +37,5 @@ size_t TCiString::hashVal(const char* s, size_t len, const CodePage& cp) {
template <>
void Out<TCiString>(IOutputStream& o, const TCiString& p) {
- o.Write(p.data(), p.size());
+ o.Write(p.data(), p.size());
}
diff --git a/library/cpp/charset/ci_string.h b/library/cpp/charset/ci_string.h
index edf24c1b6f..7ee4b5ab3e 100644
--- a/library/cpp/charset/ci_string.h
+++ b/library/cpp/charset/ci_string.h
@@ -248,14 +248,14 @@ struct TCIHash<const char*> {
template <>
struct TCIHash<TStringBuf> {
inline size_t operator()(const TStringBuf& s) const {
- return TCiString::hashVal(s.data(), s.size());
+ return TCiString::hashVal(s.data(), s.size());
}
};
template <>
struct TCIHash<TString> {
inline size_t operator()(const TString& s) const {
- return TCiString::hashVal(s.data(), s.size());
+ return TCiString::hashVal(s.data(), s.size());
}
};
diff --git a/library/cpp/charset/codepage.cpp b/library/cpp/charset/codepage.cpp
index 0431bef31b..c880c972c7 100644
--- a/library/cpp/charset/codepage.cpp
+++ b/library/cpp/charset/codepage.cpp
@@ -136,7 +136,7 @@ private:
private:
inline void AddNameWithCheck(const TString& name, ECharset code) {
if (Data.find(name.c_str()) == Data.end()) {
- Data.insert(TData::value_type(Pool.Append(name.data(), name.size() + 1), code));
+ Data.insert(TData::value_type(Pool.Append(name.data(), name.size() + 1), code));
} else {
Y_ASSERT(Data.find(name.c_str())->second == code);
}
@@ -294,12 +294,12 @@ void DoDecodeUnknownPlane(TxChar* str, TxChar*& ee, const ECharset enc) {
buf.push_back(Lo8(Lo16(*s)));
} else {
if (!buf.empty()) {
- if (RecodeToUnicode(enc, buf.data(), d, buf.size(), e - d, read, written) == RECODE_OK) {
+ if (RecodeToUnicode(enc, buf.data(), d, buf.size(), e - d, read, written) == RECODE_OK) {
Y_ASSERT(read == buf.size());
d += written;
} else { // just copying broken symbols
Y_ASSERT(buf.size() <= static_cast<size_t>(e - d));
- Copy(buf.data(), buf.size(), d);
+ Copy(buf.data(), buf.size(), d);
d += buf.size();
}
buf.clear();
@@ -413,7 +413,7 @@ static inline void NormalizeEncodingPrefixes(TString& enc) {
TString enccopy = enc.substr(preflen);
enccopy.prepend("latin");
const TLatinToIsoHash* latinhash = Singleton<TLatinToIsoHash>();
- TLatinToIsoHash::const_iterator it = latinhash->find(enccopy.data());
+ TLatinToIsoHash::const_iterator it = latinhash->find(enccopy.data());
if (it != latinhash->end())
enc.assign(it->second);
return;
diff --git a/library/cpp/charset/codepage_ut.cpp b/library/cpp/charset/codepage_ut.cpp
index c3ac3ac478..975b75376f 100644
--- a/library/cpp/charset/codepage_ut.cpp
+++ b/library/cpp/charset/codepage_ut.cpp
@@ -254,11 +254,11 @@ void TCodepageTest::TestUTFFromUnknownPlane() {
// test TChar version
// bytebuffer of len writtenbytes contains sampletext of len samplelen chars in utf8
TUtf16String wtr = CharToWide(TStringBuf(bytebuffer, writtenbytes), CODES_UNKNOWNPLANE);
- TChar* strend = wtr.begin() + wtr.size();
+ TChar* strend = wtr.begin() + wtr.size();
DecodeUnknownPlane(wtr.begin(), strend, CODES_UTF8);
- wtr.resize(strend - wtr.data(), 'Q');
- UNIT_ASSERT_VALUES_EQUAL(wtr.size(), samplelen);
- for (size_t i = 0; i < wtr.size(); ++i) {
+ wtr.resize(strend - wtr.data(), 'Q');
+ UNIT_ASSERT_VALUES_EQUAL(wtr.size(), samplelen);
+ for (size_t i = 0; i < wtr.size(); ++i) {
if (sampletext[i] >= 0x10000) {
UNIT_ASSERT_VALUES_EQUAL(wtr[i], ' ');
} else {
diff --git a/library/cpp/charset/recyr.hh b/library/cpp/charset/recyr.hh
index 5ec8734bcf..ffa04835a3 100644
--- a/library/cpp/charset/recyr.hh
+++ b/library/cpp/charset/recyr.hh
@@ -121,7 +121,7 @@ inline bool Recode(ECharset from, ECharset to, const TStringBuf& in, TString& ou
size_t inRead = 0;
size_t outWritten = 0;
- const RECODE_RESULT res = Recode(from, to, in.data(), out.begin(), inSize, outSize, inRead, outWritten);
+ const RECODE_RESULT res = Recode(from, to, in.data(), out.begin(), inSize, outSize, inRead, outWritten);
Y_ENSURE(RECODE_OK == res, "Recode failed. ");
if (outWritten > outSize)
ythrow yexception() << "Recode overrun the buffer: size="
diff --git a/library/cpp/charset/wide.h b/library/cpp/charset/wide.h
index 32d30e849e..cbbfe40b58 100644
--- a/library/cpp/charset/wide.h
+++ b/library/cpp/charset/wide.h
@@ -58,15 +58,15 @@ namespace NDetail {
template <typename TCharType>
inline TBasicStringBuf<TCharType> RecodeSingleByteChar(const TStringBuf src, TCharType* dst, const CodePage& cp) {
Y_ASSERT(cp.SingleByteCodepage());
- ::CharToWide(src.data(), src.size(), dst, cp);
+ ::CharToWide(src.data(), src.size(), dst, cp);
return TBasicStringBuf<TCharType>(dst, src.size());
}
template <typename TCharType>
inline TStringBuf RecodeSingleByteChar(const TBasicStringBuf<TCharType> src, char* dst, const CodePage& cp) {
Y_ASSERT(cp.SingleByteCodepage());
- ::WideToChar(src.data(), src.size(), dst, cp.CPEnum);
- return TStringBuf(dst, src.size());
+ ::WideToChar(src.data(), src.size(), dst, cp.CPEnum);
+ return TStringBuf(dst, src.size());
}
template <typename TCharType>
@@ -74,7 +74,7 @@ namespace NDetail {
Y_ASSERT(!NCodepagePrivate::NativeCodepage(encoding));
size_t read = 0;
size_t written = 0;
- ::NICONVPrivate::RecodeToUnicode(encoding, src.data(), dst, src.size(), src.size(), read, written);
+ ::NICONVPrivate::RecodeToUnicode(encoding, src.data(), dst, src.size(), src.size(), read, written);
return TBasicStringBuf<TCharType>(dst, written);
}
@@ -83,14 +83,14 @@ namespace NDetail {
Y_ASSERT(!NCodepagePrivate::NativeCodepage(encoding));
size_t read = 0;
size_t written = 0;
- ::NICONVPrivate::RecodeFromUnicode(encoding, src.data(), dst, src.size(), src.size() * 3, read, written);
+ ::NICONVPrivate::RecodeFromUnicode(encoding, src.data(), dst, src.size(), src.size() * 3, read, written);
return TStringBuf(dst, written);
}
template <typename TCharType>
inline TBasicStringBuf<TCharType> RecodeUtf8(const TStringBuf src, TCharType* dst) {
size_t len = 0;
- if (!::UTF8ToWide(src.data(), src.size(), dst, len))
+ if (!::UTF8ToWide(src.data(), src.size(), dst, len))
ythrow yexception() << "Invalid UTF8: \"" << src.SubStr(0, 50) << (src.size() > 50 ? "...\"" : "\"");
return TBasicStringBuf<TCharType>(dst, len);
}
@@ -98,7 +98,7 @@ namespace NDetail {
template <typename TCharType>
inline TStringBuf RecodeUtf8(const TBasicStringBuf<TCharType> src, char* dst) {
size_t len = 0;
- ::WideToUTF8(src.data(), src.size(), dst, len);
+ ::WideToUTF8(src.data(), src.size(), dst, len);
return TStringBuf(dst, len);
}
@@ -190,7 +190,7 @@ namespace NDetail {
// do re-coding
size_t written = 0;
- UTF8ToWide<true>(src.data(), src.size(), dstbuf, written);
+ UTF8ToWide<true>(src.data(), src.size(), dstbuf, written);
// truncate result back to proper size
TRecodeResultOps<TResult>::Truncate(dst, written);
diff --git a/library/cpp/charset/wide_ut.cpp b/library/cpp/charset/wide_ut.cpp
index 78947d51ba..742db7cf95 100644
--- a/library/cpp/charset/wide_ut.cpp
+++ b/library/cpp/charset/wide_ut.cpp
@@ -230,42 +230,42 @@ void TConversionTest::TestYandexEncoding() {
void TConversionTest::TestRecodeIntoString() {
TString sYandex(UnicodeText.size() * 4, 'x');
- const char* sdata = sYandex.data();
+ const char* sdata = sYandex.data();
TStringBuf sres = NDetail::Recode<wchar16>(UnicodeText, sYandex, CODES_YANDEX);
UNIT_ASSERT(sYandex == YandexText); // same content
- UNIT_ASSERT(sYandex.data() == sdata); // reserved buffer reused
- UNIT_ASSERT(sYandex.data() == sres.data()); // same buffer
- UNIT_ASSERT(sYandex.size() == sres.size()); // same size
+ UNIT_ASSERT(sYandex.data() == sdata); // reserved buffer reused
+ UNIT_ASSERT(sYandex.data() == sres.data()); // same buffer
+ UNIT_ASSERT(sYandex.size() == sres.size()); // same size
TEST_WCHAR32(sYandex, UnicodeText, CODES_YANDEX);
TUtf16String sUnicode;
sUnicode.reserve(YandexText.size() * 4);
- const wchar16* wdata = sUnicode.data();
+ const wchar16* wdata = sUnicode.data();
TWtringBuf wres = NDetail::Recode<char>(YandexText, sUnicode, CODES_YANDEX);
UNIT_ASSERT(sUnicode == UnicodeText); // same content
- UNIT_ASSERT(sUnicode.data() == wdata); // reserved buffer reused
- UNIT_ASSERT(sUnicode.data() == wres.data()); // same buffer
- UNIT_ASSERT(sUnicode.size() == wres.size()); // same size
+ UNIT_ASSERT(sUnicode.data() == wdata); // reserved buffer reused
+ UNIT_ASSERT(sUnicode.data() == wres.data()); // same buffer
+ UNIT_ASSERT(sUnicode.size() == wres.size()); // same size
TString sUtf8 = " ";
size_t scap = sUtf8.capacity();
sres = NDetail::Recode<wchar16>(UnicodeText, sUtf8, CODES_UTF8);
UNIT_ASSERT(sUtf8 == UTF8Text); // same content
UNIT_ASSERT(sUtf8.capacity() > scap); // increased buffer capacity (supplied was too small)
- UNIT_ASSERT(sUtf8.data() == sres.data()); // same buffer
- UNIT_ASSERT(sUtf8.size() == sres.size()); // same size
+ UNIT_ASSERT(sUtf8.data() == sres.data()); // same buffer
+ UNIT_ASSERT(sUtf8.size() == sres.size()); // same size
TEST_WCHAR32(sUtf8, UnicodeText, CODES_UTF8);
sUnicode.clear();
- wdata = sUnicode.data();
+ wdata = sUnicode.data();
TUtf16String copy = sUnicode; // increase ref-counter
wres = NDetail::Recode<char>(UTF8Text, sUnicode, CODES_UTF8);
UNIT_ASSERT(sUnicode == UnicodeText); // same content
#ifndef TSTRING_IS_STD_STRING
- UNIT_ASSERT(sUnicode.data() != wdata); // re-allocated (shared buffer supplied)
- UNIT_ASSERT(sUnicode.data() == wres.data()); // same buffer
+ UNIT_ASSERT(sUnicode.data() != wdata); // re-allocated (shared buffer supplied)
+ UNIT_ASSERT(sUnicode.data() == wres.data()); // same buffer
#endif
- UNIT_ASSERT(sUnicode.size() == wres.size()); // same content
+ UNIT_ASSERT(sUnicode.size() == wres.size()); // same content
}
static TString GenerateJunk(size_t seed) {