diff options
author | kimkim <kimkim@yandex-team.ru> | 2022-02-10 16:49:27 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:27 +0300 |
commit | 13f84424ed9975f6827d9786087c6fe6ea265cda (patch) | |
tree | b94acc282c49a5de96b9e3e19feead21736f3273 | |
parent | 35f29a67a6b8e50e1826c837330086049114c5ba (diff) | |
download | ydb-13f84424ed9975f6827d9786087c6fe6ea265cda.tar.gz |
Restoring authorship annotation for <kimkim@yandex-team.ru>. Commit 1 of 2.
143 files changed, 748 insertions, 748 deletions
diff --git a/library/cpp/archive/yarchive.cpp b/library/cpp/archive/yarchive.cpp index 1becc3e5da..fdd53a3b0c 100644 --- a/library/cpp/archive/yarchive.cpp +++ b/library/cpp/archive/yarchive.cpp @@ -1,10 +1,10 @@ #include "yarchive.h" #include <util/generic/algorithm.h> -#include <util/generic/hash.h> +#include <util/generic/hash.h> #include <util/generic/utility.h> -#include <util/generic/vector.h> -#include <util/generic/yexception.h> +#include <util/generic/vector.h> +#include <util/generic/yexception.h> #include <util/memory/blob.h> #include <util/memory/tempbuf.h> #include <util/stream/input.h> diff --git a/library/cpp/archive/yarchive.h b/library/cpp/archive/yarchive.h index 8120bcb940..048bb64d22 100644 --- a/library/cpp/archive/yarchive.h +++ b/library/cpp/archive/yarchive.h @@ -3,7 +3,7 @@ #include "models_archive_reader.h" #include <util/generic/fwd.h> -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> class IInputStream; diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h index 87d1ab0ad4..74ecb2b43d 100644 --- a/library/cpp/cgiparam/cgiparam.h +++ b/library/cpp/cgiparam/cgiparam.h @@ -3,7 +3,7 @@ #include <library/cpp/iterator/iterate_values.h> #include <util/generic/iterator_range.h> -#include <util/generic/map.h> +#include <util/generic/map.h> #include <util/generic/strbuf.h> #include <util/generic/string.h> diff --git a/library/cpp/charset/codepage_ut.cpp b/library/cpp/charset/codepage_ut.cpp index c3ac3ac478..4c6021c569 100644 --- a/library/cpp/charset/codepage_ut.cpp +++ b/library/cpp/charset/codepage_ut.cpp @@ -5,7 +5,7 @@ #include <library/cpp/testing/unittest/registar.h> #include <util/charset/utf8.h> -#include <util/system/yassert.h> +#include <util/system/yassert.h> #if defined(_MSC_VER) #pragma warning(disable : 4309) /*truncation of constant value*/ diff --git a/library/cpp/charset/ya.make b/library/cpp/charset/ya.make index 7565566bf0..fa404b14e2 100644 --- a/library/cpp/charset/ya.make +++ b/library/cpp/charset/ya.make @@ -1,22 +1,22 @@ LIBRARY() OWNER(alzobnin) - -SRCS( + +SRCS( generated/cp_data.cpp generated/encrec_data.cpp - codepage.cpp - cp_encrec.cpp + codepage.cpp + cp_encrec.cpp doccodes.cpp iconv.cpp recyr.hh recyr_int.hh ci_string.cpp wide.cpp -) - +) + PEERDIR( contrib/libs/libiconv ) -END() +END() diff --git a/library/cpp/containers/atomizer/atomizer.h b/library/cpp/containers/atomizer/atomizer.h index 5e40f47ab9..b37e68ede7 100644 --- a/library/cpp/containers/atomizer/atomizer.h +++ b/library/cpp/containers/atomizer/atomizer.h @@ -2,8 +2,8 @@ #include <library/cpp/containers/str_map/str_map.h> -#include <util/generic/vector.h> -#include <util/generic/utility.h> +#include <util/generic/vector.h> +#include <util/generic/utility.h> #include <utility> #include <cstdio> diff --git a/library/cpp/containers/comptrie/comptrie_trie.h b/library/cpp/containers/comptrie/comptrie_trie.h index 40ec1e52b3..6e3167e896 100644 --- a/library/cpp/containers/comptrie/comptrie_trie.h +++ b/library/cpp/containers/comptrie/comptrie_trie.h @@ -562,7 +562,7 @@ TCompactTrieHolder<T, D, S>::TCompactTrieHolder(IInputStream& is, size_t len) : Storage(new char[len]) { if (is.Load(Storage.Get(), len) != len) { - ythrow yexception() << "bad data load"; + ythrow yexception() << "bad data load"; } TBase::Init(Storage.Get(), len); } diff --git a/library/cpp/containers/comptrie/comptrie_ut.cpp b/library/cpp/containers/comptrie/comptrie_ut.cpp index 74bee09b5d..a28ea2322b 100644 --- a/library/cpp/containers/comptrie/comptrie_ut.cpp +++ b/library/cpp/containers/comptrie/comptrie_ut.cpp @@ -7,7 +7,7 @@ #include <util/charset/wide.h> #include <util/generic/algorithm.h> #include <util/generic/buffer.h> -#include <util/generic/map.h> +#include <util/generic/map.h> #include <util/generic/vector.h> #include <util/generic/ptr.h> #include <util/generic/ylimits.h> diff --git a/library/cpp/containers/str_map/str_map.h b/library/cpp/containers/str_map/str_map.h index 31b00d1b99..58b365d5bd 100644 --- a/library/cpp/containers/str_map/str_map.h +++ b/library/cpp/containers/str_map/str_map.h @@ -1,8 +1,8 @@ #pragma once #include <util/memory/segmented_string_pool.h> -#include <util/generic/map.h> -#include <util/generic/hash.h> +#include <util/generic/map.h> +#include <util/generic/hash.h> #include <util/generic/buffer.h> #include <util/str_stl.h> // less<> and equal_to<> for const char* #include <utility> diff --git a/library/cpp/coroutine/listener/listen.cpp b/library/cpp/coroutine/listener/listen.cpp index 3d4e711d1d..d925a2d4b4 100644 --- a/library/cpp/coroutine/listener/listen.cpp +++ b/library/cpp/coroutine/listener/listen.cpp @@ -5,7 +5,7 @@ #include <util/network/ip.h> #include <util/network/address.h> -#include <util/generic/ylimits.h> +#include <util/generic/ylimits.h> #include <util/generic/intrlist.h> using namespace NAddr; @@ -110,7 +110,7 @@ private: C_ = Parent_->E_->Create<TOneSocketListener, &TOneSocketListener::Run>(this, "listen_job"); } } - + inline const IRemoteAddr* Addr() const noexcept { return Addr_.Get(); } @@ -259,9 +259,9 @@ public: if (it != L_.End()) { delete &*it; - } + } } - + private: TContExecutor* const E_; ICallBack* const Cb_; @@ -318,14 +318,14 @@ void TContListener::Bind(const TNetworkAddress& addr) { void TContListener::Stop() noexcept { Impl_.Destroy(); } - + void TContListener::StopListenAddr(const IRemoteAddr& addr) { CheckImpl(Impl_)->StopListenAddr(addr); -} - +} + void TContListener::StopListenAddr(const TIpAddress& addr) { return StopListenAddr(TIPv4Addr(addr)); -} +} void TContListener::StopListenAddr(const TNetworkAddress& addr) { for (TNetworkAddress::TIterator it = addr.Begin(); it != addr.End(); ++it) { diff --git a/library/cpp/coroutine/listener/listen.h b/library/cpp/coroutine/listener/listen.h index 3a89cd3ecc..ae4d67c1cf 100644 --- a/library/cpp/coroutine/listener/listen.h +++ b/library/cpp/coroutine/listener/listen.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/generic/ylimits.h> struct TIpAddress; @@ -112,7 +112,7 @@ public: void StopListenAddr(const NAddr::IRemoteAddr& addr); void StopListenAddr(const TIpAddress& addr); void StopListenAddr(const TNetworkAddress& addr); - + template <class T> inline void StartListenAddr(const T& addr) { Bind(addr); diff --git a/library/cpp/deprecated/kmp/kmp.cpp b/library/cpp/deprecated/kmp/kmp.cpp index d02074c94a..d3ca452e4e 100644 --- a/library/cpp/deprecated/kmp/kmp.cpp +++ b/library/cpp/deprecated/kmp/kmp.cpp @@ -1,6 +1,6 @@ #include "kmp.h" -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> TKMPMatcher::TKMPMatcher(const char* patternBegin, const char* patternEnd) : Pattern(patternBegin, patternEnd) diff --git a/library/cpp/deprecated/kmp/kmp.h b/library/cpp/deprecated/kmp/kmp.h index a7f72eece6..757d15fa8d 100644 --- a/library/cpp/deprecated/kmp/kmp.h +++ b/library/cpp/deprecated/kmp/kmp.h @@ -1,8 +1,8 @@ #pragma once -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/generic/string.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/generic/yexception.h> template <typename T> diff --git a/library/cpp/deprecated/mapped_file/mapped_file.h b/library/cpp/deprecated/mapped_file/mapped_file.h index 45859ed65a..460080ab12 100644 --- a/library/cpp/deprecated/mapped_file/mapped_file.h +++ b/library/cpp/deprecated/mapped_file/mapped_file.h @@ -1,9 +1,9 @@ #pragma once #include <util/generic/flags.h> -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/generic/string.h> -#include <util/generic/utility.h> +#include <util/generic/utility.h> #include <util/generic/yexception.h> #include <util/system/align.h> #include <util/system/file.h> diff --git a/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp b/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp index afbd5b3358..786e82e479 100644 --- a/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp +++ b/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp @@ -15,4 +15,4 @@ Y_UNIT_TEST_SUITE(TMappedFileTest) { NFs::Remove(FileName_); } -}; +}; diff --git a/library/cpp/deprecated/split/split_iterator.h b/library/cpp/deprecated/split/split_iterator.h index 0eacc29228..558b905d55 100644 --- a/library/cpp/deprecated/split/split_iterator.h +++ b/library/cpp/deprecated/split/split_iterator.h @@ -6,11 +6,11 @@ #include <util/string/builder.h> #include <util/system/yassert.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/generic/strbuf.h> #include <util/generic/string.h> -#include <util/generic/vector.h> -#include <util/generic/yexception.h> +#include <util/generic/vector.h> +#include <util/generic/yexception.h> #include <cstdio> diff --git a/library/cpp/digest/old_crc/crc.h b/library/cpp/digest/old_crc/crc.h index 4a3ce6d05e..5088fed403 100644 --- a/library/cpp/digest/old_crc/crc.h +++ b/library/cpp/digest/old_crc/crc.h @@ -1,6 +1,6 @@ #pragma once -#include <util/system/defaults.h> +#include <util/system/defaults.h> #define CRC16INIT 0 #define CRC32INIT 0 diff --git a/library/cpp/digest/sfh/sfh.h b/library/cpp/digest/sfh/sfh.h index 372938654c..288552c8f3 100644 --- a/library/cpp/digest/sfh/sfh.h +++ b/library/cpp/digest/sfh/sfh.h @@ -1,6 +1,6 @@ #pragma once -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/system/unaligned_mem.h> inline ui32 SuperFastHash(const void* d, size_t l) noexcept { diff --git a/library/cpp/execprofile/profile.cpp b/library/cpp/execprofile/profile.cpp index d05de20203..7001cd73a1 100644 --- a/library/cpp/execprofile/profile.cpp +++ b/library/cpp/execprofile/profile.cpp @@ -15,8 +15,8 @@ #include <dlfcn.h> #include <util/system/platform.h> -#include <util/generic/hash.h> -#include <util/generic/map.h> +#include <util/generic/hash.h> +#include <util/generic/map.h> #include <util/generic/noncopyable.h> #include <util/generic/algorithm.h> #include <util/generic/vector.h> diff --git a/library/cpp/getopt/small/opt2.cpp b/library/cpp/getopt/small/opt2.cpp index 0cdc774e78..f5913e9238 100644 --- a/library/cpp/getopt/small/opt2.cpp +++ b/library/cpp/getopt/small/opt2.cpp @@ -2,8 +2,8 @@ #include <util/generic/hash.h> #include <util/generic/utility.h> -#include <util/generic/yexception.h> -#include <util/str_stl.h> +#include <util/generic/yexception.h> +#include <util/str_stl.h> #include <stdio.h> #include <errno.h> @@ -37,7 +37,7 @@ void Opt2::EatArgv(const char* optspec, const char* long_alias) { optspec++; } if (*optspec == '-') - ythrow yexception() << "Flag '-' can not be used in Opt2's optspec"; + ythrow yexception() << "Flag '-' can not be used in Opt2's optspec"; // step 1 - parse optspec for (const char* s = optspec; *s; s++) { if (SpecsMap[(ui8)*s]) @@ -50,7 +50,7 @@ void Opt2::EatArgv(const char* optspec, const char* long_alias) { if (s[1] == ':') { Specs.back().HasArg = true; if (s[2] == ':') - ythrow yexception() << "Opt2 does not accept optional parameters (e.g. \"a::\") in optspec"; + ythrow yexception() << "Opt2 does not accept optional parameters (e.g. \"a::\") in optspec"; s++; } } diff --git a/library/cpp/getopt/small/opt2.h b/library/cpp/getopt/small/opt2.h index 4d9d943237..11767fd94a 100644 --- a/library/cpp/getopt/small/opt2.h +++ b/library/cpp/getopt/small/opt2.h @@ -1,8 +1,8 @@ #pragma once -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/generic/string.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> // simplified options parser // No 'optional argument' (e.g. "a::" in spec.) support; diff --git a/library/cpp/getopt/small/ygetopt.cpp b/library/cpp/getopt/small/ygetopt.cpp index 1f52827f74..735071c2cd 100644 --- a/library/cpp/getopt/small/ygetopt.cpp +++ b/library/cpp/getopt/small/ygetopt.cpp @@ -2,8 +2,8 @@ #include "ygetopt.h" #include <util/generic/string.h> -#include <util/generic/vector.h> -#include <util/generic/yexception.h> +#include <util/generic/vector.h> +#include <util/generic/yexception.h> class TGetOpt::TImpl: public TSimpleRefCount<TImpl> { public: diff --git a/library/cpp/getopt/small/ygetopt.h b/library/cpp/getopt/small/ygetopt.h index 615d3dd18e..0d5b7371ff 100644 --- a/library/cpp/getopt/small/ygetopt.h +++ b/library/cpp/getopt/small/ygetopt.h @@ -1,7 +1,7 @@ #pragma once #include <util/generic/fwd.h> -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> class TGetOpt { public: diff --git a/library/cpp/getopt/ya.make b/library/cpp/getopt/ya.make index 6df23b22b2..e5a0fa62dc 100644 --- a/library/cpp/getopt/ya.make +++ b/library/cpp/getopt/ya.make @@ -1,15 +1,15 @@ LIBRARY() - + OWNER(pg) - + PEERDIR( library/cpp/getopt/small library/cpp/svnversion library/cpp/build_info ) -SRCS( +SRCS( GLOBAL print.cpp -) - -END() +) + +END() diff --git a/library/cpp/http/fetch/http_socket.cpp b/library/cpp/http/fetch/http_socket.cpp index 1524ef04a8..b8261febc9 100644 --- a/library/cpp/http/fetch/http_socket.cpp +++ b/library/cpp/http/fetch/http_socket.cpp @@ -40,7 +40,7 @@ static int gcry_pthread_mutex_init(void** priv) { int err = 0; try { - TMutex* lock = new TMutex; + TMutex* lock = new TMutex; *priv = lock; } catch (...) { err = -1; @@ -50,19 +50,19 @@ static int gcry_pthread_mutex_init(void** priv) { } static int gcry_pthread_mutex_destroy(void** lock) { - delete static_cast<TMutex*>(*lock); + delete static_cast<TMutex*>(*lock); return 0; } static int gcry_pthread_mutex_lock(void** lock) { - static_cast<TMutex*>(*lock)->Acquire(); + static_cast<TMutex*>(*lock)->Acquire(); return 0; } static int gcry_pthread_mutex_unlock(void** lock) { - static_cast<TMutex*>(*lock)->Release(); + static_cast<TMutex*>(*lock)->Release(); return 0; } diff --git a/library/cpp/http/fetch/httpzreader.h b/library/cpp/http/fetch/httpzreader.h index 68eb00853d..105102b7d1 100644 --- a/library/cpp/http/fetch/httpzreader.h +++ b/library/cpp/http/fetch/httpzreader.h @@ -279,17 +279,17 @@ protected: case 0: return ret; case ENOMEM: - ythrow yexception() << "SCompressedHttpReader: not enough memory"; + ythrow yexception() << "SCompressedHttpReader: not enough memory"; case EINVAL: ythrow yexception() << "SCompressedHttpReader: zlib error: " << ZMsg(); case ENOTSUP: - ythrow yexception() << "SCompressedHttpReader: unsupported compression method"; + ythrow yexception() << "SCompressedHttpReader: unsupported compression method"; case EFAULT: - ythrow zlib_exception() << "SCompressedHttpReader: " << ZMsg(); + ythrow zlib_exception() << "SCompressedHttpReader: " << ZMsg(); case E2BIG: - ythrow zlib_exception() << "SCompressedHttpReader: Content exceeds maximum length"; + ythrow zlib_exception() << "SCompressedHttpReader: Content exceeds maximum length"; default: - ythrow yexception() << "SCompressedHttpReader: unknown error"; + ythrow yexception() << "SCompressedHttpReader: unknown error"; } } }; diff --git a/library/cpp/http/io/chunk.cpp b/library/cpp/http/io/chunk.cpp index 6975d9eac1..86a5085fa7 100644 --- a/library/cpp/http/io/chunk.cpp +++ b/library/cpp/http/io/chunk.cpp @@ -8,7 +8,7 @@ static inline size_t ParseHex(const TString& s) { if (s.empty()) { - ythrow yexception() << "can not parse chunk length(empty string)"; + ythrow yexception() << "can not parse chunk length(empty string)"; } size_t ret = 0; @@ -228,7 +228,7 @@ void TChunkedOutput::DoWrite(const void* buf, size_t len) { if (Impl_.Get()) { Impl_->Write(buf, len); } else { - ythrow yexception() << "can not write to finished stream"; + ythrow yexception() << "can not write to finished stream"; } } diff --git a/library/cpp/http/io/chunk.h b/library/cpp/http/io/chunk.h index 88d89fafda..8f0927d1a5 100644 --- a/library/cpp/http/io/chunk.h +++ b/library/cpp/http/io/chunk.h @@ -2,7 +2,7 @@ #include <util/stream/output.h> #include <util/generic/maybe.h> -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> class THttpHeaders; diff --git a/library/cpp/http/io/headers.h b/library/cpp/http/io/headers.h index a71793d1c6..2dc1916f71 100644 --- a/library/cpp/http/io/headers.h +++ b/library/cpp/http/io/headers.h @@ -3,7 +3,7 @@ #include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/deque.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/string/cast.h> class IInputStream; diff --git a/library/cpp/http/io/stream.h b/library/cpp/http/io/stream.h index 78ca4fc814..95b7b61b41 100644 --- a/library/cpp/http/io/stream.h +++ b/library/cpp/http/io/stream.h @@ -4,10 +4,10 @@ #include <util/stream/output.h> #include <util/generic/maybe.h> -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/generic/string.h> #include <util/generic/strbuf.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #include <util/generic/array_ref.h> class TSocket; diff --git a/library/cpp/http/misc/httpdate.cpp b/library/cpp/http/misc/httpdate.cpp index 4a3031bbf4..c5d3f2892c 100644 --- a/library/cpp/http/misc/httpdate.cpp +++ b/library/cpp/http/misc/httpdate.cpp @@ -35,7 +35,7 @@ #include <cstring> #include <ctime> -#include <util/system/compat.h> /* stricmp */ +#include <util/system/compat.h> /* stricmp */ #include <util/system/yassert.h> #include "httpdate.h" #include <util/datetime/base.h> diff --git a/library/cpp/http/misc/httpreqdata.h b/library/cpp/http/misc/httpreqdata.h index 16e59c4d78..ee5fc0dccf 100644 --- a/library/cpp/http/misc/httpreqdata.h +++ b/library/cpp/http/misc/httpreqdata.h @@ -4,12 +4,12 @@ #include <util/str_stl.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/string/cast.h> #include <library/cpp/cgiparam/cgiparam.h> #include <util/network/address.h> #include <util/network/socket.h> -#include <util/generic/hash.h> +#include <util/generic/hash.h> #include <util/system/yassert.h> #include <util/generic/string.h> #include <util/datetime/base.h> diff --git a/library/cpp/http/server/http.h b/library/cpp/http/server/http.h index b292d38f27..fbf7901446 100644 --- a/library/cpp/http/server/http.h +++ b/library/cpp/http/server/http.h @@ -6,8 +6,8 @@ #include <util/thread/pool.h> #include <library/cpp/http/io/stream.h> #include <util/memory/blob.h> -#include <util/generic/ptr.h> -#include <util/generic/vector.h> +#include <util/generic/ptr.h> +#include <util/generic/vector.h> #include <util/system/atomic.h> class IThreadFactory; diff --git a/library/cpp/logger/backend.h b/library/cpp/logger/backend.h index d088726d6d..6cd051c1ed 100644 --- a/library/cpp/logger/backend.h +++ b/library/cpp/logger/backend.h @@ -2,7 +2,7 @@ #include "priority.h" -#include <util/generic/noncopyable.h> +#include <util/generic/noncopyable.h> #include <cstddef> diff --git a/library/cpp/logger/file.h b/library/cpp/logger/file.h index 10b4cd0c20..6c80a98d30 100644 --- a/library/cpp/logger/file.h +++ b/library/cpp/logger/file.h @@ -3,7 +3,7 @@ #include "backend.h" #include <util/generic/fwd.h> -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> class TFileLogBackend: public TLogBackend { public: diff --git a/library/cpp/logger/log_ut.cpp b/library/cpp/logger/log_ut.cpp index 8de46f17f5..3c135cdb3b 100644 --- a/library/cpp/logger/log_ut.cpp +++ b/library/cpp/logger/log_ut.cpp @@ -5,10 +5,10 @@ #include <util/system/fs.h> #include <util/system/rwlock.h> #include <util/system/yield.h> -#include <util/memory/blob.h> +#include <util/memory/blob.h> #include <util/stream/file.h> #include <util/generic/string.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> class TLogTest: public TTestBase { UNIT_TEST_SUITE(TLogTest); diff --git a/library/cpp/logger/thread.h b/library/cpp/logger/thread.h index 65f7a88e87..c42b9542d4 100644 --- a/library/cpp/logger/thread.h +++ b/library/cpp/logger/thread.h @@ -2,7 +2,7 @@ #include "backend.h" -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <functional> diff --git a/library/cpp/messagebus/coreconn.h b/library/cpp/messagebus/coreconn.h index fca228d82e..dda64fabcd 100644 --- a/library/cpp/messagebus/coreconn.h +++ b/library/cpp/messagebus/coreconn.h @@ -10,11 +10,11 @@ #include <util/datetime/base.h> #include <util/generic/algorithm.h> -#include <util/generic/list.h> +#include <util/generic/list.h> #include <util/generic/map.h> #include <util/generic/set.h> #include <util/generic/string.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/network/address.h> #include <util/network/ip.h> #include <util/network/poller.h> diff --git a/library/cpp/mime/types/mime.cpp b/library/cpp/mime/types/mime.cpp index 706d776b24..12c67ea506 100644 --- a/library/cpp/mime/types/mime.cpp +++ b/library/cpp/mime/types/mime.cpp @@ -1,7 +1,7 @@ #include "mime.h" #include <util/system/defaults.h> -#include <util/generic/hash.h> +#include <util/generic/hash.h> #include <util/generic/strbuf.h> #include <util/generic/singleton.h> #include <util/generic/yexception.h> diff --git a/library/cpp/on_disk/chunks/chunked_helpers.h b/library/cpp/on_disk/chunks/chunked_helpers.h index 5fa96afdca..3078db573c 100644 --- a/library/cpp/on_disk/chunks/chunked_helpers.h +++ b/library/cpp/on_disk/chunks/chunked_helpers.h @@ -1,11 +1,11 @@ #pragma once -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/generic/buffer.h> #include <util/generic/hash_set.h> #include <util/generic/cast.h> #include <util/generic/ymath.h> -#include <util/memory/blob.h> +#include <util/memory/blob.h> #include <util/stream/buffer.h> #include <util/stream/mem.h> #include <util/system/unaligned_mem.h> diff --git a/library/cpp/packers/ut/packers_ut.cpp b/library/cpp/packers/ut/packers_ut.cpp index 18ce2150d1..72fee42dd4 100644 --- a/library/cpp/packers/ut/packers_ut.cpp +++ b/library/cpp/packers/ut/packers_ut.cpp @@ -6,7 +6,7 @@ #include <util/charset/wide.h> #include <util/generic/algorithm.h> #include <util/generic/buffer.h> -#include <util/generic/map.h> +#include <util/generic/map.h> #include <util/generic/vector.h> #include <util/generic/ptr.h> #include <util/generic/ylimits.h> diff --git a/library/cpp/regex/pcre/regexp.cpp b/library/cpp/regex/pcre/regexp.cpp index 575c09cee4..407eab0960 100644 --- a/library/cpp/regex/pcre/regexp.cpp +++ b/library/cpp/regex/pcre/regexp.cpp @@ -30,7 +30,7 @@ private: Pmatch[MatchPos].rm_eo = MatchBuf[2 * i + 1]; MatchPos++; if (MatchPos >= NMATCHES) { - ythrow yexception() << "TRegExBase::Exec(): Not enough space in internal buffer."; + ythrow yexception() << "TRegExBase::Exec(): Not enough space in internal buffer."; } } } @@ -47,7 +47,7 @@ private: NMATCHES); /* number of elements in the output vector */ if (rc == 0) { - ythrow yexception() << "TRegExBase::Exec(): Not enough space in internal buffer."; + ythrow yexception() << "TRegExBase::Exec(): Not enough space in internal buffer."; } return rc; @@ -161,10 +161,10 @@ public: int Exec(const char* str, regmatch_t pmatch[], int eflags, int nmatches) const { if (!RegExpr) { - ythrow yexception() << "Regular expression is not compiled"; + ythrow yexception() << "Regular expression is not compiled"; } if (!str) { - ythrow yexception() << "Empty string is passed to TRegExBaseImpl::Exec"; + ythrow yexception() << "Empty string is passed to TRegExBaseImpl::Exec"; } if ((eflags & REGEXP_GLOBAL) == 0) { return regexec(&Preg, str, nmatches, pmatch, eflags); diff --git a/library/cpp/regex/pcre/regexp.h b/library/cpp/regex/pcre/regexp.h index bc610bd2f3..af415be70c 100644 --- a/library/cpp/regex/pcre/regexp.h +++ b/library/cpp/regex/pcre/regexp.h @@ -2,9 +2,9 @@ #include <sys/types.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/generic/string.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #include <contrib/libs/pcre/pcre.h> #include <contrib/libs/pcre/pcreposix.h> diff --git a/library/cpp/regex/pcre/ya.make b/library/cpp/regex/pcre/ya.make index d34911f103..e997f0751c 100644 --- a/library/cpp/regex/pcre/ya.make +++ b/library/cpp/regex/pcre/ya.make @@ -1,20 +1,20 @@ LIBRARY() OWNER(g:util) - -PEERDIR( - contrib/libs/pcre + +PEERDIR( + contrib/libs/pcre contrib/libs/pcre/pcre16 contrib/libs/pcre/pcre32 library/cpp/containers/stack_array -) - -SRCS( +) + +SRCS( pcre.cpp - regexp.cpp -) - -END() + regexp.cpp +) + +END() RECURSE_FOR_TESTS( benchmark diff --git a/library/cpp/streams/bzip2/bzip2.h b/library/cpp/streams/bzip2/bzip2.h index 2322277ef6..90ec70195f 100644 --- a/library/cpp/streams/bzip2/bzip2.h +++ b/library/cpp/streams/bzip2/bzip2.h @@ -2,8 +2,8 @@ #include <util/stream/input.h> #include <util/stream/output.h> -#include <util/generic/ptr.h> -#include <util/generic/yexception.h> +#include <util/generic/ptr.h> +#include <util/generic/yexception.h> #define BZIP_BUF_LEN (8 * 1024) #define BZIP_COMPRESSION_LEVEL 6 diff --git a/library/cpp/streams/lz/lz.cpp b/library/cpp/streams/lz/lz.cpp index b65bb3ed96..cee653c2ba 100644 --- a/library/cpp/streams/lz/lz.cpp +++ b/library/cpp/streams/lz/lz.cpp @@ -1,12 +1,12 @@ #include "lz.h" -#include <util/system/yassert.h> +#include <util/system/yassert.h> #include <util/system/byteorder.h> #include <util/memory/addstorage.h> #include <util/generic/buffer.h> -#include <util/generic/utility.h> +#include <util/generic/utility.h> #include <util/generic/singleton.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #include <util/stream/mem.h> #include <contrib/libs/lz4/lz4.h> diff --git a/library/cpp/streams/lz/lz.h b/library/cpp/streams/lz/lz.h index 3a2eaad88b..e3ede3796c 100644 --- a/library/cpp/streams/lz/lz.h +++ b/library/cpp/streams/lz/lz.h @@ -2,8 +2,8 @@ #include <util/stream/output.h> #include <util/stream/input.h> -#include <util/generic/ptr.h> -#include <util/generic/yexception.h> +#include <util/generic/ptr.h> +#include <util/generic/yexception.h> /** * @file diff --git a/library/cpp/string_utils/base64/base64.h b/library/cpp/string_utils/base64/base64.h index f778a6425a..e60233f6db 100644 --- a/library/cpp/string_utils/base64/base64.h +++ b/library/cpp/string_utils/base64/base64.h @@ -1,6 +1,6 @@ #pragma once -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/generic/strbuf.h> #include <util/generic/string.h> diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp index 85f4ac5d69..e3f4be758c 100644 --- a/library/cpp/string_utils/url/url.cpp +++ b/library/cpp/string_utils/url/url.cpp @@ -7,10 +7,10 @@ #include <util/string/strip.h> #include <util/charset/unidata.h> // for ToLower -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/generic/algorithm.h> #include <util/generic/hash_set.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #include <util/generic/singleton.h> #include <cstdlib> diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index 44517a0092..99742fd376 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -6,7 +6,7 @@ #include <util/generic/hash.h> #include <util/generic/intrlist.h> #include <util/generic/map.h> -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/generic/set.h> #include <util/generic/typetraits.h> #include <util/generic/vector.h> diff --git a/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp b/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp index 3b5203194a..df8d3a3e86 100644 --- a/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp +++ b/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp @@ -3,7 +3,7 @@ #include <util/stream/output.h> #include <util/system/atomic.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include "task_scheduler.h" diff --git a/library/cpp/uri/other.cpp b/library/cpp/uri/other.cpp index b23a5b68a9..aab42db0a5 100644 --- a/library/cpp/uri/other.cpp +++ b/library/cpp/uri/other.cpp @@ -1,7 +1,7 @@ #include "other.h" #include <util/string/util.h> -#include <util/system/yassert.h> +#include <util/system/yassert.h> /********************************************************/ /********************************************************/ diff --git a/library/cpp/uri/uri.cpp b/library/cpp/uri/uri.cpp index 56a9a4e5ef..89a08e3c2e 100644 --- a/library/cpp/uri/uri.cpp +++ b/library/cpp/uri/uri.cpp @@ -3,7 +3,7 @@ #include <util/string/cast.h> #include <util/string/util.h> -#include <util/system/yassert.h> +#include <util/system/yassert.h> namespace NUri { TState::EParsed TUri::CheckHost(const TStringBuf& host) { diff --git a/tools/archiver/main.cpp b/tools/archiver/main.cpp index 6cda54c1ea..d685372bc0 100644 --- a/tools/archiver/main.cpp +++ b/tools/archiver/main.cpp @@ -6,7 +6,7 @@ #include <util/folder/dirut.h> #include <util/folder/filelist.h> #include <util/folder/path.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/generic/yexception.h> #include <util/memory/blob.h> #include <util/stream/file.h> diff --git a/util/charset/ya.make b/util/charset/ya.make index 26d38cb10b..fce146c10c 100644 --- a/util/charset/ya.make +++ b/util/charset/ya.make @@ -2,9 +2,9 @@ LIBRARY() OWNER(g:util) SUBSCRIBER(g:util-subscribers) - + NO_UTIL() - + IF (TSTRING_IS_STD_STRING) CFLAGS(GLOBAL -DTSTRING_IS_STD_STRING) ENDIF() @@ -17,8 +17,8 @@ JOIN_SRCS( unidata.cpp utf8.cpp wide.cpp -) - +) + IF (ARCH_X86_64 AND NOT DISABLE_INSTRUCTION_SETS) SRC_CPP_SSE41(wide_sse41.cpp) ELSE() @@ -28,7 +28,7 @@ ELSE() ) ENDIF() -END() +END() RECURSE_FOR_TESTS( ut diff --git a/util/datetime/base.h b/util/datetime/base.h index 5e902b8f63..138dee9ae1 100644 --- a/util/datetime/base.h +++ b/util/datetime/base.h @@ -8,7 +8,7 @@ #include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/ylimits.h> -#include <util/generic/utility.h> +#include <util/generic/utility.h> #include <util/generic/typetraits.h> #include <util/generic/yexception.h> diff --git a/util/datetime/base_ut.cpp b/util/datetime/base_ut.cpp index afc3f802eb..b0aa67541e 100644 --- a/util/datetime/base_ut.cpp +++ b/util/datetime/base_ut.cpp @@ -6,7 +6,7 @@ #include <util/generic/ylimits.h> #include <util/generic/ymath.h> #include <util/string/cast.h> -#include <util/stream/output.h> +#include <util/stream/output.h> #include <util/system/compat.h> #include <util/random/random.h> @@ -29,9 +29,9 @@ struct TTestTime { Tm_.tm_year = 101; Tm_.tm_wday = 4; Tm_.tm_yday = 108; - } + } }; - + namespace { inline void OldDate8601(char* buf, time_t when) { struct tm theTm; @@ -197,20 +197,20 @@ Y_UNIT_TEST_SUITE(TDateTimeTest) { ui64 mcrsecB = MicroSeconds(); struct timeval tvB; gettimeofday(&tvB, nullptr); - + usleep(100000); - + ui64 mlsecA = millisec(); ui64 mcrsecA = MicroSeconds(); struct timeval tvA; gettimeofday(&tvA, nullptr); - + UNIT_ASSERT(mlsecB + 90 < mlsecA); UNIT_ASSERT((mcrsecB + 90000 < mcrsecA)); //UNIT_ASSERT(ToMicroSeconds(&tvB) + 90000 < ToMicroSeconds(&tvA)); //UNIT_ASSERT(TVdiff(tvB, tvA) == long(ToMicroSeconds(&tvA) - ToMicroSeconds(&tvB))); } - + Y_UNIT_TEST(TestCompatFuncs) { struct tm t; struct tm* tret = nullptr; @@ -218,7 +218,7 @@ Y_UNIT_TEST_SUITE(TDateTimeTest) { tret = gmtime_r(&e.T_, &t); UNIT_ASSERT(tret == &t); UNIT_ASSERT(CompareTM(e.Tm_, t)); - + /* * strptime seems to be broken on Mac OS X: * @@ -240,16 +240,16 @@ Y_UNIT_TEST_SUITE(TDateTimeTest) { time_t t3 = timegm(&t); UNIT_ASSERT(t3 == e.T_); } - + Y_UNIT_TEST(TestSprintSscan) { char buf[256]; long secs; TTestTime e; - + sprint_gm_date(buf, e.T_, &secs); UNIT_ASSERT(strcmp(buf, e.SprintDate_) == 0); UNIT_ASSERT(secs == e.SprintSecs_); - + struct tm t; Zero(t); bool ret = sscan_date(buf, t); @@ -258,12 +258,12 @@ Y_UNIT_TEST_SUITE(TDateTimeTest) { t.tm_year == e.Tm_.tm_year && t.tm_mon == e.Tm_.tm_mon && t.tm_mday == e.Tm_.tm_mday); - + buf[0] = 'a'; ret = sscan_date(buf, t); UNIT_ASSERT(!ret); } - + Y_UNIT_TEST(TestNow) { i64 seconds = Seconds(); i64 milliseconds = millisec(); @@ -337,7 +337,7 @@ Y_UNIT_TEST_SUITE(TDateTimeTest) { } } } - + Y_UNIT_TEST_SUITE(DateTimeTest) { Y_UNIT_TEST(TestDurationFromFloat) { UNIT_ASSERT_EQUAL(TDuration::MilliSeconds(500), TDuration::Seconds(0.5)); diff --git a/util/datetime/parser_ut.cpp b/util/datetime/parser_ut.cpp index 61364af997..59aaa6ca08 100644 --- a/util/datetime/parser_ut.cpp +++ b/util/datetime/parser_ut.cpp @@ -139,7 +139,7 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) { } else if (ch >= 'N' && ch <= 'Y') { return -(ch - 'N' + 1) * SECONDS_PER_HOUR; } else { - ythrow yexception() << "Invalid military zone."; + ythrow yexception() << "Invalid military zone."; } } diff --git a/util/digest/fnv.h b/util/digest/fnv.h index 87b41a3de7..3cccefc47e 100644 --- a/util/digest/fnv.h +++ b/util/digest/fnv.h @@ -1,6 +1,6 @@ #pragma once -#include <util/system/defaults.h> +#include <util/system/defaults.h> #define FNV32INIT 2166136261U #define FNV32PRIME 16777619U diff --git a/util/digest/murmur.h b/util/digest/murmur.h index 6b519b430a..2cce535710 100644 --- a/util/digest/murmur.h +++ b/util/digest/murmur.h @@ -1,6 +1,6 @@ #pragma once -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/generic/array_ref.h> /* diff --git a/util/digest/numeric.h b/util/digest/numeric.h index e20bd908e4..455699c2d9 100644 --- a/util/digest/numeric.h +++ b/util/digest/numeric.h @@ -1,7 +1,7 @@ #pragma once #include <util/generic/typelist.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> /* * original url (now dead): http://www.cris.com/~Ttwang/tech/inthash.htm diff --git a/util/draft/date.cpp b/util/draft/date.cpp index a290c46050..0b4240f205 100644 --- a/util/draft/date.cpp +++ b/util/draft/date.cpp @@ -1,7 +1,7 @@ #include "date.h" #include <util/string/cast.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #include <util/datetime/base.h> time_t GetDateStart(time_t ts) { diff --git a/util/draft/holder_vector.h b/util/draft/holder_vector.h index 1c62055bd9..80933c79d0 100644 --- a/util/draft/holder_vector.h +++ b/util/draft/holder_vector.h @@ -1,7 +1,7 @@ #pragma once -#include <util/generic/ptr.h> -#include <util/generic/vector.h> +#include <util/generic/ptr.h> +#include <util/generic/vector.h> #include <util/generic/noncopyable.h> template <class T, class D = TDelete> diff --git a/util/draft/matrix.h b/util/draft/matrix.h index 154d00b35e..a9afb13347 100644 --- a/util/draft/matrix.h +++ b/util/draft/matrix.h @@ -2,7 +2,7 @@ #include <util/generic/noncopyable.h> #include <util/system/yassert.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <string.h> template <typename T> diff --git a/util/folder/dirent_win.h b/util/folder/dirent_win.h index ac11a64c04..830ad7665c 100644 --- a/util/folder/dirent_win.h +++ b/util/folder/dirent_win.h @@ -1,6 +1,6 @@ #pragma once -#include <util/system/defaults.h> +#include <util/system/defaults.h> #ifdef _win_ diff --git a/util/folder/dirut.h b/util/folder/dirut.h index 2537027b12..a470130795 100644 --- a/util/folder/dirut.h +++ b/util/folder/dirut.h @@ -1,10 +1,10 @@ #pragma once -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/system/sysstat.h> #include <util/system/fs.h> #include <util/generic/string.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #include <sys/types.h> diff --git a/util/folder/filelist.cpp b/util/folder/filelist.cpp index b21fcdbf20..b241c0b981 100644 --- a/util/folder/filelist.cpp +++ b/util/folder/filelist.cpp @@ -2,7 +2,7 @@ #include "filelist.h" #include "iterator.h" -#include <util/system/defaults.h> +#include <util/system/defaults.h> void TFileEntitiesList::Fill(const TString& dirname, TStringBuf prefix, TStringBuf suffix, int depth, bool sort) { TDirIterator::TOptions opts; diff --git a/util/folder/fts.cpp b/util/folder/fts.cpp index 0e6a6f86eb..521922e903 100644 --- a/util/folder/fts.cpp +++ b/util/folder/fts.cpp @@ -36,7 +36,7 @@ #include <util/memory/tempbuf.h> #include <util/system/compat.h> #include <util/system/compiler.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/system/error.h> #include <stdlib.h> diff --git a/util/folder/fts.h b/util/folder/fts.h index f3c799e8c8..34964d2669 100644 --- a/util/folder/fts.h +++ b/util/folder/fts.h @@ -2,7 +2,7 @@ #include <sys/types.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #ifndef _win32_ typedef int dird; diff --git a/util/folder/lstat_win.h b/util/folder/lstat_win.h index 0bf7c19055..d96725afd1 100644 --- a/util/folder/lstat_win.h +++ b/util/folder/lstat_win.h @@ -1,6 +1,6 @@ #pragma once -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include "fts.h" #ifdef _win_ diff --git a/util/generic/hash_set.h b/util/generic/hash_set.h index e8088cf23b..75855b1699 100644 --- a/util/generic/hash_set.h +++ b/util/generic/hash_set.h @@ -1,7 +1,7 @@ #pragma once #include "fwd.h" -#include "hash.h" +#include "hash.h" #include <initializer_list> #include <utility> diff --git a/util/generic/hash_ut.cpp b/util/generic/hash_ut.cpp index 0551d58770..a764ad7b99 100644 --- a/util/generic/hash_ut.cpp +++ b/util/generic/hash_ut.cpp @@ -6,7 +6,7 @@ #include <library/cpp/testing/unittest/registar.h> #include <utility> -#include <util/str_stl.h> +#include <util/str_stl.h> #include <util/digest/multi.h> static const char star = 42; diff --git a/util/generic/ptr.h b/util/generic/ptr.h index 19db0e3ec5..7cec95acbd 100644 --- a/util/generic/ptr.h +++ b/util/generic/ptr.h @@ -1,9 +1,9 @@ #pragma once #include "fwd.h" -#include "utility.h" -#include "intrlist.h" -#include "refcount.h" +#include "utility.h" +#include "intrlist.h" +#include "refcount.h" #include "typetraits.h" #include "singleton.h" diff --git a/util/memory/addstorage.h b/util/memory/addstorage.h index 597c73a988..76dfd0b0e1 100644 --- a/util/memory/addstorage.h +++ b/util/memory/addstorage.h @@ -1,7 +1,7 @@ #pragma once #include <util/system/align.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <new> diff --git a/util/memory/blob.cpp b/util/memory/blob.cpp index 91da5cadca..ad98c7668b 100644 --- a/util/memory/blob.cpp +++ b/util/memory/blob.cpp @@ -5,12 +5,12 @@ #include <util/system/filemap.h> #include <util/system/mlock.h> #include <util/stream/buffer.h> -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/generic/string.h> #include <util/generic/buffer.h> #include <util/generic/ylimits.h> #include <util/generic/singleton.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> template <class TCounter> class TDynamicBlobBase: public TBlob::TBase, diff --git a/util/memory/blob.h b/util/memory/blob.h index 20c02a68df..99ab304238 100644 --- a/util/memory/blob.h +++ b/util/memory/blob.h @@ -3,7 +3,7 @@ #include <util/generic/fwd.h> #include <util/generic/strbuf.h> #include <util/generic/utility.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> class TMemoryMap; class IInputStream; diff --git a/util/memory/pool.h b/util/memory/pool.h index 13c8b6b9ed..346d95eb07 100644 --- a/util/memory/pool.h +++ b/util/memory/pool.h @@ -5,7 +5,7 @@ #include <util/system/align.h> #include <util/system/yassert.h> #include <util/generic/bitops.h> -#include <util/generic/utility.h> +#include <util/generic/utility.h> #include <util/generic/intrlist.h> #include <util/generic/strbuf.h> #include <util/generic/singleton.h> diff --git a/util/memory/smallobj.h b/util/memory/smallobj.h index 63de666bae..1f03dd1375 100644 --- a/util/memory/smallobj.h +++ b/util/memory/smallobj.h @@ -3,7 +3,7 @@ #include "pool.h" #include "alloc.h" -#include <util/generic/utility.h> +#include <util/generic/utility.h> #include <util/generic/intrlist.h> class TFixedSizeAllocator { diff --git a/util/memory/smallobj_ut.cpp b/util/memory/smallobj_ut.cpp index 86003d1d53..04a4fd054c 100644 --- a/util/memory/smallobj_ut.cpp +++ b/util/memory/smallobj_ut.cpp @@ -2,7 +2,7 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/hash_set.h> +#include <util/generic/hash_set.h> class TSmallObjAllocTest: public TTestBase { struct TClass: public TObjectFromPool<TClass> { diff --git a/util/memory/tempbuf.cpp b/util/memory/tempbuf.cpp index 09a2d0f140..914181acba 100644 --- a/util/memory/tempbuf.cpp +++ b/util/memory/tempbuf.cpp @@ -3,7 +3,7 @@ #include <util/system/tls.h> #include <util/system/yassert.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/generic/intrlist.h> #include <util/generic/singleton.h> #include <util/generic/yexception.h> diff --git a/util/memory/tempbuf.h b/util/memory/tempbuf.h index 334670eb1e..e94054a9cc 100644 --- a/util/memory/tempbuf.h +++ b/util/memory/tempbuf.h @@ -1,7 +1,7 @@ #pragma once -#include <util/system/defaults.h> -#include <util/generic/ptr.h> +#include <util/system/defaults.h> +#include <util/generic/ptr.h> /* * This is really fast buffer for temporary data. diff --git a/util/network/address.cpp b/util/network/address.cpp index a81a9e6994..4ed77db6e9 100644 --- a/util/network/address.cpp +++ b/util/network/address.cpp @@ -1,5 +1,5 @@ -#include <util/stream/str.h> - +#include <util/stream/str.h> + #include "address.h" #if defined(_unix_) @@ -119,17 +119,17 @@ void NAddr::PrintHost(IOutputStream& out, const IRemoteAddr& addr) { } TString NAddr::PrintHost(const IRemoteAddr& addr) { - TStringStream ss; - PrintAddr<false>(ss, addr); - return ss.Str(); -} - + TStringStream ss; + PrintAddr<false>(ss, addr); + return ss.Str(); +} + TString NAddr::PrintHostAndPort(const IRemoteAddr& addr) { - TStringStream ss; - PrintAddr<true>(ss, addr); - return ss.Str(); -} - + TStringStream ss; + PrintAddr<true>(ss, addr); + return ss.Str(); +} + IRemoteAddrPtr NAddr::GetSockAddr(SOCKET s) { auto addr = MakeHolder<TOpaqueAddr>(); diff --git a/util/network/address.h b/util/network/address.h index 448fcac0c9..ebc636869f 100644 --- a/util/network/address.h +++ b/util/network/address.h @@ -21,7 +21,7 @@ namespace NAddr { IRemoteAddrPtr GetSockAddr(SOCKET s); IRemoteAddrPtr GetPeerAddr(SOCKET s); void PrintHost(IOutputStream& out, const IRemoteAddr& addr); - + TString PrintHost(const IRemoteAddr& addr); TString PrintHostAndPort(const IRemoteAddr& addr); diff --git a/util/network/hostip.cpp b/util/network/hostip.cpp index cb8d43bf90..66e8850cfc 100644 --- a/util/network/hostip.cpp +++ b/util/network/hostip.cpp @@ -1,7 +1,7 @@ #include "socket.h" #include "hostip.h" -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/system/byteorder.h> #if defined(_unix_) || defined(_cygwin_) diff --git a/util/network/hostip.h b/util/network/hostip.h index cf63e4846a..5d1e2db1a9 100644 --- a/util/network/hostip.h +++ b/util/network/hostip.h @@ -1,6 +1,6 @@ #pragma once -#include <util/system/defaults.h> +#include <util/system/defaults.h> namespace NResolver { // resolve hostname and fills up to *slots slots in ip array; diff --git a/util/network/init.cpp b/util/network/init.cpp index 366e65682c..d7a5f22fb3 100644 --- a/util/network/init.cpp +++ b/util/network/init.cpp @@ -2,7 +2,7 @@ #include <util/system/compat.h> #include <util/system/yassert.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/generic/singleton.h> #include <cstdio> diff --git a/util/network/ip_ut.cpp b/util/network/ip_ut.cpp index 6716c6a699..eb7e557e62 100644 --- a/util/network/ip_ut.cpp +++ b/util/network/ip_ut.cpp @@ -2,7 +2,7 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> class TSysIpTest: public TTestBase { UNIT_TEST_SUITE(TSysIpTest); diff --git a/util/network/poller.h b/util/network/poller.h index 8dccd73140..5970eeed64 100644 --- a/util/network/poller.h +++ b/util/network/poller.h @@ -2,7 +2,7 @@ #include "socket.h" -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/datetime/base.h> class TSocketPoller { diff --git a/util/network/pollerimpl.h b/util/network/pollerimpl.h index e8c7e40fba..08cd063c92 100644 --- a/util/network/pollerimpl.h +++ b/util/network/pollerimpl.h @@ -4,11 +4,11 @@ #include <util/system/error.h> #include <util/system/mutex.h> -#include <util/system/defaults.h> -#include <util/generic/ylimits.h> -#include <util/generic/utility.h> +#include <util/system/defaults.h> +#include <util/generic/ylimits.h> +#include <util/generic/utility.h> #include <util/generic/vector.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #include <util/datetime/base.h> #if defined(_freebsd_) || defined(_darwin_) @@ -164,7 +164,7 @@ public: return EIO; } - return event->fflags; + return event->fflags; } static inline int ExtractFilterImpl(const TEvent* event) noexcept { diff --git a/util/network/socket.cpp b/util/network/socket.cpp index 4f6e804346..be7bf20acd 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -4,7 +4,7 @@ #include "pollerimpl.h" #include "iovec.h" -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/system/byteorder.h> #if defined(_unix_) @@ -33,7 +33,7 @@ #include <util/system/compat.h> #endif -#include <util/generic/ylimits.h> +#include <util/generic/ylimits.h> #include <util/string/cast.h> #include <util/stream/mem.h> @@ -1241,7 +1241,7 @@ ssize_t PollD(struct pollfd fds[], nfds_t nfds, const TInstant& deadLine) noexce if (res < 0) { const int err = LastSystemError(); - if (err != ETIMEDOUT && err != EINTR) { + if (err != ETIMEDOUT && err != EINTR) { return -err; } } diff --git a/util/network/socket.h b/util/network/socket.h index 40c8648b40..5ec92eeb2b 100644 --- a/util/network/socket.h +++ b/util/network/socket.h @@ -3,7 +3,7 @@ #include "init.h" #include <util/system/yassert.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/system/error.h> #include <util/stream/output.h> #include <util/stream/input.h> diff --git a/util/network/socket_ut.cpp b/util/network/socket_ut.cpp index 6b20e11f70..90b952f62f 100644 --- a/util/network/socket_ut.cpp +++ b/util/network/socket_ut.cpp @@ -5,7 +5,7 @@ #include <library/cpp/testing/unittest/registar.h> #include <util/string/builder.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <ctime> @@ -246,7 +246,7 @@ sockaddr_in TPollTest::GetAddress(ui32 ip, ui16 port) { SOCKET TPollTest::CreateSocket() { SOCKET s = socket(AF_INET, SOCK_STREAM, 0); if (s == INVALID_SOCKET) { - ythrow yexception() << "Can not create socket (" << LastSystemErrorText() << ")"; + ythrow yexception() << "Can not create socket (" << LastSystemErrorText() << ")"; } return s; } @@ -255,10 +255,10 @@ SOCKET TPollTest::StartServerSocket(ui16 port, int backlog) { TSocketHolder s(CreateSocket()); sockaddr_in addr = GetAddress(ntohl(INADDR_ANY), port); if (bind(s, (sockaddr*)&addr, sizeof(addr)) == SOCKET_ERROR) { - ythrow yexception() << "Can not bind server socket (" << LastSystemErrorText() << ")"; + ythrow yexception() << "Can not bind server socket (" << LastSystemErrorText() << ")"; } if (listen(s, backlog) == SOCKET_ERROR) { - ythrow yexception() << "Can not listen on server socket (" << LastSystemErrorText() << ")"; + ythrow yexception() << "Can not listen on server socket (" << LastSystemErrorText() << ")"; } return s.Release(); } @@ -267,7 +267,7 @@ SOCKET TPollTest::StartClientSocket(ui32 ip, ui16 port) { TSocketHolder s(CreateSocket()); sockaddr_in addr = GetAddress(ip, port); if (connect(s, (sockaddr*)&addr, sizeof(addr)) == SOCKET_ERROR) { - ythrow yexception() << "Can not connect client socket (" << LastSystemErrorText() << ")"; + ythrow yexception() << "Can not connect client socket (" << LastSystemErrorText() << ")"; } return s.Release(); } @@ -275,7 +275,7 @@ SOCKET TPollTest::StartClientSocket(ui32 ip, ui16 port) { SOCKET TPollTest::AcceptConnection(SOCKET serverSocket) { SOCKET connectedSocket = accept(serverSocket, nullptr, nullptr); if (connectedSocket == INVALID_SOCKET) { - ythrow yexception() << "Can not accept connection on server socket (" << LastSystemErrorText() << ")"; + ythrow yexception() << "Can not accept connection on server socket (" << LastSystemErrorText() << ")"; } return connectedSocket; } @@ -300,7 +300,7 @@ void TPollTest::TestPollInOut() { if (i % 5 == 0 || i % 5 == 2) { char buffer = 'c'; if (send(*clientSocket, &buffer, 1, 0) == -1) - ythrow yexception() << "Can not send (" << LastSystemErrorText() << ")"; + ythrow yexception() << "Can not send (" << LastSystemErrorText() << ")"; } TSimpleSharedPtr<TSocketHolder> connectedSocket(new TSocketHolder(AcceptConnection(serverSocket))); diff --git a/util/random/mersenne32.h b/util/random/mersenne32.h index 861f3a3d38..de3317964f 100644 --- a/util/random/mersenne32.h +++ b/util/random/mersenne32.h @@ -1,6 +1,6 @@ #pragma once -#include <util/system/defaults.h> +#include <util/system/defaults.h> class IInputStream; diff --git a/util/stream/buffer.h b/util/stream/buffer.h index 9dc99dbe49..f46dca73aa 100644 --- a/util/stream/buffer.h +++ b/util/stream/buffer.h @@ -3,7 +3,7 @@ #include "zerocopy.h" #include "zerocopy_output.h" -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> class TBuffer; diff --git a/util/stream/buffered.h b/util/stream/buffered.h index 0847186141..405eeb6217 100644 --- a/util/stream/buffered.h +++ b/util/stream/buffered.h @@ -4,7 +4,7 @@ #include "zerocopy_output.h" #include <utility> -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/generic/typetraits.h> #include <util/generic/store_policy.h> diff --git a/util/stream/debug.cpp b/util/stream/debug.cpp index afd5b3e1c7..260dc2ad38 100644 --- a/util/stream/debug.cpp +++ b/util/stream/debug.cpp @@ -10,7 +10,7 @@ void TDebugOutput::DoWrite(const void* buf, size_t len) { if (len != fwrite(buf, 1, len, stderr)) { - ythrow yexception() << "write failed(" << LastSystemErrorText() << ")"; + ythrow yexception() << "write failed(" << LastSystemErrorText() << ")"; } } diff --git a/util/stream/file.cpp b/util/stream/file.cpp index dc5d2f6311..71b1721c45 100644 --- a/util/stream/file.cpp +++ b/util/stream/file.cpp @@ -1,6 +1,6 @@ #include "file.h" -#include <util/memory/blob.h> +#include <util/memory/blob.h> #include <util/generic/yexception.h> TUnbufferedFileInput::TUnbufferedFileInput(const TString& path) diff --git a/util/stream/input.cpp b/util/stream/input.cpp index 6e8170f2f9..e86190baf8 100644 --- a/util/stream/input.cpp +++ b/util/stream/input.cpp @@ -5,7 +5,7 @@ #include <util/charset/wide.h> #include <util/memory/tempbuf.h> #include <util/generic/string.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #include <util/generic/singleton.h> #include <util/string/cast.h> #include <util/system/compat.h> @@ -103,7 +103,7 @@ TString IInputStream::ReadLine() { TString ret; if (!ReadLine(ret)) { - ythrow yexception() << "can not read line from stream"; + ythrow yexception() << "can not read line from stream"; } return ret; @@ -113,7 +113,7 @@ TString IInputStream::ReadTo(char ch) { TString ret; if (!ReadTo(ret, ch)) { - ythrow yexception() << "can not read from stream"; + ythrow yexception() << "can not read from stream"; } return ret; @@ -253,64 +253,64 @@ namespace { IInputStream& NPrivate::StdInStream() noexcept { return *SingletonWithPriority<TGetLine, 4>(); } - -// implementation of >> operator - + +// implementation of >> operator + // helper functions - + static inline bool IsStdDelimiter(char c) { - return (c == '\0') || (c == ' ') || (c == '\r') || (c == '\n') || (c == '\t'); -} - + return (c == '\0') || (c == ' ') || (c == '\r') || (c == '\n') || (c == '\t'); +} + static void ReadUpToDelimiter(IInputStream& i, TString& s) { - char c; - while (i.ReadChar(c)) { // skip delimiters + char c; + while (i.ReadChar(c)) { // skip delimiters if (!IsStdDelimiter(c)) { - s += c; - break; - } - } + s += c; + break; + } + } while (i.ReadChar(c) && !IsStdDelimiter(c)) { // read data (with trailing delimiter) - s += c; - } -} - -// specialization for string-related stuff - -template <> + s += c; + } +} + +// specialization for string-related stuff + +template <> void In<TString>(IInputStream& i, TString& s) { s.resize(0); - ReadUpToDelimiter(i, s); -} - -template <> + ReadUpToDelimiter(i, s); +} + +template <> void In<TUtf16String>(IInputStream& i, TUtf16String& w) { TString s; - ReadUpToDelimiter(i, s); - - if (s.empty()) { - w.erase(); - } else { + ReadUpToDelimiter(i, s); + + if (s.empty()) { + w.erase(); + } else { w = UTF8ToWide(s); - } -} - + } +} + // specialization for char types - + #define SPEC_FOR_CHAR(T) \ template <> \ void In<T>(IInputStream & i, T & t) { \ i.ReadChar((char&)t); \ } - -SPEC_FOR_CHAR(char) -SPEC_FOR_CHAR(unsigned char) -SPEC_FOR_CHAR(signed char) - -#undef SPEC_FOR_CHAR - -// specialization for number types - + +SPEC_FOR_CHAR(char) +SPEC_FOR_CHAR(unsigned char) +SPEC_FOR_CHAR(signed char) + +#undef SPEC_FOR_CHAR + +// specialization for number types + #define SPEC_FOR_NUMBER(T) \ template <> \ void In<T>(IInputStream & i, T & t) { \ @@ -327,18 +327,18 @@ SPEC_FOR_CHAR(signed char) } \ t = FromString<T, char>(buf, pos); \ } - -SPEC_FOR_NUMBER(signed short) -SPEC_FOR_NUMBER(signed int) -SPEC_FOR_NUMBER(signed long int) -SPEC_FOR_NUMBER(signed long long int) -SPEC_FOR_NUMBER(unsigned short) -SPEC_FOR_NUMBER(unsigned int) -SPEC_FOR_NUMBER(unsigned long int) -SPEC_FOR_NUMBER(unsigned long long int) - -SPEC_FOR_NUMBER(float) -SPEC_FOR_NUMBER(double) -SPEC_FOR_NUMBER(long double) - -#undef SPEC_FOR_NUMBER + +SPEC_FOR_NUMBER(signed short) +SPEC_FOR_NUMBER(signed int) +SPEC_FOR_NUMBER(signed long int) +SPEC_FOR_NUMBER(signed long long int) +SPEC_FOR_NUMBER(unsigned short) +SPEC_FOR_NUMBER(unsigned int) +SPEC_FOR_NUMBER(unsigned long int) +SPEC_FOR_NUMBER(unsigned long long int) + +SPEC_FOR_NUMBER(float) +SPEC_FOR_NUMBER(double) +SPEC_FOR_NUMBER(long double) + +#undef SPEC_FOR_NUMBER diff --git a/util/stream/input.h b/util/stream/input.h index f0d5807ed2..e7e113d575 100644 --- a/util/stream/input.h +++ b/util/stream/input.h @@ -43,7 +43,7 @@ public: return DoRead(buf, len); } - + /** * Reads one character from the stream. * @@ -243,9 +243,9 @@ ui64 TransferData(IInputStream* in, IOutputStream* out); * @throws `yexception` on invalid input or end of stream. * @see Out(IOutputStream&, T&) */ -template <typename T> +template <typename T> void In(IInputStream& in, T& value); - + /** * Reads a value from the stream. * @@ -255,12 +255,12 @@ void In(IInputStream& in, T& value); * @throws `yexception` on invalid input or end of stream. * @see operator<<(IOutputStream&, T&) */ -template <typename T> +template <typename T> inline IInputStream& operator>>(IInputStream& in, T& value) { In<T>(in, value); - return in; -} - + return in; +} + namespace NPrivate { IInputStream& StdInStream() noexcept; } diff --git a/util/stream/ios_ut.cpp b/util/stream/ios_ut.cpp index 139f4296e5..5430c90686 100644 --- a/util/stream/ios_ut.cpp +++ b/util/stream/ios_ut.cpp @@ -54,38 +54,38 @@ UNIT_TEST_SUITE_REGISTRATION(TStreamsTest); void TStreamsTest::TestIStreamOperators() { TString data("first line\r\nsecond\t\xd1\x82\xd0\xb5\xd1\x81\xd1\x82 line\r\n 1 -4 59 4320000000009999999 c\n -1.5 1e-110"); - TStringInput si(data); - + TStringInput si(data); + TString l1; TString l2; TString l3; TUtf16String w1; TString l4; - ui16 i1; - i16 i2; - i32 i3; - ui64 i4; - char c1; - unsigned char c2; - float f1; - double f2; - - si >> l1 >> l2 >> l3 >> w1 >> l4 >> i1 >> i2 >> i3 >> i4 >> c1 >> c2 >> f1 >> f2; - - UNIT_ASSERT_EQUAL(l1, "first"); - UNIT_ASSERT_EQUAL(l2, "line"); - UNIT_ASSERT_EQUAL(l3, "second"); - UNIT_ASSERT_EQUAL(l4, "line"); - UNIT_ASSERT_EQUAL(i1, 1); - UNIT_ASSERT_EQUAL(i2, -4); - UNIT_ASSERT_EQUAL(i3, 59); - UNIT_ASSERT_EQUAL(i4, 4320000000009999999ULL); - UNIT_ASSERT_EQUAL(c1, 'c'); - UNIT_ASSERT_EQUAL(c2, '\n'); - UNIT_ASSERT_EQUAL(f1, -1.5); - UNIT_ASSERT_EQUAL(f2, 1e-110); -} - + ui16 i1; + i16 i2; + i32 i3; + ui64 i4; + char c1; + unsigned char c2; + float f1; + double f2; + + si >> l1 >> l2 >> l3 >> w1 >> l4 >> i1 >> i2 >> i3 >> i4 >> c1 >> c2 >> f1 >> f2; + + UNIT_ASSERT_EQUAL(l1, "first"); + UNIT_ASSERT_EQUAL(l2, "line"); + UNIT_ASSERT_EQUAL(l3, "second"); + UNIT_ASSERT_EQUAL(l4, "line"); + UNIT_ASSERT_EQUAL(i1, 1); + UNIT_ASSERT_EQUAL(i2, -4); + UNIT_ASSERT_EQUAL(i3, 59); + UNIT_ASSERT_EQUAL(i4, 4320000000009999999ULL); + UNIT_ASSERT_EQUAL(c1, 'c'); + UNIT_ASSERT_EQUAL(c2, '\n'); + UNIT_ASSERT_EQUAL(f1, -1.5); + UNIT_ASSERT_EQUAL(f2, 1e-110); +} + void TStreamsTest::TestStringStream() { TStringStream s; diff --git a/util/stream/mem.cpp b/util/stream/mem.cpp index 22a3339e27..20d825195c 100644 --- a/util/stream/mem.cpp +++ b/util/stream/mem.cpp @@ -1,6 +1,6 @@ #include "mem.h" -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> TMemoryInput::TMemoryInput() noexcept : Buf_(nullptr) diff --git a/util/stream/pipe.h b/util/stream/pipe.h index 18525b9517..793be6d16f 100644 --- a/util/stream/pipe.h +++ b/util/stream/pipe.h @@ -4,7 +4,7 @@ #include "output.h" #include <util/system/pipe.h> -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/generic/string.h> /** diff --git a/util/stream/zerocopy.h b/util/stream/zerocopy.h index 3315aa3a51..7fdae10bd6 100644 --- a/util/stream/zerocopy.h +++ b/util/stream/zerocopy.h @@ -1,7 +1,7 @@ #pragma once -#include <util/system/yassert.h> -#include <util/system/defaults.h> +#include <util/system/yassert.h> +#include <util/system/defaults.h> #include <util/generic/ylimits.h> #include "input.h" diff --git a/util/stream/zlib.h b/util/stream/zlib.h index e7de7c81b7..e27649a0fe 100644 --- a/util/stream/zlib.h +++ b/util/stream/zlib.h @@ -5,9 +5,9 @@ #include "output.h" #include "buffered.h" -#include <util/system/defaults.h> -#include <util/generic/ptr.h> -#include <util/generic/yexception.h> +#include <util/system/defaults.h> +#include <util/generic/ptr.h> +#include <util/generic/yexception.h> /** * @addtogroup Streams_Archs diff --git a/util/string/cast.cpp b/util/string/cast.cpp index aa1e65a8e9..9a840c11c3 100644 --- a/util/string/cast.cpp +++ b/util/string/cast.cpp @@ -1,4 +1,4 @@ -#include <util/system/defaults.h> +#include <util/system/defaults.h> #if defined(_freebsd_) && !defined(__LONG_LONG_SUPPORTED) #define __LONG_LONG_SUPPORTED @@ -15,8 +15,8 @@ #include <contrib/libs/double-conversion/double-conversion.h> #include <util/generic/string.h> -#include <util/system/yassert.h> -#include <util/generic/yexception.h> +#include <util/system/yassert.h> +#include <util/generic/yexception.h> #include <util/generic/typetraits.h> #include <util/generic/ylimits.h> #include <util/generic/singleton.h> diff --git a/util/string/cast.h b/util/string/cast.h index 90e925c194..acef6d3235 100644 --- a/util/string/cast.h +++ b/util/string/cast.h @@ -1,6 +1,6 @@ #pragma once -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/stream/str.h> #include <util/generic/string.h> #include <util/generic/strbuf.h> diff --git a/util/string/split.h b/util/string/split.h index bc46d9e64c..6b5de0dc20 100644 --- a/util/string/split.h +++ b/util/string/split.h @@ -12,7 +12,7 @@ #include <util/generic/string.h> #include <util/generic/typetraits.h> #include <util/generic/vector.h> -#include <util/generic/ylimits.h> +#include <util/generic/ylimits.h> #include <util/system/compat.h> #include <util/system/defaults.h> diff --git a/util/string/util.h b/util/string/util.h index 0d77a5042b..ee6dacdd29 100644 --- a/util/string/util.h +++ b/util/string/util.h @@ -6,7 +6,7 @@ #include <cstdarg> #include <algorithm> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/generic/string.h> #include <util/generic/strbuf.h> diff --git a/util/string/vector.cpp b/util/string/vector.cpp index 9ba401f0a2..897061d42a 100644 --- a/util/string/vector.cpp +++ b/util/string/vector.cpp @@ -1,80 +1,80 @@ -#include "util.h" -#include "split.h" +#include "util.h" +#include "split.h" #include "vector.h" #include <util/system/defaults.h> -template <class TConsumer, class TDelim, typename TChr> +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); -} - -template <class TConsumer, class TDelim, typename TChr> +} + +template <class TConsumer, class TDelim, typename TChr> 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 { - TSkipEmptyTokens<TConsumer> sc(&cc); - + } else { + TSkipEmptyTokens<TConsumer> sc(&cc); + DoSplit2(sc, d, str, opts); - } -} - -template <class C, class TDelim, typename 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) { using TStringType = std::conditional_t<std::is_same<TChr, wchar16>::value, TUtf16String, TString>; - res->clear(); - + res->clear(); + if (!str.data()) { - return; - } - + return; + } + using TConsumer = TContainerConsumer<C>; - TConsumer cc(res); - - if (maxFields) { - TLimitingConsumer<TConsumer, const TChr> lc(maxFields, &cc); - + TConsumer cc(res); + + if (maxFields) { + TLimitingConsumer<TConsumer, const TChr> lc(maxFields, &cc); + DoSplit1(lc, d, str, options); - - if (lc.Last) { + + if (lc.Last) { res->push_back(TStringType(lc.Last, str.data() + str.size() - lc.Last)); - } - } else { + } + } else { DoSplit1(cc, d, str, options); - } -} - -template <typename TChr> + } +} + +template <typename TChr> static void SplitStringImplT(TVector<std::conditional_t<std::is_same<TChr, wchar16>::value, TUtf16String, TString>>* res, const TBasicStringBuf<TChr> str, const TChr* delim, size_t maxFields, int options) { - if (!*delim) { - return; - } - - if (*(delim + 1)) { + if (!*delim) { + return; + } + + if (*(delim + 1)) { TStringDelimiter<const TChr> d(delim, std::char_traits<TChr>::length(delim)); - + DoSplit0(res, str, d, maxFields, options); - } else { - TCharDelimiter<const TChr> d(*delim); - + } else { + TCharDelimiter<const TChr> d(*delim); + DoSplit0(res, str, d, maxFields, options); - } -} - + } +} + 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); -} - +} + 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); } 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); -} - +} + 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); } diff --git a/util/string/vector.h b/util/string/vector.h index e36c348bbe..9d486e2356 100644 --- a/util/string/vector.h +++ b/util/string/vector.h @@ -3,15 +3,15 @@ #include "cast.h" #include "split.h" -#include <util/generic/map.h> +#include <util/generic/map.h> #include <util/generic/strbuf.h> #include <util/generic/string.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/string/cast.h> #include <util/system/yassert.h> #define KEEP_EMPTY_TOKENS 0x01 - + // // NOTE: Check StringSplitter below to get more convenient split string interface. @@ -47,9 +47,9 @@ SplitString(const C* ptr, const C* delimiter, size_t maxFields = 0, int options = 0) { TVector<typename ::NPrivate::TStringDeducer<C>::type> res; ::NPrivate::SplitStringImpl(&res, ptr, delimiter, maxFields, options); - return res; -} - + return res; +} + template <typename C> TVector<typename ::NPrivate::TStringDeducer<C>::type> SplitString(const C* ptr, size_t len, const C* delimiter, diff --git a/util/system/atexit.cpp b/util/system/atexit.cpp index 74fb10b6b1..328b0efa3b 100644 --- a/util/system/atexit.cpp +++ b/util/system/atexit.cpp @@ -4,7 +4,7 @@ #include "spinlock.h" #include "thread.h" -#include <util/generic/ylimits.h> +#include <util/generic/ylimits.h> #include <util/generic/utility.h> #include <util/generic/deque.h> #include <util/generic/queue.h> diff --git a/util/system/atexit_ut.cpp b/util/system/atexit_ut.cpp index 953f432811..d577b27a2a 100644 --- a/util/system/atexit_ut.cpp +++ b/util/system/atexit_ut.cpp @@ -1,85 +1,85 @@ #include <library/cpp/testing/unittest/registar.h> #include "atexit.h" - + #include <errno.h> -#ifdef _win_ +#ifdef _win_ // not implemented -#else +#else #include <sys/types.h> #include <sys/wait.h> -#endif //_win_ - -#include <stdio.h> - -#ifdef _win_ +#endif //_win_ + +#include <stdio.h> + +#ifdef _win_ // not implemented -#else -struct TAtExitParams { - TAtExitParams(int fd_, const char* str_) - : fd(fd_) - , str(str_) - { - } - - int fd; - const char* str; -}; - +#else +struct TAtExitParams { + TAtExitParams(int fd_, const char* str_) + : fd(fd_) + , str(str_) + { + } + + int fd; + const char* str; +}; + void MyAtExitFunc(void* ptr) { THolder<TAtExitParams> params{static_cast<TAtExitParams*>(ptr)}; if (write(params->fd, params->str, strlen(params->str)) < 0) { abort(); } -} -#endif - +} +#endif + class TAtExitTest: public TTestBase { UNIT_TEST_SUITE(TAtExitTest); UNIT_TEST(TestAtExit) - UNIT_TEST_SUITE_END(); - - void TestAtExit() { -#ifdef _win_ + UNIT_TEST_SUITE_END(); + + void TestAtExit() { +#ifdef _win_ // not implemented -#else - int ret; - int pipefd[2]; - - ret = pipe(pipefd); - UNIT_ASSERT(ret == 0); - - pid_t pid = fork(); - - if (pid < 0) { - UNIT_ASSERT(0); - } - - if (pid > 0) { - char data[1024]; - int last = 0; - - close(pipefd[1]); - - while (read(pipefd[0], data + last++, 1) > 0 && last < 1024) { - } - data[--last] = 0; - - UNIT_ASSERT(strcmp(data, "High prio\nMiddle prio\nLow-middle prio\nLow prio\nVery low prio\n") == 0); - } else { - close(pipefd[0]); - - AtExit(MyAtExitFunc, new TAtExitParams(pipefd[1], "Low prio\n"), 3); - AtExit(MyAtExitFunc, new TAtExitParams(pipefd[1], "Middle prio\n"), 5); - AtExit(MyAtExitFunc, new TAtExitParams(pipefd[1], "High prio\n"), 7); - AtExit(MyAtExitFunc, new TAtExitParams(pipefd[1], "Very low prio\n"), 1); - AtExit(MyAtExitFunc, new TAtExitParams(pipefd[1], "Low-middle prio\n"), 4); - - exit(0); - } -#endif //_win_ - } -}; - -UNIT_TEST_SUITE_REGISTRATION(TAtExitTest); +#else + int ret; + int pipefd[2]; + + ret = pipe(pipefd); + UNIT_ASSERT(ret == 0); + + pid_t pid = fork(); + + if (pid < 0) { + UNIT_ASSERT(0); + } + + if (pid > 0) { + char data[1024]; + int last = 0; + + close(pipefd[1]); + + while (read(pipefd[0], data + last++, 1) > 0 && last < 1024) { + } + data[--last] = 0; + + UNIT_ASSERT(strcmp(data, "High prio\nMiddle prio\nLow-middle prio\nLow prio\nVery low prio\n") == 0); + } else { + close(pipefd[0]); + + AtExit(MyAtExitFunc, new TAtExitParams(pipefd[1], "Low prio\n"), 3); + AtExit(MyAtExitFunc, new TAtExitParams(pipefd[1], "Middle prio\n"), 5); + AtExit(MyAtExitFunc, new TAtExitParams(pipefd[1], "High prio\n"), 7); + AtExit(MyAtExitFunc, new TAtExitParams(pipefd[1], "Very low prio\n"), 1); + AtExit(MyAtExitFunc, new TAtExitParams(pipefd[1], "Low-middle prio\n"), 4); + + exit(0); + } +#endif //_win_ + } +}; + +UNIT_TEST_SUITE_REGISTRATION(TAtExitTest); diff --git a/util/system/backtrace_ut.cpp b/util/system/backtrace_ut.cpp index 9b5ead71bc..41e62bd188 100644 --- a/util/system/backtrace_ut.cpp +++ b/util/system/backtrace_ut.cpp @@ -2,21 +2,21 @@ #include <util/generic/array_ref.h> #include <library/cpp/testing/unittest/registar.h> - + #include <util/stream/output.h> using PFunc = int (*)(void**, size_t); - -int Dbg1(void** buf, size_t len) { + +int Dbg1(void** buf, size_t len) { volatile int ret = (int)BackTrace(buf, len); - return ret; -} - -int Dbg2(void** buf, size_t len) { + return ret; +} + +int Dbg2(void** buf, size_t len) { volatile int ret = (int)BackTrace(buf, len); - return ret; -} - + return ret; +} + void FormatBackTraceReplacement(IOutputStream* out, void* const*, size_t) { *out << "WorksLikeACharm" << Endl; } @@ -35,13 +35,13 @@ void SomeMethod() { } class TBackTraceTest: public TTestBase { - UNIT_TEST_SUITE(TBackTraceTest); + UNIT_TEST_SUITE(TBackTraceTest); UNIT_TEST(TestBackTrace) UNIT_TEST(TestBackTraceView) UNIT_TEST(TestPrintBackTrace) UNIT_TEST(TestSetFormatBackTraceFn) - UNIT_TEST_SUITE_END(); - + UNIT_TEST_SUITE_END(); + void TestPrintBackTrace() { SomeMethod(); } @@ -55,21 +55,21 @@ class TBackTraceTest: public TTestBase { TestPrintBackTrace(); } - void TestBackTrace() { + void TestBackTrace() { //PrintBackTrace(); - void* buf1[100]; - size_t ret1; - - void* buf2[100]; - size_t ret2; - - volatile PFunc func = &Dbg1; - ret1 = (*func)(buf1, 100); - func = &Dbg2; - ret2 = (*func)(buf2, 100); - - UNIT_ASSERT_EQUAL(ret1, ret2); - } + void* buf1[100]; + size_t ret1; + + void* buf2[100]; + size_t ret2; + + volatile PFunc func = &Dbg1; + ret1 = (*func)(buf1, 100); + func = &Dbg2; + ret2 = (*func)(buf2, 100); + + UNIT_ASSERT_EQUAL(ret1, ret2); + } void TestBackTraceView() { try { @@ -80,6 +80,6 @@ class TBackTraceTest: public TTestBase { UNIT_ASSERT_VALUES_EQUAL(btView.size(), bt.size()); } } -}; - -UNIT_TEST_SUITE_REGISTRATION(TBackTraceTest); +}; + +UNIT_TEST_SUITE_REGISTRATION(TBackTraceTest); diff --git a/util/system/condvar.h b/util/system/condvar.h index 569162717c..79fe7d98bd 100644 --- a/util/system/condvar.h +++ b/util/system/condvar.h @@ -2,8 +2,8 @@ #include "mutex.h" -#include <util/generic/ptr.h> -#include <util/generic/noncopyable.h> +#include <util/generic/ptr.h> +#include <util/generic/noncopyable.h> #include <util/datetime/base.h> #include <utility> diff --git a/util/system/condvar_ut.cpp b/util/system/condvar_ut.cpp index 5130a18d32..7c1c85a26a 100644 --- a/util/system/condvar_ut.cpp +++ b/util/system/condvar_ut.cpp @@ -3,45 +3,45 @@ #include "condvar.h" #include <library/cpp/testing/unittest/registar.h> - + #include <util/system/atomic.h> #include <util/system/atomic_ops.h> #include <util/thread/pool.h> - + class TCondVarTest: public TTestBase { - UNIT_TEST_SUITE(TCondVarTest); + UNIT_TEST_SUITE(TCondVarTest); UNIT_TEST(TestBasics) UNIT_TEST(TestSyncronize) - UNIT_TEST_SUITE_END(); - - struct TSharedData { - TSharedData() - : stopWaiting(false) - , in(0) - , out(0) - , waited(0) - , failed(false) - { - } - - TMutex mutex; - TCondVar condVar1; - TCondVar condVar2; - + UNIT_TEST_SUITE_END(); + + struct TSharedData { + TSharedData() + : stopWaiting(false) + , in(0) + , out(0) + , waited(0) + , failed(false) + { + } + + TMutex mutex; + TCondVar condVar1; + TCondVar condVar2; + TAtomic stopWaiting; - + TAtomic in; TAtomic out; - + TAtomic waited; - - bool failed; - }; - + + bool failed; + }; + class TThreadTask: public IObjectInQueue { public: using PFunc = void (TThreadTask::*)(void); - + TThreadTask(PFunc func, size_t id, size_t totalIds, TSharedData& data) : Func_(func) , Id_(id) @@ -49,20 +49,20 @@ class TCondVarTest: public TTestBase { , Data_(data) { } - + void Process(void*) override { THolder<TThreadTask> This(this); (this->*Func_)(); } - + #define FAIL_ASSERT(cond) \ if (!(cond)) { \ Data_.failed = true; \ - } + } void RunBasics() { Y_ASSERT(TotalIds_ == 3); - + if (Id_ < 2) { TGuard<TMutex> guard(Data_.mutex); while (!AtomicGet(Data_.stopWaiting)) { @@ -109,10 +109,10 @@ class TCondVarTest: public TTestBase { AtomicIncrement(Data_.waited); while (AtomicGet(Data_.in) < TotalIds_) { bool res = Data_.condVar1.WaitT(Data_.mutex, TDuration::Seconds(1)); - FAIL_ASSERT(res == true); - } - } - + FAIL_ASSERT(res == true); + } + } + AtomicIncrement(Data_.out); if (AtomicGet(Data_.out) == TotalIds_) { AtomicSet(Data_.in, 0); @@ -121,10 +121,10 @@ class TCondVarTest: public TTestBase { while (AtomicGet(Data_.out) < TotalIds_) { bool res = Data_.condVar2.WaitT(Data_.mutex, TDuration::Seconds(1)); FAIL_ASSERT(res == true); - } - } + } + } } - + FAIL_ASSERT(AtomicGet(Data_.waited) == (TotalIds_ - 1) * 10); } @@ -157,15 +157,15 @@ class TCondVarTest: public TTestBase { FAIL_ASSERT(Data_.waited == (TotalIds_ - 1) * 10); } -#undef FAIL_ASSERT - +#undef FAIL_ASSERT + private: PFunc Func_; size_t Id_; TAtomicBase TotalIds_; TSharedData& Data_; - }; - + }; + private: #define RUN_CYCLE(what, count) \ Q_.Start(count); \ @@ -176,11 +176,11 @@ private: bool b = Data_.failed; \ Data_.failed = false; \ UNIT_ASSERT(!b); - + inline void TestBasics() { RUN_CYCLE(RunBasics, 3); } - + inline void TestBasicsWithPredicate() { RUN_CYCLE(RunBasicsWithPredicate, 3); } @@ -195,6 +195,6 @@ private: #undef RUN_CYCLE TSharedData Data_; TThreadPool Q_; -}; - -UNIT_TEST_SUITE_REGISTRATION(TCondVarTest); +}; + +UNIT_TEST_SUITE_REGISTRATION(TCondVarTest); diff --git a/util/system/context.cpp b/util/system/context.cpp index ad99309088..82d113b09c 100644 --- a/util/system/context.cpp +++ b/util/system/context.cpp @@ -25,7 +25,7 @@ namespace __cxxabiv1 { #endif #include <util/stream/output.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #define FROM_CONTEXT_IMPL #include "context.h" @@ -220,10 +220,10 @@ void ContextTrampoLine(void* arg) { TContMachineContext::TContMachineContext() : Fiber_(ConvertThreadToFiber(this)) , MainFiber_(true) -{ +{ Y_ENSURE(Fiber_, TStringBuf("fiber error")); -} - +} + TContMachineContext::TContMachineContext(const TContClosure& c) : Fiber_(CreateFiber(c.Stack.size(), (LPFIBER_START_ROUTINE)ContextTrampoLine, (LPVOID)c.TrampoLine)) , MainFiber_(false) diff --git a/util/system/context.h b/util/system/context.h index d2a349bfc5..5db49a9583 100644 --- a/util/system/context.h +++ b/util/system/context.h @@ -7,7 +7,7 @@ #include <util/generic/array_ref.h> #include <util/generic/utility.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #define STACK_ALIGN (8 * PLATFORM_DATA_ALIGN) diff --git a/util/system/dynlib.cpp b/util/system/dynlib.cpp index 9d2541c25f..35ebc4f7b8 100644 --- a/util/system/dynlib.cpp +++ b/util/system/dynlib.cpp @@ -123,7 +123,7 @@ void* TDynamicLibrary::SymOptional(const char* name) noexcept { void* TDynamicLibrary::Sym(const char* name) { if (!IsLoaded()) { - ythrow yexception() << "library not loaded"; + ythrow yexception() << "library not loaded"; } return Impl_->Sym(name); diff --git a/util/system/dynlib.h b/util/system/dynlib.h index 66eaf4a5c1..de77cd86cf 100644 --- a/util/system/dynlib.h +++ b/util/system/dynlib.h @@ -2,7 +2,7 @@ #include "defaults.h" -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/generic/string.h> #define Y_GET_FUNC(dll, name) FUNC_##name((dll).Sym(#name)) diff --git a/util/system/error_ut.cpp b/util/system/error_ut.cpp index 763b0dddb7..57fbf40b5f 100644 --- a/util/system/error_ut.cpp +++ b/util/system/error_ut.cpp @@ -2,7 +2,7 @@ #include <library/cpp/testing/unittest/registar.h> -#include <util/generic/ylimits.h> +#include <util/generic/ylimits.h> #ifdef _win_ #include "winint.h" diff --git a/util/system/event.h b/util/system/event.h index cab2fc478a..7e8dfe4d2b 100644 --- a/util/system/event.h +++ b/util/system/event.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/datetime/base.h> struct TEventResetType { diff --git a/util/system/event_ut.cpp b/util/system/event_ut.cpp index 2506cb7a91..685336e927 100644 --- a/util/system/event_ut.cpp +++ b/util/system/event_ut.cpp @@ -2,22 +2,22 @@ #include "atomic.h" #include <library/cpp/testing/unittest/registar.h> - + #include <util/thread/pool.h> - + namespace { - struct TSharedData { - TSharedData() - : Counter(0) - , failed(false) - { - } - + struct TSharedData { + TSharedData() + : Counter(0) + , failed(false) + { + } + TAtomic Counter; TManualEvent event; - bool failed; - }; - + bool failed; + }; + struct TThreadTask: public IObjectInQueue { public: TThreadTask(TSharedData& data, size_t id) @@ -25,7 +25,7 @@ namespace { , Id_(id) { } - + void Process(void*) override { THolder<TThreadTask> This(this); @@ -38,16 +38,16 @@ namespace { Data_.event.Signal(); } else { while (!Data_.event.WaitT(TDuration::Seconds(100))) { - } + } AtomicAdd(Data_.Counter, Id_); - } + } } - + private: TSharedData& Data_; size_t Id_; - }; - + }; + class TSignalTask: public IObjectInQueue { private: TManualEvent& Ev_; @@ -89,12 +89,12 @@ Y_UNIT_TEST_SUITE(EventTest) { queue.Start(5); for (size_t i = 0; i < 5; ++i) { UNIT_ASSERT(queue.Add(new TThreadTask(data, i))); - } + } queue.Stop(); UNIT_ASSERT(data.Counter == 10); UNIT_ASSERT(!data.failed); } - + Y_UNIT_TEST(ConcurrentSignalAndWaitTest) { // test for problem detected by thread-sanitizer (signal/wait race) SEARCH-2113 const size_t limit = 200; @@ -121,7 +121,7 @@ Y_UNIT_TEST_SUITE(EventTest) { tasks.emplace_back(MakeHolder<TSignalTask>(*owner->Ev)); tasks.emplace_back(std::move(owner)); } - + TThreadPool queue; queue.Start(4); for (auto& task : tasks) { diff --git a/util/system/file.cpp b/util/system/file.cpp index 4a261d020c..3a684cd90a 100644 --- a/util/system/file.cpp +++ b/util/system/file.cpp @@ -18,7 +18,7 @@ #include <util/generic/size_literals.h> #include <util/generic/string.h> -#include <util/generic/ylimits.h> +#include <util/generic/ylimits.h> #include <util/generic/yexception.h> #include <util/datetime/base.h> diff --git a/util/system/file.h b/util/system/file.h index 9502e159b6..1d67a2ca7f 100644 --- a/util/system/file.h +++ b/util/system/file.h @@ -4,7 +4,7 @@ #include "flock.h" #include <util/generic/flags.h> -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/generic/noncopyable.h> #include <cstdio> diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp index 7454a4cb94..50b94878ee 100644 --- a/util/system/filemap.cpp +++ b/util/system/filemap.cpp @@ -30,7 +30,7 @@ #error todo #endif -#include <util/generic/utility.h> +#include <util/generic/utility.h> #include <util/system/sanitizers.h> #include "filemap.h" @@ -512,7 +512,7 @@ void TFileMap::Unmap() { if (Map_.Unmap(Region_)) { Region_.Reset(); } else { - ythrow yexception() << "can't unmap file"; + ythrow yexception() << "can't unmap file"; } } diff --git a/util/system/filemap.h b/util/system/filemap.h index 11be64bff4..5517231d34 100644 --- a/util/system/filemap.h +++ b/util/system/filemap.h @@ -5,8 +5,8 @@ #include "yassert.h" #include <util/generic/noncopyable.h> -#include <util/generic/ptr.h> -#include <util/generic/utility.h> +#include <util/generic/ptr.h> +#include <util/generic/utility.h> #include <util/generic/yexception.h> #include <util/generic/flags.h> #include <util/generic/string.h> diff --git a/util/system/filemap_ut.cpp b/util/system/filemap_ut.cpp index 73f109dc88..96836304af 100644 --- a/util/system/filemap_ut.cpp +++ b/util/system/filemap_ut.cpp @@ -3,9 +3,9 @@ #ifdef _unix_ #include <sys/resource.h> #endif - -#include "filemap.h" - + +#include "filemap.h" + #include <util/system/fs.h> #include <cstring> @@ -13,43 +13,43 @@ Y_UNIT_TEST_SUITE(TFileMapTest) { static const char* FileName_("./mappped_file"); - + void BasicTest(TMemoryMapCommon::EOpenMode mode) { - char data[] = "abcdefgh"; - + char data[] = "abcdefgh"; + TFile file(FileName_, CreateAlways | WrOnly); file.Write(static_cast<void*>(data), sizeof(data)); - file.Close(); - - { + file.Close(); + + { TFileMap mappedFile(FileName_, mode); - mappedFile.Map(0, mappedFile.Length()); - UNIT_ASSERT(mappedFile.MappedSize() == sizeof(data) && mappedFile.Length() == sizeof(data)); - UNIT_ASSERT(mappedFile.IsOpen()); - for (size_t i = 0; i < sizeof(data); ++i) { - UNIT_ASSERT(static_cast<char*>(mappedFile.Ptr())[i] == data[i]); - static_cast<char*>(mappedFile.Ptr())[i] = data[i] + 1; - } - mappedFile.Flush(); + mappedFile.Map(0, mappedFile.Length()); + UNIT_ASSERT(mappedFile.MappedSize() == sizeof(data) && mappedFile.Length() == sizeof(data)); + UNIT_ASSERT(mappedFile.IsOpen()); + for (size_t i = 0; i < sizeof(data); ++i) { + UNIT_ASSERT(static_cast<char*>(mappedFile.Ptr())[i] == data[i]); + static_cast<char*>(mappedFile.Ptr())[i] = data[i] + 1; + } + mappedFile.Flush(); TFileMap::TMapResult mapResult = mappedFile.Map(2, 2); UNIT_ASSERT(mapResult.MappedSize() == 2); UNIT_ASSERT(mapResult.MappedData() == mappedFile.Ptr()); - UNIT_ASSERT(mappedFile.MappedSize() == 2); - UNIT_ASSERT(static_cast<char*>(mappedFile.Ptr())[0] == 'd' && static_cast<char*>(mappedFile.Ptr())[1] == 'e'); + UNIT_ASSERT(mappedFile.MappedSize() == 2); + UNIT_ASSERT(static_cast<char*>(mappedFile.Ptr())[0] == 'd' && static_cast<char*>(mappedFile.Ptr())[1] == 'e'); - mappedFile.Unmap(); + mappedFile.Unmap(); UNIT_ASSERT(mappedFile.MappedSize() == 0); FILE* f = fopen(FileName_, "rb"); TFileMap mappedFile2(f); - mappedFile2.Map(0, mappedFile2.Length()); - UNIT_ASSERT(mappedFile2.MappedSize() == sizeof(data)); - UNIT_ASSERT(static_cast<char*>(mappedFile2.Ptr())[0] == data[0] + 1); - fclose(f); - } + mappedFile2.Map(0, mappedFile2.Length()); + UNIT_ASSERT(mappedFile2.MappedSize() == sizeof(data)); + UNIT_ASSERT(static_cast<char*>(mappedFile2.Ptr())[0] == data[0] + 1); + fclose(f); + } NFs::Remove(FileName_); - } + } Y_UNIT_TEST(TestFileMap) { BasicTest(TMemoryMapCommon::oRdWr); @@ -170,7 +170,7 @@ Y_UNIT_TEST_SUITE(TFileMapTest) { maps.emplace_back(MakeHolder<TFileMap>(FileName_, TMemoryMapCommon::oRdOnly | TMemoryMapCommon::oNotGreedy)); maps.back()->Map(i * sizeof(page), sizeof(page)); } - + // Oh, good, we're not dead yet for (int i = 0; i < 16; ++i) { TFileMap& map = *maps[i]; @@ -212,20 +212,20 @@ Y_UNIT_TEST_SUITE(TFileMapTest) { #endif Y_UNIT_TEST(TestFileMappedArray) { - { + { TFileMappedArray<ui32> mappedArray; - ui32 data[] = {123, 456, 789, 10}; - size_t sz = sizeof(data) / sizeof(data[0]); + ui32 data[] = {123, 456, 789, 10}; + size_t sz = sizeof(data) / sizeof(data[0]); TFile file(FileName_, CreateAlways | WrOnly); file.Write(static_cast<void*>(data), sizeof(data)); - file.Close(); - + file.Close(); + mappedArray.Init(FileName_); // actual test begin UNIT_ASSERT(mappedArray.Size() == sz); for (size_t i = 0; i < sz; ++i) { - UNIT_ASSERT(mappedArray[i] == data[i]); + UNIT_ASSERT(mappedArray[i] == data[i]); } UNIT_ASSERT(mappedArray.GetAt(mappedArray.Size()) == 0); @@ -234,7 +234,7 @@ Y_UNIT_TEST_SUITE(TFileMapTest) { UNIT_ASSERT(!mappedArray.Empty()); // actual test end mappedArray.Term(); - + // Init array via file mapping TFileMap fileMap(FileName_); fileMap.Map(0, fileMap.Length()); @@ -255,41 +255,41 @@ Y_UNIT_TEST_SUITE(TFileMapTest) { file = TFile(FileName_, WrOnly); file.Seek(0, sEnd); file.Write("x", 1); - file.Close(); - + file.Close(); + bool caught = false; - try { + try { mappedArray.Init(FileName_); - } catch (const yexception&) { + } catch (const yexception&) { caught = true; - } + } UNIT_ASSERT(caught); - } + } NFs::Remove(FileName_); - } - + } + Y_UNIT_TEST(TestMappedArray) { - ui32 sz = 10; + ui32 sz = 10; TMappedArray<ui32> mappedArray; - ui32* ptr = mappedArray.Create(sz); + ui32* ptr = mappedArray.Create(sz); UNIT_ASSERT(ptr != nullptr); - UNIT_ASSERT(mappedArray.size() == sz); - UNIT_ASSERT(mappedArray.begin() + sz == mappedArray.end()); - - for (size_t i = 0; i < sz; ++i) { + UNIT_ASSERT(mappedArray.size() == sz); + UNIT_ASSERT(mappedArray.begin() + sz == mappedArray.end()); + + for (size_t i = 0; i < sz; ++i) { mappedArray[i] = (ui32)i; - } - for (size_t i = 0; i < sz; ++i) { - UNIT_ASSERT(mappedArray[i] == i); - } - + } + for (size_t i = 0; i < sz; ++i) { + UNIT_ASSERT(mappedArray[i] == i); + } + TMappedArray<ui32> mappedArray2(1000); - mappedArray.swap(mappedArray2); + mappedArray.swap(mappedArray2); UNIT_ASSERT(mappedArray.size() == 1000 && mappedArray2.size() == sz); - } - + } + Y_UNIT_TEST(TestMemoryMap) { TFile file(FileName_, CreateAlways | WrOnly); file.Close(); @@ -356,4 +356,4 @@ Y_UNIT_TEST_SUITE(TFileMapTest) { } NFs::Remove(FileName_); } -}; +}; diff --git a/util/system/guard.h b/util/system/guard.h index efc091d5f8..e4e6b04853 100644 --- a/util/system/guard.h +++ b/util/system/guard.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/noncopyable.h> +#include <util/generic/noncopyable.h> template <class T> struct TCommonLockOps { diff --git a/util/system/guard_ut.cpp b/util/system/guard_ut.cpp index 404ede99ab..e5901d1c8e 100644 --- a/util/system/guard_ut.cpp +++ b/util/system/guard_ut.cpp @@ -2,11 +2,11 @@ #include "rwlock.h" #include <library/cpp/testing/unittest/registar.h> - + #include <util/thread/pool.h> - + struct TTestGuard: public TTestBase { - UNIT_TEST_SUITE(TTestGuard); + UNIT_TEST_SUITE(TTestGuard); UNIT_TEST(TestGuard) UNIT_TEST(TestTryGuard) UNIT_TEST(TestMove) @@ -15,20 +15,20 @@ struct TTestGuard: public TTestBase { UNIT_TEST(TestTryReadGuard) UNIT_TEST(TestWithLock) UNIT_TEST(TestWithLockScope); - UNIT_TEST_SUITE_END(); - - struct TGuardChecker { - TGuardChecker() - : guarded(false) - { - } - - void Acquire() { - guarded = true; - } - void Release() { - guarded = false; - } + UNIT_TEST_SUITE_END(); + + struct TGuardChecker { + TGuardChecker() + : guarded(false) + { + } + + void Acquire() { + guarded = true; + } + void Release() { + guarded = false; + } bool TryAcquire() { if (guarded) { return false; @@ -37,10 +37,10 @@ struct TTestGuard: public TTestBase { return true; } } - - bool guarded; - }; - + + bool guarded; + }; + void TestUnguard() { TGuardChecker m; @@ -101,16 +101,16 @@ struct TTestGuard: public TTestBase { UNIT_ASSERT_VALUES_EQUAL(n, 1); } - void TestGuard() { - TGuardChecker checker; - - UNIT_ASSERT(!checker.guarded); - { - TGuard<TGuardChecker> guard(checker); - UNIT_ASSERT(checker.guarded); - } - UNIT_ASSERT(!checker.guarded); - } + void TestGuard() { + TGuardChecker checker; + + UNIT_ASSERT(!checker.guarded); + { + TGuard<TGuardChecker> guard(checker); + UNIT_ASSERT(checker.guarded); + } + UNIT_ASSERT(!checker.guarded); + } void TestTryGuard() { TGuardChecker checker; @@ -175,6 +175,6 @@ struct TTestGuard: public TTestBase { Y_UNUSED(Guard); } } -}; - -UNIT_TEST_SUITE_REGISTRATION(TTestGuard) +}; + +UNIT_TEST_SUITE_REGISTRATION(TTestGuard) diff --git a/util/system/hostname.cpp b/util/system/hostname.cpp index 386f646d6b..2fe1adb19c 100644 --- a/util/system/hostname.cpp +++ b/util/system/hostname.cpp @@ -1,6 +1,6 @@ #include <util/memory/tempbuf.h> #include <util/generic/singleton.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #include <util/network/ip.h> #if defined(_unix_) diff --git a/util/system/mutex.cpp b/util/system/mutex.cpp index 4041402db9..5710447400 100644 --- a/util/system/mutex.cpp +++ b/util/system/mutex.cpp @@ -85,7 +85,7 @@ public: return TryEnterCriticalSection(obj); #endif // _WIN32_WINNT < 0x0400 } -#endif // _win_ +#endif // _win_ inline bool TryAcquire() noexcept { #if defined(_win_) diff --git a/util/system/mutex.h b/util/system/mutex.h index 032630d134..5973b169c6 100644 --- a/util/system/mutex.h +++ b/util/system/mutex.h @@ -3,8 +3,8 @@ #include "guard.h" #include "defaults.h" -#include <util/generic/ptr.h> -#include <util/generic/noncopyable.h> +#include <util/generic/ptr.h> +#include <util/generic/noncopyable.h> class TFakeMutex: public TNonCopyable { public: diff --git a/util/system/mutex_ut.cpp b/util/system/mutex_ut.cpp index c8d7caafa1..0fc27c191d 100644 --- a/util/system/mutex_ut.cpp +++ b/util/system/mutex_ut.cpp @@ -2,52 +2,52 @@ #include "atomic.h" #include <library/cpp/testing/unittest/registar.h> - + #include <util/thread/pool.h> -#include <util/random/random.h> - +#include <util/random/random.h> + class TMutexTest: public TTestBase { - UNIT_TEST_SUITE(TMutexTest); + UNIT_TEST_SUITE(TMutexTest); UNIT_TEST(TestBasics) UNIT_TEST(TestFake) UNIT_TEST(TestRecursive) - UNIT_TEST_SUITE_END(); - - struct TSharedData { - TSharedData() - : sharedCounter(0) - , failed(false) - { - } - - volatile ui32 sharedCounter; - TMutex mutex; - TFakeMutex fakeMutex; - - bool failed; - }; - + UNIT_TEST_SUITE_END(); + + struct TSharedData { + TSharedData() + : sharedCounter(0) + , failed(false) + { + } + + volatile ui32 sharedCounter; + TMutex mutex; + TFakeMutex fakeMutex; + + bool failed; + }; + class TThreadTask: public IObjectInQueue { public: using PFunc = void (TThreadTask::*)(void); - + TThreadTask(PFunc func, TSharedData& data, size_t id) : Func_(func) , Data_(data) , Id_(id) { } - + void Process(void*) override { THolder<TThreadTask> This(this); (this->*Func_)(); } - + #define FAIL_ASSERT(cond) \ if (!(cond)) { \ Data_.failed = true; \ - } + } void RunBasics() { Data_.mutex.Acquire(); @@ -55,10 +55,10 @@ class TMutexTest: public TTestBase { Data_.sharedCounter = oldCounter; usleep(10 + RandomNumber<ui32>() % 10); FAIL_ASSERT(Data_.sharedCounter == oldCounter); - + Data_.mutex.Release(); } - + void RunFakeMutex() { bool res = Data_.fakeMutex.TryAcquire(); FAIL_ASSERT(res); @@ -69,9 +69,9 @@ class TMutexTest: public TTestBase { Data_.mutex.Acquire(); ++Data_.sharedCounter; usleep(1); - } + } FAIL_ASSERT(Data_.sharedCounter == Id_ + 1); - + bool res = Data_.mutex.TryAcquire(); FAIL_ASSERT(res); Data_.mutex.Release(); @@ -79,20 +79,20 @@ class TMutexTest: public TTestBase { for (size_t i = 0; i < Id_; ++i) { --Data_.sharedCounter; Data_.mutex.Release(); - } + } FAIL_ASSERT(Data_.sharedCounter == 1); --Data_.sharedCounter; Data_.mutex.Release(); } - -#undef FAIL_ASSERT - + +#undef FAIL_ASSERT + private: PFunc Func_; TSharedData& Data_; size_t Id_; - }; - + }; + private: #define RUN_CYCLE(what, count) \ Q_.Start(count); \ @@ -103,27 +103,27 @@ private: bool b = Data_.failed; \ Data_.failed = false; \ UNIT_ASSERT(!b); - + void TestBasics() { RUN_CYCLE(RunBasics, 5); - + UNIT_ASSERT(Data_.sharedCounter == 10); Data_.sharedCounter = 0; } - + void TestFake() { RUN_CYCLE(RunFakeMutex, 3); } - + void TestRecursive() { RUN_CYCLE(RunRecursiveMutex, 4); } - -#undef RUN_CYCLE - + +#undef RUN_CYCLE + private: TSharedData Data_; TThreadPool Q_; -}; - -UNIT_TEST_SUITE_REGISTRATION(TMutexTest) +}; + +UNIT_TEST_SUITE_REGISTRATION(TMutexTest) diff --git a/util/system/rwlock_ut.cpp b/util/system/rwlock_ut.cpp index 2b384c05b3..d050737c9c 100644 --- a/util/system/rwlock_ut.cpp +++ b/util/system/rwlock_ut.cpp @@ -2,36 +2,36 @@ #include "atomic.h" #include <library/cpp/testing/unittest/registar.h> - + #include <util/thread/pool.h> -#include <util/random/random.h> - +#include <util/random/random.h> + class TRWMutexTest: public TTestBase { - UNIT_TEST_SUITE(TRWMutexTest); + UNIT_TEST_SUITE(TRWMutexTest); UNIT_TEST(TestReaders) UNIT_TEST(TestReadersWriters) - UNIT_TEST_SUITE_END(); - - struct TSharedData { - TSharedData() - : writersIn(0) - , readersIn(0) - , failed(false) - { - } - + UNIT_TEST_SUITE_END(); + + struct TSharedData { + TSharedData() + : writersIn(0) + , readersIn(0) + , failed(false) + { + } + TAtomic writersIn; TAtomic readersIn; - - bool failed; - - TRWMutex mutex; - }; + + bool failed; + + TRWMutex mutex; + }; class TThreadTask: public IObjectInQueue { public: using PFunc = void (TThreadTask::*)(void); - + TThreadTask(PFunc func, TSharedData& data, size_t id, size_t total) : Func_(func) , Data_(data) @@ -39,62 +39,62 @@ class TRWMutexTest: public TTestBase { , Total_(total) { } - + void Process(void*) override { THolder<TThreadTask> This(this); (this->*Func_)(); } - + #define FAIL_ASSERT(cond) \ if (!(cond)) { \ Data_.failed = true; \ - } + } void RunReaders() { Data_.mutex.AcquireRead(); - + AtomicIncrement(Data_.readersIn); usleep(100); FAIL_ASSERT(Data_.readersIn == long(Total_)); usleep(100); AtomicDecrement(Data_.readersIn); - + Data_.mutex.ReleaseRead(); } - + void RunReadersWriters() { if (Id_ % 2 == 0) { for (size_t i = 0; i < 10; ++i) { Data_.mutex.AcquireRead(); - + AtomicIncrement(Data_.readersIn); FAIL_ASSERT(Data_.writersIn == 0); usleep(RandomNumber<ui32>() % 5); AtomicDecrement(Data_.readersIn); - + Data_.mutex.ReleaseRead(); } } else { for (size_t i = 0; i < 10; ++i) { Data_.mutex.AcquireWrite(); - + AtomicIncrement(Data_.writersIn); FAIL_ASSERT(Data_.readersIn == 0 && Data_.writersIn == 1); usleep(RandomNumber<ui32>() % 5); AtomicDecrement(Data_.writersIn); - + Data_.mutex.ReleaseWrite(); - } - } + } + } } -#undef FAIL_ASSERT - +#undef FAIL_ASSERT + private: PFunc Func_; TSharedData& Data_; size_t Id_; size_t Total_; - }; + }; private: #define RUN_CYCLE(what, count) \ @@ -106,19 +106,19 @@ private: bool b = Data_.failed; \ Data_.failed = false; \ UNIT_ASSERT(!b); - + void TestReaders() { RUN_CYCLE(RunReaders, 1); } - + void TestReadersWriters() { RUN_CYCLE(RunReadersWriters, 1); } - -#undef RUN_CYCLE + +#undef RUN_CYCLE private: TSharedData Data_; TThreadPool Q_; -}; - -UNIT_TEST_SUITE_REGISTRATION(TRWMutexTest) +}; + +UNIT_TEST_SUITE_REGISTRATION(TRWMutexTest) diff --git a/util/system/thread.cpp b/util/system/thread.cpp index 6236746c2d..37e4a6b446 100644 --- a/util/system/thread.cpp +++ b/util/system/thread.cpp @@ -2,8 +2,8 @@ #include "thread.h" #include "thread.i" -#include <util/generic/ptr.h> -#include <util/generic/ymath.h> +#include <util/generic/ptr.h> +#include <util/generic/ymath.h> #include <util/generic/ylimits.h> #include <util/generic/yexception.h> #include "yassert.h" diff --git a/util/system/thread.h b/util/system/thread.h index a6e8abdb5b..9ba987f321 100644 --- a/util/system/thread.h +++ b/util/system/thread.h @@ -4,7 +4,7 @@ /// If you need threads, use thread pool functionality in <util/thread/factory.h> /// @see SystemThreadFactory() -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/generic/string.h> #include "defaults.h" diff --git a/util/system/tls.h b/util/system/tls.h index 3c4f56dbeb..c8047ebf9e 100644 --- a/util/system/tls.h +++ b/util/system/tls.h @@ -2,8 +2,8 @@ #include "defaults.h" -#include <util/generic/ptr.h> -#include <util/generic/noncopyable.h> +#include <util/generic/ptr.h> +#include <util/generic/noncopyable.h> #include <new> diff --git a/util/thread/factory.h b/util/thread/factory.h index 561fcbac88..b544798588 100644 --- a/util/thread/factory.h +++ b/util/thread/factory.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <functional> class IThreadFactory { diff --git a/util/thread/pool.cpp b/util/thread/pool.cpp index 05fad02e9b..26f7679419 100644 --- a/util/thread/pool.cpp +++ b/util/thread/pool.cpp @@ -1,15 +1,15 @@ #include <atomic> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #if defined(_unix_) #include <pthread.h> #endif -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/generic/intrlist.h> -#include <util/generic/yexception.h> -#include <util/generic/ylimits.h> +#include <util/generic/yexception.h> +#include <util/generic/ylimits.h> #include <util/generic/singleton.h> #include <util/generic/fastqueue.h> diff --git a/util/thread/pool.h b/util/thread/pool.h index d1ea3a67cb..f51ba928a0 100644 --- a/util/thread/pool.h +++ b/util/thread/pool.h @@ -4,9 +4,9 @@ #include "factory.h" #include <util/system/yassert.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/generic/yexception.h> -#include <util/generic/ptr.h> +#include <util/generic/ptr.h> #include <util/generic/noncopyable.h> #include <functional> diff --git a/util/ysafeptr.h b/util/ysafeptr.h index af7dfd4bed..30096351cc 100644 --- a/util/ysafeptr.h +++ b/util/ysafeptr.h @@ -2,7 +2,7 @@ #include <stddef.h> #include <util/system/yassert.h> -#include <util/system/defaults.h> +#include <util/system/defaults.h> #include <util/system/tls.h> //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/util/ysaveload.h b/util/ysaveload.h index 02efb4049b..f17bb07301 100644 --- a/util/ysaveload.h +++ b/util/ysaveload.h @@ -3,7 +3,7 @@ #include <util/generic/fwd.h> #include <util/generic/strbuf.h> #include <util/generic/string.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> #include <util/generic/typetraits.h> #include <util/generic/algorithm.h> #include <util/stream/output.h> diff --git a/util/ysaveload_ut.cpp b/util/ysaveload_ut.cpp index 723c68f391..049f94338e 100644 --- a/util/ysaveload_ut.cpp +++ b/util/ysaveload_ut.cpp @@ -6,12 +6,12 @@ #include <util/stream/buffer.h> #include <util/memory/blob.h> #include <util/generic/list.h> -#include <util/generic/map.h> +#include <util/generic/map.h> #include <util/generic/set.h> #include <util/generic/hash.h> #include <util/generic/deque.h> #include <util/generic/string.h> -#include <util/generic/vector.h> +#include <util/generic/vector.h> #include <util/generic/buffer.h> #include <util/generic/hash_set.h> #include <util/generic/maybe.h> |