aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/string_utils
diff options
context:
space:
mode:
authortobo <tobo@yandex-team.ru>2022-02-10 16:47:27 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:27 +0300
commit7fe839092527589b38f014d854c51565b3c1adfa (patch)
tree309e97022d3530044b712b8f71318c78faf7856e /library/cpp/string_utils
parentd0d68c395c10da4cb56a1c845504570a04d7893e (diff)
downloadydb-7fe839092527589b38f014d854c51565b3c1adfa.tar.gz
Restoring authorship annotation for <tobo@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/string_utils')
-rw-r--r--library/cpp/string_utils/base64/base64.cpp2
-rw-r--r--library/cpp/string_utils/base64/base64_ut.cpp20
-rw-r--r--library/cpp/string_utils/indent_text/indent_text.h2
-rw-r--r--library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp4
-rw-r--r--library/cpp/string_utils/quote/quote.cpp8
-rw-r--r--library/cpp/string_utils/quote/quote_ut.cpp4
-rw-r--r--library/cpp/string_utils/url/url.cpp22
7 files changed, 31 insertions, 31 deletions
diff --git a/library/cpp/string_utils/base64/base64.cpp b/library/cpp/string_utils/base64/base64.cpp
index 05c201f0de..c85ad417ce 100644
--- a/library/cpp/string_utils/base64/base64.cpp
+++ b/library/cpp/string_utils/base64/base64.cpp
@@ -65,7 +65,7 @@ namespace {
}
};
- const TImpl GetImpl() {
+ const TImpl GetImpl() {
static const TImpl IMPL;
return IMPL;
}
diff --git a/library/cpp/string_utils/base64/base64_ut.cpp b/library/cpp/string_utils/base64/base64_ut.cpp
index bcc1e65879..4dbefc74e8 100644
--- a/library/cpp/string_utils/base64/base64_ut.cpp
+++ b/library/cpp/string_utils/base64/base64_ut.cpp
@@ -16,8 +16,8 @@
#include <array>
-using namespace std::string_view_literals;
-
+using namespace std::string_view_literals;
+
#define BASE64_UT_DECLARE_BASE64_IMPL(prefix, encFunction, decFunction) \
Y_DECLARE_UNUSED \
static size_t prefix##Base64Decode(void* dst, const char* b, const char* e) { \
@@ -298,7 +298,7 @@ Y_UNIT_TEST_SUITE(TBase64) {
}
Y_UNIT_TEST(TestAllPossibleOctets) {
- const TString x("\0\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0B\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7F"sv);
+ const TString x("\0\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0B\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7F"sv);
const TString xEnc = "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn8=";
const TString y = Base64Decode(xEnc);
const TString yEnc = Base64Encode(x);
@@ -307,7 +307,7 @@ Y_UNIT_TEST_SUITE(TBase64) {
}
Y_UNIT_TEST(TestTwoPaddingCharacters) {
- const TString x("a");
+ const TString x("a");
const TString xEnc = "YQ==";
const TString y = Base64Decode(xEnc);
const TString yEnc = Base64Encode(x);
@@ -316,7 +316,7 @@ Y_UNIT_TEST_SUITE(TBase64) {
}
Y_UNIT_TEST(TestOnePaddingCharacter) {
- const TString x("aa");
+ const TString x("aa");
const TString xEnc = "YWE=";
const TString y = Base64Decode(xEnc);
const TString yEnc = Base64Encode(x);
@@ -325,7 +325,7 @@ Y_UNIT_TEST_SUITE(TBase64) {
}
Y_UNIT_TEST(TestNoPaddingCharacters) {
- const TString x("aaa");
+ const TString x("aaa");
const TString xEnc = "YWFh";
const TString y = Base64Decode(xEnc);
const TString yEnc = Base64Encode(x);
@@ -334,7 +334,7 @@ Y_UNIT_TEST_SUITE(TBase64) {
}
Y_UNIT_TEST(TestTrailingZero) {
- const TString x("foo\0"sv);
+ const TString x("foo\0"sv);
const TString xEnc = "Zm9vAA==";
const TString y = Base64Decode(xEnc);
const TString yEnc = Base64Encode(x);
@@ -343,7 +343,7 @@ Y_UNIT_TEST_SUITE(TBase64) {
}
Y_UNIT_TEST(TestTwoTrailingZeroes) {
- const TString x("foo\0\0"sv);
+ const TString x("foo\0\0"sv);
const TString xEnc = "Zm9vAAA=";
const TString y = Base64Decode(xEnc);
const TString yEnc = Base64Encode(x);
@@ -352,7 +352,7 @@ Y_UNIT_TEST_SUITE(TBase64) {
}
Y_UNIT_TEST(TestZero) {
- const TString x("\0"sv);
+ const TString x("\0"sv);
const TString xEnc = "AA==";
const TString y = Base64Decode(xEnc);
const TString yEnc = Base64Encode(x);
@@ -361,7 +361,7 @@ Y_UNIT_TEST_SUITE(TBase64) {
}
Y_UNIT_TEST(TestSymbolsAfterZero) {
- const TString x("\0a"sv);
+ const TString x("\0a"sv);
const TString xEnc = "AGE=";
const TString y = Base64Decode(xEnc);
const TString yEnc = Base64Encode(x);
diff --git a/library/cpp/string_utils/indent_text/indent_text.h b/library/cpp/string_utils/indent_text/indent_text.h
index 7117d6c0ee..2e8b450ec9 100644
--- a/library/cpp/string_utils/indent_text/indent_text.h
+++ b/library/cpp/string_utils/indent_text/indent_text.h
@@ -3,4 +3,4 @@
#include <util/generic/string.h>
#include <util/generic/strbuf.h>
-TString IndentText(TStringBuf text, TStringBuf indent = TStringBuf(" "));
+TString IndentText(TStringBuf text, TStringBuf indent = TStringBuf(" "));
diff --git a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp
index cf0f78637f..a2705d6ba3 100644
--- a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp
+++ b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp
@@ -26,8 +26,8 @@ namespace {
Y_UNIT_TEST_SUITE(Levenstein) {
Y_UNIT_TEST(Distance) {
- UNIT_ASSERT_VALUES_EQUAL(NLevenshtein::Distance(TStringBuf("hello"), TStringBuf("hulloah")), 3);
- UNIT_ASSERT_VALUES_EQUAL(NLevenshtein::Distance(TStringBuf("yeoman"), TStringBuf("yo man")), 2);
+ UNIT_ASSERT_VALUES_EQUAL(NLevenshtein::Distance(TStringBuf("hello"), TStringBuf("hulloah")), 3);
+ UNIT_ASSERT_VALUES_EQUAL(NLevenshtein::Distance(TStringBuf("yeoman"), TStringBuf("yo man")), 2);
}
}
diff --git a/library/cpp/string_utils/quote/quote.cpp b/library/cpp/string_utils/quote/quote.cpp
index e523350b80..26693c44b3 100644
--- a/library/cpp/string_utils/quote/quote.cpp
+++ b/library/cpp/string_utils/quote/quote.cpp
@@ -114,7 +114,7 @@ static inline It1 Escape(It1 to, It2 from, It3 end, const bool* escape_map = cha
*to++ = (*from == ' ' ? '+' : *from);
}
- ++from;
+ ++from;
}
*to = 0;
@@ -129,12 +129,12 @@ static inline It1 Unescape(It1 to, It2 from, It3 end, FromHex fromHex) {
while (from != end) {
switch (*from) {
case '%':
- ++from;
+ ++from;
*to++ = fromHex.x2c(from);
break;
case '+':
*to++ = ' ';
- ++from;
+ ++from;
break;
default:
*to++ = *from++;
@@ -289,7 +289,7 @@ char* UrlEscape(char* to, const char* from, bool forceEscape) {
*to++ = d2x((unsigned char)*from & 0xF);
} else
*to++ = *from;
- ++from;
+ ++from;
}
*to = 0;
diff --git a/library/cpp/string_utils/quote/quote_ut.cpp b/library/cpp/string_utils/quote/quote_ut.cpp
index 6c552b279e..1c682efda0 100644
--- a/library/cpp/string_utils/quote/quote_ut.cpp
+++ b/library/cpp/string_utils/quote/quote_ut.cpp
@@ -22,7 +22,7 @@ Y_UNIT_TEST_SUITE(TCGIEscapeTest) {
Y_UNIT_TEST(StringBuf) {
char tmp[100];
- UNIT_ASSERT_VALUES_EQUAL(CgiEscape(tmp, "!@#$%^&*(){}[]\" "), TStringBuf("!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
+ UNIT_ASSERT_VALUES_EQUAL(CgiEscape(tmp, "!@#$%^&*(){}[]\" "), TStringBuf("!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
}
Y_UNIT_TEST(StrokaRet) {
@@ -51,7 +51,7 @@ Y_UNIT_TEST_SUITE(TCGIUnescapeTest) {
Y_UNIT_TEST(StringBuf) {
char tmp[100];
- UNIT_ASSERT_VALUES_EQUAL(CgiUnescape(tmp, "!@%23$%25^%26*%28%29"), TStringBuf("!@#$%^&*()"));
+ UNIT_ASSERT_VALUES_EQUAL(CgiUnescape(tmp, "!@%23$%25^%26*%28%29"), TStringBuf("!@#$%^&*()"));
}
Y_UNIT_TEST(TestValidZeroTerm) {
diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp
index 85f4ac5d69..ae70184c31 100644
--- a/library/cpp/string_utils/url/url.cpp
+++ b/library/cpp/string_utils/url/url.cpp
@@ -17,14 +17,14 @@
namespace {
struct TUncheckedSize {
- static bool Has(size_t) {
+ static bool Has(size_t) {
return true;
}
};
struct TKnownSize {
size_t MySize;
- explicit TKnownSize(size_t sz)
+ explicit TKnownSize(size_t sz)
: MySize(sz)
{
}
@@ -158,17 +158,17 @@ TStringBuf GetSchemeHostAndPort(const TStringBuf url, bool trimHttp, bool trimDe
const size_t schemeSize = GetSchemePrefixSize(url);
const TStringBuf scheme = url.Head(schemeSize);
- const bool isHttp = (schemeSize == 0 || scheme == TStringBuf("http://"));
+ const bool isHttp = (schemeSize == 0 || scheme == TStringBuf("http://"));
TStringBuf hostAndPort = GetHostAndPort(url.Tail(schemeSize));
if (trimDefaultPort) {
const size_t pos = hostAndPort.find(':');
if (pos != TStringBuf::npos) {
- const bool isHttps = (scheme == TStringBuf("https://"));
+ const bool isHttps = (scheme == TStringBuf("https://"));
const TStringBuf port = hostAndPort.Tail(pos + 1);
- if ((isHttp && port == TStringBuf("80")) || (isHttps && port == TStringBuf("443"))) {
+ if ((isHttp && port == TStringBuf("80")) || (isHttps && port == TStringBuf("443"))) {
// trimming default port
hostAndPort = hostAndPort.Head(pos);
}
@@ -221,9 +221,9 @@ bool TryGetSchemeHostAndPort(const TStringBuf url, TStringBuf& scheme, TStringBu
}
} else {
host = hostAndPort;
- if (scheme == TStringBuf("https://")) {
+ if (scheme == TStringBuf("https://")) {
port = 443;
- } else if (scheme == TStringBuf("http://")) {
+ } else if (scheme == TStringBuf("http://")) {
port = 80;
}
}
@@ -254,7 +254,7 @@ TStringBuf GetDomain(const TStringBuf host) noexcept {
for (bool wasPoint = false; c != host.data(); --c) {
if (*c == '.') {
if (wasPoint) {
- ++c;
+ ++c;
break;
}
wasPoint = true;
@@ -316,14 +316,14 @@ static inline bool IsSchemeChar(char c) noexcept {
static bool HasPrefix(const TStringBuf url) noexcept {
TStringBuf scheme, unused;
- if (!url.TrySplit(TStringBuf("://"), scheme, unused))
+ if (!url.TrySplit(TStringBuf("://"), scheme, unused))
return false;
return AllOf(scheme, IsSchemeChar);
}
TString AddSchemePrefix(const TString& url) {
- return AddSchemePrefix(url, TStringBuf("http"));
+ return AddSchemePrefix(url, TStringBuf("http"));
}
TString AddSchemePrefix(const TString& url, TStringBuf scheme) {
@@ -331,7 +331,7 @@ TString AddSchemePrefix(const TString& url, TStringBuf scheme) {
return url;
}
- return TString::Join(scheme, TStringBuf("://"), url);
+ return TString::Join(scheme, TStringBuf("://"), url);
}
#define X(c) (c >= 'A' ? ((c & 0xdf) - 'A') + 10 : (c - '0'))