aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authoralbert <albert@yandex-team.ru>2022-02-10 16:48:14 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:14 +0300
commit9f25ef3232c288ca664ceee6c376cf64e4349a2e (patch)
treeb192eaf3150845f7302fafd460a972b0439d6fe5 /util
parent6a1e535429145ec1ecfbc5f1efd3c95323261fb5 (diff)
downloadydb-9f25ef3232c288ca664ceee6c376cf64e4349a2e.tar.gz
Restoring authorship annotation for <albert@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/charset/wide.h24
-rw-r--r--util/folder/dirut_ut.cpp6
-rw-r--r--util/generic/strbase.h42
-rw-r--r--util/generic/strbuf.cpp6
-rw-r--r--util/generic/strbuf.h216
-rw-r--r--util/generic/strbuf_ut.cpp48
-rw-r--r--util/generic/string.h90
-rw-r--r--util/generic/typetraits.h2
-rw-r--r--util/generic/yexception.h8
-rw-r--r--util/memory/tempbuf.cpp16
-rw-r--r--util/stream/format.h10
-rw-r--r--util/stream/mem.cpp4
-rw-r--r--util/stream/mem.h154
-rw-r--r--util/stream/output.h4
-rw-r--r--util/string/util.h16
-rw-r--r--util/system/atomic_ut.cpp142
-rw-r--r--util/system/cpu_id.cpp18
-rw-r--r--util/system/file_ut.cpp4
-rw-r--r--util/system/maxlen.h8
-rw-r--r--util/system/platform.h2
-rw-r--r--util/system/tls.h78
21 files changed, 449 insertions, 449 deletions
diff --git a/util/charset/wide.h b/util/charset/wide.h
index 04e6928aab..dd662373c2 100644
--- a/util/charset/wide.h
+++ b/util/charset/wide.h
@@ -185,10 +185,10 @@ inline bool WriteSymbol(wchar32 s, wchar16*& dest, const wchar16* destEnd) noexc
}
inline size_t WriteSymbol(wchar32 s, wchar32*& dest) noexcept {
- *(dest++) = s;
- return 1;
-}
-
+ *(dest++) = s;
+ return 1;
+}
+
inline bool WriteSymbol(wchar32 s, wchar32*& dest, const wchar32* destEnd) noexcept {
Y_ASSERT(dest < destEnd);
@@ -299,11 +299,11 @@ namespace NDetail {
}
//! @return len if robust and position where encoding stopped if not
-template <bool robust, typename TCharType>
+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);
const unsigned char* last = cur + len;
- TCharType* p = dest;
+ TCharType* p = dest;
#ifdef _sse_ //can't check for sse4, as we build most of arcadia without sse4 support even on platforms that support it
if (cur + 16 <= last && NX86::CachedHaveSSE41()) {
::NDetail::UTF8ToWideImplSSE41(cur, last, p);
@@ -315,8 +315,8 @@ inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size
return cur - reinterpret_cast<const unsigned char*>(text);
}
-template <typename TCharType>
-inline size_t UTF8ToWideImpl(const char* text, size_t len, TCharType* dest, size_t& written) {
+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);
}
@@ -332,7 +332,7 @@ inline TUtf16String UTF8ToWide(const char* text, size_t len) {
return w;
}
-template <bool robust, typename TCharType>
+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;
}
@@ -341,7 +341,7 @@ inline bool UTF8ToWide(const char* text, size_t len, TCharType* dest, size_t& wr
//! @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>
+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);
}
@@ -659,10 +659,10 @@ inline TUtf32String ASCIIToUTF32(const TStringBuf s) {
}
//! returns @c true if string contains whitespace characters only
-inline bool IsSpace(const wchar16* s, size_t n) {
+inline bool IsSpace(const wchar16* s, size_t n) {
if (n == 0)
return false;
-
+
Y_ASSERT(s);
const wchar16* const e = s + n;
diff --git a/util/folder/dirut_ut.cpp b/util/folder/dirut_ut.cpp
index 45ebfc842c..ba6a569073 100644
--- a/util/folder/dirut_ut.cpp
+++ b/util/folder/dirut_ut.cpp
@@ -70,16 +70,16 @@ Y_UNIT_TEST_SUITE(TDirutTest) {
#else
DoTest("bar", "/foo/baz", "/foo/bar");
DoTest("/foo/bar", "/bar/baz", "/foo/bar");
-
+
#ifdef NDEBUG
DoTest("bar", "./baz", "./bar");
#if 0 // should we support, for consistency, single-label dirs
DoTest("bar", "baz", "bar");
#endif
#endif
-#endif
+#endif
}
-
+
Y_UNIT_TEST(TestResolvePathRelative) {
TTempDir tempDir;
TTempBuf tempBuf;
diff --git a/util/generic/strbase.h b/util/generic/strbase.h
index ab39fc7537..e6bdf8e9b1 100644
--- a/util/generic/strbase.h
+++ b/util/generic/strbase.h
@@ -132,9 +132,9 @@ public:
}
inline size_t IterOff(const_iterator it) const noexcept {
- return begin() <= it && end() > it ? size_t(it - begin()) : npos;
- }
-
+ return begin() <= it && end() > it ? size_t(it - begin()) : npos;
+ }
+
inline const_iterator begin() const noexcept {
return Ptr();
}
@@ -197,26 +197,26 @@ public:
return !empty();
}
-public: // style-guide compliant methods
+public: // style-guide compliant methods
constexpr const TCharType* Data() const noexcept {
- return Ptr();
- }
-
+ return Ptr();
+ }
+
constexpr size_t Size() const noexcept {
- return Len();
- }
-
+ return Len();
+ }
+
Y_PURE_FUNCTION constexpr bool Empty() const noexcept {
- return 0 == Len();
- }
-
+ 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);
}
-public:
+public:
// ~~~ Comparison ~~~ : FAMILY0(int, compare)
static int compare(const TSelf& s1, const TSelf& s2) noexcept {
return s1.AsStringView().compare(s2.AsStringView());
@@ -469,8 +469,8 @@ public:
return npos;
}
return AsStringView().rfind(c, pos - 1);
- }
-
+ }
+
inline size_t rfind(const TStringView str, size_t pos = npos) const {
return AsStringView().rfind(str.data(), pos, str.size());
}
@@ -549,7 +549,7 @@ public:
}
inline size_t copy(TCharType* pc, size_t n, size_t pos) const {
- if (pos > Len()) {
+ if (pos > Len()) {
throw std::out_of_range("TStringBase::copy");
}
@@ -557,16 +557,16 @@ public:
}
inline size_t copy(TCharType* pc, size_t n) const noexcept {
- return CopyImpl(pc, n, 0);
+ return CopyImpl(pc, n, 0);
}
inline size_t strcpy(TCharType* pc, size_t n) const noexcept {
if (n) {
- n = copy(pc, n - 1);
- pc[n] = 0;
+ n = copy(pc, n - 1);
+ pc[n] = 0;
}
- return n;
+ return n;
}
inline TDerived copy() const Y_WARN_UNUSED_RESULT {
diff --git a/util/generic/strbuf.cpp b/util/generic/strbuf.cpp
index 668602ca16..2845c1e220 100644
--- a/util/generic/strbuf.cpp
+++ b/util/generic/strbuf.cpp
@@ -1,8 +1,8 @@
#include "strbuf.h"
-
-#include <util/stream/output.h>
+
+#include <util/stream/output.h>
#include <ostream>
-
+
std::ostream& operator<<(std::ostream& os, TStringBuf buf) {
os.write(buf.data(), buf.size());
return os;
diff --git a/util/generic/strbuf.h b/util/generic/strbuf.h
index 70b9360d58..a794baa72d 100644
--- a/util/generic/strbuf.h
+++ b/util/generic/strbuf.h
@@ -16,8 +16,8 @@ private:
using TdSelf = TBasicStringBuf;
using TBase = TStringBase<TdSelf, TCharType, TTraits>;
using TStringView = std::basic_string_view<TCharType>;
-
-public:
+
+public:
using char_type = TCharType; // TODO: DROP
using traits_type = TTraits;
@@ -99,8 +99,8 @@ public:
constexpr inline TBasicStringBuf(const TCharType* data, size_t size) noexcept
: TStringView(data, size)
- {
- }
+ {
+ }
constexpr TBasicStringBuf(const TCharType* data) noexcept
/*
@@ -108,26 +108,26 @@ public:
* while std::string_view (using std::char_traits) will abort in such case
*/
: TStringView(data, TBase::StrLen(data))
- {
- }
+ {
+ }
constexpr inline TBasicStringBuf(const TCharType* beg, const TCharType* end) noexcept
: TStringView(beg, end - beg)
{
}
-
+
template <typename D, typename T>
inline TBasicStringBuf(const TStringBase<D, TCharType, T>& str) noexcept
: TStringView(str.data(), str.size())
- {
- }
+ {
+ }
- template <typename T, typename A>
+ template <typename T, typename A>
inline TBasicStringBuf(const std::basic_string<TCharType, T, A>& str) noexcept
: TStringView(str)
- {
- }
-
+ {
+ }
+
template <typename TCharTraits>
constexpr TBasicStringBuf(std::basic_string_view<TCharType, TCharTraits> view) noexcept
: TStringView(view)
@@ -143,12 +143,12 @@ public:
*
* This means, that a class with default ctor can not be a constant member of another class with default ctor.
*/
- }
+ }
inline TBasicStringBuf(const TBasicStringBuf& src, size_t pos, size_t n) noexcept
: TBasicStringBuf(src)
{
- Skip(pos).Trunc(n);
+ Skip(pos).Trunc(n);
}
inline TBasicStringBuf(const TBasicStringBuf& src, size_t pos) noexcept
@@ -162,14 +162,14 @@ public:
return TBasicStringBuf(data() + pos, n);
}
-public:
- void Clear() {
- *this = TdSelf();
- }
-
+public:
+ void Clear() {
+ *this = TdSelf();
+ }
+
constexpr bool IsInited() const noexcept {
return data() != nullptr;
- }
+ }
public:
/**
@@ -184,8 +184,8 @@ public:
* @returns Whether the split was actually performed.
*/
inline bool TrySplit(TCharType delim, TdSelf& l, TdSelf& r) const noexcept {
- return TrySplitOn(TBase::find(delim), l, r);
- }
+ return TrySplitOn(TBase::find(delim), l, r);
+ }
/**
* Tries to split string in two parts using given delimiter character.
@@ -199,8 +199,8 @@ public:
* @returns Whether the split was actually performed.
*/
inline bool TryRSplit(TCharType delim, TdSelf& l, TdSelf& r) const noexcept {
- return TrySplitOn(TBase::rfind(delim), l, r);
- }
+ return TrySplitOn(TBase::rfind(delim), l, r);
+ }
/**
* Tries to split string in two parts using given delimiter sequence.
@@ -234,11 +234,11 @@ public:
inline void Split(TCharType delim, TdSelf& l, TdSelf& r) const noexcept {
SplitTemplate(delim, l, r);
- }
-
+ }
+
inline void RSplit(TCharType delim, TdSelf& l, TdSelf& r) const noexcept {
RSplitTemplate(delim, l, r);
- }
+ }
inline void Split(TdSelf delim, TdSelf& l, TdSelf& r) const noexcept {
SplitTemplate(delim, l, r);
@@ -249,14 +249,14 @@ public:
}
private:
- // splits on a delimiter at a given position; delimiter is excluded
+ // splits on a delimiter at a given position; delimiter is excluded
void DoSplitOn(size_t pos, TdSelf& l, TdSelf& r, size_t len) const noexcept {
Y_ASSERT(pos != TBase::npos);
- // make a copy in case one of l/r is really *this
+ // make a copy in case one of l/r is really *this
const TdSelf tok = SubStr(pos + len);
- l = Head(pos);
- r = tok;
+ l = Head(pos);
+ r = tok;
}
public:
@@ -268,39 +268,39 @@ public:
// s.TrySplitOn(s.find('z'), ...) is false, but s.TrySplitOn(100500, ...) is true.
bool TrySplitOn(size_t pos, TdSelf& l, TdSelf& r, size_t len = 1) const noexcept {
- if (TBase::npos == pos)
- return false;
+ if (TBase::npos == pos)
+ return false;
DoSplitOn(pos, l, r, len);
- return true;
- }
-
+ return true;
+ }
+
void SplitOn(size_t pos, TdSelf& l, TdSelf& r, size_t len = 1) const noexcept {
if (!TrySplitOn(pos, l, r, len)) {
- l = *this;
- r = TdSelf();
+ l = *this;
+ r = TdSelf();
}
- }
+ }
bool TrySplitAt(size_t pos, TdSelf& l, TdSelf& r) const noexcept {
return TrySplitOn(pos, l, r, 0);
- }
-
+ }
+
void SplitAt(size_t pos, TdSelf& l, TdSelf& r) const noexcept {
SplitOn(pos, l, r, 0);
- }
-
+ }
+
/*
// Not implemented intentionally, use TrySplitOn() instead
void RSplitOn(size_t pos, TdSelf& l, TdSelf& r) const noexcept;
void RSplitAt(size_t pos, TdSelf& l, TdSelf& r) const noexcept;
*/
-
+
public:
Y_PURE_FUNCTION inline TdSelf After(TCharType c) const noexcept {
- TdSelf l, r;
+ TdSelf l, r;
return TrySplit(c, l, r) ? r : *this;
- }
+ }
Y_PURE_FUNCTION inline TdSelf Before(TCharType c) const noexcept {
TdSelf l, r;
@@ -308,10 +308,10 @@ public:
}
Y_PURE_FUNCTION inline TdSelf RAfter(TCharType c) const noexcept {
- TdSelf l, r;
+ TdSelf l, r;
return TryRSplit(c, l, r) ? r : *this;
- }
-
+ }
+
Y_PURE_FUNCTION inline TdSelf RBefore(TCharType c) const noexcept {
TdSelf l, r;
return TryRSplit(c, l, r) ? l : *this;
@@ -346,43 +346,43 @@ public:
public:
// returns tail, including pos
- TdSelf SplitOffAt(size_t pos) {
- const TdSelf tok = SubStr(pos);
- Trunc(pos);
- return tok;
- }
-
+ TdSelf SplitOffAt(size_t pos) {
+ const TdSelf tok = SubStr(pos);
+ Trunc(pos);
+ return tok;
+ }
+
// returns head, tail includes pos
- TdSelf NextTokAt(size_t pos) {
- const TdSelf tok = Head(pos);
- Skip(pos);
- return tok;
- }
-
- TdSelf SplitOffOn(size_t pos) {
- TdSelf tok;
- SplitOn(pos, *this, tok);
- return tok;
- }
-
- TdSelf NextTokOn(size_t pos) {
- TdSelf tok;
- SplitOn(pos, tok, *this);
- return tok;
- }
+ TdSelf NextTokAt(size_t pos) {
+ const TdSelf tok = Head(pos);
+ Skip(pos);
+ return tok;
+ }
+
+ TdSelf SplitOffOn(size_t pos) {
+ TdSelf tok;
+ SplitOn(pos, *this, tok);
+ return tok;
+ }
+
+ TdSelf NextTokOn(size_t pos) {
+ TdSelf tok;
+ SplitOn(pos, tok, *this);
+ return tok;
+ }
/*
// See comment on RSplitOn() above
TdSelf RSplitOffOn(size_t pos);
TdSelf RNextTokOn(size_t pos);
*/
-
+
public:
TdSelf SplitOff(TCharType delim) {
- TdSelf tok;
- Split(delim, *this, tok);
- return tok;
- }
-
+ TdSelf tok;
+ Split(delim, *this, tok);
+ return tok;
+ }
+
TdSelf RSplitOff(TCharType delim) {
TdSelf tok;
RSplit(delim, tok, *this);
@@ -419,8 +419,8 @@ public:
TdSelf NextTok(TCharType delim) {
return NextTokTemplate(delim);
- }
-
+ }
+
TdSelf RNextTok(TCharType delim) {
return RNextTokTemplate(delim);
}
@@ -433,29 +433,29 @@ public:
return RNextTokTemplate(delim);
}
-public: // string subsequences
+public: // string subsequences
/// Cut last @c shift characters (or less if length is less than @c shift)
inline TdSelf& Chop(size_t shift) noexcept {
this->remove_suffix(std::min(shift, size()));
- return *this;
- }
+ return *this;
+ }
/// Cut first @c shift characters (or less if length is less than @c shift)
inline TdSelf& Skip(size_t shift) noexcept {
this->remove_prefix(std::min(shift, size()));
- return *this;
- }
+ return *this;
+ }
/// Sets the start pointer to a position relative to the end
inline TdSelf& RSeek(size_t tailSize) noexcept {
if (size() > tailSize) {
//WARN: removing TStringView:: will lead to an infinite recursion
*this = TStringView::substr(size() - tailSize, tailSize);
- }
-
- return *this;
- }
-
+ }
+
+ return *this;
+ }
+
// coverity[exn_spec_violation]
inline TdSelf& Trunc(size_t targetSize) noexcept {
// Coverity false positive issue
@@ -463,30 +463,30 @@ public: // string subsequences
// fun_call_w_exception: Called function TStringView::substr throws an exception of type "std::out_of_range".
// Suppress this issue because we pass argument pos=0 and string_view can't throw std::out_of_range.
*this = TStringView::substr(0, targetSize); //WARN: removing TStringView:: will lead to an infinite recursion
- return *this;
- }
+ return *this;
+ }
Y_PURE_FUNCTION inline TdSelf SubStr(size_t beg) const noexcept {
- return TdSelf(*this).Skip(beg);
- }
+ return TdSelf(*this).Skip(beg);
+ }
Y_PURE_FUNCTION inline TdSelf SubStr(size_t beg, size_t len) const noexcept {
- return SubStr(beg).Trunc(len);
- }
-
+ return SubStr(beg).Trunc(len);
+ }
+
Y_PURE_FUNCTION inline TdSelf Head(size_t pos) const noexcept {
- return TdSelf(*this).Trunc(pos);
- }
-
+ return TdSelf(*this).Trunc(pos);
+ }
+
Y_PURE_FUNCTION inline TdSelf Tail(size_t pos) const noexcept {
- return SubStr(pos);
- }
-
+ return SubStr(pos);
+ }
+
Y_PURE_FUNCTION inline TdSelf Last(size_t len) const noexcept {
- return TdSelf(*this).RSeek(len);
- }
-
-private:
+ return TdSelf(*this).RSeek(len);
+ }
+
+private:
template <typename TDelimiterType>
TdSelf NextTokTemplate(TDelimiterType delim) {
TdSelf tok;
diff --git a/util/generic/strbuf_ut.cpp b/util/generic/strbuf_ut.cpp
index 69cde785af..e155946ea2 100644
--- a/util/generic/strbuf_ut.cpp
+++ b/util/generic/strbuf_ut.cpp
@@ -10,10 +10,10 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {
UNIT_ASSERT_EQUAL(*str.data(), 'q');
UNIT_ASSERT_EQUAL(str.size(), 6);
-
+
TStringBuf str1("qwe\0rty"sv);
- TStringBuf str2(str1.data());
- UNIT_ASSERT_VALUES_UNEQUAL(str1, str2);
+ TStringBuf str2(str1.data());
+ UNIT_ASSERT_VALUES_UNEQUAL(str1, str2);
UNIT_ASSERT_VALUES_EQUAL(str1.size(), 7);
UNIT_ASSERT_VALUES_EQUAL(str2.size(), 3);
@@ -139,33 +139,33 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {
UNIT_ASSERT(TStringBuf().empty());
UNIT_ASSERT(!TStringBuf("q").empty());
}
-
+
Y_UNIT_TEST(TestShift) {
- TStringBuf qw("qwerty");
- TStringBuf str;
-
- str = qw;
- str.Chop(10);
+ TStringBuf qw("qwerty");
+ TStringBuf str;
+
+ str = qw;
+ str.Chop(10);
UNIT_ASSERT(str.empty());
-
- str = qw;
+
+ str = qw;
UNIT_ASSERT_EQUAL(str.SubStr(2), TStringBuf("erty"));
UNIT_ASSERT_EQUAL(str.Skip(3), qw.SubStr(3));
- str.Chop(1);
+ str.Chop(1);
UNIT_ASSERT_EQUAL(str, TStringBuf("rt"));
- }
-
+ }
+
Y_UNIT_TEST(TestSplit) {
- TStringBuf qw("qwerty");
- TStringBuf lt, rt;
-
- rt = qw;
- lt = rt.NextTok('r');
+ TStringBuf qw("qwerty");
+ TStringBuf lt, rt;
+
+ rt = qw;
+ lt = rt.NextTok('r');
UNIT_ASSERT_EQUAL(lt, TStringBuf("qwe"));
UNIT_ASSERT_EQUAL(rt, TStringBuf("ty"));
-
- lt = qw;
- rt = lt.SplitOff('r');
+
+ lt = qw;
+ rt = lt.SplitOff('r');
UNIT_ASSERT_EQUAL(lt, TStringBuf("qwe"));
UNIT_ASSERT_EQUAL(rt, TStringBuf("ty"));
@@ -174,8 +174,8 @@ Y_UNIT_TEST_SUITE(TStrBufTest) {
TStringBuf ty = rt.NextTok('r'); // no 'r' in "ty"
UNIT_ASSERT_EQUAL(rt.size(), 0);
UNIT_ASSERT_EQUAL(ty, TStringBuf("ty"));
- }
-
+ }
+
Y_UNIT_TEST(TestNextTok) {
TStringBuf buf("12q45q");
TStringBuf tok;
diff --git a/util/generic/string.h b/util/generic/string.h
index 8cd8aa6917..9829891afe 100644
--- a/util/generic/string.h
+++ b/util/generic/string.h
@@ -248,7 +248,7 @@ public:
return StdStr();
#endif
- }
+ }
inline const_reference operator[](size_t pos) const noexcept {
Y_ASSERT(pos <= length());
@@ -362,8 +362,8 @@ public:
#else
return 1 == RefCount();
#endif
- }
-
+ }
+
// ~~~ Size and capacity ~~~
TBasicString& resize(size_t n, TCharType c = ' ') { // remove or append
MutRef().resize(n, c);
@@ -500,9 +500,9 @@ public:
explicit TBasicString(const TBasicStringBuf<TCharType, TTraits> s)
: TBasicString(s.data(), s.size())
- {
- }
-
+ {
+ }
+
template <typename Traits>
explicit inline TBasicString(const std::basic_string_view<TCharType, Traits>& s)
: TBasicString(s.data(), s.size())
@@ -648,12 +648,12 @@ public:
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) {
- return AssignNoAlias(s.SubString(spos, sn));
- }
-
+ return AssignNoAlias(s.SubString(spos, sn));
+ }
+
/**
* WARN:
* Certain invocations of this method will result in link-time error.
@@ -675,9 +675,9 @@ public:
}
TBasicString& operator=(const TBasicString& s) {
- return assign(s);
- }
-
+ return assign(s);
+ }
+
TBasicString& operator=(TBasicString&& s) noexcept {
swap(s);
return *this;
@@ -691,18 +691,18 @@ public:
}
TBasicString& operator=(const TBasicStringBuf<TCharType, TTraits> s) {
- return assign(s);
- }
-
+ return assign(s);
+ }
+
TBasicString& operator=(std::initializer_list<TCharType> il) {
return assign(il.begin(), il.end());
}
TBasicString& operator=(const TCharType* s) {
- return assign(s);
- }
+ return assign(s);
+ }
TBasicString& operator=(std::nullptr_t) = delete;
-
+
TBasicString& operator=(TExplicitType<TCharType> ch) {
return assign(ch);
}
@@ -771,20 +771,20 @@ public:
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) {
- return AppendNoAlias(s.SubString(spos, sn));
- }
-
+ 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, size_t spos, size_t sn = TBase::npos) {
- return append(s.SubString(spos, sn));
- }
-
+ return append(s.SubString(spos, sn));
+ }
+
TBasicString& append(const TCharType* pc, size_t pos, size_t n, size_t pc_len = TBase::npos) {
return append(pc + pos, Min(n, pc_len - pos));
}
@@ -882,8 +882,8 @@ public:
#endif
s1 += s2;
return std::move(s1);
- }
-
+ }
+
friend TBasicString operator+(TBasicString&& s1, const TBasicStringBuf<TCharType, TTraits> s2) Y_WARN_UNUSED_RESULT {
s1 += s2;
return std::move(s1);
@@ -968,8 +968,8 @@ public:
MutRef().insert(size_t(0), n, c);
return *this;
- }
-
+ }
+
TBasicString& prepend(TCharType c) {
MutRef().insert(size_t(0), 1, c);
@@ -977,9 +977,9 @@ public:
}
TBasicString& prepend(const TBasicStringBuf<TCharType, TTraits> s, size_t spos = 0, size_t sn = TBase::npos) {
- return insert(0, s, spos, sn);
- }
-
+ return insert(0, s, spos, sn);
+ }
+
// ~~~ Insertion ~~~ : FAMILY1(TBasicString&, insert, size_t pos);
TBasicString& insert(size_t pos, const TBasicString& s) {
MutRef().insert(pos, s.ConstRef());
@@ -1033,8 +1033,8 @@ public:
MutRef().insert(pos, s, spos, sn);
return *this;
- }
-
+ }
+
// ~~~ Removing ~~~
TBasicString& remove(size_t pos, size_t n) Y_NOEXCEPT {
if (pos < length()) {
@@ -1097,14 +1097,14 @@ public:
MutRef().replace(pos, n, s, len);
return *this;
- }
-
+ }
+
TBasicString& replace(size_t pos, size_t n, const TCharType* s, size_t spos, size_t sn) Y_NOEXCEPT {
MutRef().replace(pos, n, s + spos, sn - spos);
return *this;
- }
-
+ }
+
TBasicString& replace(size_t pos, size_t n1, size_t n2, TCharType c) Y_NOEXCEPT {
MutRef().replace(pos, n1, n2, c);
@@ -1113,7 +1113,7 @@ public:
TBasicString& replace(size_t pos, size_t n, const TBasicStringBuf<TCharType, TTraits> s, size_t spos = 0, size_t sn = TBase::npos) Y_NOEXCEPT {
MutRef().replace(pos, n, s, spos, sn);
-
+
return *this;
}
@@ -1131,7 +1131,7 @@ public:
*/
TBasicString Quote() const {
extern TBasicString EscapeC(const TBasicString&);
-
+
return TBasicString() + '"' + EscapeC(*this) + '"';
}
diff --git a/util/generic/typetraits.h b/util/generic/typetraits.h
index d165bd1a06..5ca96f4df1 100644
--- a/util/generic/typetraits.h
+++ b/util/generic/typetraits.h
@@ -161,7 +161,7 @@ class TTypeTraits<void>: public TTypeTraitsBase<void> {};
template <class T> \
struct THas##name \
: TBaseHas##name<T, std::is_class<T>::value || std::is_union<T>::value> {}
-
+
#define Y_HAS_MEMBER_IMPL_1(name) Y_HAS_MEMBER_IMPL_2(name, name)
/* @def Y_HAS_MEMBER
diff --git a/util/generic/yexception.h b/util/generic/yexception.h
index b0c604e8c4..e73b517df5 100644
--- a/util/generic/yexception.h
+++ b/util/generic/yexception.h
@@ -57,7 +57,7 @@ namespace NPrivateException {
}
TStringBuf AsStrBuf() const;
-
+
private:
void ZeroTerminate() noexcept;
@@ -83,9 +83,9 @@ class yexception: public NPrivateException::yexception {
};
Y_DECLARE_OUT_SPEC(inline, yexception, stream, value) {
- stream << value.AsStrBuf();
-}
-
+ stream << value.AsStrBuf();
+}
+
class TSystemError: public yexception {
public:
TSystemError(int status)
diff --git a/util/memory/tempbuf.cpp b/util/memory/tempbuf.cpp
index 09a2d0f140..17bf3e8bd3 100644
--- a/util/memory/tempbuf.cpp
+++ b/util/memory/tempbuf.cpp
@@ -36,7 +36,7 @@ public:
const void* Data() const noexcept {
return Data_;
}
-
+
inline size_t Size() const noexcept {
return Size_;
}
@@ -57,7 +57,7 @@ public:
Y_ASSERT(off <= Size());
Offset_ = off;
}
-
+
inline void Proceed(size_t off) {
Y_ASSERT(off <= Left());
@@ -225,8 +225,8 @@ char* TTempBuf::Data() noexcept {
const char* TTempBuf::Data() const noexcept {
return static_cast<const char*>(Impl_->Data());
-}
-
+}
+
size_t TTempBuf::Size() const noexcept {
return Impl_->Size();
}
@@ -251,10 +251,10 @@ void TTempBuf::Reset() noexcept {
Impl_->Reset();
}
-void TTempBuf::SetPos(size_t off) {
- Impl_->SetPos(off);
-}
-
+void TTempBuf::SetPos(size_t off) {
+ Impl_->SetPos(off);
+}
+
char* TTempBuf::Proceed(size_t off) {
char* ptr = Current();
Impl_->Proceed(off);
diff --git a/util/stream/format.h b/util/stream/format.h
index b033208a1b..c17431f052 100644
--- a/util/stream/format.h
+++ b/util/stream/format.h
@@ -114,7 +114,7 @@ namespace NFormatPrivate {
if (str[0] == '-') {
stream << '-';
str.Skip(1);
- }
+ }
if (value.Flags & HF_ADDX) {
if (Base == 16) {
@@ -130,7 +130,7 @@ namespace NFormatPrivate {
stream << str;
return stream;
- }
+ }
template <typename Char, size_t Base>
struct TBaseText {
@@ -275,11 +275,11 @@ static constexpr ::NFormatPrivate::TUnsignedBaseNumber<T, 16> Hex(const T& value
* @param value Value to output.
* @param flags Output flags.
*/
-template <typename T>
+template <typename T>
static constexpr ::NFormatPrivate::TBaseNumber<T, 16> SHex(const T& value, const ENumberFormat flags = HF_FULL | HF_ADDX) noexcept {
return {value, flags};
-}
-
+}
+
/**
* Output manipulator similar to `std::setbase(2)`.
*
diff --git a/util/stream/mem.cpp b/util/stream/mem.cpp
index 22a3339e27..a91c90a305 100644
--- a/util/stream/mem.cpp
+++ b/util/stream/mem.cpp
@@ -52,11 +52,11 @@ void TMemoryOutput::DoUndo(size_t len) {
}
void TMemoryOutput::DoWrite(const void* buf, size_t len) {
- char* end = Buf_ + len;
+ char* end = Buf_ + len;
Y_ENSURE(end <= End_, TStringBuf("memory output stream exhausted"));
memcpy(Buf_, buf, len);
- Buf_ = end;
+ Buf_ = end;
}
void TMemoryOutput::DoWriteC(char c) {
diff --git a/util/stream/mem.h b/util/stream/mem.h
index 18a5d46772..038b1bf4c1 100644
--- a/util/stream/mem.h
+++ b/util/stream/mem.h
@@ -3,8 +3,8 @@
#include "zerocopy.h"
#include "zerocopy_output.h"
-#include <util/generic/strbuf.h>
-
+#include <util/generic/strbuf.h>
+
/**
* @addtogroup Streams_Memory
* @{
@@ -14,7 +14,7 @@
* Input stream that reads data from a memory block.
*/
class TMemoryInput: public IZeroCopyInputFastReadTo {
-public:
+public:
TMemoryInput() noexcept;
/**
@@ -57,31 +57,31 @@ public:
* @param len Size of the new memory block.
*/
void Reset(const void* buf, size_t len) noexcept {
- Buf_ = (const char*)buf;
- Len_ = len;
- }
+ Buf_ = (const char*)buf;
+ Len_ = len;
+ }
/**
* @returns Whether there is more data in the stream.
*/
bool Exhausted() const noexcept {
- return !Avail();
- }
+ return !Avail();
+ }
/**
* @returns Number of bytes available in the stream.
*/
size_t Avail() const noexcept {
- return Len_;
- }
+ return Len_;
+ }
/**
* @returns Current read position in the memory block
* used by this stream.
*/
const char* Buf() const noexcept {
- return Buf_;
- }
+ return Buf_;
+ }
/**
* Initializes this stream with a next chunk extracted from the given zero
@@ -94,22 +94,22 @@ public:
if (!Len_) {
Reset(nullptr, 0);
}
- }
+ }
-private:
+private:
size_t DoNext(const void** ptr, size_t len) override;
void DoUndo(size_t len) override;
-private:
- const char* Buf_;
- size_t Len_;
+private:
+ const char* Buf_;
+ size_t Len_;
};
/**
* Output stream that writes data to a memory block.
*/
class TMemoryOutput: public IZeroCopyOutput {
-public:
+public:
/**
* Constructs a stream that writes to the provided memory block. It's up
* to the user to make sure that the memory block doesn't get freed while
@@ -138,50 +138,50 @@ public:
*/
inline void Reset(void* buf, size_t len) noexcept {
Buf_ = static_cast<char*>(buf);
- End_ = Buf_ + len;
- }
+ End_ = Buf_ + len;
+ }
/**
* @returns Whether there is more space in the
* stream for writing.
*/
inline bool Exhausted() const noexcept {
- return !Avail();
- }
+ return !Avail();
+ }
/**
* @returns Number of bytes available for writing
* in the stream.
*/
inline size_t Avail() const noexcept {
- return End_ - Buf_;
- }
+ return End_ - Buf_;
+ }
/**
* @returns Current write position in the memory block
* used by this stream.
*/
inline char* Buf() const noexcept {
- return Buf_;
- }
+ return Buf_;
+ }
/**
* @returns Pointer to the end of the memory block
* used by this stream.
*/
- char* End() const {
- return End_;
- }
-
-private:
+ char* End() const {
+ return End_;
+ }
+
+private:
size_t DoNext(void** ptr) override;
void DoUndo(size_t len) override;
void DoWrite(const void* buf, size_t len) override;
void DoWriteC(char c) override;
-protected:
- char* Buf_;
- char* End_;
+protected:
+ char* Buf_;
+ char* End_;
};
/**
@@ -191,65 +191,65 @@ protected:
* @see TMemoryOutput
*/
class TMemoryWriteBuffer: public TMemoryOutput {
-public:
- TMemoryWriteBuffer(void* buf, size_t len)
- : TMemoryOutput(buf, len)
- , Beg_(Buf_)
+public:
+ TMemoryWriteBuffer(void* buf, size_t len)
+ : TMemoryOutput(buf, len)
+ , Beg_(Buf_)
{
}
-
- void Reset(void* buf, size_t len) {
- TMemoryOutput::Reset(buf, len);
- Beg_ = Buf_;
- }
-
- size_t Len() const {
- return Buf() - Beg();
- }
-
- size_t Empty() const {
- return Buf() == Beg();
- }
-
+
+ void Reset(void* buf, size_t len) {
+ TMemoryOutput::Reset(buf, len);
+ Beg_ = Buf_;
+ }
+
+ size_t Len() const {
+ return Buf() - Beg();
+ }
+
+ size_t Empty() const {
+ return Buf() == Beg();
+ }
+
/**
* @returns Data that has been written into this
* stream as a string.
*/
- TStringBuf Str() const {
- return TStringBuf(Beg(), Buf());
- }
-
- char* Beg() const {
- return Beg_;
- }
-
+ TStringBuf Str() const {
+ return TStringBuf(Beg(), Buf());
+ }
+
+ char* Beg() const {
+ return Beg_;
+ }
+
/**
* @param ptr New write position for this stream.
* Must be inside the memory block that
* this stream uses.
*/
- void SetPos(char* ptr) {
+ void SetPos(char* ptr) {
Y_ASSERT(Beg_ <= ptr);
- SetPosImpl(ptr);
- }
-
+ SetPosImpl(ptr);
+ }
+
/**
* @param pos New write position for this stream,
* relative to the beginning of the memory
* block that this stream uses.
*/
- void SetPos(size_t pos) {
- SetPosImpl(Beg_ + pos);
- }
-
-protected:
- void SetPosImpl(char* ptr) {
+ void SetPos(size_t pos) {
+ SetPosImpl(Beg_ + pos);
+ }
+
+protected:
+ void SetPosImpl(char* ptr) {
Y_ASSERT(End_ >= ptr);
- Buf_ = ptr;
- }
-
-protected:
- char* Beg_;
-};
-
+ Buf_ = ptr;
+ }
+
+protected:
+ char* Beg_;
+};
+
/** @} */
diff --git a/util/stream/output.h b/util/stream/output.h
index 00eef50b95..8a2f209116 100644
--- a/util/stream/output.h
+++ b/util/stream/output.h
@@ -82,7 +82,7 @@ public:
inline void Write(const TStringBuf st) {
Write(st.data(), st.size());
}
-
+
/**
* Writes several data blocks into this stream.
*
@@ -191,7 +191,7 @@ void Out(IOutputStream& out, typename TTypeTraits<T>::TFuncParam value);
#define Y_DECLARE_OUT_SPEC(MODIF, T, stream, value) \
template <> \
MODIF void Out<T>(IOutputStream & stream, TTypeTraits<T>::TFuncParam value)
-
+
template <>
inline void Out<const char*>(IOutputStream& o, const char* t) {
if (t) {
diff --git a/util/string/util.h b/util/string/util.h
index 0d77a5042b..b42a5f2050 100644
--- a/util/string/util.h
+++ b/util/string/util.h
@@ -102,19 +102,19 @@ public:
return cbrk(s) - s;
}
- size_t spn(const char* s, const char* e) const {
- return cbrk(s, e) - s;
- }
-
+ size_t spn(const char* s, const char* e) const {
+ return cbrk(s, e) - s;
+ }
+
/// Offset of the first character in table, like strcspn().
size_t cspn(const char* s) const {
return brk(s) - s;
}
- size_t cspn(const char* s, const char* e) const {
- return brk(s, e) - s;
- }
-
+ size_t cspn(const char* s, const char* e) const {
+ return brk(s, e) - s;
+ }
+
char* brk(char* s) const {
return const_cast<char*>(brk((const char*)s));
}
diff --git a/util/system/atomic_ut.cpp b/util/system/atomic_ut.cpp
index 07211ffba7..a0a0d60608 100644
--- a/util/system/atomic_ut.cpp
+++ b/util/system/atomic_ut.cpp
@@ -4,10 +4,10 @@
#include <util/generic/ylimits.h>
-template <typename TAtomic>
-class TAtomicTest
+template <typename TAtomic>
+class TAtomicTest
: public TTestBase {
- UNIT_TEST_SUITE(TAtomicTest);
+ UNIT_TEST_SUITE(TAtomicTest);
UNIT_TEST(TestAtomicInc1)
UNIT_TEST(TestAtomicInc2)
UNIT_TEST(TestAtomicGetAndInc)
@@ -24,30 +24,30 @@ class TAtomicTest
UNIT_TEST(TestCAS)
UNIT_TEST(TestGetAndCAS)
UNIT_TEST(TestLockUnlock)
- UNIT_TEST_SUITE_END();
-
-private:
- inline void TestLockUnlock() {
- TAtomic v = 0;
-
- UNIT_ASSERT(AtomicTryLock(&v));
- UNIT_ASSERT(!AtomicTryLock(&v));
- UNIT_ASSERT_VALUES_EQUAL(v, 1);
- AtomicUnlock(&v);
- UNIT_ASSERT_VALUES_EQUAL(v, 0);
- }
-
- inline void TestCAS() {
- TAtomic v = 0;
-
- UNIT_ASSERT(AtomicCas(&v, 1, 0));
- UNIT_ASSERT(!AtomicCas(&v, 1, 0));
- UNIT_ASSERT_VALUES_EQUAL(v, 1);
- UNIT_ASSERT(AtomicCas(&v, 0, 1));
- UNIT_ASSERT_VALUES_EQUAL(v, 0);
- UNIT_ASSERT(AtomicCas(&v, Max<intptr_t>(), 0));
- UNIT_ASSERT_VALUES_EQUAL(v, Max<intptr_t>());
- }
+ UNIT_TEST_SUITE_END();
+
+private:
+ inline void TestLockUnlock() {
+ TAtomic v = 0;
+
+ UNIT_ASSERT(AtomicTryLock(&v));
+ UNIT_ASSERT(!AtomicTryLock(&v));
+ UNIT_ASSERT_VALUES_EQUAL(v, 1);
+ AtomicUnlock(&v);
+ UNIT_ASSERT_VALUES_EQUAL(v, 0);
+ }
+
+ inline void TestCAS() {
+ TAtomic v = 0;
+
+ UNIT_ASSERT(AtomicCas(&v, 1, 0));
+ UNIT_ASSERT(!AtomicCas(&v, 1, 0));
+ UNIT_ASSERT_VALUES_EQUAL(v, 1);
+ UNIT_ASSERT(AtomicCas(&v, 0, 1));
+ UNIT_ASSERT_VALUES_EQUAL(v, 0);
+ UNIT_ASSERT(AtomicCas(&v, Max<intptr_t>(), 0));
+ UNIT_ASSERT_VALUES_EQUAL(v, Max<intptr_t>());
+ }
inline void TestGetAndCAS() {
TAtomic v = 0;
@@ -61,23 +61,23 @@ private:
UNIT_ASSERT_VALUES_EQUAL(v, Max<intptr_t>());
}
- inline void TestAtomicInc1() {
- TAtomic v = 0;
+ inline void TestAtomicInc1() {
+ TAtomic v = 0;
- UNIT_ASSERT(AtomicAdd(v, 1));
- UNIT_ASSERT_VALUES_EQUAL(v, 1);
- UNIT_ASSERT(AtomicAdd(v, 10));
- UNIT_ASSERT_VALUES_EQUAL(v, 11);
- }
+ UNIT_ASSERT(AtomicAdd(v, 1));
+ UNIT_ASSERT_VALUES_EQUAL(v, 1);
+ UNIT_ASSERT(AtomicAdd(v, 10));
+ UNIT_ASSERT_VALUES_EQUAL(v, 11);
+ }
- inline void TestAtomicInc2() {
- TAtomic v = 0;
+ inline void TestAtomicInc2() {
+ TAtomic v = 0;
- UNIT_ASSERT(AtomicIncrement(v));
- UNIT_ASSERT_VALUES_EQUAL(v, 1);
- UNIT_ASSERT(AtomicIncrement(v));
- UNIT_ASSERT_VALUES_EQUAL(v, 2);
- }
+ UNIT_ASSERT(AtomicIncrement(v));
+ UNIT_ASSERT_VALUES_EQUAL(v, 1);
+ UNIT_ASSERT(AtomicIncrement(v));
+ UNIT_ASSERT_VALUES_EQUAL(v, 2);
+ }
inline void TestAtomicGetAndInc() {
TAtomic v = 0;
@@ -88,14 +88,14 @@ private:
UNIT_ASSERT_VALUES_EQUAL(v, 2);
}
- inline void TestAtomicDec() {
- TAtomic v = 2;
+ inline void TestAtomicDec() {
+ TAtomic v = 2;
- UNIT_ASSERT(AtomicDecrement(v));
- UNIT_ASSERT_VALUES_EQUAL(v, 1);
- UNIT_ASSERT(!AtomicDecrement(v));
- UNIT_ASSERT_VALUES_EQUAL(v, 0);
- }
+ UNIT_ASSERT(AtomicDecrement(v));
+ UNIT_ASSERT_VALUES_EQUAL(v, 1);
+ UNIT_ASSERT(!AtomicDecrement(v));
+ UNIT_ASSERT_VALUES_EQUAL(v, 0);
+ }
inline void TestAtomicGetAndDec() {
TAtomic v = 2;
@@ -106,15 +106,15 @@ private:
UNIT_ASSERT_VALUES_EQUAL(v, 0);
}
- inline void TestAtomicAdd() {
- TAtomic v = 0;
-
- UNIT_ASSERT_VALUES_EQUAL(AtomicAdd(v, 1), 1);
- UNIT_ASSERT_VALUES_EQUAL(AtomicAdd(v, 2), 3);
- UNIT_ASSERT_VALUES_EQUAL(AtomicAdd(v, -4), -1);
- UNIT_ASSERT_VALUES_EQUAL(v, -1);
- }
+ inline void TestAtomicAdd() {
+ TAtomic v = 0;
+ UNIT_ASSERT_VALUES_EQUAL(AtomicAdd(v, 1), 1);
+ UNIT_ASSERT_VALUES_EQUAL(AtomicAdd(v, 2), 3);
+ UNIT_ASSERT_VALUES_EQUAL(AtomicAdd(v, -4), -1);
+ UNIT_ASSERT_VALUES_EQUAL(v, -1);
+ }
+
inline void TestAtomicGetAndAdd() {
TAtomic v = 0;
@@ -125,13 +125,13 @@ private:
}
inline void TestAtomicSub() {
- TAtomic v = 4;
+ TAtomic v = 4;
- UNIT_ASSERT_VALUES_EQUAL(AtomicSub(v, 1), 3);
- UNIT_ASSERT_VALUES_EQUAL(AtomicSub(v, 2), 1);
- UNIT_ASSERT_VALUES_EQUAL(AtomicSub(v, 3), -2);
- UNIT_ASSERT_VALUES_EQUAL(v, -2);
- }
+ UNIT_ASSERT_VALUES_EQUAL(AtomicSub(v, 1), 3);
+ UNIT_ASSERT_VALUES_EQUAL(AtomicSub(v, 2), 1);
+ UNIT_ASSERT_VALUES_EQUAL(AtomicSub(v, 3), -2);
+ UNIT_ASSERT_VALUES_EQUAL(v, -2);
+ }
inline void TestAtomicGetAndSub() {
TAtomic v = 4;
@@ -142,15 +142,15 @@ private:
UNIT_ASSERT_VALUES_EQUAL(v, -2);
}
- inline void TestAtomicSwap() {
- TAtomic v = 0;
+ inline void TestAtomicSwap() {
+ TAtomic v = 0;
UNIT_ASSERT_VALUES_EQUAL(AtomicSwap(&v, 3), 0);
UNIT_ASSERT_VALUES_EQUAL(AtomicSwap(&v, 5), 3);
UNIT_ASSERT_VALUES_EQUAL(AtomicSwap(&v, -7), 5);
UNIT_ASSERT_VALUES_EQUAL(AtomicSwap(&v, Max<intptr_t>()), -7);
- UNIT_ASSERT_VALUES_EQUAL(v, Max<intptr_t>());
- }
+ UNIT_ASSERT_VALUES_EQUAL(v, Max<intptr_t>());
+ }
inline void TestAtomicOr() {
TAtomic v = 0xf0;
@@ -191,26 +191,26 @@ private:
UNIT_TEST_SUITE_REGISTRATION(TAtomicTest<TAtomic>);
#ifndef _MSC_VER
-// chooses type *other than* T1
+// chooses type *other than* T1
template <typename T1, typename T2, typename T3>
struct TChooser {
using TdType = T2;
-};
+};
template <typename T1, typename T2>
struct TChooser<T1, T1, T2> {
using TdType = T2;
-};
+};
template <typename T1>
struct TChooser<T1, T1, T1> {};
-
+
#if defined(__IOS__) && defined(_32_)
using TAltAtomic = int;
#else
using TAltAtomic = volatile TChooser<TAtomicBase, long, long long>::TdType;
#endif
-
+
class TTTest: public TAtomicTest<TAltAtomic> {
public:
TString Name() const noexcept override {
diff --git a/util/system/cpu_id.cpp b/util/system/cpu_id.cpp
index 598c71f4d9..0ae06b2868 100644
--- a/util/system/cpu_id.cpp
+++ b/util/system/cpu_id.cpp
@@ -60,8 +60,8 @@ bool NX86::CpuId(ui32 op, ui32* res) noexcept {
return false;
#endif
-}
-
+}
+
namespace {
union TX86CpuInfo {
ui32 Info[4];
@@ -80,11 +80,11 @@ namespace {
inline TX86CpuInfo(ui32 op, ui32 subOp) noexcept {
NX86::CpuId(op, subOp, Info);
}
- };
+ };
static_assert(sizeof(TX86CpuInfo) == 16, "please, fix me");
}
-
+
// https://en.wikipedia.org/wiki/CPUID
bool NX86::HaveRDTSCP() noexcept {
return (TX86CpuInfo(0x80000001).EDX >> 27) & 1u;
@@ -96,8 +96,8 @@ bool NX86::HaveSSE() noexcept {
bool NX86::HaveSSE2() noexcept {
return (TX86CpuInfo(0x1).EDX >> 26) & 1u;
-}
-
+}
+
bool NX86::HaveSSE3() noexcept {
return TX86CpuInfo(0x1).ECX & 1u;
}
@@ -116,8 +116,8 @@ bool NX86::HaveSSE41() noexcept {
bool NX86::HaveSSE42() noexcept {
return (TX86CpuInfo(0x1).ECX >> 20) & 1u;
-}
-
+}
+
bool NX86::HaveF16C() noexcept {
return (TX86CpuInfo(0x1).ECX >> 29) & 1u;
}
@@ -253,7 +253,7 @@ const char* CpuBrand(ui32* store) noexcept {
#endif
return (const char*)store;
-}
+}
#define Y_DEF_NAME(X) \
bool NX86::CachedHave##X() noexcept { \
diff --git a/util/system/file_ut.cpp b/util/system/file_ut.cpp
index 941e6a50f3..4e8ada2d9a 100644
--- a/util/system/file_ut.cpp
+++ b/util/system/file_ut.cpp
@@ -175,7 +175,7 @@ void TFileTest::TestRW() {
f1.Flush();
ui32 v;
f1.Load(&v, sizeof(v));
- UNIT_ASSERT_VALUES_EQUAL(v, 3u);
+ UNIT_ASSERT_VALUES_EQUAL(v, 3u);
UNIT_ASSERT_VALUES_EQUAL(f1.GetPosition(), 16);
TFile f2 = f1;
@@ -189,7 +189,7 @@ void TFileTest::TestRW() {
UNIT_ASSERT_VALUES_EQUAL(f1.Seek(-4, sCur), 16);
v = 0;
f1.Load(&v, sizeof(v));
- UNIT_ASSERT_VALUES_EQUAL(v, 3u);
+ UNIT_ASSERT_VALUES_EQUAL(v, 3u);
f1.Close();
UNIT_ASSERT(!f1.IsOpen());
UNIT_ASSERT(!f2.IsOpen());
diff --git a/util/system/maxlen.h b/util/system/maxlen.h
index e1ff7f5008..49efad8a23 100644
--- a/util/system/maxlen.h
+++ b/util/system/maxlen.h
@@ -2,11 +2,11 @@
#include <cstdlib>
-// http://support.microsoft.com/kb/208427
-#ifndef URL_MAXLEN
+// http://support.microsoft.com/kb/208427
+#ifndef URL_MAXLEN
#define URL_MAXLEN 2083
-#endif
-
+#endif
+
#define HOST_MAX 260
#ifndef URL_MAX
#define URL_MAX 1024
diff --git a/util/system/platform.h b/util/system/platform.h
index 58f310ab34..512d940123 100644
--- a/util/system/platform.h
+++ b/util/system/platform.h
@@ -240,7 +240,7 @@
#define SIZEOF_LONG_LONG 8
#define SIZEOF_UNSIGNED_LONG_LONG 8
-#undef SIZEOF_SIZE_T // in case we include <Python.h> which defines it, too
+#undef SIZEOF_SIZE_T // in case we include <Python.h> which defines it, too
#define SIZEOF_SIZE_T SIZEOF_PTR
// clang-format on
diff --git a/util/system/tls.h b/util/system/tls.h
index 3c4f56dbeb..b42508143c 100644
--- a/util/system/tls.h
+++ b/util/system/tls.h
@@ -178,42 +178,42 @@ namespace NTls {
template <class T>
class TValue: public TMoveOnly {
- class TConstructor {
- public:
+ class TConstructor {
+ public:
TConstructor() noexcept = default;
virtual ~TConstructor() = default;
- virtual T* Construct(void* ptr) const = 0;
- };
+ virtual T* Construct(void* ptr) const = 0;
+ };
- class TDefaultConstructor: public TConstructor {
- public:
+ class TDefaultConstructor: public TConstructor {
+ public:
~TDefaultConstructor() override = default;
T* Construct(void* ptr) const override {
//memset(ptr, 0, sizeof(T));
return ::new (ptr) T();
- }
- };
+ }
+ };
- template <class T1>
- class TCopyConstructor: public TConstructor {
- public:
- inline TCopyConstructor(const T1& value)
- : Value(value)
- {
- }
+ template <class T1>
+ class TCopyConstructor: public TConstructor {
+ public:
+ inline TCopyConstructor(const T1& value)
+ : Value(value)
+ {
+ }
~TCopyConstructor() override = default;
T* Construct(void* ptr) const override {
return ::new (ptr) T(Value);
- }
+ }
- private:
- T1 Value;
- };
+ private:
+ T1 Value;
+ };
public:
inline TValue()
@@ -239,30 +239,30 @@ namespace NTls {
}
inline operator T&() {
- return Get();
- }
-
+ return Get();
+ }
+
inline const T& operator->() const {
return Get();
}
- inline T& operator->() {
- return Get();
- }
-
- inline const T* operator&() const {
- return GetPtr();
- }
-
- inline T* operator&() {
- return GetPtr();
- }
-
+ inline T& operator->() {
+ return Get();
+ }
+
+ inline const T* operator&() const {
+ return GetPtr();
+ }
+
+ inline T* operator&() {
+ return GetPtr();
+ }
+
inline T& Get() const {
- return *GetPtr();
- }
-
- inline T* GetPtr() const {
+ return *GetPtr();
+ }
+
+ inline T* GetPtr() const {
T* val = static_cast<T*>(Key_.Get());
if (!val) {
@@ -274,7 +274,7 @@ namespace NTls {
val = newval.Release();
}
- return val;
+ return val;
}
private: