aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/charset
diff options
context:
space:
mode:
authorkrock21 <krock21@yandex-team.ru>2022-02-10 16:46:02 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:02 +0300
commit4aae166b5d23fd02653919f43e2015cd636fa6fd (patch)
tree70e52225c1ede3476f358bc4699197ace987d46d /library/cpp/charset
parent9ab30620977aa96ae9e9da959e2f7e1370cb796d (diff)
downloadydb-4aae166b5d23fd02653919f43e2015cd636fa6fd.tar.gz
Restoring authorship annotation for <krock21@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/charset')
-rw-r--r--library/cpp/charset/ci_string.cpp20
-rw-r--r--library/cpp/charset/ci_string.h24
2 files changed, 22 insertions, 22 deletions
diff --git a/library/cpp/charset/ci_string.cpp b/library/cpp/charset/ci_string.cpp
index 6097e40131..dcd1dbf9e1 100644
--- a/library/cpp/charset/ci_string.cpp
+++ b/library/cpp/charset/ci_string.cpp
@@ -12,20 +12,20 @@ int TCiString::compare(const TCiString& s1, const char* p, const CodePage& cp) {
return cp.stricmp(s1.data(), p);
}
-int TCiString::compare(const TStringBuf& p1, const TStringBuf& p2, const CodePage& cp) {
- int rv = cp.strnicmp(p1.data(), p2.data(), Min(p1.size(), p2.size()));
- return rv ? rv : p1.size() < p2.size() ? -1 : p1.size() == p2.size() ? 0 : 1;
+int TCiString::compare(const TStringBuf& p1, const TStringBuf& p2, const CodePage& cp) {
+ int rv = cp.strnicmp(p1.data(), p2.data(), Min(p1.size(), p2.size()));
+ return rv ? rv : p1.size() < p2.size() ? -1 : p1.size() == p2.size() ? 0 : 1;
}
-bool TCiString::is_prefix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp) {
- size_t len = what.size();
- return len <= of.size() && cp.strnicmp(what.data(), of.data(), len) == 0;
+bool TCiString::is_prefix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp) {
+ size_t len = what.size();
+ return len <= of.size() && cp.strnicmp(what.data(), of.data(), len) == 0;
}
-bool TCiString::is_suffix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp) {
- size_t len = what.size();
- size_t slen = of.size();
- return (len <= slen) && (0 == cp.strnicmp(what.data(), of.data() + slen - len, len));
+bool TCiString::is_suffix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp) {
+ size_t len = what.size();
+ size_t slen = of.size();
+ return (len <= slen) && (0 == cp.strnicmp(what.data(), of.data() + slen - len, len));
}
size_t TCiString::hashVal(const char* s, size_t len, const CodePage& cp) {
diff --git a/library/cpp/charset/ci_string.h b/library/cpp/charset/ci_string.h
index edf24c1b6f..2c61f5ca76 100644
--- a/library/cpp/charset/ci_string.h
+++ b/library/cpp/charset/ci_string.h
@@ -51,7 +51,7 @@ public:
{
}
- explicit TCiString(const TStringBuf& s)
+ explicit TCiString(const TStringBuf& s)
: TString(s)
{
}
@@ -60,17 +60,17 @@ public:
static int compare(const TCiString& s1, const TCiString& s2, const CodePage& cp = csYandex);
static int compare(const char* p, const TCiString& s2, const CodePage& cp = csYandex);
static int compare(const TCiString& s1, const char* p, const CodePage& cp = csYandex);
- static int compare(const TStringBuf& p1, const TStringBuf& p2, const CodePage& cp = csYandex);
+ static int compare(const TStringBuf& p1, const TStringBuf& p2, const CodePage& cp = csYandex);
// TODO: implement properly in TString via enum ECaseSensitivity
- static bool is_prefix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp = csYandex);
- static bool is_suffix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp = csYandex);
+ static bool is_prefix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp = csYandex);
+ static bool is_suffix(const TStringBuf& what, const TStringBuf& of, const CodePage& cp = csYandex);
- bool StartsWith(const TStringBuf& s, const CodePage& cp = csYandex) const {
+ bool StartsWith(const TStringBuf& s, const CodePage& cp = csYandex) const {
return is_prefix(s, *this, cp);
}
- bool EndsWith(const TStringBuf& s, const CodePage& cp = csYandex) const {
+ bool EndsWith(const TStringBuf& s, const CodePage& cp = csYandex) const {
return is_suffix(s, *this, cp);
}
@@ -217,8 +217,8 @@ struct ci_hash {
inline size_t operator()(const char* s) const {
return TCiString::hashVal(s, strlen(s));
}
- inline size_t operator()(const TStringBuf& s) const {
- return TCiString::hashVal(s.data(), s.size());
+ inline size_t operator()(const TStringBuf& s) const {
+ return TCiString::hashVal(s.data(), s.size());
}
};
@@ -240,8 +240,8 @@ struct TCIHash {
template <>
struct TCIHash<const char*> {
- inline size_t operator()(const TStringBuf& s) const {
- return TCiString::hashVal(s.data(), s.size());
+ inline size_t operator()(const TStringBuf& s) const {
+ return TCiString::hashVal(s.data(), s.size());
}
};
@@ -270,8 +270,8 @@ struct ci_equal_to {
return csYandex.stricmp(x, y) == 0;
}
// this implementation is not suitable for strings with zero characters inside, sorry
- bool operator()(const TStringBuf& x, const TStringBuf& y) const {
- return x.size() == y.size() && csYandex.strnicmp(x.data(), y.data(), y.size()) == 0;
+ bool operator()(const TStringBuf& x, const TStringBuf& y) const {
+ return x.size() == y.size() && csYandex.strnicmp(x.data(), y.data(), y.size()) == 0;
}
};