aboutsummaryrefslogtreecommitdiffstats
path: root/util
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 /util
parent9ab30620977aa96ae9e9da959e2f7e1370cb796d (diff)
downloadydb-4aae166b5d23fd02653919f43e2015cd636fa6fd.tar.gz
Restoring authorship annotation for <krock21@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/generic/strbase.h80
-rw-r--r--util/generic/strbuf.h16
-rw-r--r--util/generic/string.cpp28
-rw-r--r--util/generic/string.h70
-rw-r--r--util/str_stl.h4
-rw-r--r--util/stream/output.cpp12
-rw-r--r--util/string/ascii.cpp12
-rw-r--r--util/string/ascii.h16
-rw-r--r--util/string/vector.cpp20
-rw-r--r--util/system/fs_win.cpp2
10 files changed, 130 insertions, 130 deletions
diff --git a/util/generic/strbase.h b/util/generic/strbase.h
index ab39fc7537..b3ff909e1b 100644
--- a/util/generic/strbase.h
+++ b/util/generic/strbase.h
@@ -36,9 +36,9 @@ namespace NStringPrivate {
template <typename TDerived, typename TCharType, typename TTraitsType = std::char_traits<TCharType>>
class TStringBase {
- using TStringView = std::basic_string_view<TCharType>;
+ using TStringView = std::basic_string_view<TCharType>;
using TStringViewWithTraits = std::basic_string_view<TCharType, TTraitsType>;
-
+
public:
using TChar = TCharType;
using TTraits = TTraitsType;
@@ -210,12 +210,12 @@ public: // style-guide compliant methods
return 0 == Len();
}
-private:
- static inline TStringView LegacySubString(const TStringView view, size_t p, size_t n) noexcept {
- p = Min(p, view.length());
- return view.substr(p, n);
- }
-
+private:
+ static inline TStringView LegacySubString(const TStringView view, size_t p, size_t n) noexcept {
+ p = Min(p, view.length());
+ return view.substr(p, n);
+ }
+
public:
// ~~~ Comparison ~~~ : FAMILY0(int, compare)
static int compare(const TSelf& s1, const TSelf& s2) noexcept {
@@ -232,7 +232,7 @@ public:
return s1.AsStringView().compare(p ? p : &null);
}
- static int compare(const TStringView s1, const TStringView s2) noexcept {
+ static int compare(const TStringView s1, const TStringView s2) noexcept {
return TStringViewWithTraits(s1.data(), s1.size()).compare(TStringViewWithTraits(s2.data(), s2.size()));
}
@@ -241,20 +241,20 @@ public:
return compare(*this, t);
}
- inline int compare(size_t p, size_t n, const TStringView t) const noexcept {
- return compare(LegacySubString(*this, p, n), t);
+ inline int compare(size_t p, size_t n, const TStringView t) const noexcept {
+ return compare(LegacySubString(*this, p, n), t);
}
- inline int compare(size_t p, size_t n, const TStringView t, size_t p1, size_t n1) const noexcept {
- return compare(LegacySubString(*this, p, n), LegacySubString(t, p1, n1));
+ inline int compare(size_t p, size_t n, const TStringView t, size_t p1, size_t n1) const noexcept {
+ return compare(LegacySubString(*this, p, n), LegacySubString(t, p1, n1));
}
- inline int compare(size_t p, size_t n, const TStringView t, size_t n1) const noexcept {
- return compare(LegacySubString(*this, p, n), LegacySubString(t, 0, n1));
+ inline int compare(size_t p, size_t n, const TStringView t, size_t n1) const noexcept {
+ return compare(LegacySubString(*this, p, n), LegacySubString(t, 0, n1));
}
inline int compare(const TCharType* p, size_t len) const noexcept {
- return compare(*this, TStringView(p, len));
+ return compare(*this, TStringView(p, len));
}
static bool equal(const TSelf& s1, const TSelf& s2) noexcept {
@@ -273,7 +273,7 @@ public:
return equal(s2, p);
}
- static bool equal(const TStringView s1, const TStringView s2) noexcept {
+ static bool equal(const TStringView s1, const TStringView s2) noexcept {
return TStringViewWithTraits{s1.data(), s1.size()} == TStringViewWithTraits{s2.data(), s2.size()};
}
@@ -282,16 +282,16 @@ public:
return equal(*this, t);
}
- inline bool equal(size_t p, size_t n, const TStringView t) const noexcept {
- return equal(LegacySubString(*this, p, n), t);
+ inline bool equal(size_t p, size_t n, const TStringView t) const noexcept {
+ return equal(LegacySubString(*this, p, n), t);
}
- inline bool equal(size_t p, size_t n, const TStringView t, size_t p1, size_t n1) const noexcept {
- return equal(LegacySubString(*this, p, n), LegacySubString(t, p1, n1));
+ inline bool equal(size_t p, size_t n, const TStringView t, size_t p1, size_t n1) const noexcept {
+ return equal(LegacySubString(*this, p, n), LegacySubString(t, p1, n1));
}
- inline bool equal(size_t p, size_t n, const TStringView t, size_t n1) const noexcept {
- return equal(LegacySubString(*this, p, n), LegacySubString(t, 0, n1));
+ inline bool equal(size_t p, size_t n, const TStringView t, size_t n1) const noexcept {
+ return equal(LegacySubString(*this, p, n), LegacySubString(t, 0, n1));
}
static inline bool StartsWith(const TCharType* what, size_t whatLen, const TCharType* with, size_t withLen) noexcept {
@@ -306,8 +306,8 @@ public:
return StartsWith(Ptr(), Len(), s, n);
}
- inline bool StartsWith(const TStringView s) const noexcept {
- return StartsWith(s.data(), s.length());
+ inline bool StartsWith(const TStringView s) const noexcept {
+ return StartsWith(s.data(), s.length());
}
inline bool StartsWith(TCharType ch) const noexcept {
@@ -318,8 +318,8 @@ public:
return EndsWith(Ptr(), Len(), s, n);
}
- inline bool EndsWith(const TStringView s) const noexcept {
- return EndsWith(s.data(), s.length());
+ inline bool EndsWith(const TStringView s) const noexcept {
+ return EndsWith(s.data(), s.length());
}
inline bool EndsWith(TCharType ch) const noexcept {
@@ -448,7 +448,7 @@ public:
/**
* @return Position of the substring inside this string, or `npos` if not found.
*/
- inline size_t find(const TStringView s, size_t pos = 0) const noexcept {
+ inline size_t find(const TStringView s, size_t pos = 0) const noexcept {
return find(s.data(), pos, s.size());
}
@@ -471,7 +471,7 @@ public:
return AsStringView().rfind(c, pos - 1);
}
- inline size_t rfind(const TStringView str, size_t pos = npos) const {
+ inline size_t rfind(const TStringView str, size_t pos = npos) const {
return AsStringView().rfind(str.data(), pos, str.size());
}
@@ -479,8 +479,8 @@ public:
/**
* @returns Whether this string contains the provided substring.
*/
- inline bool Contains(const TStringView s, size_t pos = 0) const noexcept {
- return !s.length() || find(s, pos) != npos;
+ inline bool Contains(const TStringView s, size_t pos = 0) const noexcept {
+ return !s.length() || find(s, pos) != npos;
}
inline bool Contains(TChar c, size_t pos = 0) const noexcept {
@@ -500,11 +500,11 @@ public:
return find(c, pos);
}
- inline size_t find_first_of(const TStringView set) const noexcept {
+ inline size_t find_first_of(const TStringView set) const noexcept {
return find_first_of(set, 0);
}
- inline size_t find_first_of(const TStringView set, size_t pos) const noexcept {
+ inline size_t find_first_of(const TStringView set, size_t pos) const noexcept {
return AsStringView().find_first_of(set.data(), pos, set.size());
}
@@ -513,14 +513,14 @@ public:
}
inline size_t find_first_not_of(TCharType c, size_t pos) const noexcept {
- return find_first_not_of(TStringView(&c, 1), pos);
+ return find_first_not_of(TStringView(&c, 1), pos);
}
- inline size_t find_first_not_of(const TStringView set) const noexcept {
+ inline size_t find_first_not_of(const TStringView set) const noexcept {
return find_first_not_of(set, 0);
}
- inline size_t find_first_not_of(const TStringView set, size_t pos) const noexcept {
+ inline size_t find_first_not_of(const TStringView set, size_t pos) const noexcept {
return AsStringView().find_first_not_of(set.data(), pos, set.size());
}
@@ -528,8 +528,8 @@ public:
return find_last_of(&c, pos, 1);
}
- inline size_t find_last_of(const TStringView set, size_t pos = npos) const noexcept {
- return find_last_of(set.data(), pos, set.length());
+ inline size_t find_last_of(const TStringView set, size_t pos = npos) const noexcept {
+ return find_last_of(set.data(), pos, set.length());
}
inline size_t find_last_of(const TCharType* set, size_t pos, size_t n) const noexcept {
@@ -540,8 +540,8 @@ public:
return AsStringView().find_last_not_of(c, pos);
}
- inline size_t find_last_not_of(const TStringView set, size_t pos = npos) const noexcept {
- return find_last_not_of(set.data(), pos, set.length());
+ inline size_t find_last_not_of(const TStringView set, size_t pos = npos) const noexcept {
+ return find_last_not_of(set.data(), pos, set.length());
}
inline size_t find_last_not_of(const TCharType* set, size_t pos, size_t n) const noexcept {
diff --git a/util/generic/strbuf.h b/util/generic/strbuf.h
index 70b9360d58..e7fb3ece47 100644
--- a/util/generic/strbuf.h
+++ b/util/generic/strbuf.h
@@ -1,7 +1,7 @@
#pragma once
#include "fwd.h"
-#include "strbase.h"
+#include "strbase.h"
#include "utility.h"
#include "typetraits.h"
@@ -111,7 +111,7 @@ public:
{
}
- constexpr inline TBasicStringBuf(const TCharType* beg, const TCharType* end) noexcept
+ constexpr inline TBasicStringBuf(const TCharType* beg, const TCharType* end) noexcept
: TStringView(beg, end - beg)
{
}
@@ -145,13 +145,13 @@ public:
*/
}
- inline TBasicStringBuf(const TBasicStringBuf& src, size_t pos, size_t n) noexcept
- : TBasicStringBuf(src)
+ inline TBasicStringBuf(const TBasicStringBuf& src, size_t pos, size_t n) noexcept
+ : TBasicStringBuf(src)
{
Skip(pos).Trunc(n);
}
- inline TBasicStringBuf(const TBasicStringBuf& src, size_t pos) noexcept
+ inline TBasicStringBuf(const TBasicStringBuf& src, size_t pos) noexcept
: TBasicStringBuf(src, pos, TBase::npos)
{
}
@@ -160,8 +160,8 @@ public:
pos = Min(pos, size());
n = Min(n, size() - pos);
return TBasicStringBuf(data() + pos, n);
- }
-
+ }
+
public:
void Clear() {
*this = TdSelf();
@@ -320,7 +320,7 @@ public:
public:
inline bool AfterPrefix(const TdSelf& prefix, TdSelf& result) const noexcept {
if (this->StartsWith(prefix)) {
- result = Tail(prefix.size());
+ result = Tail(prefix.size());
return true;
}
return false;
diff --git a/util/generic/string.cpp b/util/generic/string.cpp
index 3c655f1f66..4a2b96ab99 100644
--- a/util/generic/string.cpp
+++ b/util/generic/string.cpp
@@ -40,11 +40,11 @@ bool TBasicString<char, std::char_traits<char>>::to_title(size_t pos, size_t n)
template <>
TUtf16String&
TBasicString<wchar16, std::char_traits<wchar16>>::AppendAscii(const ::TStringBuf& s) {
- ReserveAndResize(size() + s.size());
+ ReserveAndResize(size() + s.size());
- auto dst = begin() + size() - s.size();
+ auto dst = begin() + size() - s.size();
- for (const char* src = s.data(); dst != end(); ++dst, ++src) {
+ for (const char* src = s.data(); dst != end(); ++dst, ++src) {
*dst = static_cast<wchar16>(*src);
}
@@ -55,11 +55,11 @@ template <>
TUtf16String&
TBasicString<wchar16, std::char_traits<wchar16>>::AppendUtf8(const ::TStringBuf& s) {
size_t oldSize = size();
- ReserveAndResize(size() + s.size() * 4);
+ ReserveAndResize(size() + s.size() * 4);
size_t written = 0;
- size_t pos = UTF8ToWideImpl(s.data(), s.size(), begin() + oldSize, written);
+ size_t pos = UTF8ToWideImpl(s.data(), s.size(), begin() + oldSize, written);
if (pos != s.size()) {
- ythrow yexception() << "failed to decode UTF-8 string at pos " << pos << ::NDetail::InStringMsg(s.data(), s.size());
+ ythrow yexception() << "failed to decode UTF-8 string at pos " << pos << ::NDetail::InStringMsg(s.data(), s.size());
}
resize(oldSize + written);
@@ -84,11 +84,11 @@ bool TBasicString<wchar16, std::char_traits<wchar16>>::to_title(size_t pos, size
template <>
TUtf32String&
TBasicString<wchar32, std::char_traits<wchar32>>::AppendAscii(const ::TStringBuf& s) {
- ReserveAndResize(size() + s.size());
+ ReserveAndResize(size() + s.size());
- auto dst = begin() + size() - s.size();
+ auto dst = begin() + size() - s.size();
- for (const char* src = s.data(); dst != end(); ++dst, ++src) {
+ for (const char* src = s.data(); dst != end(); ++dst, ++src) {
*dst = static_cast<wchar32>(*src);
}
@@ -113,11 +113,11 @@ template <>
TUtf32String&
TBasicString<wchar32, std::char_traits<wchar32>>::AppendUtf8(const ::TStringBuf& s) {
size_t oldSize = size();
- ReserveAndResize(size() + s.size() * 4);
+ ReserveAndResize(size() + s.size() * 4);
size_t written = 0;
- size_t pos = UTF8ToWideImpl(s.data(), s.size(), begin() + oldSize, written);
+ size_t pos = UTF8ToWideImpl(s.data(), s.size(), begin() + oldSize, written);
if (pos != s.size()) {
- ythrow yexception() << "failed to decode UTF-8 string at pos " << pos << ::NDetail::InStringMsg(s.data(), s.size());
+ ythrow yexception() << "failed to decode UTF-8 string at pos " << pos << ::NDetail::InStringMsg(s.data(), s.size());
}
resize(oldSize + written);
@@ -128,11 +128,11 @@ template <>
TUtf32String&
TBasicString<wchar32, std::char_traits<wchar32>>::AppendUtf16(const ::TWtringBuf& s) {
size_t oldSize = size();
- ReserveAndResize(size() + s.size() * 2);
+ ReserveAndResize(size() + s.size() * 2);
wchar32* oldEnd = begin() + oldSize;
wchar32* end = oldEnd;
- NDetail::UTF16ToUTF32ImplScalar(s.data(), s.data() + s.size(), end);
+ NDetail::UTF16ToUTF32ImplScalar(s.data(), s.data() + s.size(), end);
size_t written = end - oldEnd;
resize(oldSize + written);
diff --git a/util/generic/string.h b/util/generic/string.h
index 8cd8aa6917..6e55f0dd67 100644
--- a/util/generic/string.h
+++ b/util/generic/string.h
@@ -16,8 +16,8 @@
#include "explicit_type.h"
#include "reserve.h"
#include "singleton.h"
-#include "strbase.h"
-#include "strbuf.h"
+#include "strbase.h"
+#include "strbuf.h"
#include "string_hash.h"
#if defined(address_sanitizer_enabled) || defined(thread_sanitizer_enabled)
@@ -192,8 +192,8 @@ public:
static size_t res = TStringType().max_size();
return res;
- }
-
+ }
+
protected:
#ifdef TSTRING_IS_STD_STRING
TStorage Storage_;
@@ -498,7 +498,7 @@ public:
{
}
- explicit TBasicString(const TBasicStringBuf<TCharType, TTraits> s)
+ explicit TBasicString(const TBasicStringBuf<TCharType, TTraits> s)
: TBasicString(s.data(), s.size())
{
}
@@ -514,15 +514,15 @@ public:
* Certain invocations of this method will result in link-time error.
* You are free to implement corresponding methods in string.cpp if you need them.
*/
- static TBasicString FromAscii(const ::TStringBuf& s) {
+ static TBasicString FromAscii(const ::TStringBuf& s) {
return TBasicString().AppendAscii(s);
}
- static TBasicString FromUtf8(const ::TStringBuf& s) {
+ static TBasicString FromUtf8(const ::TStringBuf& s) {
return TBasicString().AppendUtf8(s);
}
- static TBasicString FromUtf16(const ::TWtringBuf& s) {
+ static TBasicString FromUtf16(const ::TWtringBuf& s) {
return TBasicString().AppendUtf16(s);
}
@@ -532,8 +532,8 @@ public:
private:
template <typename... R>
- static size_t SumLength(const TBasicStringBuf<TCharType, TTraits> s1, const R&... r) noexcept {
- return s1.size() + SumLength(r...);
+ static size_t SumLength(const TBasicStringBuf<TCharType, TTraits> s1, const R&... r) noexcept {
+ return s1.size() + SumLength(r...);
}
template <typename... R>
@@ -546,9 +546,9 @@ private:
}
template <typename... R>
- static void CopyAll(TCharType* p, const TBasicStringBuf<TCharType, TTraits> s, const R&... r) {
+ static void CopyAll(TCharType* p, const TBasicStringBuf<TCharType, TTraits> s, const R&... r) {
TTraits::copy(p, s.data(), s.size());
- CopyAll(p + s.size(), r...);
+ CopyAll(p + s.size(), r...);
}
template <typename... R, class TNextCharType, typename = std::enable_if_t<std::is_same<TCharType, TNextCharType>::value>>
@@ -646,11 +646,11 @@ public:
return AssignNoAlias(b, e - b);
}
- TBasicString& AssignNoAlias(const TBasicStringBuf<TCharType, TTraits> s) {
- return AssignNoAlias(s.data(), s.size());
+ TBasicString& AssignNoAlias(const TBasicStringBuf<TCharType, TTraits> s) {
+ return AssignNoAlias(s.data(), s.size());
}
- TBasicString& AssignNoAlias(const TBasicStringBuf<TCharType, TTraits> s, size_t spos, size_t sn = TBase::npos) {
+ TBasicString& AssignNoAlias(const TBasicStringBuf<TCharType, TTraits> s, size_t spos, size_t sn = TBase::npos) {
return AssignNoAlias(s.SubString(spos, sn));
}
@@ -659,17 +659,17 @@ public:
* Certain invocations of this method will result in link-time error.
* You are free to implement corresponding methods in string.cpp if you need them.
*/
- auto AssignAscii(const ::TStringBuf& s) {
+ auto AssignAscii(const ::TStringBuf& s) {
clear();
return AppendAscii(s);
}
- auto AssignUtf8(const ::TStringBuf& s) {
+ auto AssignUtf8(const ::TStringBuf& s) {
clear();
return AppendUtf8(s);
}
- auto AssignUtf16(const ::TWtringBuf& s) {
+ auto AssignUtf16(const ::TWtringBuf& s) {
clear();
return AppendUtf16(s);
}
@@ -690,7 +690,7 @@ public:
return *this;
}
- TBasicString& operator=(const TBasicStringBuf<TCharType, TTraits> s) {
+ TBasicString& operator=(const TBasicStringBuf<TCharType, TTraits> s) {
return assign(s);
}
@@ -769,19 +769,19 @@ public:
return *this;
}
- TBasicString& AppendNoAlias(const TBasicStringBuf<TCharType, TTraits> s) {
- return AppendNoAlias(s.data(), s.size());
+ TBasicString& AppendNoAlias(const TBasicStringBuf<TCharType, TTraits> s) {
+ return AppendNoAlias(s.data(), s.size());
}
- TBasicString& AppendNoAlias(const TBasicStringBuf<TCharType, TTraits> s, size_t spos, size_t sn = TBase::npos) {
+ TBasicString& AppendNoAlias(const TBasicStringBuf<TCharType, TTraits> s, size_t spos, size_t sn = TBase::npos) {
return AppendNoAlias(s.SubString(spos, sn));
}
- TBasicString& append(const TBasicStringBuf<TCharType, TTraits> s) {
- return append(s.data(), s.size());
+ TBasicString& append(const TBasicStringBuf<TCharType, TTraits> s) {
+ return append(s.data(), s.size());
}
- TBasicString& append(const TBasicStringBuf<TCharType, TTraits> s, size_t spos, size_t sn = TBase::npos) {
+ TBasicString& append(const TBasicStringBuf<TCharType, TTraits> s, size_t spos, size_t sn = TBase::npos) {
return append(s.SubString(spos, sn));
}
@@ -794,11 +794,11 @@ public:
* Certain invocations of this method will result in link-time error.
* You are free to implement corresponding methods in string.cpp if you need them.
*/
- TBasicString& AppendAscii(const ::TStringBuf& s);
+ TBasicString& AppendAscii(const ::TStringBuf& s);
- TBasicString& AppendUtf8(const ::TStringBuf& s);
+ TBasicString& AppendUtf8(const ::TStringBuf& s);
- TBasicString& AppendUtf16(const ::TWtringBuf& s);
+ TBasicString& AppendUtf16(const ::TWtringBuf& s);
inline void push_back(TCharType c) {
// TODO
@@ -884,7 +884,7 @@ public:
return std::move(s1);
}
- friend TBasicString operator+(TBasicString&& s1, const TBasicStringBuf<TCharType, TTraits> s2) Y_WARN_UNUSED_RESULT {
+ friend TBasicString operator+(TBasicString&& s1, const TBasicStringBuf<TCharType, TTraits> s2) Y_WARN_UNUSED_RESULT {
s1 += s2;
return std::move(s1);
}
@@ -907,7 +907,7 @@ public:
return Join(s1, s2);
}
- friend TBasicString operator+(const TBasicString& s1, const TBasicStringBuf<TCharType, TTraits> s2) Y_WARN_UNUSED_RESULT {
+ friend TBasicString operator+(const TBasicString& s1, const TBasicStringBuf<TCharType, TTraits> s2) Y_WARN_UNUSED_RESULT {
return Join(s1, s2);
}
@@ -916,7 +916,7 @@ public:
}
friend TBasicString operator+(const TBasicString& s1, TCharType s2) Y_WARN_UNUSED_RESULT {
- return Join(s1, TBasicStringBuf<TCharType, TTraits>(&s2, 1));
+ return Join(s1, TBasicStringBuf<TCharType, TTraits>(&s2, 1));
}
friend TBasicString operator+(const TCharType* s1, TBasicString&& s2) Y_WARN_UNUSED_RESULT {
@@ -924,12 +924,12 @@ public:
return std::move(s2);
}
- friend TBasicString operator+(const TBasicStringBuf<TCharType, TTraits> s1, TBasicString&& s2) Y_WARN_UNUSED_RESULT {
+ friend TBasicString operator+(const TBasicStringBuf<TCharType, TTraits> s1, TBasicString&& s2) Y_WARN_UNUSED_RESULT {
s2.prepend(s1);
return std::move(s2);
}
- friend TBasicString operator+(const TBasicStringBuf<TCharType, TTraits> s1, const TBasicString& s2) Y_WARN_UNUSED_RESULT {
+ friend TBasicString operator+(const TBasicStringBuf<TCharType, TTraits> s1, const TBasicString& s2) Y_WARN_UNUSED_RESULT {
return Join(s1, s2);
}
@@ -976,7 +976,7 @@ public:
return *this;
}
- TBasicString& prepend(const TBasicStringBuf<TCharType, TTraits> s, size_t spos = 0, size_t sn = TBase::npos) {
+ TBasicString& prepend(const TBasicStringBuf<TCharType, TTraits> s, size_t spos = 0, size_t sn = TBase::npos) {
return insert(0, s, spos, sn);
}
@@ -1029,7 +1029,7 @@ public:
return this->insert(pos, 1, ch);
}
- TBasicString& insert(size_t pos, const TBasicStringBuf<TCharType, TTraits> s, size_t spos = 0, size_t sn = TBase::npos) {
+ TBasicString& insert(size_t pos, const TBasicStringBuf<TCharType, TTraits> s, size_t spos = 0, size_t sn = TBase::npos) {
MutRef().insert(pos, s, spos, sn);
return *this;
diff --git a/util/str_stl.h b/util/str_stl.h
index f1e137181d..4b98c82ee1 100644
--- a/util/str_stl.h
+++ b/util/str_stl.h
@@ -23,8 +23,8 @@ namespace std {
bool operator()(const char* x, const char* y) const {
return strcmp(x, y) == 0;
}
- bool operator()(const char* x, const TStringBuf y) const {
- return strlen(x) == y.size() && memcmp(x, y.data(), y.size()) == 0;
+ bool operator()(const char* x, const TStringBuf y) const {
+ return strlen(x) == y.size() && memcmp(x, y.data(), y.size()) == 0;
}
using is_transparent = void;
};
diff --git a/util/stream/output.cpp b/util/stream/output.cpp
index db81b81b70..6eab28d41b 100644
--- a/util/stream/output.cpp
+++ b/util/stream/output.cpp
@@ -115,18 +115,18 @@ void Out<std::u32string_view>(IOutputStream& o, const std::u32string_view& p) {
}
template <>
-void Out<TStringBuf>(IOutputStream& o, const TStringBuf& p) {
- o.Write(p.data(), p.length());
+void Out<TStringBuf>(IOutputStream& o, const TStringBuf& p) {
+ o.Write(p.data(), p.length());
}
template <>
-void Out<TWtringBuf>(IOutputStream& o, const TWtringBuf& p) {
- WriteString(o, p.data(), p.length());
+void Out<TWtringBuf>(IOutputStream& o, const TWtringBuf& p) {
+ WriteString(o, p.data(), p.length());
}
template <>
-void Out<TUtf32StringBuf>(IOutputStream& o, const TUtf32StringBuf& p) {
- WriteString(o, p.data(), p.length());
+void Out<TUtf32StringBuf>(IOutputStream& o, const TUtf32StringBuf& p) {
+ WriteString(o, p.data(), p.length());
}
template <>
diff --git a/util/string/ascii.cpp b/util/string/ascii.cpp
index 95edb95cc8..bec423539b 100644
--- a/util/string/ascii.cpp
+++ b/util/string/ascii.cpp
@@ -43,16 +43,16 @@ extern const unsigned char NPrivate::ASCII_LOWER[256] = {
};
// clang-format on
-int AsciiCompareIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept {
- if (s1.size() <= s2.size()) {
- if (int cmp = strnicmp(s1.data(), s2.data(), s1.size())) {
+int AsciiCompareIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept {
+ if (s1.size() <= s2.size()) {
+ if (int cmp = strnicmp(s1.data(), s2.data(), s1.size())) {
return cmp;
}
- return (s1.size() < s2.size()) ? -1 : 0;
+ return (s1.size() < s2.size()) ? -1 : 0;
}
- Y_ASSERT(s1.size() > s2.size());
- if (int cmp = strnicmp(s1.data(), s2.data(), s2.size())) {
+ Y_ASSERT(s1.size() > s2.size());
+ if (int cmp = strnicmp(s1.data(), s2.data(), s2.size())) {
return cmp;
}
return 1;
diff --git a/util/string/ascii.h b/util/string/ascii.h
index 10344384d3..ac63cafa66 100644
--- a/util/string/ascii.h
+++ b/util/string/ascii.h
@@ -179,8 +179,8 @@ static inline bool AsciiEqualsIgnoreCase(const char* s1, const char* s2) noexcep
*
* @return true iff @c s1 ans @c s2 are case-insensitively equal.
*/
-static inline bool AsciiEqualsIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept {
- return (s1.size() == s2.size()) && strnicmp(s1.data(), s2.data(), s1.size()) == 0;
+static inline bool AsciiEqualsIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept {
+ return (s1.size() == s2.size()) && strnicmp(s1.data(), s2.data(), s1.size()) == 0;
}
/**
@@ -222,8 +222,8 @@ Y_PURE_FUNCTION int AsciiCompareIgnoreCase(const TStringBuf s1, const TStringBuf
*
* @return true iff @c s2 are case-sensitively prefix of @c s1.
*/
-static inline bool AsciiHasPrefix(const TStringBuf s1, const TStringBuf s2) noexcept {
- return (s1.size() >= s2.size()) && memcmp(s1.data(), s2.data(), s2.size()) == 0;
+static inline bool AsciiHasPrefix(const TStringBuf s1, const TStringBuf s2) noexcept {
+ return (s1.size() >= s2.size()) && memcmp(s1.data(), s2.data(), s2.size()) == 0;
}
/**
@@ -232,8 +232,8 @@ static inline bool AsciiHasPrefix(const TStringBuf s1, const TStringBuf s2) noex
*
* @return true iff @c s2 are case-insensitively prefix of @c s1.
*/
-static inline bool AsciiHasPrefixIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept {
- return (s1.size() >= s2.size()) && strnicmp(s1.data(), s2.data(), s2.size()) == 0;
+static inline bool AsciiHasPrefixIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept {
+ return (s1.size() >= s2.size()) && strnicmp(s1.data(), s2.data(), s2.size()) == 0;
}
/**
@@ -242,6 +242,6 @@ static inline bool AsciiHasPrefixIgnoreCase(const TStringBuf s1, const TStringBu
*
* @return true iff @c s2 are case-insensitively suffix of @c s1.
*/
-static inline bool AsciiHasSuffixIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept {
- return (s1.size() >= s2.size()) && strnicmp((s1.data() + (s1.size() - s2.size())), s2.data(), s2.size()) == 0;
+static inline bool AsciiHasSuffixIgnoreCase(const TStringBuf s1, const TStringBuf s2) noexcept {
+ return (s1.size() >= s2.size()) && strnicmp((s1.data() + (s1.size() - s2.size())), s2.data(), s2.size()) == 0;
}
diff --git a/util/string/vector.cpp b/util/string/vector.cpp
index 9ba401f0a2..5bb5fbfe3b 100644
--- a/util/string/vector.cpp
+++ b/util/string/vector.cpp
@@ -5,12 +5,12 @@
#include <util/system/defaults.h>
template <class TConsumer, class TDelim, typename TChr>
-static inline void DoSplit2(TConsumer& c, TDelim& d, const TBasicStringBuf<TChr> str, int) {
- SplitString(str.data(), str.data() + str.size(), d, c);
+static inline void DoSplit2(TConsumer& c, TDelim& d, const TBasicStringBuf<TChr> str, int) {
+ SplitString(str.data(), str.data() + str.size(), d, c);
}
template <class TConsumer, class TDelim, typename TChr>
-static inline void DoSplit1(TConsumer& cc, TDelim& d, const TBasicStringBuf<TChr> str, int opts) {
+static inline void DoSplit1(TConsumer& cc, TDelim& d, const TBasicStringBuf<TChr> str, int opts) {
if (opts & KEEP_EMPTY_TOKENS) {
DoSplit2(cc, d, str, opts);
} else {
@@ -21,11 +21,11 @@ static inline void DoSplit1(TConsumer& cc, TDelim& d, const TBasicStringBuf<TChr
}
template <class C, class TDelim, typename TChr>
-static inline void DoSplit0(C* res, const TBasicStringBuf<TChr> str, TDelim& d, size_t maxFields, int options) {
+static inline void DoSplit0(C* res, const TBasicStringBuf<TChr> str, TDelim& d, size_t maxFields, int options) {
using TStringType = std::conditional_t<std::is_same<TChr, wchar16>::value, TUtf16String, TString>;
res->clear();
- if (!str.data()) {
+ if (!str.data()) {
return;
}
@@ -38,7 +38,7 @@ static inline void DoSplit0(C* res, const TBasicStringBuf<TChr> str, TDelim& d,
DoSplit1(lc, d, str, options);
if (lc.Last) {
- res->push_back(TStringType(lc.Last, str.data() + str.size() - lc.Last));
+ res->push_back(TStringType(lc.Last, str.data() + str.size() - lc.Last));
}
} else {
DoSplit1(cc, d, str, options);
@@ -64,19 +64,19 @@ static void SplitStringImplT(TVector<std::conditional_t<std::is_same<TChr, wchar
}
void ::NPrivate::SplitStringImpl(TVector<TString>* res, const char* ptr, const char* delim, size_t maxFields, int options) {
- return SplitStringImplT<char>(res, TStringBuf(ptr), delim, maxFields, options);
+ return SplitStringImplT<char>(res, TStringBuf(ptr), delim, maxFields, options);
}
void ::NPrivate::SplitStringImpl(TVector<TString>* res, const char* ptr, size_t len, const char* delim, size_t maxFields, int options) {
- return SplitStringImplT<char>(res, TStringBuf(ptr, len), delim, maxFields, options);
+ return SplitStringImplT<char>(res, TStringBuf(ptr, len), delim, maxFields, options);
}
void ::NPrivate::SplitStringImpl(TVector<TUtf16String>* res, const wchar16* ptr, const wchar16* delimiter, size_t maxFields, int options) {
- return SplitStringImplT<wchar16>(res, TWtringBuf(ptr), delimiter, maxFields, options);
+ return SplitStringImplT<wchar16>(res, TWtringBuf(ptr), delimiter, maxFields, options);
}
void ::NPrivate::SplitStringImpl(TVector<TUtf16String>* res, const wchar16* ptr, size_t len, const wchar16* delimiter, size_t maxFields, int options) {
- return SplitStringImplT<wchar16>(res, TWtringBuf(ptr, len), delimiter, maxFields, options);
+ return SplitStringImplT<wchar16>(res, TWtringBuf(ptr, len), delimiter, maxFields, options);
}
TUtf16String JoinStrings(const TVector<TUtf16String>& v, const TWtringBuf delim) {
diff --git a/util/system/fs_win.cpp b/util/system/fs_win.cpp
index a410ccac06..44a4c54935 100644
--- a/util/system/fs_win.cpp
+++ b/util/system/fs_win.cpp
@@ -91,7 +91,7 @@ namespace NFsPrivate {
if (linkDir) {
TString fullTarget(tName);
- resolvepath(fullTarget, TString{linkDir});
+ resolvepath(fullTarget, TString{linkDir});
TUtf16String fullTargetW;
LPCWSTR ptrFullTarget = UTF8ToWCHAR(fullTarget, fullTargetW);
attr = ::GetFileAttributesW(ptrFullTarget);