diff options
author | thegeorg <thegeorg@yandex-team.ru> | 2022-02-10 16:45:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:08 +0300 |
commit | 4e839db24a3bbc9f1c610c43d6faaaa99824dcca (patch) | |
tree | 506dac10f5df94fab310584ee51b24fc5a081c22 /library | |
parent | 2d37894b1b037cf24231090eda8589bbb44fb6fc (diff) | |
download | ydb-4e839db24a3bbc9f1c610c43d6faaaa99824dcca.tar.gz |
Restoring authorship annotation for <thegeorg@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library')
187 files changed, 947 insertions, 947 deletions
diff --git a/library/cpp/actors/core/actor_coroutine.cpp b/library/cpp/actors/core/actor_coroutine.cpp index 0ab4d2b24d..a287823028 100644 --- a/library/cpp/actors/core/actor_coroutine.cpp +++ b/library/cpp/actors/core/actor_coroutine.cpp @@ -21,7 +21,7 @@ namespace NActors { : Stack(stackSize) , AllowUnhandledPoisonPill(allowUnhandledPoisonPill) , AllowUnhandledDtor(allowUnhandledDtor) - , FiberClosure{this, TArrayRef(Stack.Begin(), Stack.End())} + , FiberClosure{this, TArrayRef(Stack.Begin(), Stack.End())} , FiberContext(FiberClosure) { #ifndef NDEBUG diff --git a/library/cpp/actors/core/event.cpp b/library/cpp/actors/core/event.cpp index 33f8ce2aaf..95dd27a3bd 100644 --- a/library/cpp/actors/core/event.cpp +++ b/library/cpp/actors/core/event.cpp @@ -16,7 +16,7 @@ namespace NActors { } if (Event) { TAllocChunkSerializer serializer; - Event->SerializeToArcadiaStream(&serializer); + Event->SerializeToArcadiaStream(&serializer); auto chainBuf = serializer.Release(Event->IsExtendedFormat()); Event.Reset(); return chainBuf; @@ -29,7 +29,7 @@ namespace NActors { return Buffer; if (Event) { TAllocChunkSerializer serializer; - Event->SerializeToArcadiaStream(&serializer); + Event->SerializeToArcadiaStream(&serializer); Buffer = serializer.Release(Event->IsExtendedFormat()); return Buffer; } diff --git a/library/cpp/actors/core/event.h b/library/cpp/actors/core/event.h index 6ff02aaf94..e4b957e08f 100644 --- a/library/cpp/actors/core/event.h +++ b/library/cpp/actors/core/event.h @@ -15,7 +15,7 @@ namespace NActors { class ISerializerToStream { public: - virtual bool SerializeToArcadiaStream(TChunkSerializer*) const = 0; + virtual bool SerializeToArcadiaStream(TChunkSerializer*) const = 0; }; class IEventBase @@ -35,7 +35,7 @@ namespace NActors { return 0; } virtual ui32 Type() const = 0; - virtual bool SerializeToArcadiaStream(TChunkSerializer*) const = 0; + virtual bool SerializeToArcadiaStream(TChunkSerializer*) const = 0; virtual bool IsSerializable() const = 0; virtual bool IsExtendedFormat() const { return false; @@ -318,7 +318,7 @@ namespace NActors { TString ToStringHeader() const override { \ return TString(header); \ } \ - bool SerializeToArcadiaStream(NActors::TChunkSerializer*) const override { \ + bool SerializeToArcadiaStream(NActors::TChunkSerializer*) const override { \ Y_FAIL("Local event " #eventType " is not serializable"); \ } \ static IEventBase* Load(NActors::TEventSerializedData*) { \ @@ -332,7 +332,7 @@ namespace NActors { TString ToStringHeader() const override { \ return TString(header); \ } \ - bool SerializeToArcadiaStream(NActors::TChunkSerializer*) const override { \ + bool SerializeToArcadiaStream(NActors::TChunkSerializer*) const override { \ return true; \ } \ static IEventBase* Load(NActors::TEventSerializedData*) { \ diff --git a/library/cpp/actors/core/event_local.h b/library/cpp/actors/core/event_local.h index 2845aa94dd..55694fb36b 100644 --- a/library/cpp/actors/core/event_local.h +++ b/library/cpp/actors/core/event_local.h @@ -13,7 +13,7 @@ namespace NActors { return TypeName<TEv>(); } - bool SerializeToArcadiaStream(TChunkSerializer* /*serializer*/) const override { + bool SerializeToArcadiaStream(TChunkSerializer* /*serializer*/) const override { Y_FAIL("Serialization of local event %s type %" PRIu32, TypeName<TEv>().data(), TEventType); } @@ -54,7 +54,7 @@ namespace NActors { return header; } - bool SerializeToArcadiaStream(TChunkSerializer* /*serializer*/) const override { + bool SerializeToArcadiaStream(TChunkSerializer* /*serializer*/) const override { static_assert(sizeof(TEv) == sizeof(TEventSimple<TEv, TEventType>), "Descendant should be an empty class"); return true; } diff --git a/library/cpp/actors/core/event_pb.cpp b/library/cpp/actors/core/event_pb.cpp index 018ff9ac34..b0eec9be3d 100644 --- a/library/cpp/actors/core/event_pb.cpp +++ b/library/cpp/actors/core/event_pb.cpp @@ -173,7 +173,7 @@ namespace NActors { void TCoroutineChunkSerializer::DoRun() { while (!CancelFlag) { Y_VERIFY(Event); - SerializationSuccess = Event->SerializeToArcadiaStream(this); + SerializationSuccess = Event->SerializeToArcadiaStream(this); Event = nullptr; if (!CancelFlag) { // cancel flag may have been received during serialization InnerContext.SwitchTo(BufFeedContext); diff --git a/library/cpp/actors/core/event_pb.h b/library/cpp/actors/core/event_pb.h index d7546b901a..f40504a2d6 100644 --- a/library/cpp/actors/core/event_pb.h +++ b/library/cpp/actors/core/event_pb.h @@ -3,8 +3,8 @@ #include "event.h" #include "event_load.h" -#include <google/protobuf/io/zero_copy_stream.h> -#include <google/protobuf/arena.h> +#include <google/protobuf/io/zero_copy_stream.h> +#include <google/protobuf/arena.h> #include <library/cpp/actors/protos/actors.pb.h> #include <util/generic/deque.h> #include <util/system/context.h> @@ -26,12 +26,12 @@ namespace NActors { bool Next(const void** data, int* size) override; void BackUp(int count) override; bool Skip(int count) override; - int64_t ByteCount() const override { - return TotalByteCount; - } + int64_t ByteCount() const override { + return TotalByteCount; + } private: - int64_t TotalByteCount = 0; + int64_t TotalByteCount = 0; }; class TChunkSerializer : public NProtoBuf::io::ZeroCopyOutputStream { @@ -47,9 +47,9 @@ namespace NActors { public: bool Next(void** data, int* size) override; void BackUp(int count) override; - int64_t ByteCount() const override { - return Buffers->GetSize(); - } + int64_t ByteCount() const override { + return Buffers->GetSize(); + } bool WriteAliasedRaw(const void* data, int size) override; // WARNING: these methods require owner to retain ownership and immutability of passed objects @@ -90,9 +90,9 @@ namespace NActors { bool Next(void** data, int* size) override; void BackUp(int count) override; - int64_t ByteCount() const override { - return TotalSerializedDataSize; - } + int64_t ByteCount() const override { + return TotalSerializedDataSize; + } bool WriteAliasedRaw(const void* data, int size) override; bool AllowsAliasing() const override; @@ -166,7 +166,7 @@ namespace NActors { return static_cast<bool>(Payload); } - bool SerializeToArcadiaStream(TChunkSerializer* chunker) const override { + bool SerializeToArcadiaStream(TChunkSerializer* chunker) const override { // serialize payload first if (Payload) { void *data; @@ -471,8 +471,8 @@ namespace NActors { return GetRecord().ShortDebugString(); } - bool SerializeToArcadiaStream(TChunkSerializer* chunker) const override { - return chunker->WriteString(&PreSerializedData) && TBase::SerializeToArcadiaStream(chunker); + bool SerializeToArcadiaStream(TChunkSerializer* chunker) const override { + return chunker->WriteString(&PreSerializedData) && TBase::SerializeToArcadiaStream(chunker); } ui32 CalculateSerializedSize() const override { diff --git a/library/cpp/actors/core/event_pb_payload_ut.cpp b/library/cpp/actors/core/event_pb_payload_ut.cpp index eab007bc15..11c2c27481 100644 --- a/library/cpp/actors/core/event_pb_payload_ut.cpp +++ b/library/cpp/actors/core/event_pb_payload_ut.cpp @@ -49,7 +49,7 @@ Y_UNIT_TEST_SUITE(TEventProtoWithPayload) { msg.Record.AddSomeData(MakeString((size1 + size2) % 50 + 11)); auto serializer = MakeHolder<TAllocChunkSerializer>(); - msg.SerializeToArcadiaStream(serializer.Get()); + msg.SerializeToArcadiaStream(serializer.Get()); auto buffers = serializer->Release(msg.IsExtendedFormat()); UNIT_ASSERT_VALUES_EQUAL(buffers->GetSize(), msg.CalculateSerializedSize()); TString ser = buffers->GetString(); @@ -127,14 +127,14 @@ Y_UNIT_TEST_SUITE(TEventProtoWithPayload) { Y_PROTOBUF_SUPPRESS_NODISCARD msg.SerializeToString(&e1.PreSerializedData); auto serializer1 = MakeHolder<TAllocChunkSerializer>(); - e1.SerializeToArcadiaStream(serializer1.Get()); + e1.SerializeToArcadiaStream(serializer1.Get()); auto buffers1 = serializer1->Release(e1.IsExtendedFormat()); UNIT_ASSERT_VALUES_EQUAL(buffers1->GetSize(), e1.CalculateSerializedSize()); TString ser1 = buffers1->GetString(); TEvMessageWithPayload e2(msg); auto serializer2 = MakeHolder<TAllocChunkSerializer>(); - e2.SerializeToArcadiaStream(serializer2.Get()); + e2.SerializeToArcadiaStream(serializer2.Get()); auto buffers2 = serializer2->Release(e2.IsExtendedFormat()); UNIT_ASSERT_VALUES_EQUAL(buffers2->GetSize(), e2.CalculateSerializedSize()); TString ser2 = buffers2->GetString(); diff --git a/library/cpp/actors/core/events.h b/library/cpp/actors/core/events.h index 702cf50fad..3e6170891b 100644 --- a/library/cpp/actors/core/events.h +++ b/library/cpp/actors/core/events.h @@ -63,7 +63,7 @@ namespace NActors { return "THelloWorld::Blob"; } - bool SerializeToArcadiaStream(TChunkSerializer *serializer) const override { + bool SerializeToArcadiaStream(TChunkSerializer *serializer) const override { return serializer->WriteString(&Blob); } @@ -150,7 +150,7 @@ namespace NActors { {} TString ToStringHeader() const override; - bool SerializeToArcadiaStream(TChunkSerializer *serializer) const override; + bool SerializeToArcadiaStream(TChunkSerializer *serializer) const override; static IEventBase* Load(TEventSerializedData* bufs); bool IsSerializable() const override; diff --git a/library/cpp/actors/core/events_undelivered.cpp b/library/cpp/actors/core/events_undelivered.cpp index 23deaffd10..1612fabfe4 100644 --- a/library/cpp/actors/core/events_undelivered.cpp +++ b/library/cpp/actors/core/events_undelivered.cpp @@ -6,7 +6,7 @@ namespace NActors { return "TSystem::Undelivered"; } - bool TEvents::TEvUndelivered::SerializeToArcadiaStream(TChunkSerializer *serializer) const { + bool TEvents::TEvUndelivered::SerializeToArcadiaStream(TChunkSerializer *serializer) const { Y_VERIFY(!Unsure); // these are local-only events generated by Interconnect return serializer->WriteString(&Data); } diff --git a/library/cpp/actors/core/hfunc.h b/library/cpp/actors/core/hfunc.h index 26f3c65013..9a3c6de777 100644 --- a/library/cpp/actors/core/hfunc.h +++ b/library/cpp/actors/core/hfunc.h @@ -3,7 +3,7 @@ #include "actor.h" #include "executor_thread.h" -#include <util/system/defaults.h> +#include <util/system/defaults.h> #define HFunc(TEvType, HandleFunc) \ case TEvType::EventType: { \ @@ -21,7 +21,7 @@ #define HFuncTraced(TEvType, HandleFunc) \ case TEvType::EventType: { \ - TRACE_EVENT_TYPE(Y_STRINGIZE(TEvType)); \ + TRACE_EVENT_TYPE(Y_STRINGIZE(TEvType)); \ TEvType::TPtr* x = reinterpret_cast<TEvType::TPtr*>(&ev); \ HandleFunc(*x, ctx); \ break; \ @@ -29,7 +29,7 @@ #define hFuncTraced(TEvType, HandleFunc) \ case TEvType::EventType: { \ - TRACE_EVENT_TYPE(Y_STRINGIZE(TEvType)); \ + TRACE_EVENT_TYPE(Y_STRINGIZE(TEvType)); \ typename TEvType::TPtr* x = reinterpret_cast<typename TEvType::TPtr*>(&ev); \ HandleFunc(*x); \ break; \ diff --git a/library/cpp/actors/core/log_settings.cpp b/library/cpp/actors/core/log_settings.cpp index f52f2fc5d2..6f8019c47f 100644 --- a/library/cpp/actors/core/log_settings.cpp +++ b/library/cpp/actors/core/log_settings.cpp @@ -52,15 +52,15 @@ namespace NActors { Y_VERIFY(minVal >= 0, "NLog::TSettings: minVal must be non-negative"); Y_VERIFY(maxVal > minVal, "NLog::TSettings: maxVal must be greater than minVal"); - // update bounds + // update bounds if (!MaxVal || minVal < MinVal) { MinVal = minVal; } - if (!MaxVal || maxVal > MaxVal) { + if (!MaxVal || maxVal > MaxVal) { MaxVal = maxVal; - // expand ComponentNames to the new bounds + // expand ComponentNames to the new bounds auto oldMask = Mask; Mask = PowerOf2Mask(MaxVal); @@ -79,10 +79,10 @@ namespace NActors { ComponentNames.resize(Mask + 1); } - // assign new names but validate if newly added members were not used before + // assign new names but validate if newly added members were not used before for (int i = minVal; i <= maxVal; i++) { - Y_VERIFY(!ComponentNames[i], "component name at %d already set: %s", - i, ComponentNames[i].data()); + Y_VERIFY(!ComponentNames[i], "component name at %d already set: %s", + i, ComponentNames[i].data()); ComponentNames[i] = func(i); } } diff --git a/library/cpp/actors/core/log_settings.h b/library/cpp/actors/core/log_settings.h index 7fe4504edd..cae7002c8b 100644 --- a/library/cpp/actors/core/log_settings.h +++ b/library/cpp/actors/core/log_settings.h @@ -110,14 +110,14 @@ namespace NActors { void Append(EComponent minVal, EComponent maxVal, EComponentToStringFunc func); template <typename T> - void Append(T minVal, T maxVal, const TString& (*func)(T)) { - Append( - static_cast<EComponent>(minVal), - static_cast<EComponent>(maxVal), - [func](EComponent c) -> const TString& { - return func(static_cast<T>(c)); - } - ); + void Append(T minVal, T maxVal, const TString& (*func)(T)) { + Append( + static_cast<EComponent>(minVal), + static_cast<EComponent>(maxVal), + [func](EComponent c) -> const TString& { + return func(static_cast<T>(c)); + } + ); } inline bool Satisfies(EPriority priority, EComponent component, ui64 sampleBy = 0) const { diff --git a/library/cpp/actors/core/mon.h b/library/cpp/actors/core/mon.h index c450f2338e..6c6c9a8907 100644 --- a/library/cpp/actors/core/mon.h +++ b/library/cpp/actors/core/mon.h @@ -111,7 +111,7 @@ namespace NActors { return "TEvRemoteHttpInfo"; } - bool SerializeToArcadiaStream(TChunkSerializer *serializer) const override { + bool SerializeToArcadiaStream(TChunkSerializer *serializer) const override { return serializer->WriteString(&Query); } @@ -148,7 +148,7 @@ namespace NActors { return "TEvRemoteHttpInfoRes"; } - bool SerializeToArcadiaStream(TChunkSerializer *serializer) const override { + bool SerializeToArcadiaStream(TChunkSerializer *serializer) const override { return serializer->WriteString(&Html); } @@ -180,7 +180,7 @@ namespace NActors { return "TEvRemoteJsonInfoRes"; } - bool SerializeToArcadiaStream(TChunkSerializer *serializer) const override { + bool SerializeToArcadiaStream(TChunkSerializer *serializer) const override { return serializer->WriteString(&Json); } @@ -212,7 +212,7 @@ namespace NActors { return "TEvRemoteBinaryInfoRes"; } - bool SerializeToArcadiaStream(TChunkSerializer *serializer) const override { + bool SerializeToArcadiaStream(TChunkSerializer *serializer) const override { return serializer->WriteString(&Blob); } diff --git a/library/cpp/actors/core/ya.make b/library/cpp/actors/core/ya.make index 880a9d00db..2f8322aa66 100644 --- a/library/cpp/actors/core/ya.make +++ b/library/cpp/actors/core/ya.make @@ -11,7 +11,7 @@ IF (PROFILE_MEMORY_ALLOCATIONS) CFLAGS(-DPROFILE_MEMORY_ALLOCATIONS) ENDIF() -IF (ALLOCATOR == "B" OR ALLOCATOR == "BS" OR ALLOCATOR == "C") +IF (ALLOCATOR == "B" OR ALLOCATOR == "BS" OR ALLOCATOR == "C") CXXFLAGS(-DBALLOC) PEERDIR( library/cpp/balloc/optional diff --git a/library/cpp/actors/interconnect/interconnect_handshake.cpp b/library/cpp/actors/interconnect/interconnect_handshake.cpp index 9ede998d8e..03ae76b38a 100644 --- a/library/cpp/actors/interconnect/interconnect_handshake.cpp +++ b/library/cpp/actors/interconnect/interconnect_handshake.cpp @@ -6,7 +6,7 @@ #include <library/cpp/actors/protos/services_common.pb.h> #include <util/system/getpid.h> -#include <google/protobuf/text_format.h> +#include <google/protobuf/text_format.h> #include <variant> diff --git a/library/cpp/actors/interconnect/ut/lib/node.h b/library/cpp/actors/interconnect/ut/lib/node.h index ff30b1445e..dd44f2fa3b 100644 --- a/library/cpp/actors/interconnect/ut/lib/node.h +++ b/library/cpp/actors/interconnect/ut/lib/node.h @@ -74,9 +74,9 @@ public: loggerSettings->Append( NActorsServices::EServiceCommon_MIN, - NActorsServices::EServiceCommon_MAX, - NActorsServices::EServiceCommon_Name - ); + NActorsServices::EServiceCommon_MAX, + NActorsServices::EServiceCommon_Name + ); constexpr ui32 WilsonComponentId = 430; // NKikimrServices::WILSON static const TString WilsonComponentName = "WILSON"; diff --git a/library/cpp/actors/interconnect/ut/ya.make b/library/cpp/actors/interconnect/ut/ya.make index 2f5b13352e..c38a24a0c2 100644 --- a/library/cpp/actors/interconnect/ut/ya.make +++ b/library/cpp/actors/interconnect/ut/ya.make @@ -5,7 +5,7 @@ OWNER( g:kikimr ) -IF (SANITIZER_TYPE == "thread") +IF (SANITIZER_TYPE == "thread") TIMEOUT(1200) SIZE(LARGE) TAG(ya:fat) diff --git a/library/cpp/actors/protos/services_common.proto b/library/cpp/actors/protos/services_common.proto index afa0ec0073..4459c76ef2 100644 --- a/library/cpp/actors/protos/services_common.proto +++ b/library/cpp/actors/protos/services_common.proto @@ -3,8 +3,8 @@ option java_package = "ru.yandex.kikimr.proto"; // 0-255 range enum EServiceCommon { - // WARN: This must be the smallest value in the enumeration - + // WARN: This must be the smallest value in the enumeration + GLOBAL = 0; INTERCONNECT = 1; TEST = 2; @@ -14,8 +14,8 @@ enum EServiceCommon { INTERCONNECT_NETWORK = 6; INTERCONNECT_SESSION = 7; HTTP = 8; - - // This value is reserved boundary. Is must not be aliased with any values - // TODO: use reseved values upon protobuf update - // COMMON_END = 256; + + // This value is reserved boundary. Is must not be aliased with any values + // TODO: use reseved values upon protobuf update + // COMMON_END = 256; }; diff --git a/library/cpp/actors/testlib/test_runtime.cpp b/library/cpp/actors/testlib/test_runtime.cpp index 6fa25b9965..3f70aa834e 100644 --- a/library/cpp/actors/testlib/test_runtime.cpp +++ b/library/cpp/actors/testlib/test_runtime.cpp @@ -497,11 +497,11 @@ namespace NActors { } void TTestActorRuntimeBase::InitNodeImpl(TNodeDataBase* node, size_t nodeIndex) { - node->LogSettings->Append( - NActorsServices::EServiceCommon_MIN, - NActorsServices::EServiceCommon_MAX, - NActorsServices::EServiceCommon_Name - ); + node->LogSettings->Append( + NActorsServices::EServiceCommon_MIN, + NActorsServices::EServiceCommon_MAX, + NActorsServices::EServiceCommon_Name + ); if (!UseRealThreads) { node->SchedulerPool.Reset(CreateExecutorPoolStub(this, nodeIndex, node, 0)); diff --git a/library/cpp/binsaver/util_stream_io.h b/library/cpp/binsaver/util_stream_io.h index d65d630b93..d378f3364e 100644 --- a/library/cpp/binsaver/util_stream_io.h +++ b/library/cpp/binsaver/util_stream_io.h @@ -71,7 +71,7 @@ public: }; template <class T> -inline void SerializeToArcadiaStream(IOutputStream& stream, T& c) { +inline void SerializeToArcadiaStream(IOutputStream& stream, T& c) { TYaStreamOutput f(stream); { IBinSaver bs(f, false); @@ -82,5 +82,5 @@ inline void SerializeToArcadiaStream(IOutputStream& stream, T& c) { template <class T> inline void SerializeToFile(const TString& fileName, T& c) { TOFStream out(fileName); - SerializeToArcadiaStream(out, c); + SerializeToArcadiaStream(out, c); } diff --git a/library/cpp/blockcodecs/codecs/zstd/zstd.cpp b/library/cpp/blockcodecs/codecs/zstd/zstd.cpp index 95299b3f6d..d79e4ef8c9 100644 --- a/library/cpp/blockcodecs/codecs/zstd/zstd.cpp +++ b/library/cpp/blockcodecs/codecs/zstd/zstd.cpp @@ -3,7 +3,7 @@ #include <library/cpp/blockcodecs/core/register.h> #define ZSTD_STATIC_LINKING_ONLY -#include <contrib/libs/zstd/include/zstd.h> +#include <contrib/libs/zstd/include/zstd.h> using namespace NBlockCodecs; diff --git a/library/cpp/blockcodecs/codecs_ut.cpp b/library/cpp/blockcodecs/codecs_ut.cpp index bfe5a23690..829d6bbf62 100644 --- a/library/cpp/blockcodecs/codecs_ut.cpp +++ b/library/cpp/blockcodecs/codecs_ut.cpp @@ -324,17 +324,17 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) { UNIT_ASSERT_VALUES_EQUAL(ALL_CODECS, JoinSeq(",", ListAllCodecs())); } - - Y_UNIT_TEST(TestEncodeDecodeIntoString) { - TStringBuf data = "na gorshke sidel korol"; - - TCodecList codecs = ListAllCodecs(); - for (const auto& codec : codecs) { - const ICodec* c = Codec(codec); - TString encoded = c->Encode(data); - TString decoded = c->Decode(encoded); - - UNIT_ASSERT_VALUES_EQUAL(decoded, data); - } - } + + Y_UNIT_TEST(TestEncodeDecodeIntoString) { + TStringBuf data = "na gorshke sidel korol"; + + TCodecList codecs = ListAllCodecs(); + for (const auto& codec : codecs) { + const ICodec* c = Codec(codec); + TString encoded = c->Encode(data); + TString decoded = c->Decode(encoded); + + UNIT_ASSERT_VALUES_EQUAL(decoded, data); + } + } } diff --git a/library/cpp/blockcodecs/core/codecs.cpp b/library/cpp/blockcodecs/core/codecs.cpp index 21506e812b..9f37df3044 100644 --- a/library/cpp/blockcodecs/core/codecs.cpp +++ b/library/cpp/blockcodecs/core/codecs.cpp @@ -13,7 +13,7 @@ #include <util/generic/cast.h> #include <util/generic/deque.h> #include <util/generic/buffer.h> -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/generic/singleton.h> #include <util/generic/algorithm.h> #include <util/generic/mem_copy.h> @@ -129,20 +129,20 @@ void ICodec::Decode(const TData& in, TBuffer& out) const { void ICodec::Encode(const TData& in, TString& out) const { const size_t maxLen = MaxCompressedLength(in); - out.ReserveAndResize(maxLen); + out.ReserveAndResize(maxLen); - size_t actualLen = Compress(in, out.begin()); - Y_ASSERT(actualLen <= maxLen); - out.resize(actualLen); + size_t actualLen = Compress(in, out.begin()); + Y_ASSERT(actualLen <= maxLen); + out.resize(actualLen); } void ICodec::Decode(const TData& in, TString& out) const { - const size_t maxLen = GetDecompressedLength(in); - out.ReserveAndResize(maxLen); + const size_t maxLen = GetDecompressedLength(in); + out.ReserveAndResize(maxLen); - size_t actualLen = Decompress(in, out.begin()); - Y_ASSERT(actualLen <= maxLen); - out.resize(actualLen); + size_t actualLen = Decompress(in, out.begin()); + Y_ASSERT(actualLen <= maxLen); + out.resize(actualLen); } ICodec::~ICodec() = default; diff --git a/library/cpp/blockcodecs/core/common.h b/library/cpp/blockcodecs/core/common.h index f05df4d334..0954098489 100644 --- a/library/cpp/blockcodecs/core/common.h +++ b/library/cpp/blockcodecs/core/common.h @@ -12,7 +12,7 @@ #include <util/generic/hash.h> #include <util/generic/cast.h> #include <util/generic/buffer.h> -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/generic/singleton.h> #include <util/generic/algorithm.h> #include <util/generic/mem_copy.h> diff --git a/library/cpp/blockcodecs/fuzz/main.cpp b/library/cpp/blockcodecs/fuzz/main.cpp index 763c6c5a10..b0d2ff4080 100644 --- a/library/cpp/blockcodecs/fuzz/main.cpp +++ b/library/cpp/blockcodecs/fuzz/main.cpp @@ -1,5 +1,5 @@ #include <contrib/libs/protobuf-mutator/src/libfuzzer/libfuzzer_macro.h> -#include <google/protobuf/stubs/logging.h> +#include <google/protobuf/stubs/logging.h> #include <library/cpp/blockcodecs/codecs.h> #include <library/cpp/blockcodecs/fuzz/proto/case.pb.h> diff --git a/library/cpp/blockcodecs/ya.make b/library/cpp/blockcodecs/ya.make index b8f03d5421..9d2bd4127b 100644 --- a/library/cpp/blockcodecs/ya.make +++ b/library/cpp/blockcodecs/ya.make @@ -21,7 +21,7 @@ SRCS( ) END() - + RECURSE_FOR_TESTS( - ut -) + ut +) diff --git a/library/cpp/cgiparam/cgiparam.cpp b/library/cpp/cgiparam/cgiparam.cpp index f3277b8e4b..c8863c97a3 100644 --- a/library/cpp/cgiparam/cgiparam.cpp +++ b/library/cpp/cgiparam/cgiparam.cpp @@ -237,7 +237,7 @@ TQuickCgiParam::TQuickCgiParam(const TStringBuf cgiParamStr) { buf += name.size() + 1; TStringBuf value = CgiUnescapeBuf(buf, val); buf += value.size() + 1; - Y_ASSERT(buf <= UnescapeBuf.begin() + UnescapeBuf.capacity() + 1 /*trailing zero*/); + Y_ASSERT(buf <= UnescapeBuf.begin() + UnescapeBuf.capacity() + 1 /*trailing zero*/); emplace(name, value); }; diff --git a/library/cpp/charset/codepage.cpp b/library/cpp/charset/codepage.cpp index 0431bef31b..e8a9550f9b 100644 --- a/library/cpp/charset/codepage.cpp +++ b/library/cpp/charset/codepage.cpp @@ -311,10 +311,10 @@ void DoDecodeUnknownPlane(TxChar* str, TxChar*& ee, const ECharset enc) { ee = e; } -void DecodeUnknownPlane(wchar16* str, wchar16*& ee, const ECharset enc) { +void DecodeUnknownPlane(wchar16* str, wchar16*& ee, const ECharset enc) { DoDecodeUnknownPlane(str, ee, enc); } -void DecodeUnknownPlane(wchar32* str, wchar32*& ee, const ECharset enc) { +void DecodeUnknownPlane(wchar32* str, wchar32*& ee, const ECharset enc) { DoDecodeUnknownPlane(str, ee, enc); } diff --git a/library/cpp/charset/codepage.h b/library/cpp/charset/codepage.h index 30a02a4610..e2031007f9 100644 --- a/library/cpp/charset/codepage.h +++ b/library/cpp/charset/codepage.h @@ -288,7 +288,7 @@ extern const CodePage& csYandex; /// these functions change (lowers) [end] position in case of utf-8 /// null character is NOT assumed or written at [*end] -void DecodeUnknownPlane(wchar16* start, wchar16*& end, const ECharset enc4unk); +void DecodeUnknownPlane(wchar16* start, wchar16*& end, const ECharset enc4unk); void DecodeUnknownPlane(wchar32* start, wchar32*& end, const ECharset enc4unk); inline void ToLower(char* s, size_t n, const CodePage& cp = csYandex) { diff --git a/library/cpp/charset/recyr.hh b/library/cpp/charset/recyr.hh index 5ec8734bcf..509b1e3a5d 100644 --- a/library/cpp/charset/recyr.hh +++ b/library/cpp/charset/recyr.hh @@ -81,7 +81,7 @@ inline RECODE_RESULT Recode(ECharset from, ECharset to, const char* in, char* ou } size_t wideSize = inSize * 3; - TArrayHolder<wchar16> wide(new wchar16[wideSize]); + TArrayHolder<wchar16> wide(new wchar16[wideSize]); size_t wideRead = 0; size_t wideWritten = 0; diff --git a/library/cpp/charset/wide.h b/library/cpp/charset/wide.h index 32d30e849e..3841cce938 100644 --- a/library/cpp/charset/wide.h +++ b/library/cpp/charset/wide.h @@ -186,7 +186,7 @@ namespace NDetail { template <typename TResult> TWtringBuf RecodeUTF8Robust(const TStringBuf src, TResult& dst) { // make enough room for re-coded string - wchar16* dstbuf = TRecodeResultOps<TResult>::Reserve(dst, src.size() * TRecodeTraits<wchar16>::ReserveSize); + wchar16* dstbuf = TRecodeResultOps<TResult>::Reserve(dst, src.size() * TRecodeTraits<wchar16>::ReserveSize); // do re-coding size_t written = 0; diff --git a/library/cpp/codecs/codecs.h b/library/cpp/codecs/codecs.h index cc5e72b285..52e9b2624b 100644 --- a/library/cpp/codecs/codecs.h +++ b/library/cpp/codecs/codecs.h @@ -168,7 +168,7 @@ namespace NCodecs { } TString GetName() const override { - return ToString(MyName()); + return ToString(MyName()); } }; @@ -184,7 +184,7 @@ namespace NCodecs { } TString GetName() const override { - return ToString(MyName()); + return ToString(MyName()); } }; diff --git a/library/cpp/codecs/codecs_registry.cpp b/library/cpp/codecs/codecs_registry.cpp index 17d07062ab..50abf61ad6 100644 --- a/library/cpp/codecs/codecs_registry.cpp +++ b/library/cpp/codecs/codecs_registry.cpp @@ -101,18 +101,18 @@ namespace NCodecs { TVector<TString> ListNames() const override { TVector<TString> vs; - vs.push_back(ToString(TSolarCodec::MyName())); - vs.push_back(ToString(TSolarCodec::MyName8k())); - vs.push_back(ToString(TSolarCodec::MyName16k())); - vs.push_back(ToString(TSolarCodec::MyName32k())); - vs.push_back(ToString(TSolarCodec::MyName64k())); - vs.push_back(ToString(TSolarCodec::MyName256k())); - vs.push_back(ToString(TSolarCodec::MyName8kAdapt())); - vs.push_back(ToString(TSolarCodec::MyName16kAdapt())); - vs.push_back(ToString(TSolarCodec::MyName32kAdapt())); - vs.push_back(ToString(TSolarCodec::MyName64kAdapt())); - vs.push_back(ToString(TSolarCodec::MyName256kAdapt())); - vs.push_back(ToString(TSolarCodec::MyNameShortInt())); + vs.push_back(ToString(TSolarCodec::MyName())); + vs.push_back(ToString(TSolarCodec::MyName8k())); + vs.push_back(ToString(TSolarCodec::MyName16k())); + vs.push_back(ToString(TSolarCodec::MyName32k())); + vs.push_back(ToString(TSolarCodec::MyName64k())); + vs.push_back(ToString(TSolarCodec::MyName256k())); + vs.push_back(ToString(TSolarCodec::MyName8kAdapt())); + vs.push_back(ToString(TSolarCodec::MyName16kAdapt())); + vs.push_back(ToString(TSolarCodec::MyName32kAdapt())); + vs.push_back(ToString(TSolarCodec::MyName64kAdapt())); + vs.push_back(ToString(TSolarCodec::MyName256kAdapt())); + vs.push_back(ToString(TSolarCodec::MyNameShortInt())); return vs; } }; @@ -141,8 +141,8 @@ namespace NCodecs { TVector<TString> ListNames() const override { TVector<TString> vs; - vs.push_back(ToString(TCompTableCodec::MyNameHQ())); - vs.push_back(ToString(TCompTableCodec::MyNameLQ())); + vs.push_back(ToString(TCompTableCodec::MyNameHQ())); + vs.push_back(ToString(TCompTableCodec::MyNameLQ())); return vs; } }; @@ -156,7 +156,7 @@ namespace NCodecs { } TString GetName() const override { - return ToString(Codec->Name()); + return ToString(Codec->Name()); } ui8 Encode(TStringBuf r, TBuffer& b) const override { diff --git a/library/cpp/codecs/codecs_registry.h b/library/cpp/codecs/codecs_registry.h index 53710310d5..cc89015936 100644 --- a/library/cpp/codecs/codecs_registry.h +++ b/library/cpp/codecs/codecs_registry.h @@ -27,7 +27,7 @@ namespace NCodecs { TVector<TString> ListNames() const override { TVector<TString> vs; - vs.push_back(ToString(TCodec::MyName())); + vs.push_back(ToString(TCodec::MyName())); return vs; } }; diff --git a/library/cpp/codecs/comptable_codec.cpp b/library/cpp/codecs/comptable_codec.cpp index 476b8ada80..28c9554b36 100644 --- a/library/cpp/codecs/comptable_codec.cpp +++ b/library/cpp/codecs/comptable_codec.cpp @@ -82,7 +82,7 @@ namespace NCodecs { TCompTableCodec::~TCompTableCodec() = default; TString TCompTableCodec::GetName() const { - return ToString(Impl->Quality ? MyNameHQ() : MyNameLQ()); + return ToString(Impl->Quality ? MyNameHQ() : MyNameLQ()); } ui8 TCompTableCodec::Encode(TStringBuf in, TBuffer& out) const { diff --git a/library/cpp/codecs/delta_codec.h b/library/cpp/codecs/delta_codec.h index 21325825e6..e3ac4e769e 100644 --- a/library/cpp/codecs/delta_codec.h +++ b/library/cpp/codecs/delta_codec.h @@ -2,7 +2,7 @@ #include "codecs.h" -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/generic/typetraits.h> #include <util/generic/bitops.h> #include <util/string/cast.h> @@ -70,7 +70,7 @@ namespace NCodecs { } TString GetName() const override { - return ToString(MyName()); + return ToString(MyName()); } template <class TItem> @@ -85,16 +85,16 @@ namespace NCodecs { } b.Reserve(s.size()); - TArrayRef<const T> tin{(const T*)s.data(), s.size() / sizeof(T)}; + TArrayRef<const T> tin{(const T*)s.data(), s.size() / sizeof(T)}; - const T* it = tin.begin(); + const T* it = tin.begin(); TDelta last = *(it++); AppendTo(b, last); TDelta maxt = SubSafe(MaxDelta, last); TDelta mint = AddSafe(MinDelta, last); - for (; it != tin.end(); ++it) { + for (; it != tin.end(); ++it) { TDelta t = *it; if (Y_LIKELY((t >= mint) & (t <= maxt))) { @@ -122,11 +122,11 @@ namespace NCodecs { } b.Reserve(s.size()); - TArrayRef<const T> tin{(const T*)s.data(), s.size() / sizeof(T)}; + TArrayRef<const T> tin{(const T*)s.data(), s.size() / sizeof(T)}; TDecoder dec; - for (const T* it = tin.begin(); it != tin.end(); ++it) { + for (const T* it = tin.begin(); it != tin.end(); ++it) { T tmp; memcpy(&tmp, it, sizeof(tmp)); if (dec.Decode(tmp)) { diff --git a/library/cpp/codecs/float_huffman.cpp b/library/cpp/codecs/float_huffman.cpp index c4a8bd228f..3a0d995b21 100644 --- a/library/cpp/codecs/float_huffman.cpp +++ b/library/cpp/codecs/float_huffman.cpp @@ -57,7 +57,7 @@ namespace NCodecs::NFloatHuff { {0x00000000, 0x16, 5, 32}, // whole range, 37 bits, prefix [01101] }; - [[noreturn]] Y_NO_INLINE void ThrowInvalidOffset(size_t size, size_t byteOffset) { + [[noreturn]] Y_NO_INLINE void ThrowInvalidOffset(size_t size, size_t byteOffset) { ythrow yexception() << "Decompression error: requested decoding 8 bytes past end of input buffer of " << size << " bytes size at position " << byteOffset << ". "; } diff --git a/library/cpp/codecs/huffman_codec.cpp b/library/cpp/codecs/huffman_codec.cpp index 650fe7cdfd..96feeeca36 100644 --- a/library/cpp/codecs/huffman_codec.cpp +++ b/library/cpp/codecs/huffman_codec.cpp @@ -461,7 +461,7 @@ namespace NCodecs { BuildDecoder(); } - void LearnByFreqs(const TArrayRef<std::pair<char, ui64>>& freqs) { + void LearnByFreqs(const TArrayRef<std::pair<char, ui64>>& freqs) { TCodeTree tree; ui64 freqsArray[256]; @@ -584,7 +584,7 @@ namespace NCodecs { Impl->Learn(&in); } - void THuffmanCodec::LearnByFreqs(const TArrayRef<std::pair<char, ui64>>& freqs) { + void THuffmanCodec::LearnByFreqs(const TArrayRef<std::pair<char, ui64>>& freqs) { Impl->LearnByFreqs(freqs); Trained = true; } diff --git a/library/cpp/codecs/huffman_codec.h b/library/cpp/codecs/huffman_codec.h index 559545b90d..9880dff470 100644 --- a/library/cpp/codecs/huffman_codec.h +++ b/library/cpp/codecs/huffman_codec.h @@ -21,14 +21,14 @@ namespace NCodecs { } TString GetName() const override { - return ToString(MyName()); + return ToString(MyName()); } ui8 Encode(TStringBuf in, TBuffer& bbb) const override; void Decode(TStringBuf in, TBuffer& bbb) const override; - void LearnByFreqs(const TArrayRef<std::pair<char, ui64>>& freqs); + void LearnByFreqs(const TArrayRef<std::pair<char, ui64>>& freqs); protected: void DoLearn(ISequenceReader& in) override; diff --git a/library/cpp/codecs/pfor_codec.h b/library/cpp/codecs/pfor_codec.h index d7d4bb8bf4..31d71aafb5 100644 --- a/library/cpp/codecs/pfor_codec.h +++ b/library/cpp/codecs/pfor_codec.h @@ -32,7 +32,7 @@ namespace NCodecs { } TString GetName() const override { - return ToString(MyName()); + return ToString(MyName()); } ui8 Encode(TStringBuf s, TBuffer& b) const override { @@ -52,15 +52,15 @@ namespace NCodecs { s = TStringBuf{db.data(), db.size()}; } - TArrayRef<const TValue> tin{(const TValue*)s.data(), s.size() / sizeof(TValue)}; + TArrayRef<const TValue> tin{(const TValue*)s.data(), s.size() / sizeof(TValue)}; - const ui64 sz = tin.size(); + const ui64 sz = tin.size(); ui64 bitcounts[BitsInT + 1]; Zero(bitcounts); ui32 zeros = 0; - for (const TValue* it = tin.begin(); it != tin.end(); ++it) { + for (const TValue* it = tin.begin(); it != tin.end(); ++it) { TUnsigned v = 1 + (TUnsigned)*it; ui64 l = MostSignificantBit(v) + 1; ++bitcounts[l]; @@ -105,7 +105,7 @@ namespace NCodecs { bout.Write(hasexceptions, 1); bout.Write(optimalbits, 6); - for (const TValue* it = tin.begin(); it != tin.end(); ++it) { + for (const TValue* it = tin.begin(); it != tin.end(); ++it) { TUnsigned word = 1 + (TUnsigned)*it; ui64 len = MostSignificantBit(word) + 1; if (len > optimalbits || !word) { diff --git a/library/cpp/codecs/solar_codec.h b/library/cpp/codecs/solar_codec.h index 7158ae7926..79c1d94c6a 100644 --- a/library/cpp/codecs/solar_codec.h +++ b/library/cpp/codecs/solar_codec.h @@ -121,7 +121,7 @@ namespace NCodecs { } TString GetName() const override { - return ToString(MyName()); + return ToString(MyName()); } protected: @@ -207,9 +207,9 @@ namespace NCodecs { TString GetName() const override { if (CanUseShortInt()) { - return ToString(MyNameShortInt()); + return ToString(MyNameShortInt()); } else { - return ToString(MyName()); + return ToString(MyName()); } } }; @@ -231,7 +231,7 @@ namespace NCodecs { } TString GetName() const override { - return ToString(MyNameShortInt()); + return ToString(MyNameShortInt()); } protected: diff --git a/library/cpp/codecs/static/static.cpp b/library/cpp/codecs/static/static.cpp index 44a07dd73a..cf4d74a43f 100644 --- a/library/cpp/codecs/static/static.cpp +++ b/library/cpp/codecs/static/static.cpp @@ -21,7 +21,7 @@ namespace NCodecs { void SaveCodecInfoToStream(IOutputStream& out, const TStaticCodecInfo& info) { TBufferOutput bout; - info.SerializeToArcadiaStream(&bout); + info.SerializeToArcadiaStream(&bout); ui64 hash = DataSignature(bout.Buffer()); out.Write(GetStaticCodecInfoMagic()); ::Save(&out, hash); diff --git a/library/cpp/codecs/ut/codecs_ut.cpp b/library/cpp/codecs/ut/codecs_ut.cpp index caf6089aef..8696cc760b 100644 --- a/library/cpp/codecs/ut/codecs_ut.cpp +++ b/library/cpp/codecs/ut/codecs_ut.cpp @@ -1233,7 +1233,7 @@ private: } } - codec.LearnByFreqs(TArrayRef<std::pair<char, ui64>>(freqs, Y_ARRAY_SIZE(freqs))); + codec.LearnByFreqs(TArrayRef<std::pair<char, ui64>>(freqs, Y_ARRAY_SIZE(freqs))); for (ui32 i = 0; i < data.size(); ++i) { outLearnByFreqs.emplace_back(); diff --git a/library/cpp/codecs/zstd_dict_codec.cpp b/library/cpp/codecs/zstd_dict_codec.cpp index c42a2879e6..28de94ffc6 100644 --- a/library/cpp/codecs/zstd_dict_codec.cpp +++ b/library/cpp/codecs/zstd_dict_codec.cpp @@ -11,9 +11,9 @@ #define ZDICT_STATIC_LINKING_ONLY -#include <contrib/libs/zstd/include/zdict.h> -#include <contrib/libs/zstd/include/zstd.h> -#include <contrib/libs/zstd/include/zstd_errors.h> +#include <contrib/libs/zstd/include/zdict.h> +#include <contrib/libs/zstd/include/zstd.h> +#include <contrib/libs/zstd/include/zstd_errors.h> // See IGNIETFERRO-320 for possible bugs @@ -234,7 +234,7 @@ namespace NCodecs { } TString TZStdDictCodec::GetName() const { - return TStringBuilder() << MyName() << "-" << Impl->GetCompressionLevel(); + return TStringBuilder() << MyName() << "-" << Impl->GetCompressionLevel(); } ui8 TZStdDictCodec::Encode(TStringBuf in, TBuffer& out) const { diff --git a/library/cpp/colorizer/ut/colorizer_ut.cpp b/library/cpp/colorizer/ut/colorizer_ut.cpp index 20341440af..a1b736d6e2 100644 --- a/library/cpp/colorizer/ut/colorizer_ut.cpp +++ b/library/cpp/colorizer/ut/colorizer_ut.cpp @@ -9,8 +9,8 @@ Y_UNIT_TEST_SUITE(ColorizerTest) { Y_UNIT_TEST(BasicTest) { NColorizer::TColors colors; colors.Enable(); - UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.BlueColor()), "\\x1B[22;34m"); - UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.ForeBlue()), "\\x1B[34m"); + UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.BlueColor()), "\\x1B[22;34m"); + UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.ForeBlue()), "\\x1B[34m"); colors.Disable(); UNIT_ASSERT(colors.BlueColor().Empty()); } @@ -19,10 +19,10 @@ Y_UNIT_TEST_SUITE(ColorizerTest) { NColorizer::TColors colors; colors.Enable(); // 22;39, not 0, should be used so that only foreground changes - UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.OldColor()), "\\x1B[22;39m"); - UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.Reset()), "\\x1B[0m"); + UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.OldColor()), "\\x1B[22;39m"); + UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.Reset()), "\\x1B[0m"); // 22, not 0, should be used to reset boldness - UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.PurpleColor()), "\\x1B[22;35m"); + UNIT_ASSERT_STRINGS_EQUAL(EscapeC(colors.PurpleColor()), "\\x1B[22;35m"); } Y_UNIT_TEST(PrintAnsi) { diff --git a/library/cpp/compproto/bit.h b/library/cpp/compproto/bit.h index 6a421b65f7..1800e255fc 100644 --- a/library/cpp/compproto/bit.h +++ b/library/cpp/compproto/bit.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/generic/vector.h> #include <util/stream/output.h> #include <util/stream/input.h> @@ -82,8 +82,8 @@ namespace NCompProto { Junk(); } - TArrayRef<const char> AsDataRegion() const { - return TArrayRef<const char>(reinterpret_cast<const char*>(Out.data()), ByteLength()); + TArrayRef<const char> AsDataRegion() const { + return TArrayRef<const char>(reinterpret_cast<const char*>(Out.data()), ByteLength()); } }; diff --git a/library/cpp/containers/comptrie/comptrie_ut.cpp b/library/cpp/containers/comptrie/comptrie_ut.cpp index 74bee09b5d..0ae4bc3a83 100644 --- a/library/cpp/containers/comptrie/comptrie_ut.cpp +++ b/library/cpp/containers/comptrie/comptrie_ut.cpp @@ -1296,7 +1296,7 @@ void TCompactTrieTest::TestFindLongestPrefixWithEmptyValue() { template <typename TChar> struct TConvertKey { static inline TString Convert(const TStringBuf& key) { - return ToString(key); + return ToString(key); } }; diff --git a/library/cpp/containers/comptrie/key_selector.h b/library/cpp/containers/comptrie/key_selector.h index 60466cef71..f156d6a909 100644 --- a/library/cpp/containers/comptrie/key_selector.h +++ b/library/cpp/containers/comptrie/key_selector.h @@ -12,7 +12,7 @@ struct TCompactTrieKeySelector { template <class TChar> struct TCompactTrieCharKeySelector { - typedef TBasicString<TChar> TKey; + typedef TBasicString<TChar> TKey; typedef TBasicStringBuf<TChar> TKeyBuf; }; diff --git a/library/cpp/containers/comptrie/protopacker.h b/library/cpp/containers/comptrie/protopacker.h index 3e15866dc5..038c870528 100644 --- a/library/cpp/containers/comptrie/protopacker.h +++ b/library/cpp/containers/comptrie/protopacker.h @@ -10,12 +10,12 @@ public: void UnpackLeaf(const char* p, Proto& entry) const { TMemoryInput in(p + sizeof(ui32), SkipLeaf(p) - sizeof(ui32)); - entry.ParseFromArcadiaStream(&in); + entry.ParseFromArcadiaStream(&in); } void PackLeaf(char* p, const Proto& entry, size_t size) const { TMemoryOutput out(p, size + sizeof(ui32)); Save<ui32>(&out, size); - entry.SerializeToArcadiaStream(&out); + entry.SerializeToArcadiaStream(&out); } size_t MeasureLeaf(const Proto& entry) const { return entry.ByteSize() + sizeof(ui32); diff --git a/library/cpp/containers/stack_array/stack_array.h b/library/cpp/containers/stack_array/stack_array.h index 28e49bfc3c..acbe68084f 100644 --- a/library/cpp/containers/stack_array/stack_array.h +++ b/library/cpp/containers/stack_array/stack_array.h @@ -28,11 +28,11 @@ namespace NStackArray { inline TStackArray(void* data, size_t len) : TArrayRef<T>((T*)data, len) { - NRangeOps::InitializeRange(this->begin(), this->end()); + NRangeOps::InitializeRange(this->begin(), this->end()); } inline ~TStackArray() { - NRangeOps::DestroyRange(this->begin(), this->end()); + NRangeOps::DestroyRange(this->begin(), this->end()); } }; } diff --git a/library/cpp/containers/stack_array/ut/tests_ut.cpp b/library/cpp/containers/stack_array/ut/tests_ut.cpp index 3e96384f0e..02e81f7243 100644 --- a/library/cpp/containers/stack_array/ut/tests_ut.cpp +++ b/library/cpp/containers/stack_array/ut/tests_ut.cpp @@ -15,9 +15,9 @@ Y_UNIT_TEST_SUITE(TestStackArray) { Y_UNIT_TEST(Test1) { TStackArray<ui32> s(ALLOC(ui32, 10)); - UNIT_ASSERT_VALUES_EQUAL(s.size(), 10); + UNIT_ASSERT_VALUES_EQUAL(s.size(), 10); - for (size_t i = 0; i < s.size(); ++i) { + for (size_t i = 0; i < s.size(); ++i) { UNIT_ASSERT_VALUES_EQUAL(s[i], 0xCCCCCCCC); } diff --git a/library/cpp/containers/stack_vector/stack_vec.h b/library/cpp/containers/stack_vector/stack_vec.h index fcc5d9a2a5..02bd049629 100644 --- a/library/cpp/containers/stack_vector/stack_vec.h +++ b/library/cpp/containers/stack_vector/stack_vec.h @@ -57,22 +57,22 @@ namespace NPrivate { : Alloc(std::forward<TArgs>(args)...) {} - T* allocate(size_type n) { + T* allocate(size_type n) { if (!IsStorageUsed && CountOnStack >= n) { IsStorageUsed = true; - return reinterpret_cast<T*>(&StackBasedStorage[0]); + return reinterpret_cast<T*>(&StackBasedStorage[0]); } else { if constexpr (!UseFallbackAlloc) { Y_FAIL( "Stack storage overflow. Capacity: %d, requested: %d", (int)CountOnStack, int(n)); } - return FallbackAllocator().allocate(n); + return FallbackAllocator().allocate(n); } } - void deallocate(T* p, size_type n) { - if (p >= reinterpret_cast<T*>(&StackBasedStorage[0]) && - p < reinterpret_cast<T*>(&StackBasedStorage[CountOnStack])) { + void deallocate(T* p, size_type n) { + if (p >= reinterpret_cast<T*>(&StackBasedStorage[0]) && + p < reinterpret_cast<T*>(&StackBasedStorage[CountOnStack])) { Y_VERIFY(IsStorageUsed); IsStorageUsed = false; } else { @@ -93,10 +93,10 @@ namespace NPrivate { template <typename T, size_t CountOnStack, bool UseFallbackAlloc, class Alloc> class TStackVec: public TVector<T, ::NPrivate::TStackBasedAllocator<T, CountOnStack, UseFallbackAlloc, TReboundAllocator<Alloc, T>>> { -private: - using TBase = TVector<T, ::NPrivate::TStackBasedAllocator<T, CountOnStack, UseFallbackAlloc, TReboundAllocator<Alloc, T>>>; +private: + using TBase = TVector<T, ::NPrivate::TStackBasedAllocator<T, CountOnStack, UseFallbackAlloc, TReboundAllocator<Alloc, T>>>; using TAllocator = typename TBase::allocator_type; - + public: using typename TBase::const_iterator; using typename TBase::const_reverse_iterator; @@ -130,7 +130,7 @@ public: TBase::assign(count, val); } - TStackVec(const TStackVec& src) + TStackVec(const TStackVec& src) : TStackVec(src.begin(), src.end()) { } @@ -167,21 +167,21 @@ public: } public: - void swap(TStackVec&) = delete; + void swap(TStackVec&) = delete; void shrink_to_fit() = delete; - TStackVec& operator=(const TStackVec& src) { + TStackVec& operator=(const TStackVec& src) { TBase::assign(src.begin(), src.end()); return *this; } template <class A> - TStackVec& operator=(const TVector<T, A>& src) { + TStackVec& operator=(const TVector<T, A>& src) { TBase::assign(src.begin(), src.end()); return *this; } - TStackVec& operator=(std::initializer_list<T> il) { + TStackVec& operator=(std::initializer_list<T> il) { TBase::assign(il.begin(), il.end()); return *this; } diff --git a/library/cpp/containers/stack_vector/stack_vec_ut.cpp b/library/cpp/containers/stack_vector/stack_vec_ut.cpp index 19f9677781..cca1c0a7cc 100644 --- a/library/cpp/containers/stack_vector/stack_vec_ut.cpp +++ b/library/cpp/containers/stack_vector/stack_vec_ut.cpp @@ -59,12 +59,12 @@ Y_UNIT_TEST_SUITE(TStackBasedVectorTest) { } Y_UNIT_TEST(TestReallyOnStack) { - const TStackVec<int> vec(5); - - UNIT_ASSERT( - (const char*)&vec <= (const char*)&vec[0] && - (const char*)&vec[0] <= (const char*)&vec + sizeof(vec) - ); + const TStackVec<int> vec(5); + + UNIT_ASSERT( + (const char*)&vec <= (const char*)&vec[0] && + (const char*)&vec[0] <= (const char*)&vec + sizeof(vec) + ); } Y_UNIT_TEST(TestFallback) { diff --git a/library/cpp/deprecated/accessors/memory_traits.h b/library/cpp/deprecated/accessors/memory_traits.h index aa837705d3..6b7f46f8eb 100644 --- a/library/cpp/deprecated/accessors/memory_traits.h +++ b/library/cpp/deprecated/accessors/memory_traits.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/memory/blob.h> #include <util/memory/tempbuf.h> #include <util/generic/buffer.h> @@ -133,14 +133,14 @@ struct TMemoryTraits<TString>: public TElementDependentMemoryTraits<char> { }; template <> -struct TMemoryTraits<TUtf16String>: public TElementDependentMemoryTraits<wchar16> { +struct TMemoryTraits<TUtf16String>: public TElementDependentMemoryTraits<wchar16> { enum { OwnsMemory = true }; }; template <typename T> -struct TMemoryTraits<TArrayRef<T>>: public TElementDependentMemoryTraits<T> { +struct TMemoryTraits<TArrayRef<T>>: public TElementDependentMemoryTraits<T> { enum { OwnsMemory = false }; @@ -161,7 +161,7 @@ struct TMemoryTraits<TStringBuf>: public TElementDependentMemoryTraits<char> { }; template <> -struct TMemoryTraits<TWtringBuf>: public TElementDependentMemoryTraits<wchar16> { +struct TMemoryTraits<TWtringBuf>: public TElementDependentMemoryTraits<wchar16> { enum { OwnsMemory = false }; diff --git a/library/cpp/diff/diff.cpp b/library/cpp/diff/diff.cpp index be57da7f39..8690ead6a6 100644 --- a/library/cpp/diff/diff.cpp +++ b/library/cpp/diff/diff.cpp @@ -3,8 +3,8 @@ #include <util/generic/hash.h> #include <util/digest/fnv.h> -#include <iterator> - +#include <iterator> + template <typename T> struct TCollectionImpl { TVector<TConstArrayRef<T>> Words; @@ -18,21 +18,21 @@ struct TCollectionImpl { return true; } - TConstArrayRef<T> Remap(const TConstArrayRef<ui64>& keys) const { + TConstArrayRef<T> Remap(const TConstArrayRef<ui64>& keys) const { if (keys.empty()) { return TConstArrayRef<T>(); } - auto firstWordPos = std::distance(Keys.data(), keys.begin()); - auto lastWordPos = std::distance(Keys.data(), keys.end()) - 1; - Y_ASSERT(firstWordPos >= 0); - Y_ASSERT(lastWordPos >= firstWordPos); - Y_ASSERT(static_cast<size_t>(lastWordPos) < Words.size()); - - return TConstArrayRef<T>(Words[firstWordPos].begin(), Words[lastWordPos].end()); + auto firstWordPos = std::distance(Keys.data(), keys.begin()); + auto lastWordPos = std::distance(Keys.data(), keys.end()) - 1; + Y_ASSERT(firstWordPos >= 0); + Y_ASSERT(lastWordPos >= firstWordPos); + Y_ASSERT(static_cast<size_t>(lastWordPos) < Words.size()); + + return TConstArrayRef<T>(Words[firstWordPos].begin(), Words[lastWordPos].end()); } TConstArrayRef<ui64> GetKeys() const { - return TConstArrayRef<ui64>(Keys); + return TConstArrayRef<ui64>(Keys); } }; @@ -50,10 +50,10 @@ struct TCollection<char>: public TCollectionImpl<char> { }; template <> -struct TCollection<wchar16>: public TCollectionImpl<wchar16> { +struct TCollection<wchar16>: public TCollectionImpl<wchar16> { TCollection(const TWtringBuf& str, const TUtf16String& delims) { - TSetDelimiter<const wchar16> set(delims.data()); - TKeepDelimiters<TCollection<wchar16>> c(this); + TSetDelimiter<const wchar16> set(delims.data()); + TKeepDelimiters<TCollection<wchar16>> c(this); SplitString(str.begin(), str.end(), set, c); } }; @@ -72,16 +72,16 @@ size_t NDiff::InlineDiff(TVector<TChunk<char>>& chunks, const TStringBuf& left, return dist; } -size_t NDiff::InlineDiff(TVector<TChunk<wchar16>>& chunks, const TWtringBuf& left, const TWtringBuf& right, const TUtf16String& delims) { +size_t NDiff::InlineDiff(TVector<TChunk<wchar16>>& chunks, const TWtringBuf& left, const TWtringBuf& right, const TUtf16String& delims) { if (delims.empty()) { - return InlineDiff<wchar16>(chunks, TConstArrayRef<wchar16>(left.data(), left.size()), TConstArrayRef<wchar16>(right.data(), right.size())); + return InlineDiff<wchar16>(chunks, TConstArrayRef<wchar16>(left.data(), left.size()), TConstArrayRef<wchar16>(right.data(), right.size())); } - TCollection<wchar16> c1(left, delims); - TCollection<wchar16> c2(right, delims); + TCollection<wchar16> c1(left, delims); + TCollection<wchar16> c2(right, delims); TVector<TChunk<ui64>> diff; const size_t dist = InlineDiff<ui64>(diff, c1.GetKeys(), c2.GetKeys()); for (const auto& it : diff) { - chunks.push_back(TChunk<wchar16>(c1.Remap(it.Left), c2.Remap(it.Right), c1.Remap(it.Common))); + chunks.push_back(TChunk<wchar16>(c1.Remap(it.Left), c2.Remap(it.Right), c1.Remap(it.Common))); } return dist; } diff --git a/library/cpp/diff/diff.h b/library/cpp/diff/diff.h index 94fb00cd0b..b2d66c9188 100644 --- a/library/cpp/diff/diff.h +++ b/library/cpp/diff/diff.h @@ -107,6 +107,6 @@ namespace NDiff { // Without delimiters calculates character-wise diff // With delimiters calculates token-wise diff size_t InlineDiff(TVector<TChunk<char>>& chunks, const TStringBuf& left, const TStringBuf& right, const TString& delims = TString()); - size_t InlineDiff(TVector<TChunk<wchar16>>& chunks, const TWtringBuf& left, const TWtringBuf& right, const TUtf16String& delims = TUtf16String()); + size_t InlineDiff(TVector<TChunk<wchar16>>& chunks, const TWtringBuf& left, const TWtringBuf& right, const TUtf16String& delims = TUtf16String()); } diff --git a/library/cpp/digest/argonish/internal/blake2b/blake2b.h b/library/cpp/digest/argonish/internal/blake2b/blake2b.h index 3dcfc3fc48..71e1465b57 100644 --- a/library/cpp/digest/argonish/internal/blake2b/blake2b.h +++ b/library/cpp/digest/argonish/internal/blake2b/blake2b.h @@ -35,7 +35,7 @@ namespace NArgonish { ui8 LastNode; }; - struct TBlake2BParam { + struct TBlake2BParam { ui8 DigestLen; /* 1 */ ui8 KeyLen; /* 2 */ ui8 Fanout; /* 3 */ @@ -48,7 +48,7 @@ namespace NArgonish { ui8 Reserved[14]; /* 32 */ ui8 Salt[BLAKE2B_SALTBYTES]; /* 48 */ ui8 Personal[BLAKE2B_PERSONALBYTES]; /* 64 */ - } Y_PACKED; + } Y_PACKED; TBlake2BState State_; TBlake2BParam Param_; diff --git a/library/cpp/digest/md5/md5.cpp b/library/cpp/digest/md5/md5.cpp index 24a5b69eef..9a28c3d8f3 100644 --- a/library/cpp/digest/md5/md5.cpp +++ b/library/cpp/digest/md5/md5.cpp @@ -9,11 +9,11 @@ #include <contrib/libs/nayuki_md5/md5.h> namespace { - + constexpr size_t MD5_BLOCK_LENGTH = 64; constexpr size_t MD5_PADDING_SHIFT = 56; - constexpr size_t MD5_HEX_DIGEST_LENGTH = 32; - + constexpr size_t MD5_HEX_DIGEST_LENGTH = 32; + struct TMd5Stream: public IOutputStream { inline TMd5Stream(MD5* md5) : M_(md5) @@ -48,13 +48,13 @@ char* MD5::File(const char* filename, char* buf) { } TString MD5::File(const TString& filename) { - TString buf; - buf.ReserveAndResize(MD5_HEX_DIGEST_LENGTH); - auto result = MD5::File(filename.data(), buf.begin()); - if (result == nullptr) { - buf.clear(); - } - return buf; + TString buf; + buf.ReserveAndResize(MD5_HEX_DIGEST_LENGTH); + auto result = MD5::File(filename.data(), buf.begin()); + if (result == nullptr) { + buf.clear(); + } + return buf; } char* MD5::Data(const TArrayRef<const ui8>& data, char* buf) { @@ -66,16 +66,16 @@ char* MD5::Data(const void* data, size_t len, char* buf) { } TString MD5::Data(const TArrayRef<const ui8>& data) { - TString buf; - buf.ReserveAndResize(MD5_HEX_DIGEST_LENGTH); + TString buf; + buf.ReserveAndResize(MD5_HEX_DIGEST_LENGTH); Data(data, buf.begin()); - return buf; -} - -TString MD5::Data(TStringBuf data) { + return buf; +} + +TString MD5::Data(TStringBuf data) { return Data(MakeUnsignedArrayRef(data)); -} - +} + char* MD5::Stream(IInputStream* in, char* buf) { return MD5().Update(in).End(buf); } diff --git a/library/cpp/digest/md5/md5.h b/library/cpp/digest/md5/md5.h index 2c17aa0518..674ab9dac0 100644 --- a/library/cpp/digest/md5/md5.h +++ b/library/cpp/digest/md5/md5.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/generic/strbuf.h> class IInputStream; @@ -40,18 +40,18 @@ public: MD5& Update(IInputStream* in); - /* - * Return hex-encoded md5 checksum for given file. - * - * Return nullptr / empty string if the file does not exist. - */ + /* + * Return hex-encoded md5 checksum for given file. + * + * Return nullptr / empty string if the file does not exist. + */ static char* File(const char* filename, char* buf); static TString File(const TString& filename); - + static char* Data(const void* data, size_t len, char* buf); static char* Data(const TArrayRef<const ui8>& data, char* buf); static TString Data(const TArrayRef<const ui8>& data); - static TString Data(TStringBuf data); + static TString Data(TStringBuf data); static char* Stream(IInputStream* in, char* buf); static TString Calc(TStringBuf data); // 32-byte hex-encoded diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp index 2fa5cfd070..9943310bf0 100644 --- a/library/cpp/getopt/small/modchooser.cpp +++ b/library/cpp/getopt/small/modchooser.cpp @@ -112,7 +112,7 @@ void TModChooser::AddMode(const TString& mode, TMainClassV* func, const TString& } void TModChooser::AddGroupModeDescription(const TString& description, bool hidden, bool noCompletion) { - UnsortedModes.push_back(MakeHolder<TMode>(TString(), nullptr, description.data(), hidden, noCompletion)); + UnsortedModes.push_back(MakeHolder<TMode>(TString(), nullptr, description.data(), hidden, noCompletion)); } void TModChooser::SetDefaultMode(const TString& mode) { diff --git a/library/cpp/getopt/small/ygetopt.h b/library/cpp/getopt/small/ygetopt.h index 615d3dd18e..155f16a925 100644 --- a/library/cpp/getopt/small/ygetopt.h +++ b/library/cpp/getopt/small/ygetopt.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/fwd.h> +#include <util/generic/fwd.h> #include <util/generic/ptr.h> class TGetOpt { diff --git a/library/cpp/grpc/server/grpc_request.h b/library/cpp/grpc/server/grpc_request.h index 5bd8d3902b..a56d016c3b 100644 --- a/library/cpp/grpc/server/grpc_request.h +++ b/library/cpp/grpc/server/grpc_request.h @@ -1,8 +1,8 @@ #pragma once -#include <google/protobuf/text_format.h> -#include <google/protobuf/arena.h> -#include <google/protobuf/message.h> +#include <google/protobuf/text_format.h> +#include <google/protobuf/arena.h> +#include <google/protobuf/message.h> #include <library/cpp/monlib/dynamic_counters/counters.h> #include <library/cpp/logger/priority.h> diff --git a/library/cpp/grpc/server/grpc_request_base.h b/library/cpp/grpc/server/grpc_request_base.h index fcfce1c181..efda2f4f0f 100644 --- a/library/cpp/grpc/server/grpc_request_base.h +++ b/library/cpp/grpc/server/grpc_request_base.h @@ -1,6 +1,6 @@ #pragma once -#include <google/protobuf/message.h> +#include <google/protobuf/message.h> #include <library/cpp/threading/future/future.h> #include <grpc++/server_context.h> diff --git a/library/cpp/histogram/adaptive/block_histogram.cpp b/library/cpp/histogram/adaptive/block_histogram.cpp index 6586d13ff6..4d561dab87 100644 --- a/library/cpp/histogram/adaptive/block_histogram.cpp +++ b/library/cpp/histogram/adaptive/block_histogram.cpp @@ -2,7 +2,7 @@ #include <library/cpp/histogram/adaptive/protos/histo.pb.h> -#include <util/generic/algorithm.h> +#include <util/generic/algorithm.h> #include <util/generic/yexception.h> #include <util/generic/intrlist.h> #include <util/generic/ptr.h> diff --git a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp index 558aba9e2d..f87100d470 100644 --- a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp +++ b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp @@ -3,7 +3,7 @@ #include <library/cpp/histogram/adaptive/protos/histo.pb.h> -#include <util/generic/algorithm.h> +#include <util/generic/algorithm.h> #include <util/generic/yexception.h> #include <util/generic/ymath.h> #include <util/string/printf.h> diff --git a/library/cpp/http/server/response.cpp b/library/cpp/http/server/response.cpp index 52d64c91ce..1fe2c16c9b 100644 --- a/library/cpp/http/server/response.cpp +++ b/library/cpp/http/server/response.cpp @@ -12,7 +12,7 @@ THttpResponse& THttpResponse::AddMultipleHeaders(const THttpHeaders& headers) { } THttpResponse& THttpResponse::SetContentType(const TStringBuf& contentType) { - Headers.AddOrReplaceHeader(THttpInputHeader("Content-Type", ToString(contentType))); + Headers.AddOrReplaceHeader(THttpInputHeader("Content-Type", ToString(contentType))); return *this; } diff --git a/library/cpp/iterator/cartesian_product.h b/library/cpp/iterator/cartesian_product.h index 3ef70339a2..b1855ebddb 100644 --- a/library/cpp/iterator/cartesian_product.h +++ b/library/cpp/iterator/cartesian_product.h @@ -82,9 +82,9 @@ namespace NPrivate { public: using iterator = TIterator; using const_iterator = TIterator; - using value_type = typename TIterator::value_type; - using reference = typename TIterator::reference; - using const_reference = typename TIterator::reference; + using value_type = typename TIterator::value_type; + using reference = typename TIterator::reference; + using const_reference = typename TIterator::reference; TIterator begin() const { bool isEmpty = !((std::begin(*std::get<I>(Holders_).Ptr()) != std::end(*std::get<I>(Holders_).Ptr())) && ...); diff --git a/library/cpp/iterator/concatenate.h b/library/cpp/iterator/concatenate.h index 64d2cd451a..728b7c2703 100644 --- a/library/cpp/iterator/concatenate.h +++ b/library/cpp/iterator/concatenate.h @@ -101,9 +101,9 @@ namespace NPrivate { public: using iterator = TIterator; using const_iterator = TIterator; - using value_type = typename TIterator::value_type; - using reference = typename TIterator::reference; - using const_reference = typename TIterator::reference; + using value_type = typename TIterator::value_type; + using reference = typename TIterator::reference; + using const_reference = typename TIterator::reference; TIterator begin() const { TIterator iterator{TIteratorState{std::begin(*std::get<I>(Holders_).Ptr())...}, 0, &Holders_}; diff --git a/library/cpp/iterator/enumerate.h b/library/cpp/iterator/enumerate.h index 2c83fb41bf..aacef79c98 100644 --- a/library/cpp/iterator/enumerate.h +++ b/library/cpp/iterator/enumerate.h @@ -54,9 +54,9 @@ namespace NPrivate { public: using iterator = TIterator; using const_iterator = TIterator; - using value_type = typename TIterator::value_type; - using reference = typename TIterator::reference; - using const_reference = typename TIterator::reference; + using value_type = typename TIterator::value_type; + using reference = typename TIterator::reference; + using const_reference = typename TIterator::reference; TIterator begin() const { return {0, std::begin(*Storage_.Ptr())}; diff --git a/library/cpp/iterator/filtering.h b/library/cpp/iterator/filtering.h index c28e3bc6c4..b0d0720b62 100644 --- a/library/cpp/iterator/filtering.h +++ b/library/cpp/iterator/filtering.h @@ -64,13 +64,13 @@ class TFilteringRange { using TRawIterator = decltype(std::begin(std::declval<TContainer&>())); using TConditionWrapper = std::reference_wrapper<std::remove_reference_t<TCondition>>; public: - //TODO: make TIterator typedef private + //TODO: make TIterator typedef private using TIterator = TFilteringIterator<TRawIterator, TConditionWrapper>; - + using iterator = TIterator; using const_iterator = TIterator; - using value_type = typename TIterator::value_type; - using reference = typename TIterator::reference; + using value_type = typename TIterator::value_type; + using reference = typename TIterator::reference; TFilteringRange(TContainer&& container, TCondition&& predicate) : Container(std::forward<TContainer>(container)) diff --git a/library/cpp/iterator/iterate_keys.cpp b/library/cpp/iterator/iterate_keys.cpp index 6556d39af7..609afd08da 100644 --- a/library/cpp/iterator/iterate_keys.cpp +++ b/library/cpp/iterator/iterate_keys.cpp @@ -1 +1 @@ -#include "iterate_keys.h" +#include "iterate_keys.h" diff --git a/library/cpp/iterator/iterate_keys.h b/library/cpp/iterator/iterate_keys.h index 75362a6bd6..0915d0040d 100644 --- a/library/cpp/iterator/iterate_keys.h +++ b/library/cpp/iterator/iterate_keys.h @@ -1,13 +1,13 @@ -#pragma once - -#include "mapped.h" - -template<typename TMapping> -auto IterateKeys(TMapping&& map) { - return ::MakeMappedRange( - std::forward<TMapping>(map), - [](const auto& x) -> decltype((x.first)) { - return x.first; - } - ); -} +#pragma once + +#include "mapped.h" + +template<typename TMapping> +auto IterateKeys(TMapping&& map) { + return ::MakeMappedRange( + std::forward<TMapping>(map), + [](const auto& x) -> decltype((x.first)) { + return x.first; + } + ); +} diff --git a/library/cpp/iterator/iterate_values.cpp b/library/cpp/iterator/iterate_values.cpp index 5607e58ecb..40b0eb3ae5 100644 --- a/library/cpp/iterator/iterate_values.cpp +++ b/library/cpp/iterator/iterate_values.cpp @@ -1 +1 @@ -#include "iterate_values.h" +#include "iterate_values.h" diff --git a/library/cpp/iterator/iterate_values.h b/library/cpp/iterator/iterate_values.h index ac6f2f04ce..4997ea6300 100644 --- a/library/cpp/iterator/iterate_values.h +++ b/library/cpp/iterator/iterate_values.h @@ -1,13 +1,13 @@ -#pragma once - -#include "mapped.h" - -template<typename TMapping> -auto IterateValues(TMapping&& map) { - return ::MakeMappedRange( - std::forward<TMapping>(map), - [](auto& x) -> decltype((x.second)) { - return x.second; - } - ); -} +#pragma once + +#include "mapped.h" + +template<typename TMapping> +auto IterateValues(TMapping&& map) { + return ::MakeMappedRange( + std::forward<TMapping>(map), + [](auto& x) -> decltype((x.second)) { + return x.second; + } + ); +} diff --git a/library/cpp/iterator/mapped.h b/library/cpp/iterator/mapped.h index 6c5e763184..9733ee58ab 100644 --- a/library/cpp/iterator/mapped.h +++ b/library/cpp/iterator/mapped.h @@ -17,10 +17,10 @@ namespace NIteratorPrivate { template <class TIterator, class TMapper> class TMappedIterator { -protected: +protected: using TSelf = TMappedIterator<TIterator, TMapper>; using TSrcPointerType = typename std::iterator_traits<TIterator>::reference; - using TValue = typename std::invoke_result_t<TMapper, TSrcPointerType>; + using TValue = typename std::invoke_result_t<TMapper, TSrcPointerType>; public: using difference_type = std::ptrdiff_t; using value_type = TValue; @@ -31,7 +31,7 @@ public: TMappedIterator(TIterator it, TMapper mapper) : Iter(it) - , Mapper(std::move(mapper)) + , Mapper(std::move(mapper)) { } @@ -99,14 +99,14 @@ protected: using TContainerStorage = TAutoEmbedOrPtrPolicy<TContainer>; using TMapperStorage = TAutoEmbedOrPtrPolicy<TMapper>; using TMapperWrapper = std::reference_wrapper<std::remove_reference_t<TMapper>>; - using TInternalIterator = decltype(std::begin(std::declval<TContainer&>())); - using TIterator = TMappedIterator<TInternalIterator, TMapperWrapper>; + using TInternalIterator = decltype(std::begin(std::declval<TContainer&>())); + using TIterator = TMappedIterator<TInternalIterator, TMapperWrapper>; public: - using iterator = TIterator; - using const_iterator = TIterator; - using value_type = typename TIterator::value_type; - using reference = typename TIterator::reference; - using const_reference = typename TIterator::reference; + using iterator = TIterator; + using const_iterator = TIterator; + using value_type = typename TIterator::value_type; + using reference = typename TIterator::reference; + using const_reference = typename TIterator::reference; TInputMappedRange(TContainer&& container, TMapper&& mapper) : Container(std::forward<TContainer>(container)) @@ -114,11 +114,11 @@ public: { } - TIterator begin() const { + TIterator begin() const { return {std::begin(*Container.Ptr()), {*Mapper.Ptr()}}; } - TIterator end() const { + TIterator end() const { return {std::end(*Container.Ptr()), {*Mapper.Ptr()}}; } @@ -135,8 +135,8 @@ protected: template <class TContainer, class TMapper> class TRandomAccessMappedRange : public TInputMappedRange<TContainer, TMapper> { using TBase = TInputMappedRange<TContainer, TMapper>; - using TInternalIterator = typename TBase::TInternalIterator; - using TIterator = typename TBase::TIterator; + using TInternalIterator = typename TBase::TInternalIterator; + using TIterator = typename TBase::TIterator; public: using iterator = typename TBase::iterator; using const_iterator = typename TBase::const_iterator; diff --git a/library/cpp/iterator/ut/filtering_ut.cpp b/library/cpp/iterator/ut/filtering_ut.cpp index 60c2044698..cd03e7ef83 100644 --- a/library/cpp/iterator/ut/filtering_ut.cpp +++ b/library/cpp/iterator/ut/filtering_ut.cpp @@ -1,41 +1,41 @@ -#include <library/cpp/iterator/filtering.h> +#include <library/cpp/iterator/filtering.h> -#include <library/cpp/testing/gtest/gtest.h> +#include <library/cpp/testing/gtest/gtest.h> -#include <util/generic/vector.h> - -using namespace testing; - -TEST(Filtering, TFilteringRangeTest) { - const TVector<int> x = {1, 2, 3, 4, 5}; - - EXPECT_THAT( - MakeFilteringRange( - x, - [](int x) { return x % 2 == 0; } - ), - ElementsAre(2, 4) - ); -} - -TEST(Filtering, TEmptyFilteringRangeTest) { - TVector<int> x = {1, 2, 3, 4, 5}; - EXPECT_THAT( - MakeFilteringRange( - x, - [](int x) { return x > 100; } - ), - ElementsAre() - ); -} - -TEST(Filtering, TMutableFilteringRangeTest) { - TVector<int> x = {1, 2, 3, 4, 5}; - for (auto& y : MakeFilteringRange(x, [](int x) { return x % 2 == 0; })) { - y = 7; +#include <util/generic/vector.h> + +using namespace testing; + +TEST(Filtering, TFilteringRangeTest) { + const TVector<int> x = {1, 2, 3, 4, 5}; + + EXPECT_THAT( + MakeFilteringRange( + x, + [](int x) { return x % 2 == 0; } + ), + ElementsAre(2, 4) + ); +} + +TEST(Filtering, TEmptyFilteringRangeTest) { + TVector<int> x = {1, 2, 3, 4, 5}; + EXPECT_THAT( + MakeFilteringRange( + x, + [](int x) { return x > 100; } + ), + ElementsAre() + ); +} + +TEST(Filtering, TMutableFilteringRangeTest) { + TVector<int> x = {1, 2, 3, 4, 5}; + for (auto& y : MakeFilteringRange(x, [](int x) { return x % 2 == 0; })) { + y = 7; } - EXPECT_THAT( - x, - ElementsAre(1, 7, 3, 7, 5) - ); + EXPECT_THAT( + x, + ElementsAre(1, 7, 3, 7, 5) + ); } diff --git a/library/cpp/iterator/ut/functools_ut.cpp b/library/cpp/iterator/ut/functools_ut.cpp index 2dee9a55c8..496a2a9747 100644 --- a/library/cpp/iterator/ut/functools_ut.cpp +++ b/library/cpp/iterator/ut/functools_ut.cpp @@ -1,6 +1,6 @@ -#include <library/cpp/iterator/functools.h> +#include <library/cpp/iterator/functools.h> -#include <library/cpp/testing/gtest/gtest.h> +#include <library/cpp/testing/gtest/gtest.h> #include <util/generic/vector.h> #include <util/generic/xrange.h> @@ -58,17 +58,17 @@ using namespace NFuncTools; auto it3 = std::move(it); Y_UNUSED(it3); Y_UNUSED(*it3); - EXPECT_TRUE(it3 == it3); - EXPECT_FALSE(it3 != it3); + EXPECT_TRUE(it3 == it3); + EXPECT_FALSE(it3 != it3); // const TIterator const auto it4 = it3; Y_UNUSED(*it4); - EXPECT_TRUE(it4 == it4); - EXPECT_FALSE(it4 != it4); - EXPECT_TRUE(it3 == it4); - EXPECT_TRUE(it4 == it3); - EXPECT_FALSE(it3 != it4); - EXPECT_FALSE(it4 != it3); + EXPECT_TRUE(it4 == it4); + EXPECT_FALSE(it4 != it4); + EXPECT_TRUE(it3 == it4); + EXPECT_TRUE(it4 == it3); + EXPECT_FALSE(it3 != it4); + EXPECT_FALSE(it4 != it3); } auto it = container.begin(); @@ -118,57 +118,57 @@ using namespace NFuncTools; } - TEST(FuncTools, CompileRange) { + TEST(FuncTools, CompileRange) { TestViewCompileability(Range(19)); TestViewCompileability(Range(10, 19)); TestViewCompileability(Range(10, 19, 2)); } - TEST(FuncTools, Enumerate) { - TVector<size_t> a = {1, 2, 4}; - TVector<size_t> b; - TVector<size_t> c = {1}; + TEST(FuncTools, Enumerate) { + TVector<size_t> a = {1, 2, 4}; + TVector<size_t> b; + TVector<size_t> c = {1}; for (auto& v : {a, b, c}) { - size_t j = 0; + size_t j = 0; FOR_DISPATCH_2(i, x, Enumerate(v)) { - EXPECT_EQ(v[i], x); - EXPECT_EQ(i, j++); - EXPECT_LT(i, v.size()); + EXPECT_EQ(v[i], x); + EXPECT_EQ(i, j++); + EXPECT_LT(i, v.size()); } - EXPECT_EQ(j, v.size()); + EXPECT_EQ(j, v.size()); } - TVector<size_t> d = {0, 0, 0}; + TVector<size_t> d = {0, 0, 0}; FOR_DISPATCH_2(i, x, Enumerate(d)) { x = i; } - EXPECT_THAT( - d, - testing::ElementsAre(0u, 1u, 2u) - ); + EXPECT_THAT( + d, + testing::ElementsAre(0u, 1u, 2u) + ); } - TEST(FuncTools, EnumerateTemporary) { - TVector<size_t> a = {1, 2, 4}; - TVector<size_t> b; - TVector<size_t> c = {1}; + TEST(FuncTools, EnumerateTemporary) { + TVector<size_t> a = {1, 2, 4}; + TVector<size_t> b; + TVector<size_t> c = {1}; for (auto& v : {a, b, c}) { - size_t j = 0; + size_t j = 0; FOR_DISPATCH_2(i, x, Enumerate(TVector(v))) { - EXPECT_EQ(v[i], x); - EXPECT_EQ(i, j++); - EXPECT_LT(i, v.size()); + EXPECT_EQ(v[i], x); + EXPECT_EQ(i, j++); + EXPECT_LT(i, v.size()); } - EXPECT_EQ(j, v.size()); + EXPECT_EQ(j, v.size()); } - FOR_DISPATCH_2(i, x, Enumerate(TVector<size_t>{1, 2, 3})) { - EXPECT_EQ(i + 1, x); + FOR_DISPATCH_2(i, x, Enumerate(TVector<size_t>{1, 2, 3})) { + EXPECT_EQ(i + 1, x); } } - TEST(FuncTools, CompileEnumerate) { + TEST(FuncTools, CompileEnumerate) { auto container = std::vector{1, 2, 3}; TestViewCompileability(Enumerate(container)); const auto constContainer = std::vector{1, 2, 3}; @@ -180,13 +180,13 @@ using namespace NFuncTools; FOR_DISPATCH_2(i, x, Enumerate(MakeMinimalisticContainer())) { res.push_back({i, x}); } - EXPECT_EQ(res, (std::vector<std::pair<int, int>>{ + EXPECT_EQ(res, (std::vector<std::pair<int, int>>{ {0, 0}, {1, 1}, {2, 2}, })); } - TEST(FuncTools, Zip) { - TVector<std::pair<TVector<size_t>, TVector<size_t>>> ts = { + TEST(FuncTools, Zip) { + TVector<std::pair<TVector<size_t>, TVector<size_t>>> ts = { {{1, 2, 3}, {4, 5, 6}}, {{1, 2, 3}, {4, 5, 6, 7}}, {{1, 2, 3, 4}, {4, 5, 6}}, @@ -194,28 +194,28 @@ using namespace NFuncTools; }; FOR_DISPATCH_2(a, b, ts) { - size_t k = 0; + size_t k = 0; FOR_DISPATCH_2(i, j, Zip(a, b)) { - EXPECT_EQ(++k, i); - EXPECT_EQ(i + 3, j); + EXPECT_EQ(++k, i); + EXPECT_EQ(i + 3, j); } - EXPECT_EQ(k, Min(a.size(), b.size())); + EXPECT_EQ(k, Min(a.size(), b.size())); } } - TEST(FuncTools, ZipReference) { + TEST(FuncTools, ZipReference) { TVector a = {0, 1, 2}; TVector b = {2, 1, 0, -1}; FOR_DISPATCH_2(ai, bi, Zip(a, b)) { ai = bi; } - EXPECT_THAT( - a, - testing::ElementsAre(2u, 1u, 0u) - ); + EXPECT_THAT( + a, + testing::ElementsAre(2u, 1u, 0u) + ); } - TEST(FuncTools, Zip3) { + TEST(FuncTools, Zip3) { TVector<std::tuple<TVector<i32>, TVector<i32>, TVector<i32>>> ts = { {{1, 2, 3}, {4, 5, 6}, {11, 3}}, {{1, 2, 3}, {4, 5, 6, 7}, {9, 0}}, @@ -235,11 +235,11 @@ using namespace NFuncTools; f.push_back({ai, bi, ci}); } - EXPECT_EQ(e, f); + EXPECT_EQ(e, f); } } - TEST(FuncTools, CompileZip) { + TEST(FuncTools, CompileZip) { auto container = std::vector{1, 2, 3}; TestViewCompileability(Zip(container)); TestViewCompileability(Zip(container, container, container)); @@ -252,12 +252,12 @@ using namespace NFuncTools; FOR_DISPATCH_2(a, b, Zip(MakeMinimalisticContainer(), container)) { res.push_back({a, b}); } - EXPECT_EQ(res, (std::vector<std::pair<int, int>>{ + EXPECT_EQ(res, (std::vector<std::pair<int, int>>{ {0, 1}, {1, 2}, {2, 3}, })); } - TEST(FuncTools, Filter) { + TEST(FuncTools, Filter) { TVector<TVector<i32>> ts = { {}, {1}, @@ -282,11 +282,11 @@ using namespace NFuncTools; c.push_back(x); } - EXPECT_EQ(b, c); + EXPECT_EQ(b, c); } } - TEST(FuncTools, CompileFilter) { + TEST(FuncTools, CompileFilter) { auto container = std::vector{1, 2, 3}; auto isOdd = [](int x) { return bool(x & 1); }; TestViewCompileability(Filter(isOdd, container)); @@ -294,7 +294,7 @@ using namespace NFuncTools; TestViewCompileability(Filter(isOdd, arrayContainer)); } - TEST(FuncTools, Map) { + TEST(FuncTools, Map) { TVector<TVector<i32>> ts = { {}, {1}, @@ -315,7 +315,7 @@ using namespace NFuncTools; c.push_back(x); } - EXPECT_EQ(b, c); + EXPECT_EQ(b, c); } TVector floats = {1.4, 4.1, 13.9}; @@ -329,11 +329,11 @@ using namespace NFuncTools; for (auto i : Map<float>(Map<int>(floats))) { resFloat.push_back(i); } - EXPECT_EQ(ints, res); - EXPECT_EQ(roundedFloats, resFloat); + EXPECT_EQ(ints, res); + EXPECT_EQ(roundedFloats, resFloat); } - TEST(FuncTools, CompileMap) { + TEST(FuncTools, CompileMap) { auto container = std::vector{1, 2, 3}; auto sqr = [](int x) { return x * x; }; TestViewCompileability(Map(sqr, container)); @@ -341,25 +341,25 @@ using namespace NFuncTools; TestViewCompileability(Map(sqr, arrayContainer)); } - TEST(FuncTools, MapRandomAccess) { + TEST(FuncTools, MapRandomAccess) { auto sqr = [](int x) { return x * x; }; { auto container = std::vector{1, 2, 3}; auto mapped = Map(sqr, container); - static_assert( - std::is_same_v<decltype(mapped)::iterator::iterator_category, std::random_access_iterator_tag> - ); + static_assert( + std::is_same_v<decltype(mapped)::iterator::iterator_category, std::random_access_iterator_tag> + ); } { auto container = std::set<int>{1, 2, 3}; auto mapped = Map(sqr, container); - static_assert( - std::is_same_v<decltype(mapped)::iterator::iterator_category, std::input_iterator_tag> - ); + static_assert( + std::is_same_v<decltype(mapped)::iterator::iterator_category, std::input_iterator_tag> + ); } } - TEST(FuncTools, CartesianProduct) { + TEST(FuncTools, CartesianProduct) { TVector<std::pair<TVector<i32>, TVector<i32>>> ts = { {{1, 2, 3}, {4, 5, 6}}, {{1, 2, 3}, {4, 5, 6, 7}}, @@ -381,7 +381,7 @@ using namespace NFuncTools; d.push_back({ai, bi}); } - EXPECT_EQ(c, d); + EXPECT_EQ(c, d); } { @@ -390,12 +390,12 @@ using namespace NFuncTools; FOR_DISPATCH_2(gi, i, CartesianProduct(g, h)) { gi.push_back(i); } - EXPECT_EQ(g[0], h); - EXPECT_EQ(g[1], h); + EXPECT_EQ(g[0], h); + EXPECT_EQ(g[1], h); } } - TEST(FuncTools, CartesianProduct3) { + TEST(FuncTools, CartesianProduct3) { TVector<std::tuple<TVector<i32>, TVector<i32>, TVector<i32>>> ts = { {{1, 2, 3}, {4, 5, 6}, {11, 3}}, {{1, 2, 3}, {4, 5, 6, 7}, {9}}, @@ -419,11 +419,11 @@ using namespace NFuncTools; f.push_back({ai, bi, ci}); } - EXPECT_EQ(e, f); + EXPECT_EQ(e, f); } } - TEST(FuncTools, CompileCartesianProduct) { + TEST(FuncTools, CompileCartesianProduct) { auto container = std::vector{1, 2, 3}; TestViewCompileability(CartesianProduct(container, container)); const auto constContainer = std::vector{1, 2, 3}; @@ -435,14 +435,14 @@ using namespace NFuncTools; FOR_DISPATCH_2(a, b, CartesianProduct(MakeMinimalisticContainer(), MakeMinimalisticContainer())) { res.push_back({a, b}); } - EXPECT_EQ(res, (std::vector<std::pair<int, int>>{ + EXPECT_EQ(res, (std::vector<std::pair<int, int>>{ {0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 1}, {1, 2}, {2, 0}, {2, 1}, {2, 2}, })); } - TEST(FuncTools, Concatenate2) { + TEST(FuncTools, Concatenate2) { TVector<std::pair<TVector<i32>, TVector<i32>>> ts = { {{1, 2, 3}, {4, 5, 6}}, {{1, 2, 3}, {4, 5, 6, 7}}, @@ -465,7 +465,7 @@ using namespace NFuncTools; d.push_back(x); } - EXPECT_EQ(c, d); + EXPECT_EQ(c, d); } { @@ -474,11 +474,11 @@ using namespace NFuncTools; for (auto x : Concatenate(a, TVector<i32>{5, 6})) { c.push_back(x); } - EXPECT_EQ(c, (TVector<i32>{1, 2, 3, 4, 5, 6})); + EXPECT_EQ(c, (TVector<i32>{1, 2, 3, 4, 5, 6})); } } - TEST(FuncTools, CompileConcatenate) { + TEST(FuncTools, CompileConcatenate) { auto container = std::vector{1, 2, 3}; TestViewCompileability(Concatenate(container, container)); const auto constContainer = std::vector{1, 2, 3}; @@ -490,42 +490,42 @@ using namespace NFuncTools; for (auto a : Concatenate(MakeMinimalisticContainer(), MakeMinimalisticContainer())) { res.push_back(a); } - EXPECT_EQ(res, (std::vector{0, 1, 2, 0, 1, 2})); + EXPECT_EQ(res, (std::vector{0, 1, 2, 0, 1, 2})); } - TEST(FuncTools, Combo) { - FOR_DISPATCH_2(i, j, Enumerate(xrange(10u))) { - EXPECT_EQ(i, j); + TEST(FuncTools, Combo) { + FOR_DISPATCH_2(i, j, Enumerate(xrange(10u))) { + EXPECT_EQ(i, j); } - FOR_DISPATCH_2(i, jk, Enumerate(Enumerate(xrange(10u)))) { - EXPECT_EQ(i, std::get<0>(jk)); - EXPECT_EQ(std::get<0>(jk), std::get<1>(jk)); + FOR_DISPATCH_2(i, jk, Enumerate(Enumerate(xrange(10u)))) { + EXPECT_EQ(i, std::get<0>(jk)); + EXPECT_EQ(std::get<0>(jk), std::get<1>(jk)); } - TVector<size_t> a = {0, 1, 2}; + TVector<size_t> a = {0, 1, 2}; FOR_DISPATCH_2(i, j, Enumerate(Reversed(a))) { - EXPECT_EQ(i, 2 - j); + EXPECT_EQ(i, 2 - j); } FOR_DISPATCH_2(i, j, Enumerate(Map<float>(a))) { - EXPECT_EQ(i, (size_t)j); + EXPECT_EQ(i, (size_t)j); } FOR_DISPATCH_2(i, j, Zip(a, Map<float>(a))) { - EXPECT_EQ(i, (size_t)j); + EXPECT_EQ(i, (size_t)j); } auto mapper = [](auto&& x) { return std::get<0>(x) + std::get<1>(x); }; FOR_DISPATCH_2(i, j, Zip(a, Map(mapper, Zip(a, a)))) { - EXPECT_EQ(j, 2 * i); + EXPECT_EQ(j, 2 * i); } } - TEST(FuncTools, CopyIterator) { + TEST(FuncTools, CopyIterator) { TVector a = {1, 2, 3, 4}; TVector b = {4, 5, 6, 7}; @@ -544,12 +544,12 @@ using namespace NFuncTools; auto iterable = Enumerate(a); testIterator(std::begin(iterable), [](auto p2, auto p3, auto p4) { - EXPECT_EQ(std::get<0>(p2), 1u); - EXPECT_EQ(std::get<1>(p2), 2); - EXPECT_EQ(std::get<0>(p3), 2u); - EXPECT_EQ(std::get<1>(p3), 3); - EXPECT_EQ(std::get<0>(p4), 3u); - EXPECT_EQ(std::get<1>(p4), 4); + EXPECT_EQ(std::get<0>(p2), 1u); + EXPECT_EQ(std::get<1>(p2), 2); + EXPECT_EQ(std::get<0>(p3), 2u); + EXPECT_EQ(std::get<1>(p3), 3); + EXPECT_EQ(std::get<0>(p4), 3u); + EXPECT_EQ(std::get<1>(p4), 4); }); } @@ -557,9 +557,9 @@ using namespace NFuncTools; auto iterable = Map([](i32 x) { return x*x; }, a); testIterator(std::begin(iterable), [](auto p2, auto p3, auto p4) { - EXPECT_EQ(p2, 4); - EXPECT_EQ(p3, 9); - EXPECT_EQ(p4, 16); + EXPECT_EQ(p2, 4); + EXPECT_EQ(p3, 9); + EXPECT_EQ(p4, 16); }); } @@ -567,12 +567,12 @@ using namespace NFuncTools; auto iterable = Zip(a, b); testIterator(std::begin(iterable), [](auto p2, auto p3, auto p4) { - EXPECT_EQ(std::get<0>(p2), 2); - EXPECT_EQ(std::get<1>(p2), 5); - EXPECT_EQ(std::get<0>(p3), 3); - EXPECT_EQ(std::get<1>(p3), 6); - EXPECT_EQ(std::get<0>(p4), 4); - EXPECT_EQ(std::get<1>(p4), 7); + EXPECT_EQ(std::get<0>(p2), 2); + EXPECT_EQ(std::get<1>(p2), 5); + EXPECT_EQ(std::get<0>(p3), 3); + EXPECT_EQ(std::get<1>(p3), 6); + EXPECT_EQ(std::get<0>(p4), 4); + EXPECT_EQ(std::get<1>(p4), 7); }); } @@ -581,9 +581,9 @@ using namespace NFuncTools; auto iterable = Filter([](i32 x) { return !(x & 1); }, c); testIterator(std::begin(iterable), [](auto p2, auto p3, auto p4) { - EXPECT_EQ(p2, 4); - EXPECT_EQ(p3, 6); - EXPECT_EQ(p4, 8); + EXPECT_EQ(p2, 4); + EXPECT_EQ(p3, 6); + EXPECT_EQ(p4, 8); }); } @@ -592,12 +592,12 @@ using namespace NFuncTools; // (0, 2), (0, 3), (1, 2), (1, 3) testIterator(std::begin(iterable), [](auto p2, auto p3, auto p4) { - EXPECT_EQ(std::get<0>(p2), 0); - EXPECT_EQ(std::get<1>(p2), 3); - EXPECT_EQ(std::get<0>(p3), 1); - EXPECT_EQ(std::get<1>(p3), 2); - EXPECT_EQ(std::get<0>(p4), 1); - EXPECT_EQ(std::get<1>(p4), 3); + EXPECT_EQ(std::get<0>(p2), 0); + EXPECT_EQ(std::get<1>(p2), 3); + EXPECT_EQ(std::get<0>(p3), 1); + EXPECT_EQ(std::get<1>(p3), 2); + EXPECT_EQ(std::get<0>(p4), 1); + EXPECT_EQ(std::get<1>(p4), 3); }); } } diff --git a/library/cpp/iterator/ut/iterate_keys_ut.cpp b/library/cpp/iterator/ut/iterate_keys_ut.cpp index 49eb866b6e..b5058c379d 100644 --- a/library/cpp/iterator/ut/iterate_keys_ut.cpp +++ b/library/cpp/iterator/ut/iterate_keys_ut.cpp @@ -1,37 +1,37 @@ -#include <library/cpp/iterator/iterate_keys.h> - -#include <library/cpp/testing/gtest/gtest.h> - -#include <map> - -using namespace testing; - -TEST(IterateKeys, ConstMappingIteration) { - const std::map<int, int> squares{ - {1, 1}, - {2, 4}, - {3, 9}, - }; - EXPECT_THAT( - IterateKeys(squares), - ElementsAre(1, 2, 3) - ); -} - -TEST(IterateKeys, ConstMultiMappingIteration) { - const std::multimap<int, int> primesBelow{ - {2, 2}, - {5, 3}, - {5, 5}, - {11, 7}, - {11, 11}, - {23, 13}, - {23, 17}, - {23, 23}, - }; - - EXPECT_THAT( - IterateKeys(primesBelow), - ElementsAre(2, 5, 5, 11, 11, 23, 23, 23) - ); -} +#include <library/cpp/iterator/iterate_keys.h> + +#include <library/cpp/testing/gtest/gtest.h> + +#include <map> + +using namespace testing; + +TEST(IterateKeys, ConstMappingIteration) { + const std::map<int, int> squares{ + {1, 1}, + {2, 4}, + {3, 9}, + }; + EXPECT_THAT( + IterateKeys(squares), + ElementsAre(1, 2, 3) + ); +} + +TEST(IterateKeys, ConstMultiMappingIteration) { + const std::multimap<int, int> primesBelow{ + {2, 2}, + {5, 3}, + {5, 5}, + {11, 7}, + {11, 11}, + {23, 13}, + {23, 17}, + {23, 23}, + }; + + EXPECT_THAT( + IterateKeys(primesBelow), + ElementsAre(2, 5, 5, 11, 11, 23, 23, 23) + ); +} diff --git a/library/cpp/iterator/ut/iterate_values_ut.cpp b/library/cpp/iterator/ut/iterate_values_ut.cpp index ed099e560d..b8940bded7 100644 --- a/library/cpp/iterator/ut/iterate_values_ut.cpp +++ b/library/cpp/iterator/ut/iterate_values_ut.cpp @@ -1,106 +1,106 @@ -#include <library/cpp/iterator/iterate_values.h> - -#include <library/cpp/testing/gtest/gtest.h> - -#include <util/generic/algorithm.h> - -#include <map> -#include <unordered_map> - -using namespace testing; - -TEST(IterateValues, ConstMappingIteration) { - const std::map<int, int> squares{ - {1, 1}, - {2, 4}, - {3, 9}, - }; - EXPECT_THAT( - IterateValues(squares), - ElementsAre(1, 4, 9) - ); - - const std::unordered_map<int, int> roots{ - {49, 7}, - {36, 6}, - {25, 5}, - }; - EXPECT_THAT( - IterateValues(roots), - UnorderedElementsAre(5, 6, 7) - ); - - const std::map<int, std::string> translations{ - {1, "one"}, - {2, "two"}, - {3, "three"}, - }; - EXPECT_EQ( - Accumulate(IterateValues(translations), std::string{}), - "onetwothree" - ); -} - -TEST(IterateValues, NonConstMappingIteration) { - std::map<int, int> squares{ - {1, 1}, - {2, 4}, - {3, 9}, - }; - for (auto& value: IterateValues(squares)) { - value *= value; - } - EXPECT_THAT( - IterateValues(squares), - ElementsAre(1, 16, 81) - ); -} - -TEST(IterateValues, ConstMultiMappingIteration) { - const std::multimap<int, int> primesBelow{ - {2, 2}, - {5, 3}, - {5, 5}, - {11, 7}, - {11, 11}, - {23, 13}, - {23, 17}, - {23, 23}, - }; - - EXPECT_THAT( - IterateValues(primesBelow), - ElementsAre(2, 3, 5, 7, 11, 13, 17, 23) - ); - auto [begin, end] = primesBelow.equal_range(11); - EXPECT_EQ(std::distance(begin, end), 2); - EXPECT_THAT( - IterateValues(std::vector(begin, end)), - ElementsAre(7, 11) - ); -} - -TEST(IterateValues, ConstUnorderedMultiMappingIteration) { - const std::unordered_multimap<int, int> primesBelow{ - {2, 2}, - {5, 3}, - {5, 5}, - {11, 7}, - {11, 11}, - {23, 13}, - {23, 17}, - {23, 23}, - }; - - EXPECT_THAT( - IterateValues(primesBelow), - UnorderedElementsAre(2, 3, 5, 7, 11, 13, 17, 23) - ); - - auto [begin, end] = primesBelow.equal_range(11); - EXPECT_EQ(std::distance(begin, end), 2); - EXPECT_THAT( - IterateValues(std::vector(begin, end)), - UnorderedElementsAre(7, 11) - ); -} +#include <library/cpp/iterator/iterate_values.h> + +#include <library/cpp/testing/gtest/gtest.h> + +#include <util/generic/algorithm.h> + +#include <map> +#include <unordered_map> + +using namespace testing; + +TEST(IterateValues, ConstMappingIteration) { + const std::map<int, int> squares{ + {1, 1}, + {2, 4}, + {3, 9}, + }; + EXPECT_THAT( + IterateValues(squares), + ElementsAre(1, 4, 9) + ); + + const std::unordered_map<int, int> roots{ + {49, 7}, + {36, 6}, + {25, 5}, + }; + EXPECT_THAT( + IterateValues(roots), + UnorderedElementsAre(5, 6, 7) + ); + + const std::map<int, std::string> translations{ + {1, "one"}, + {2, "two"}, + {3, "three"}, + }; + EXPECT_EQ( + Accumulate(IterateValues(translations), std::string{}), + "onetwothree" + ); +} + +TEST(IterateValues, NonConstMappingIteration) { + std::map<int, int> squares{ + {1, 1}, + {2, 4}, + {3, 9}, + }; + for (auto& value: IterateValues(squares)) { + value *= value; + } + EXPECT_THAT( + IterateValues(squares), + ElementsAre(1, 16, 81) + ); +} + +TEST(IterateValues, ConstMultiMappingIteration) { + const std::multimap<int, int> primesBelow{ + {2, 2}, + {5, 3}, + {5, 5}, + {11, 7}, + {11, 11}, + {23, 13}, + {23, 17}, + {23, 23}, + }; + + EXPECT_THAT( + IterateValues(primesBelow), + ElementsAre(2, 3, 5, 7, 11, 13, 17, 23) + ); + auto [begin, end] = primesBelow.equal_range(11); + EXPECT_EQ(std::distance(begin, end), 2); + EXPECT_THAT( + IterateValues(std::vector(begin, end)), + ElementsAre(7, 11) + ); +} + +TEST(IterateValues, ConstUnorderedMultiMappingIteration) { + const std::unordered_multimap<int, int> primesBelow{ + {2, 2}, + {5, 3}, + {5, 5}, + {11, 7}, + {11, 11}, + {23, 13}, + {23, 17}, + {23, 23}, + }; + + EXPECT_THAT( + IterateValues(primesBelow), + UnorderedElementsAre(2, 3, 5, 7, 11, 13, 17, 23) + ); + + auto [begin, end] = primesBelow.equal_range(11); + EXPECT_EQ(std::distance(begin, end), 2); + EXPECT_THAT( + IterateValues(std::vector(begin, end)), + UnorderedElementsAre(7, 11) + ); +} diff --git a/library/cpp/iterator/ut/mapped_ut.cpp b/library/cpp/iterator/ut/mapped_ut.cpp index 440cd37945..77b5d7c2f6 100644 --- a/library/cpp/iterator/ut/mapped_ut.cpp +++ b/library/cpp/iterator/ut/mapped_ut.cpp @@ -1,61 +1,61 @@ -#include <library/cpp/iterator/mapped.h> - -#include <library/cpp/testing/gtest/gtest.h> - -#include <util/generic/map.h> -#include <util/generic/vector.h> - -using namespace testing; - -TEST(TIterator, TMappedIteratorTest) { - TVector<int> x = {1, 2, 3, 4, 5}; - auto it = MakeMappedIterator(x.begin(), [](int x) { return x + 7; }); - - EXPECT_EQ(*it, 8); - EXPECT_EQ(it[2], 10); -} - -TEST(TIterator, TMappedRangeTest) { - TVector<int> x = {1, 2, 3, 4, 5}; - - EXPECT_THAT( - MakeMappedRange( - x, - [](int x) { return x + 3; } - ), - ElementsAre(4, 5, 6, 7, 8) - ); -} - -//TODO: replace with dedicated IterateKeys / IterateValues methods -TEST(TIterator, TMutableMappedRangeTest) { - TMap<int, int> points = {{1, 2}, {3, 4}}; - - EXPECT_THAT( - MakeMappedRange( - points.begin(), points.end(), - [](TMap<int, int>::value_type& kv) -> int& { return kv.second; } - ), - ElementsAre(2, 4) - ); -} - -TEST(TIterator, TOwningMappedMethodTest) { - auto range = MakeMappedRange( - TVector<std::pair<int, int>>{std::make_pair(1, 2), std::make_pair(3, 4)}, - [](auto& point) -> int& { - return point.first; +#include <library/cpp/iterator/mapped.h> + +#include <library/cpp/testing/gtest/gtest.h> + +#include <util/generic/map.h> +#include <util/generic/vector.h> + +using namespace testing; + +TEST(TIterator, TMappedIteratorTest) { + TVector<int> x = {1, 2, 3, 4, 5}; + auto it = MakeMappedIterator(x.begin(), [](int x) { return x + 7; }); + + EXPECT_EQ(*it, 8); + EXPECT_EQ(it[2], 10); +} + +TEST(TIterator, TMappedRangeTest) { + TVector<int> x = {1, 2, 3, 4, 5}; + + EXPECT_THAT( + MakeMappedRange( + x, + [](int x) { return x + 3; } + ), + ElementsAre(4, 5, 6, 7, 8) + ); +} + +//TODO: replace with dedicated IterateKeys / IterateValues methods +TEST(TIterator, TMutableMappedRangeTest) { + TMap<int, int> points = {{1, 2}, {3, 4}}; + + EXPECT_THAT( + MakeMappedRange( + points.begin(), points.end(), + [](TMap<int, int>::value_type& kv) -> int& { return kv.second; } + ), + ElementsAre(2, 4) + ); +} + +TEST(TIterator, TOwningMappedMethodTest) { + auto range = MakeMappedRange( + TVector<std::pair<int, int>>{std::make_pair(1, 2), std::make_pair(3, 4)}, + [](auto& point) -> int& { + return point.first; } - ); - EXPECT_EQ(range[0], 1); - range[0] += 1; - EXPECT_EQ(range[0], 2); - (*range.begin()) += 1; - EXPECT_EQ(range[0], 3); - for (int& y : range) { - y += 7; + ); + EXPECT_EQ(range[0], 1); + range[0] += 1; + EXPECT_EQ(range[0], 2); + (*range.begin()) += 1; + EXPECT_EQ(range[0], 3); + for (int& y : range) { + y += 7; } - EXPECT_EQ(*range.begin(), 10); - EXPECT_EQ(*(range.begin() + 1), 10); + EXPECT_EQ(*range.begin(), 10); + EXPECT_EQ(*(range.begin() + 1), 10); } diff --git a/library/cpp/iterator/ut/ya.make b/library/cpp/iterator/ut/ya.make index 601e5663b9..ed9b08aa7e 100644 --- a/library/cpp/iterator/ut/ya.make +++ b/library/cpp/iterator/ut/ya.make @@ -1,17 +1,17 @@ -GTEST() - -PEERDIR( - library/cpp/iterator -) +GTEST() +PEERDIR( + library/cpp/iterator +) + OWNER(g:util) SRCS( filtering_ut.cpp functools_ut.cpp - iterate_keys_ut.cpp - iterate_values_ut.cpp - mapped_ut.cpp + iterate_keys_ut.cpp + iterate_values_ut.cpp + mapped_ut.cpp zip_ut.cpp ) diff --git a/library/cpp/iterator/ya.make b/library/cpp/iterator/ya.make index 1ba1ffb411..c8723354b1 100644 --- a/library/cpp/iterator/ya.make +++ b/library/cpp/iterator/ya.make @@ -6,8 +6,8 @@ SRCS( cartesian_product.cpp concatenate.cpp enumerate.cpp - iterate_keys.cpp - iterate_values.cpp + iterate_keys.cpp + iterate_values.cpp filtering.cpp functools.cpp mapped.cpp diff --git a/library/cpp/iterator/zip.h b/library/cpp/iterator/zip.h index ac12ed35fe..5ba1c6cb0b 100644 --- a/library/cpp/iterator/zip.h +++ b/library/cpp/iterator/zip.h @@ -49,7 +49,7 @@ namespace NPrivate { using value_type = TValue; using pointer = TValue*; using reference = TValue&; - using const_reference = const TValue&; + using const_reference = const TValue&; using iterator_category = std::input_iterator_tag; TValue operator*() { @@ -85,9 +85,9 @@ namespace NPrivate { public: using iterator = TIterator; using const_iterator = TIterator; - using value_type = typename TIterator::value_type; - using reference = typename TIterator::reference; - using const_reference = typename TIterator::const_reference; + using value_type = typename TIterator::value_type; + using reference = typename TIterator::reference; + using const_reference = typename TIterator::const_reference; TIterator begin() const { return {TIteratorState{std::begin(*std::get<I>(Holders_).Ptr())...}}; diff --git a/library/cpp/json/ut/json_reader_fast_ut.cpp b/library/cpp/json/ut/json_reader_fast_ut.cpp index 60dffc91c7..400485ef29 100644 --- a/library/cpp/json/ut/json_reader_fast_ut.cpp +++ b/library/cpp/json/ut/json_reader_fast_ut.cpp @@ -233,8 +233,8 @@ public: TTestHandler h; const bool res = ReadJsonFast(json, &h); - UNIT_ASSERT_VALUES_EQUAL_C(res, accept, Sprintf("%s (%s)", ToString(json).data(), h.Events.back().Str.data())); - h.Assert(evs, ToString(json)); + UNIT_ASSERT_VALUES_EQUAL_C(res, accept, Sprintf("%s (%s)", ToString(json).data(), h.Events.back().Str.data())); + h.Assert(evs, ToString(json)); } void TestParse() { diff --git a/library/cpp/lfalloc/lf_allocX64.cpp b/library/cpp/lfalloc/lf_allocX64.cpp index 2eb90761fe..02719a34d3 100644 --- a/library/cpp/lfalloc/lf_allocX64.cpp +++ b/library/cpp/lfalloc/lf_allocX64.cpp @@ -63,10 +63,10 @@ extern "C" void* memalign(size_t alignment, size_t size) { return res ? nullptr : ptr; } -extern "C" void* aligned_alloc(size_t alignment, size_t size) { - return memalign(alignment, size); -} - +extern "C" void* aligned_alloc(size_t alignment, size_t size) { + return memalign(alignment, size); +} + #if !defined(_MSC_VER) && !defined(_freebsd_) // Workaround for pthread_create bug in linux. extern "C" void* __libc_memalign(size_t alignment, size_t size) { diff --git a/library/cpp/lfalloc/lf_allocX64.h b/library/cpp/lfalloc/lf_allocX64.h index fd2a906d6f..d43fbf1ccb 100644 --- a/library/cpp/lfalloc/lf_allocX64.h +++ b/library/cpp/lfalloc/lf_allocX64.h @@ -6,7 +6,7 @@ #include <library/cpp/malloc/api/malloc.h> -#include <util/system/compat.h> +#include <util/system/compat.h> #include <util/system/compiler.h> #include <util/system/types.h> diff --git a/library/cpp/logger/file.h b/library/cpp/logger/file.h index 10b4cd0c20..d855751d27 100644 --- a/library/cpp/logger/file.h +++ b/library/cpp/logger/file.h @@ -2,7 +2,7 @@ #include "backend.h" -#include <util/generic/fwd.h> +#include <util/generic/fwd.h> #include <util/generic/ptr.h> class TFileLogBackend: public TLogBackend { diff --git a/library/cpp/logger/log.h b/library/cpp/logger/log.h index 8be984ccc8..b4bf1b6bb9 100644 --- a/library/cpp/logger/log.h +++ b/library/cpp/logger/log.h @@ -6,7 +6,7 @@ #include "record.h" #include "thread.h" -#include <util/generic/fwd.h> +#include <util/generic/fwd.h> #include <util/generic/ptr.h> #include <functional> diff --git a/library/cpp/logger/rotating_file.h b/library/cpp/logger/rotating_file.h index cb047f25fb..70a9e6d984 100644 --- a/library/cpp/logger/rotating_file.h +++ b/library/cpp/logger/rotating_file.h @@ -2,7 +2,7 @@ #include "backend.h" -#include <util/generic/fwd.h> +#include <util/generic/fwd.h> #include <util/generic/ptr.h> class TRotatingFileLogBackend: public TLogBackend { diff --git a/library/cpp/lwtrace/control.h b/library/cpp/lwtrace/control.h index 16b24eafd2..75b9212d02 100644 --- a/library/cpp/lwtrace/control.h +++ b/library/cpp/lwtrace/control.h @@ -8,7 +8,7 @@ #include <library/cpp/lwtrace/protos/lwtrace.pb.h> -#include <google/protobuf/repeated_field.h> +#include <google/protobuf/repeated_field.h> #include <util/generic/deque.h> #include <util/generic/hash.h> diff --git a/library/cpp/lwtrace/example2/lwtrace_example2.cpp b/library/cpp/lwtrace/example2/lwtrace_example2.cpp index 7a4f7a1daf..c352b500c8 100644 --- a/library/cpp/lwtrace/example2/lwtrace_example2.cpp +++ b/library/cpp/lwtrace/example2/lwtrace_example2.cpp @@ -2,7 +2,7 @@ #include <library/cpp/lwtrace/all.h> #include <library/cpp/getopt/last_getopt.h> -#include <google/protobuf/text_format.h> +#include <google/protobuf/text_format.h> #include <util/stream/file.h> #define LWTRACE_EXAMPLE_PROVIDER(PROBE, EVENT, GROUPS, TYPES, NAMES) \ diff --git a/library/cpp/lwtrace/example3/lwtrace_example3.cpp b/library/cpp/lwtrace/example3/lwtrace_example3.cpp index 4493dc0077..25d9d242eb 100644 --- a/library/cpp/lwtrace/example3/lwtrace_example3.cpp +++ b/library/cpp/lwtrace/example3/lwtrace_example3.cpp @@ -1,5 +1,5 @@ #include <library/cpp/lwtrace/all.h> -#include <google/protobuf/text_format.h> +#include <google/protobuf/text_format.h> #include "my_action.h" #define LWTRACE_EXAMPLE_PROVIDER(PROBE, EVENT, GROUPS, TYPES, NAMES) \ diff --git a/library/cpp/lwtrace/mon/mon_lwtrace.cpp b/library/cpp/lwtrace/mon/mon_lwtrace.cpp index a61ee9ce22..56a12608ff 100644 --- a/library/cpp/lwtrace/mon/mon_lwtrace.cpp +++ b/library/cpp/lwtrace/mon/mon_lwtrace.cpp @@ -3,7 +3,7 @@ #include <algorithm> #include <iterator> -#include <google/protobuf/text_format.h> +#include <google/protobuf/text_format.h> #include <library/cpp/lwtrace/mon/analytics/all.h> #include <library/cpp/lwtrace/all.h> #include <library/cpp/monlib/service/pages/mon_page.h> diff --git a/library/cpp/lwtrace/signature.h b/library/cpp/lwtrace/signature.h index 868bd9bcf2..a6c546b8fb 100644 --- a/library/cpp/lwtrace/signature.h +++ b/library/cpp/lwtrace/signature.h @@ -11,8 +11,8 @@ #include <util/string/cast.h> #include <util/string/printf.h> -#include <google/protobuf/descriptor.h> -#include <google/protobuf/generated_enum_reflection.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/generated_enum_reflection.h> #include <library/cpp/lwtrace/protos/lwtrace.pb.h> diff --git a/library/cpp/lwtrace/start.cpp b/library/cpp/lwtrace/start.cpp index 121d5472b6..b8be30118b 100644 --- a/library/cpp/lwtrace/start.cpp +++ b/library/cpp/lwtrace/start.cpp @@ -2,7 +2,7 @@ #include "all.h" -#include <google/protobuf/text_format.h> +#include <google/protobuf/text_format.h> #include <util/generic/singleton.h> #include <util/stream/file.h> diff --git a/library/cpp/lwtrace/tests/trace_tests.cpp b/library/cpp/lwtrace/tests/trace_tests.cpp index 6762e344a7..7b93769325 100644 --- a/library/cpp/lwtrace/tests/trace_tests.cpp +++ b/library/cpp/lwtrace/tests/trace_tests.cpp @@ -2,7 +2,7 @@ #include <library/cpp/getopt/last_getopt.h> -#include <google/protobuf/text_format.h> +#include <google/protobuf/text_format.h> #include <util/system/pipe.h> #include <util/generic/ymath.h> diff --git a/library/cpp/lwtrace/trace.cpp b/library/cpp/lwtrace/trace.cpp index 3c974c85a0..1fcb9ae7d2 100644 --- a/library/cpp/lwtrace/trace.cpp +++ b/library/cpp/lwtrace/trace.cpp @@ -4,7 +4,7 @@ #include "preprocessor.h" #include "sleep_action.h" #include "stderr_writer.h" -#include "google/protobuf/repeated_field.h" +#include "google/protobuf/repeated_field.h" #include <util/generic/map.h> #include <util/random/random.h> diff --git a/library/cpp/lwtrace/trace_ut.cpp b/library/cpp/lwtrace/trace_ut.cpp index cb03e4fbde..0fec77546e 100644 --- a/library/cpp/lwtrace/trace_ut.cpp +++ b/library/cpp/lwtrace/trace_ut.cpp @@ -4,7 +4,7 @@ #include <library/cpp/testing/unittest/registar.h> -#include <google/protobuf/text_format.h> +#include <google/protobuf/text_format.h> enum ESimpleEnum { ValueA, diff --git a/library/cpp/messagebus/event_loop.cpp b/library/cpp/messagebus/event_loop.cpp index f685135bed..2ae3e527be 100644 --- a/library/cpp/messagebus/event_loop.cpp +++ b/library/cpp/messagebus/event_loop.cpp @@ -350,7 +350,7 @@ TChannelPtr TEventLoop::TImpl::Register(TSocket socket, TEventHandlerPtr eventHa } void TEventLoop::TImpl::Wakeup() { - if (NBus::NPrivate::SocketSend(WakeupWriteSocket, TArrayRef<const char>("", 1)) < 0) { + if (NBus::NPrivate::SocketSend(WakeupWriteSocket, TArrayRef<const char>("", 1)) < 0) { if (LastSystemError() != EAGAIN) { Y_FAIL("failed to send to wakeup socket: %s", LastSystemErrorText()); } diff --git a/library/cpp/messagebus/network.cpp b/library/cpp/messagebus/network.cpp index 304bedae5a..29ecd6a2a7 100644 --- a/library/cpp/messagebus/network.cpp +++ b/library/cpp/messagebus/network.cpp @@ -131,7 +131,7 @@ void NBus::NPrivate::SetSockOptTcpCork(SOCKET s, bool value) { #endif } -ssize_t NBus::NPrivate::SocketSend(SOCKET s, TArrayRef<const char> data) { +ssize_t NBus::NPrivate::SocketSend(SOCKET s, TArrayRef<const char> data) { int flags = 0; #if defined(_linux_) || defined(_freebsd_) flags |= MSG_NOSIGNAL; @@ -143,7 +143,7 @@ ssize_t NBus::NPrivate::SocketSend(SOCKET s, TArrayRef<const char> data) { return r; } -ssize_t NBus::NPrivate::SocketRecv(SOCKET s, TArrayRef<char> buffer) { +ssize_t NBus::NPrivate::SocketRecv(SOCKET s, TArrayRef<char> buffer) { int flags = 0; #if defined(_linux_) || defined(_freebsd_) flags |= MSG_NOSIGNAL; diff --git a/library/cpp/messagebus/network.h b/library/cpp/messagebus/network.h index cc4bd76ea3..aaa2789b62 100644 --- a/library/cpp/messagebus/network.h +++ b/library/cpp/messagebus/network.h @@ -2,7 +2,7 @@ #include "netaddr.h" -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/generic/ptr.h> #include <util/network/socket.h> @@ -12,9 +12,9 @@ namespace NBus { namespace NPrivate { void SetSockOptTcpCork(SOCKET s, bool value); - [[nodiscard]] ssize_t SocketSend(SOCKET s, TArrayRef<const char> data); + [[nodiscard]] ssize_t SocketSend(SOCKET s, TArrayRef<const char> data); - [[nodiscard]] ssize_t SocketRecv(SOCKET s, TArrayRef<char> buffer); + [[nodiscard]] ssize_t SocketRecv(SOCKET s, TArrayRef<char> buffer); } diff --git a/library/cpp/messagebus/oldmodule/module.h b/library/cpp/messagebus/oldmodule/module.h index 8d1c4a5d52..1cbff60f26 100644 --- a/library/cpp/messagebus/oldmodule/module.h +++ b/library/cpp/messagebus/oldmodule/module.h @@ -73,10 +73,10 @@ namespace NBus { } TJobHandler(const TJobHandler&) = default; TJobHandler& operator =(const TJobHandler&) = default; - bool operator==(TJobHandler h) const { + bool operator==(TJobHandler h) const { return MyPtr == h.MyPtr; } - bool operator!=(TJobHandler h) const { + bool operator!=(TJobHandler h) const { return MyPtr != h.MyPtr; } bool operator!() const { diff --git a/library/cpp/messagebus/protobuf/ybusbuf.cpp b/library/cpp/messagebus/protobuf/ybusbuf.cpp index 63415b3737..d47eee0672 100644 --- a/library/cpp/messagebus/protobuf/ybusbuf.cpp +++ b/library/cpp/messagebus/protobuf/ybusbuf.cpp @@ -2,7 +2,7 @@ #include <library/cpp/messagebus/actor/what_thread_does.h> -#include <google/protobuf/io/coded_stream.h> +#include <google/protobuf/io/coded_stream.h> using namespace NBus; @@ -78,7 +78,7 @@ TAutoPtr<TBusMessage> TBusBufferProtocol::Deserialize(ui16 messageType, TArrayRe // Need to override protobuf message size limit // NOTE: the payload size has already been checked against session MaxMessageSize google::protobuf::io::CodedInputStream input(reinterpret_cast<const ui8*>(payload.data()), payload.size()); - input.SetTotalBytesLimit(payload.size()); + input.SetTotalBytesLimit(payload.size()); bool ok = bmess->GetRecord()->ParseFromCodedStream(&input) && input.ConsumedEntireMessage(); if (!ok) { diff --git a/library/cpp/messagebus/protobuf/ybusbuf.h b/library/cpp/messagebus/protobuf/ybusbuf.h index 57b4267ea5..4f8aca472f 100644 --- a/library/cpp/messagebus/protobuf/ybusbuf.h +++ b/library/cpp/messagebus/protobuf/ybusbuf.h @@ -2,8 +2,8 @@ #include <library/cpp/messagebus/ybus.h> -#include <google/protobuf/descriptor.h> -#include <google/protobuf/message.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/message.h> #include <util/generic/cast.h> #include <util/generic/vector.h> diff --git a/library/cpp/messagebus/rain_check/core/coro.cpp b/library/cpp/messagebus/rain_check/core/coro.cpp index 500841dd5b..53248ae3f0 100644 --- a/library/cpp/messagebus/rain_check/core/coro.cpp +++ b/library/cpp/messagebus/rain_check/core/coro.cpp @@ -7,7 +7,7 @@ using namespace NRainCheck; -TContClosure TCoroTaskRunner::ContClosure(TCoroTaskRunner* runner, TArrayRef<char> memRegion) { +TContClosure TCoroTaskRunner::ContClosure(TCoroTaskRunner* runner, TArrayRef<char> memRegion) { TContClosure contClosure; contClosure.TrampoLine = runner; contClosure.Stack = memRegion; diff --git a/library/cpp/messagebus/rain_check/core/coro.h b/library/cpp/messagebus/rain_check/core/coro.h index 95e2a30f9b..0106e8a4a9 100644 --- a/library/cpp/messagebus/rain_check/core/coro.h +++ b/library/cpp/messagebus/rain_check/core/coro.h @@ -25,7 +25,7 @@ namespace NRainCheck { ~TCoroTaskRunner() override; private: - static TContClosure ContClosure(TCoroTaskRunner* runner, TArrayRef<char> memRegion); + static TContClosure ContClosure(TCoroTaskRunner* runner, TArrayRef<char> memRegion); bool ReplyReceived() override /* override */; diff --git a/library/cpp/messagebus/rain_check/core/coro_stack.h b/library/cpp/messagebus/rain_check/core/coro_stack.h index 2f3520e6e4..9f90ad4abc 100644 --- a/library/cpp/messagebus/rain_check/core/coro_stack.h +++ b/library/cpp/messagebus/rain_check/core/coro_stack.h @@ -25,8 +25,8 @@ namespace NRainCheck { return SizeValue; } - TArrayRef<char> MemRegion() { - return TArrayRef((char*)Data(), Size()); + TArrayRef<char> MemRegion() { + return TArrayRef((char*)Data(), Size()); } ui32* MagicNumberLocation() { diff --git a/library/cpp/messagebus/remote_connection.cpp b/library/cpp/messagebus/remote_connection.cpp index 22932569db..628a8c10e3 100644 --- a/library/cpp/messagebus/remote_connection.cpp +++ b/library/cpp/messagebus/remote_connection.cpp @@ -412,7 +412,7 @@ namespace NBus { ssize_t bytes; { TWhatThreadDoesPushPop pp("recv syscall"); - bytes = SocketRecv(ReaderData.Channel->GetSocket(), TArrayRef<char>(ReaderData.Buffer.Pos(), ReaderData.Buffer.Avail())); + bytes = SocketRecv(ReaderData.Channel->GetSocket(), TArrayRef<char>(ReaderData.Buffer.Pos(), ReaderData.Buffer.Avail())); } if (bytes < 0) { @@ -621,7 +621,7 @@ namespace NBus { ssize_t bytes; { TWhatThreadDoesPushPop pp("send syscall"); - bytes = SocketSend(WriterData.Channel->GetSocket(), TArrayRef<const char>(WriterData.Buffer.LeftPos(), WriterData.Buffer.Size())); + bytes = SocketSend(WriterData.Channel->GetSocket(), TArrayRef<const char>(WriterData.Buffer.LeftPos(), WriterData.Buffer.Size())); } if (bytes < 0) { diff --git a/library/cpp/messagebus/storage.h b/library/cpp/messagebus/storage.h index 7d168844ed..37e0f140b7 100644 --- a/library/cpp/messagebus/storage.h +++ b/library/cpp/messagebus/storage.h @@ -85,7 +85,7 @@ namespace NBus { } }; - typedef google::dense_hash_map<TBusKey, TValue, TIdHash> TKeyToMessage; + typedef google::dense_hash_map<TBusKey, TValue, TIdHash> TKeyToMessage; TKeyToMessage KeyToMessage; }; diff --git a/library/cpp/messagebus/ya.make b/library/cpp/messagebus/ya.make index e13cf06dea..ff3ea2d5cc 100644 --- a/library/cpp/messagebus/ya.make +++ b/library/cpp/messagebus/ya.make @@ -2,7 +2,7 @@ LIBRARY() OWNER(g:messagebus) -IF (SANITIZER_TYPE == "undefined") +IF (SANITIZER_TYPE == "undefined") NO_SANITIZE() ENDIF() diff --git a/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp b/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp index f87a2d7e8f..fb6aef82bc 100644 --- a/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp +++ b/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp @@ -9,7 +9,7 @@ #include <util/datetime/base.h> #include <util/string/split.h> -#include <google/protobuf/reflection.h> +#include <google/protobuf/reflection.h> #include <algorithm> diff --git a/library/cpp/monlib/encode/legacy_protobuf/legacy_protobuf.h b/library/cpp/monlib/encode/legacy_protobuf/legacy_protobuf.h index 7cf8985d65..527743e192 100644 --- a/library/cpp/monlib/encode/legacy_protobuf/legacy_protobuf.h +++ b/library/cpp/monlib/encode/legacy_protobuf/legacy_protobuf.h @@ -1,6 +1,6 @@ #pragma once -#include <google/protobuf/message.h> +#include <google/protobuf/message.h> #include <util/datetime/base.h> namespace NMonitoring { diff --git a/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp b/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp index 7e81357dbd..ac9ac706cc 100644 --- a/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp +++ b/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp @@ -49,8 +49,8 @@ namespace NMonitoring { template <typename T, typename U> bool TryStaticCast(U val, T& out) { static_assert(std::is_arithmetic_v<U>); - if constexpr (std::is_floating_point_v<T> || std::is_floating_point_v<U>) { - if (val > MaxFloor<T>() || val < -MaxFloor<T>()) { + if constexpr (std::is_floating_point_v<T> || std::is_floating_point_v<U>) { + if (val > MaxFloor<T>() || val < -MaxFloor<T>()) { return false; } diff --git a/library/cpp/monlib/encode/spack/compression.cpp b/library/cpp/monlib/encode/spack/compression.cpp index 0d2152fc85..fa6084f5e0 100644 --- a/library/cpp/monlib/encode/spack/compression.cpp +++ b/library/cpp/monlib/encode/spack/compression.cpp @@ -13,7 +13,7 @@ #include <contrib/libs/xxhash/xxhash.h> #include <contrib/libs/zlib/zlib.h> #define ZSTD_STATIC_LINKING_ONLY -#include <contrib/libs/zstd/include/zstd.h> +#include <contrib/libs/zstd/include/zstd.h> namespace NMonitoring { namespace { @@ -29,12 +29,12 @@ namespace NMonitoring { constexpr size_t FRAME_SIZE_LIMIT = 2_MB; constexpr size_t DEFAULT_FRAME_LEN = 64_KB; - struct Y_PACKED TFrameHeader { + struct Y_PACKED TFrameHeader { TCompressedSize CompressedSize; TUncompressedSize UncompressedSize; }; - struct Y_PACKED TFrameFooter { + struct Y_PACKED TFrameFooter { TCheckSum CheckSum; }; diff --git a/library/cpp/monlib/encode/spack/spack_v1.h b/library/cpp/monlib/encode/spack/spack_v1.h index cf1c9417b9..e0ef3c2065 100644 --- a/library/cpp/monlib/encode/spack/spack_v1.h +++ b/library/cpp/monlib/encode/spack/spack_v1.h @@ -76,7 +76,7 @@ namespace NMonitoring { /////////////////////////////////////////////////////////////////////////////// // TSpackHeader /////////////////////////////////////////////////////////////////////////////// - struct Y_PACKED TSpackHeader { + struct Y_PACKED TSpackHeader { ui16 Magic = 0x5053; // "SP" ui16 Version; // MSB - major version, LSB - minor version ui16 HeaderSize = sizeof(TSpackHeader); diff --git a/library/cpp/monlib/metrics/atomics_array.h b/library/cpp/monlib/metrics/atomics_array.h index f19aebf291..74543651c7 100644 --- a/library/cpp/monlib/metrics/atomics_array.h +++ b/library/cpp/monlib/metrics/atomics_array.h @@ -3,8 +3,8 @@ #include <util/generic/ptr.h> #include <util/generic/vector.h> -#include <atomic> - +#include <atomic> + namespace NMonitoring { class TAtomicsArray { public: diff --git a/library/cpp/monlib/metrics/labels.h b/library/cpp/monlib/metrics/labels.h index 63dc997c28..ac73e6c06f 100644 --- a/library/cpp/monlib/metrics/labels.h +++ b/library/cpp/monlib/metrics/labels.h @@ -316,7 +316,7 @@ namespace NMonitoring { inline void Clear() noexcept override { Labels_.clear(); - }; + }; TLabelImpl<TStringBackend>& front() { return Labels_.front(); @@ -451,22 +451,22 @@ inline bool operator==(const NMonitoring::ILabels& lhs, const NMonitoring::ILabe return true; } -bool operator==(const NMonitoring::ILabelsPtr& lhs, const NMonitoring::ILabelsPtr& rhs) = delete; -bool operator==(const NMonitoring::ILabels& lhs, const NMonitoring::ILabelsPtr& rhs) = delete; -bool operator==(const NMonitoring::ILabelsPtr& lhs, const NMonitoring::ILabels& rhs) = delete; +bool operator==(const NMonitoring::ILabelsPtr& lhs, const NMonitoring::ILabelsPtr& rhs) = delete; +bool operator==(const NMonitoring::ILabels& lhs, const NMonitoring::ILabelsPtr& rhs) = delete; +bool operator==(const NMonitoring::ILabelsPtr& lhs, const NMonitoring::ILabels& rhs) = delete; template<> struct TEqualTo<NMonitoring::ILabelsPtr> { bool operator()(const NMonitoring::ILabelsPtr& lhs, const NMonitoring::ILabelsPtr& rhs) { - return *lhs == *rhs; + return *lhs == *rhs; } bool operator()(const NMonitoring::ILabelsPtr& lhs, const NMonitoring::ILabels& rhs) { - return *lhs == rhs; + return *lhs == rhs; } bool operator()(const NMonitoring::ILabels& lhs, const NMonitoring::ILabelsPtr& rhs) { - return lhs == *rhs; + return lhs == *rhs; } }; diff --git a/library/cpp/monlib/service/monservice.cpp b/library/cpp/monlib/service/monservice.cpp index d1b9cda1d2..827dd0fed9 100644 --- a/library/cpp/monlib/service/monservice.cpp +++ b/library/cpp/monlib/service/monservice.cpp @@ -8,7 +8,7 @@ #include <util/generic/ptr.h> #include <util/system/hostname.h> -#include <google/protobuf/text_format.h> +#include <google/protobuf/text_format.h> using namespace NMonitoring; diff --git a/library/cpp/on_disk/chunks/reader.h b/library/cpp/on_disk/chunks/reader.h index c5fe783319..8588c4162c 100644 --- a/library/cpp/on_disk/chunks/reader.h +++ b/library/cpp/on_disk/chunks/reader.h @@ -1,6 +1,6 @@ #pragma once -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> #include <util/generic/vector.h> #include <util/generic/yexception.h> @@ -32,10 +32,10 @@ public: TBlob GetBlob(size_t index) const; template <typename T> - TArrayRef<const T> GetRegion(size_t index) const { + TArrayRef<const T> GetRegion(size_t index) const { size_t len = GetBlockLen(index); Y_ENSURE(len % sizeof(T) == 0, "wrong data padding"); - return TArrayRef<const T>(reinterpret_cast<const T*>(GetBlock(index)), len / sizeof(T)); + return TArrayRef<const T>(reinterpret_cast<const T*>(GetBlock(index)), len / sizeof(T)); } inline size_t GetBlocksCount() const { diff --git a/library/cpp/openssl/holders/holder.h b/library/cpp/openssl/holders/holder.h index c2a26ce431..72a6e28a16 100644 --- a/library/cpp/openssl/holders/holder.h +++ b/library/cpp/openssl/holders/holder.h @@ -10,7 +10,7 @@ public: inline THolder(Args... args) { Ptr = Create(args...); if (!Ptr) { - throw std::bad_alloc(); + throw std::bad_alloc(); } } diff --git a/library/cpp/openssl/method/io.cpp b/library/cpp/openssl/method/io.cpp index d184b6456c..56fb14822e 100644 --- a/library/cpp/openssl/method/io.cpp +++ b/library/cpp/openssl/method/io.cpp @@ -38,7 +38,7 @@ namespace { int Gets(BIO* bio, char* buf, int size) noexcept { return ExceptionBoundary(bio, &TAbstractIO::Gets, -1, buf, size); } - + long Ctrl(BIO* bio, int cmd, long larg, void* parg) noexcept { return ExceptionBoundary(bio, &TAbstractIO::Ctrl, -1, cmd, larg, parg); } @@ -76,7 +76,7 @@ namespace NOpenSSL { TAbstractIO::TAbstractIO() : Bio(BIO_new(*Method())) { if (Y_UNLIKELY(!Bio)) { - throw std::bad_alloc(); + throw std::bad_alloc(); } BIO_set_data(Bio, this); } diff --git a/library/cpp/packers/region_packer.h b/library/cpp/packers/region_packer.h index 2c661cb5bc..c0470fcf48 100644 --- a/library/cpp/packers/region_packer.h +++ b/library/cpp/packers/region_packer.h @@ -2,7 +2,7 @@ #include "packers.h" -#include <util/generic/array_ref.h> +#include <util/generic/array_ref.h> // Stores an array of PODs in the trie (copying them with memcpy). // Byte order and alignment are your problem. @@ -10,7 +10,7 @@ template <class TRecord> class TRegionPacker { public: - typedef TArrayRef<TRecord> TRecords; + typedef TArrayRef<TRecord> TRecords; void UnpackLeaf(const char* p, TRecords& result) const { size_t len; @@ -20,15 +20,15 @@ public: } void PackLeaf(char* buf, const TRecords& data, size_t computedSize) const { - size_t len = data.size(); + size_t len = data.size(); size_t lenChar = len * sizeof(TRecord); size_t start = computedSize - lenChar; NPackers::TIntegralPacker<size_t>().PackLeaf(buf, len, NPackers::TIntegralPacker<size_t>().MeasureLeaf(len)); - memcpy(buf + start, data.data(), lenChar); + memcpy(buf + start, data.data(), lenChar); } size_t MeasureLeaf(const TRecords& data) const { - size_t len = data.size(); + size_t len = data.size(); return NPackers::TIntegralPacker<size_t>().MeasureLeaf(len) + len * sizeof(TRecord); } diff --git a/library/cpp/packers/ut/proto_packer_ut.cpp b/library/cpp/packers/ut/proto_packer_ut.cpp index e4151ba68c..a60610b52b 100644 --- a/library/cpp/packers/ut/proto_packer_ut.cpp +++ b/library/cpp/packers/ut/proto_packer_ut.cpp @@ -25,7 +25,7 @@ void FillRepeatedFields(TTestMessage& msg) { } } -// do not want to use google/protobuf/util/message_differencer because of warnings +// do not want to use google/protobuf/util/message_differencer because of warnings bool operator==(const TTestMessage& lhs, const TTestMessage& rhs) { if (lhs.GetRequiredString() != rhs.GetRequiredString() || lhs.GetRequiredInt32() != rhs.GetRequiredInt32() || diff --git a/library/cpp/packers/ut/region_packer_ut.cpp b/library/cpp/packers/ut/region_packer_ut.cpp index 0cb08ccf65..37f05f327a 100644 --- a/library/cpp/packers/ut/region_packer_ut.cpp +++ b/library/cpp/packers/ut/region_packer_ut.cpp @@ -8,7 +8,7 @@ void TestPacker() { TRegionPacker<TValue> p; - using TValues = TArrayRef<TValue>; + using TValues = TArrayRef<TValue>; TValues valueRegion = TValues(values, Y_ARRAY_SIZE(values)); size_t sz = p.MeasureLeaf(valueRegion); UNIT_ASSERT_VALUES_EQUAL(sz, 1 + sizeof(values)); @@ -18,9 +18,9 @@ void TestPacker() { UNIT_ASSERT_VALUES_EQUAL(buffer[0], 4); p.UnpackLeaf(buffer.data(), valueRegion); - UNIT_ASSERT_EQUAL(valueRegion.data(), (const TValue*)(buffer.begin() + 1)); - UNIT_ASSERT_EQUAL(valueRegion.size(), Y_ARRAY_SIZE(values)); - UNIT_ASSERT_EQUAL(0, memcmp(values, valueRegion.data(), sizeof(values))); + UNIT_ASSERT_EQUAL(valueRegion.data(), (const TValue*)(buffer.begin() + 1)); + UNIT_ASSERT_EQUAL(valueRegion.size(), Y_ARRAY_SIZE(values)); + UNIT_ASSERT_EQUAL(0, memcmp(values, valueRegion.data(), sizeof(values))); } Y_UNIT_TEST_SUITE(RegionPacker) { diff --git a/library/cpp/protobuf/interop/cast.cpp b/library/cpp/protobuf/interop/cast.cpp index c4cd59b417..4d950d51bf 100644 --- a/library/cpp/protobuf/interop/cast.cpp +++ b/library/cpp/protobuf/interop/cast.cpp @@ -1,8 +1,8 @@ #include <library/cpp/protobuf/interop/cast.h> -#include <google/protobuf/duration.pb.h> -#include <google/protobuf/timestamp.pb.h> -#include <google/protobuf/util/time_util.h> +#include <google/protobuf/duration.pb.h> +#include <google/protobuf/timestamp.pb.h> +#include <google/protobuf/util/time_util.h> namespace NProtoInterop { google::protobuf::Duration CastToProto(TDuration duration) { diff --git a/library/cpp/protobuf/interop/ut/cast_ut.cpp b/library/cpp/protobuf/interop/ut/cast_ut.cpp index 6ef055b651..3319e4935a 100644 --- a/library/cpp/protobuf/interop/ut/cast_ut.cpp +++ b/library/cpp/protobuf/interop/ut/cast_ut.cpp @@ -1,8 +1,8 @@ #include <library/cpp/protobuf/interop/cast.h> #include <library/cpp/testing/unittest/registar.h> -#include <google/protobuf/duration.pb.h> -#include <google/protobuf/timestamp.pb.h> +#include <google/protobuf/duration.pb.h> +#include <google/protobuf/timestamp.pb.h> static constexpr ui64 MicroSecondsInSecond = 1000 * 1000; static constexpr ui64 NanoSecondsInMicroSecond = 1000; diff --git a/library/cpp/protobuf/json/field_option.h b/library/cpp/protobuf/json/field_option.h index c8a8bfbff5..f1c7b34908 100644 --- a/library/cpp/protobuf/json/field_option.h +++ b/library/cpp/protobuf/json/field_option.h @@ -1,8 +1,8 @@ #pragma once -#include <google/protobuf/descriptor.h> -#include <google/protobuf/descriptor.pb.h> -#include <google/protobuf/message.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/message.h> namespace NProtobufJson { // Functor that defines whether given field has some option set to true diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp index 640c10f5a5..f84b245de3 100644 --- a/library/cpp/protobuf/json/json2proto.cpp +++ b/library/cpp/protobuf/json/json2proto.cpp @@ -3,8 +3,8 @@ #include <library/cpp/json/json_value.h> -#include <google/protobuf/message.h> -#include <google/protobuf/descriptor.h> +#include <google/protobuf/message.h> +#include <google/protobuf/descriptor.h> #include <util/generic/hash.h> #include <util/generic/maybe.h> diff --git a/library/cpp/protobuf/json/proto2json.h b/library/cpp/protobuf/json/proto2json.h index 89a1781a40..9fd326655a 100644 --- a/library/cpp/protobuf/json/proto2json.h +++ b/library/cpp/protobuf/json/proto2json.h @@ -3,11 +3,11 @@ #include "config.h" #include "json_output.h" -#include <google/protobuf/descriptor.h> -#include <google/protobuf/descriptor.pb.h> -#include <google/protobuf/message.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/message.h> -#include <util/generic/fwd.h> +#include <util/generic/fwd.h> #include <util/generic/vector.h> #include <util/generic/yexception.h> #include <util/stream/str.h> diff --git a/library/cpp/protobuf/json/proto2json_printer.h b/library/cpp/protobuf/json/proto2json_printer.h index 9dc5aa86c6..aa44081a9e 100644 --- a/library/cpp/protobuf/json/proto2json_printer.h +++ b/library/cpp/protobuf/json/proto2json_printer.h @@ -2,9 +2,9 @@ #include "json_output.h" -#include <google/protobuf/descriptor.h> -#include <google/protobuf/descriptor.pb.h> -#include <google/protobuf/message.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.pb.h> +#include <google/protobuf/message.h> #include <util/generic/strbuf.h> #include <util/generic/string.h> diff --git a/library/cpp/protobuf/json/string_transform.cpp b/library/cpp/protobuf/json/string_transform.cpp index 7c42daa677..eca56c1b3a 100644 --- a/library/cpp/protobuf/json/string_transform.cpp +++ b/library/cpp/protobuf/json/string_transform.cpp @@ -1,6 +1,6 @@ #include "string_transform.h" -#include <google/protobuf/stubs/strutil.h> +#include <google/protobuf/stubs/strutil.h> #include <library/cpp/string_utils/base64/base64.h> diff --git a/library/cpp/protobuf/util/cast.h b/library/cpp/protobuf/util/cast.h index 83749dfcee..b62927331b 100644 --- a/library/cpp/protobuf/util/cast.h +++ b/library/cpp/protobuf/util/cast.h @@ -2,8 +2,8 @@ #include "traits.h" -#include <google/protobuf/descriptor.h> -#include <google/protobuf/message.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/message.h> #include <util/generic/cast.h> diff --git a/library/cpp/protobuf/util/is_equal.cpp b/library/cpp/protobuf/util/is_equal.cpp index 227408006e..2af2b52759 100644 --- a/library/cpp/protobuf/util/is_equal.cpp +++ b/library/cpp/protobuf/util/is_equal.cpp @@ -1,7 +1,7 @@ #include "is_equal.h" #include "traits.h" -#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.h> #include <util/generic/yexception.h> #include <util/string/cast.h> diff --git a/library/cpp/protobuf/util/is_equal_ut.cpp b/library/cpp/protobuf/util/is_equal_ut.cpp index 3ca4c90dd5..9befdd5731 100644 --- a/library/cpp/protobuf/util/is_equal_ut.cpp +++ b/library/cpp/protobuf/util/is_equal_ut.cpp @@ -3,7 +3,7 @@ #include <library/cpp/testing/unittest/registar.h> -#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.h> Y_UNIT_TEST_SUITE(ProtobufIsEqual) { const ::google::protobuf::Descriptor* Descr = TSampleForIsEqual::descriptor(); diff --git a/library/cpp/protobuf/util/iterators.h b/library/cpp/protobuf/util/iterators.h index 6d53ac71b1..e9fefea290 100644 --- a/library/cpp/protobuf/util/iterators.h +++ b/library/cpp/protobuf/util/iterators.h @@ -1,6 +1,6 @@ #pragma once -#include <google/protobuf/descriptor.h> +#include <google/protobuf/descriptor.h> namespace NProtoBuf { class TFieldsIterator { diff --git a/library/cpp/protobuf/util/merge.cpp b/library/cpp/protobuf/util/merge.cpp index dc2b9cc806..67e404c3fc 100644 --- a/library/cpp/protobuf/util/merge.cpp +++ b/library/cpp/protobuf/util/merge.cpp @@ -1,7 +1,7 @@ #include "merge.h" #include "simple_reflection.h" -#include <google/protobuf/message.h> +#include <google/protobuf/message.h> #include <library/cpp/protobuf/util/proto/merge.pb.h> diff --git a/library/cpp/protobuf/util/path.h b/library/cpp/protobuf/util/path.h index 487f643a2d..7c04fafec2 100644 --- a/library/cpp/protobuf/util/path.h +++ b/library/cpp/protobuf/util/path.h @@ -1,7 +1,7 @@ #pragma once -#include <google/protobuf/descriptor.h> -#include <google/protobuf/message.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/message.h> #include <util/generic/vector.h> diff --git a/library/cpp/protobuf/util/pb_io.cpp b/library/cpp/protobuf/util/pb_io.cpp index 6270ee0624..8e451e955b 100644 --- a/library/cpp/protobuf/util/pb_io.cpp +++ b/library/cpp/protobuf/util/pb_io.cpp @@ -3,9 +3,9 @@ #include <library/cpp/binsaver/bin_saver.h> #include <library/cpp/string_utils/base64/base64.h> -#include <google/protobuf/message.h> -#include <google/protobuf/messagext.h> -#include <google/protobuf/text_format.h> +#include <google/protobuf/message.h> +#include <google/protobuf/messagext.h> +#include <google/protobuf/text_format.h> #include <util/generic/string.h> #include <util/stream/file.h> @@ -85,9 +85,9 @@ int operator&(NProtoBuf::Message& m, IBinSaver& f) { TStringStream ss; if (f.IsReading()) { f.Add(0, &ss.Str()); - m.ParseFromArcadiaStream(&ss); + m.ParseFromArcadiaStream(&ss); } else { - m.SerializeToArcadiaStream(&ss); + m.SerializeToArcadiaStream(&ss); f.Add(0, &ss.Str()); } return 0; diff --git a/library/cpp/protobuf/util/repeated_field_utils.h b/library/cpp/protobuf/util/repeated_field_utils.h index c07bd84647..163b18ef94 100644 --- a/library/cpp/protobuf/util/repeated_field_utils.h +++ b/library/cpp/protobuf/util/repeated_field_utils.h @@ -1,6 +1,6 @@ #pragma once -#include <google/protobuf/repeated_field.h> +#include <google/protobuf/repeated_field.h> #include <util/generic/vector.h> template <typename T> diff --git a/library/cpp/protobuf/util/simple_reflection.h b/library/cpp/protobuf/util/simple_reflection.h index 61e877a787..4424424c80 100644 --- a/library/cpp/protobuf/util/simple_reflection.h +++ b/library/cpp/protobuf/util/simple_reflection.h @@ -4,8 +4,8 @@ #include "path.h" #include "traits.h" -#include <google/protobuf/descriptor.h> -#include <google/protobuf/message.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/message.h> #include <util/generic/maybe.h> #include <util/generic/typetraits.h> diff --git a/library/cpp/protobuf/util/sort.h b/library/cpp/protobuf/util/sort.h index 985ba6f689..ee1cf89a52 100644 --- a/library/cpp/protobuf/util/sort.h +++ b/library/cpp/protobuf/util/sort.h @@ -1,6 +1,6 @@ #pragma once -#include <google/protobuf/message.h> +#include <google/protobuf/message.h> #include <util/generic/vector.h> #include <util/generic/algorithm.h> diff --git a/library/cpp/protobuf/util/traits.h b/library/cpp/protobuf/util/traits.h index 50f036d0ea..b14aefb419 100644 --- a/library/cpp/protobuf/util/traits.h +++ b/library/cpp/protobuf/util/traits.h @@ -2,8 +2,8 @@ #include <util/generic/typetraits.h> -#include <google/protobuf/descriptor.h> -#include <google/protobuf/message.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/message.h> namespace NProtoBuf { // this nasty windows.h macro interfers with protobuf::Reflection::GetMessage() diff --git a/library/cpp/protobuf/util/walk.h b/library/cpp/protobuf/util/walk.h index d15d76562d..5c9d133707 100644 --- a/library/cpp/protobuf/util/walk.h +++ b/library/cpp/protobuf/util/walk.h @@ -2,8 +2,8 @@ #include "simple_reflection.h" -#include <google/protobuf/message.h> -#include <google/protobuf/descriptor.h> +#include <google/protobuf/message.h> +#include <google/protobuf/descriptor.h> #include <functional> diff --git a/library/cpp/protobuf/ya.make b/library/cpp/protobuf/ya.make index 618b542b4f..3853aee77d 100644 --- a/library/cpp/protobuf/ya.make +++ b/library/cpp/protobuf/ya.make @@ -14,6 +14,6 @@ RECURSE( util/proto yql yql/ut - yandex_patches_ut + yandex_patches_ut yt ) diff --git a/library/cpp/regex/hyperscan/hyperscan.cpp b/library/cpp/regex/hyperscan/hyperscan.cpp index ba321f9c29..749780d59f 100644 --- a/library/cpp/regex/hyperscan/hyperscan.cpp +++ b/library/cpp/regex/hyperscan/hyperscan.cpp @@ -1,13 +1,13 @@ #include "hyperscan.h" -#include <contrib/libs/hyperscan/runtime_core2/hs_common.h> -#include <contrib/libs/hyperscan/runtime_core2/hs_runtime.h> -#include <contrib/libs/hyperscan/runtime_corei7/hs_common.h> -#include <contrib/libs/hyperscan/runtime_corei7/hs_runtime.h> -#include <contrib/libs/hyperscan/runtime_avx2/hs_common.h> -#include <contrib/libs/hyperscan/runtime_avx2/hs_runtime.h> -#include <contrib/libs/hyperscan/runtime_avx512/hs_common.h> -#include <contrib/libs/hyperscan/runtime_avx512/hs_runtime.h> +#include <contrib/libs/hyperscan/runtime_core2/hs_common.h> +#include <contrib/libs/hyperscan/runtime_core2/hs_runtime.h> +#include <contrib/libs/hyperscan/runtime_corei7/hs_common.h> +#include <contrib/libs/hyperscan/runtime_corei7/hs_runtime.h> +#include <contrib/libs/hyperscan/runtime_avx2/hs_common.h> +#include <contrib/libs/hyperscan/runtime_avx2/hs_runtime.h> +#include <contrib/libs/hyperscan/runtime_avx512/hs_common.h> +#include <contrib/libs/hyperscan/runtime_avx512/hs_runtime.h> #include <util/generic/singleton.h> @@ -49,10 +49,10 @@ namespace NHyperscan { return platformInfo; } - hs_platform_info_t MakeCurrentPlatformInfo() { - return MakePlatformInfo(RuntimeCpuFeatures(DetectCurrentRuntime())); - } - + hs_platform_info_t MakeCurrentPlatformInfo() { + return MakePlatformInfo(RuntimeCpuFeatures(DetectCurrentRuntime())); + } + TImpl::TImpl(ERuntime runtime) { switch (runtime) { default: @@ -179,8 +179,8 @@ namespace NHyperscan { } // namespace NPrivate TDatabase Compile(const TStringBuf& regex, unsigned int flags) { - auto platformInfo = NPrivate::MakeCurrentPlatformInfo(); - return NPrivate::Compile(regex, flags, &platformInfo); + auto platformInfo = NPrivate::MakeCurrentPlatformInfo(); + return NPrivate::Compile(regex, flags, &platformInfo); } TDatabase Compile(const TStringBuf& regex, unsigned int flags, TCPUFeatures cpuFeatures) { @@ -194,8 +194,8 @@ namespace NHyperscan { const TVector<unsigned int>& ids, const TVector<const hs_expr_ext_t*>* extendedParameters) { - auto platformInfo = NPrivate::MakeCurrentPlatformInfo(); - return NPrivate::CompileMulti(regexs, flags, ids, &platformInfo, extendedParameters); + auto platformInfo = NPrivate::MakeCurrentPlatformInfo(); + return NPrivate::CompileMulti(regexs, flags, ids, &platformInfo, extendedParameters); } TDatabase CompileMulti( diff --git a/library/cpp/regex/hyperscan/ut/ya.make b/library/cpp/regex/hyperscan/ut/ya.make index da67b88672..8775c68bf2 100644 --- a/library/cpp/regex/hyperscan/ut/ya.make +++ b/library/cpp/regex/hyperscan/ut/ya.make @@ -1,9 +1,9 @@ -UNITTEST() - -PEERDIR( - library/cpp/regex/hyperscan -) +UNITTEST() +PEERDIR( + library/cpp/regex/hyperscan +) + OWNER(g:antiinfra) SRCS( diff --git a/library/cpp/regex/hyperscan/ya.make b/library/cpp/regex/hyperscan/ya.make index e99130ae18..3d8ef787f9 100644 --- a/library/cpp/regex/hyperscan/ya.make +++ b/library/cpp/regex/hyperscan/ya.make @@ -4,10 +4,10 @@ OWNER(g:antiinfra) PEERDIR( contrib/libs/hyperscan - contrib/libs/hyperscan/runtime_core2 - contrib/libs/hyperscan/runtime_corei7 - contrib/libs/hyperscan/runtime_avx2 - contrib/libs/hyperscan/runtime_avx512 + contrib/libs/hyperscan/runtime_core2 + contrib/libs/hyperscan/runtime_corei7 + contrib/libs/hyperscan/runtime_avx2 + contrib/libs/hyperscan/runtime_avx512 ) SRCS( diff --git a/library/cpp/regex/pire/ut/ya.make b/library/cpp/regex/pire/ut/ya.make index 8776695f40..0d03b414e1 100644 --- a/library/cpp/regex/pire/ut/ya.make +++ b/library/cpp/regex/pire/ut/ya.make @@ -39,6 +39,6 @@ SIZE(MEDIUM) TIMEOUT(600) -PIRE_INLINE(inline_ut.cpp) +PIRE_INLINE(inline_ut.cpp) END() diff --git a/library/cpp/scheme/domscheme_traits.h b/library/cpp/scheme/domscheme_traits.h index a11c4dd444..1727f89bef 100644 --- a/library/cpp/scheme/domscheme_traits.h +++ b/library/cpp/scheme/domscheme_traits.h @@ -216,7 +216,7 @@ struct TSchemeTraits { static inline TVector<TString> GetKeys(TConstValueRef v) { TVector<TString> res; for (const auto& key : v->DictKeys(true)) { - res.push_back(ToString(key)); + res.push_back(ToString(key)); } return res; } diff --git a/library/cpp/scheme/scimpl_json_read.cpp b/library/cpp/scheme/scimpl_json_read.cpp index 8a29cc7739..5f8819a2ab 100644 --- a/library/cpp/scheme/scimpl_json_read.cpp +++ b/library/cpp/scheme/scimpl_json_read.cpp @@ -176,7 +176,7 @@ namespace NSc { void OnError(size_t off, TStringBuf reason) override { Error.Offset = off; - Error.Reason = reason; + Error.Reason = reason; } }; diff --git a/library/cpp/scheme/scimpl_protobuf.cpp b/library/cpp/scheme/scimpl_protobuf.cpp index 0c99122c69..86373d16a5 100644 --- a/library/cpp/scheme/scimpl_protobuf.cpp +++ b/library/cpp/scheme/scimpl_protobuf.cpp @@ -3,9 +3,9 @@ #include <util/generic/vector.h> #include <util/generic/yexception.h> -#include <google/protobuf/descriptor.h> -#include <google/protobuf/message.h> -#include <google/protobuf/reflection.h> +#include <google/protobuf/descriptor.h> +#include <google/protobuf/message.h> +#include <google/protobuf/reflection.h> using namespace google::protobuf; diff --git a/library/cpp/scheme/scimpl_select.rl6 b/library/cpp/scheme/scimpl_select.rl6 index 11aa549b78..05e703dd48 100644 --- a/library/cpp/scheme/scimpl_select.rl6 +++ b/library/cpp/scheme/scimpl_select.rl6 @@ -263,7 +263,7 @@ namespace NSc { if (ctx.Selector.HasError || ctx.Selector.Depth > 1 || ctx.Selector.HasArray) { return NEscJ::EscapeJ<true>(rawKey); } else { - return ToString(rawKey); + return ToString(rawKey); } } diff --git a/library/cpp/streams/lzma/lzma.cpp b/library/cpp/streams/lzma/lzma.cpp index f1942fa546..dddbf77115 100644 --- a/library/cpp/streams/lzma/lzma.cpp +++ b/library/cpp/streams/lzma/lzma.cpp @@ -150,7 +150,7 @@ namespace { } inline TContClosure FilterClosure() { - return {&TrampoLine_, TArrayRef(Stack_, sizeof(Stack_))}; + return {&TrampoLine_, TArrayRef(Stack_, sizeof(Stack_))}; } inline size_t ReadImpl(void* ptr, size_t len) { diff --git a/library/cpp/streams/zstd/zstd.cpp b/library/cpp/streams/zstd/zstd.cpp index 29816f6d4c..0e2cf159db 100644 --- a/library/cpp/streams/zstd/zstd.cpp +++ b/library/cpp/streams/zstd/zstd.cpp @@ -4,7 +4,7 @@ #include <util/generic/yexception.h> #define ZSTD_STATIC_LINKING_ONLY -#include <contrib/libs/zstd/include/zstd.h> +#include <contrib/libs/zstd/include/zstd.h> namespace { inline void CheckError(const char* op, size_t code) { diff --git a/library/cpp/string_utils/base64/base64_ut.cpp b/library/cpp/string_utils/base64/base64_ut.cpp index bcc1e65879..81d76c193e 100644 --- a/library/cpp/string_utils/base64/base64_ut.cpp +++ b/library/cpp/string_utils/base64/base64_ut.cpp @@ -370,7 +370,7 @@ Y_UNIT_TEST_SUITE(TBase64) { } Y_UNIT_TEST(TestEmptyString) { - const TString x = ""; + const TString x = ""; const TString xEnc = ""; const TString y = Base64Decode(xEnc); const TString yEnc = Base64Encode(x); diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp index 85f4ac5d69..d498d24f5b 100644 --- a/library/cpp/string_utils/url/url.cpp +++ b/library/cpp/string_utils/url/url.cpp @@ -190,8 +190,8 @@ void SplitUrlToHostAndPath(const TStringBuf url, TStringBuf& host, TStringBuf& p void SplitUrlToHostAndPath(const TStringBuf url, TString& host, TString& path) { auto [hostBuf, pathBuf] = NUrl::SplitUrlToHostAndPath(url); - host = hostBuf; - path = pathBuf; + host = hostBuf; + path = pathBuf; } void SeparateUrlFromQueryAndFragment(const TStringBuf url, TStringBuf& sanitizedUrl, TStringBuf& query, TStringBuf& fragment) { diff --git a/library/cpp/testing/README.md b/library/cpp/testing/README.md index e8e0391be4..ffa2e20c62 100644 --- a/library/cpp/testing/README.md +++ b/library/cpp/testing/README.md @@ -1,16 +1,16 @@ -В этой директории лежат библиотеки для удобного написания тестов на C++, а именно: - -* `benchmark` — библиотека для реализации простых бенчмарков. -* `boost_test` — реализация тестирования средствами библиотеки _boost_. **Не используйте этот фреймворк в новом коде.** -* `boost_test_main` — реализация (средствами библиотеки _boost_) функции `int main(argc, argv)` для модуля `BOOSTTEST`. **Не используйте этот фреймворк в новом коде.** -* `common` — независимые вспомогательные функции. Например функции для получения аркадийных путей. -* `gmock` — прокси-библиотека для подключения `contrib/resticted/googltest/googlemock` без нарушения PEERDIR policy. -* `gtest` — реализация модуля `GTEST` — средства для интеграции фреймворка _googletest_ в Аркадию. +В этой директории лежат библиотеки для удобного написания тестов на C++, а именно: + +* `benchmark` — библиотека для реализации простых бенчмарков. +* `boost_test` — реализация тестирования средствами библиотеки _boost_. **Не используйте этот фреймворк в новом коде.** +* `boost_test_main` — реализация (средствами библиотеки _boost_) функции `int main(argc, argv)` для модуля `BOOSTTEST`. **Не используйте этот фреймворк в новом коде.** +* `common` — независимые вспомогательные функции. Например функции для получения аркадийных путей. +* `gmock` — прокси-библиотека для подключения `contrib/resticted/googltest/googlemock` без нарушения PEERDIR policy. +* `gtest` — реализация модуля `GTEST` — средства для интеграции фреймворка _googletest_ в Аркадию. * `gtest_boost_extensions` — расширения gtest и gmock, улучшающие поддержку типов из boost. -* `gtest_extensions` — расширения gtest и gmock, улучшающие поддержку Аркадийных типов. Все расширения включены в модуле `GTEST` по-умолчаниiю. -* `gtest_main` — реализация `int main(argc, argv)` для модуля `GTEST` (вынесена в отдельную библиотеку, чтобы в перспективе была возможна реализация `GTEST_WITH_CUSTOM_ENTRY_POINT`). +* `gtest_extensions` — расширения gtest и gmock, улучшающие поддержку Аркадийных типов. Все расширения включены в модуле `GTEST` по-умолчаниiю. +* `gtest_main` — реализация `int main(argc, argv)` для модуля `GTEST` (вынесена в отдельную библиотеку, чтобы в перспективе была возможна реализация `GTEST_WITH_CUSTOM_ENTRY_POINT`). * `gtest_protobuf` — утилиты для работы с протобуфом в тестах. * `hook` — хуки для выполнения пользовательских функций в тестах и бенчмарках. -* `mock_server` — реализация http-сервера для тестов. +* `mock_server` — реализация http-сервера для тестов. * `unittest` — реализация модуля UNITTEST — основного средства для тестирования тестов на С++ в Аркадии. * `unittest_main` — реализация `int main(argc, argv)` для модуля UNITTEST (она вынесена в отдельную библиотеку, чтобы оставить возможность для реализации `UNITTEST_WITH_CUSTOM_ENTRY_POINT` и `YT_UNITTEST`. diff --git a/library/cpp/testing/common/env.h b/library/cpp/testing/common/env.h index 7b89aa1bed..8a1d8abd24 100644 --- a/library/cpp/testing/common/env.h +++ b/library/cpp/testing/common/env.h @@ -38,7 +38,7 @@ const TString& GetRamDrivePath(); // @brief return path from env:YA_TEST_OUTPUT_RAM_DRIVE_PATH const TString& GetOutputRamDrivePath(); - + // @brief return test parameter by name. If not exists, return an empty string const TString& GetTestParam(TStringBuf name); diff --git a/library/cpp/testing/common/probe.h b/library/cpp/testing/common/probe.h index 19910979b5..522094f275 100644 --- a/library/cpp/testing/common/probe.h +++ b/library/cpp/testing/common/probe.h @@ -2,7 +2,7 @@ #include <util/system/yassert.h> -namespace NTesting { +namespace NTesting { //////////////////////////////////////////////////////////////////////////////// // Below there is a serie of probe classes for testing construction/destruction copying/moving of class. @@ -137,4 +137,4 @@ namespace NTesting { : State(nullptr) {} }; -} // namespace NTesting +} // namespace NTesting diff --git a/library/cpp/testing/common/ut/ya.make b/library/cpp/testing/common/ut/ya.make index 053aa38079..efea2793ef 100644 --- a/library/cpp/testing/common/ut/ya.make +++ b/library/cpp/testing/common/ut/ya.make @@ -1,4 +1,4 @@ -GTEST() +GTEST() OWNER( amatanhead bulatman diff --git a/library/cpp/testing/common/ya.make b/library/cpp/testing/common/ya.make index 2f4b0ce26e..d9558ad64e 100644 --- a/library/cpp/testing/common/ya.make +++ b/library/cpp/testing/common/ya.make @@ -10,7 +10,7 @@ OWNER( SRCS( env.cpp network.cpp - probe.cpp + probe.cpp scope.cpp ) diff --git a/library/cpp/testing/gtest_extensions/README.md b/library/cpp/testing/gtest_extensions/README.md index 5445c7a464..75c9c3591e 100644 --- a/library/cpp/testing/gtest_extensions/README.md +++ b/library/cpp/testing/gtest_extensions/README.md @@ -2,4 +2,4 @@ Extensions that enable better support of util types in gtest and gmock: pretty printers, matchers, some convenience macros. -If you're using `GTEST`, include `library/cpp/testing/gtest/gtest.h` and it will automatically enable these extensions. This is the preferred way to include gtest and gmock as opposed to including gtest, gmock and extensions directly. It eliminates chances of forgetting to include extensions. +If you're using `GTEST`, include `library/cpp/testing/gtest/gtest.h` and it will automatically enable these extensions. This is the preferred way to include gtest and gmock as opposed to including gtest, gmock and extensions directly. It eliminates chances of forgetting to include extensions. diff --git a/library/cpp/testing/gtest_extensions/pretty_printers.h b/library/cpp/testing/gtest_extensions/pretty_printers.h index 14d8284446..69533fe5d8 100644 --- a/library/cpp/testing/gtest_extensions/pretty_printers.h +++ b/library/cpp/testing/gtest_extensions/pretty_printers.h @@ -39,8 +39,8 @@ * } * ``` */ -#define Y_GTEST_ARCADIA_PRINTER(T) \ - void PrintTo(const T& value, std::ostream* stream) { \ +#define Y_GTEST_ARCADIA_PRINTER(T) \ + void PrintTo(const T& value, std::ostream* stream) { \ ::TString ss; \ ::TStringOutput s{ss}; \ s << value; \ @@ -48,18 +48,18 @@ } -template <typename TCharType, typename TCharTraits> -void PrintTo(const TBasicString<TCharType, TCharTraits>& value, std::ostream* stream) { +template <typename TCharType, typename TCharTraits> +void PrintTo(const TBasicString<TCharType, TCharTraits>& value, std::ostream* stream) { *stream << value.Quote().c_str(); } -template <typename TCharType, typename TCharTraits> -void PrintTo(TBasicStringBuf<TCharType, TCharTraits> value, std::ostream* stream) { - *stream << TBasicString<TCharType, TCharTraits>{value}.Quote().c_str(); +template <typename TCharType, typename TCharTraits> +void PrintTo(TBasicStringBuf<TCharType, TCharTraits> value, std::ostream* stream) { + *stream << TBasicString<TCharType, TCharTraits>{value}.Quote().c_str(); } template <typename T, typename P> -void PrintTo(const TMaybe<T, P>& value, std::ostream* stream) { +void PrintTo(const TMaybe<T, P>& value, std::ostream* stream) { if (value.Defined()) { ::testing::internal::UniversalPrint(value.GetRef(), stream); } else { @@ -67,7 +67,7 @@ void PrintTo(const TMaybe<T, P>& value, std::ostream* stream) { } } -inline void PrintTo(TNothing /* value */, std::ostream* stream) { +inline void PrintTo(TNothing /* value */, std::ostream* stream) { *stream << "nothing"; } diff --git a/library/cpp/testing/gtest_extensions/probe.cpp b/library/cpp/testing/gtest_extensions/probe.cpp index c3a49b9323..2321e0c8ba 100644 --- a/library/cpp/testing/gtest_extensions/probe.cpp +++ b/library/cpp/testing/gtest_extensions/probe.cpp @@ -2,7 +2,7 @@ #include <ostream> -namespace testing { +namespace testing { void PrintTo(const TProbeState& state, ::std::ostream* os) { int copies = state.CopyConstructors + state.CopyAssignments; int moves = state.MoveConstructors + state.MoveAssignments; @@ -10,4 +10,4 @@ namespace testing { << "copies: " << copies << " = " << state.CopyConstructors << " + " << state.CopyAssignments << "; " << "moves: " << moves << " = " << state.MoveConstructors << " + " << state.MoveAssignments; } -} // namespace testing +} // namespace testing diff --git a/library/cpp/testing/gtest_extensions/probe.h b/library/cpp/testing/gtest_extensions/probe.h index 7d1fee83d3..019759d09e 100644 --- a/library/cpp/testing/gtest_extensions/probe.h +++ b/library/cpp/testing/gtest_extensions/probe.h @@ -2,15 +2,15 @@ #include <util/system/yassert.h> -#include <library/cpp/testing/common/probe.h> - +#include <library/cpp/testing/common/probe.h> + #include <gtest/gtest.h> #include <gmock/gmock.h> -namespace testing { - using NTesting::TProbe; - using NTesting::TProbeState; - using NTesting::TCoercibleToProbe; +namespace testing { + using NTesting::TProbe; + using NTesting::TProbeState; + using NTesting::TCoercibleToProbe; // A helper functor which extracts from probe-like objectss their state. struct TProbableTraits { @@ -43,13 +43,13 @@ namespace testing { MATCHER(IsAlive, "is alive") { Y_UNUSED(result_listener); - const auto& state = TProbableTraits::ExtractState(arg); + const auto& state = TProbableTraits::ExtractState(arg); return state.Destructors < state.Constructors + state.CopyConstructors + state.CopyAssignments; } MATCHER(IsDead, "is dead") { Y_UNUSED(result_listener); - const auto& state = TProbableTraits::ExtractState(arg); + const auto& state = TProbableTraits::ExtractState(arg); return state.Destructors == state.Constructors + state.CopyConstructors + state.CopyAssignments; } @@ -57,25 +57,25 @@ namespace testing { PrintToString(copyCount) + " copy constructors and " + \ PrintToString(moveCount) + " move constructors were called") { Y_UNUSED(result_listener); - const auto& state = TProbableTraits::ExtractState(arg); + const auto& state = TProbableTraits::ExtractState(arg); return state.CopyConstructors == copyCount && state.MoveConstructors == moveCount; } MATCHER(NoCopies, "no copies were made") { Y_UNUSED(result_listener); - const auto& state = TProbableTraits::ExtractState(arg); + const auto& state = TProbableTraits::ExtractState(arg); return 0 == state.CopyConstructors && 0 == state.CopyAssignments; } MATCHER(NoMoves, "no moves were made") { Y_UNUSED(result_listener); - const auto& state = TProbableTraits::ExtractState(arg); + const auto& state = TProbableTraits::ExtractState(arg); return 0 == state.MoveConstructors && 0 == state.MoveAssignments; } MATCHER(NoAssignments, "no assignments were made") { Y_UNUSED(result_listener); - const auto& state = TProbableTraits::ExtractState(arg); + const auto& state = TProbableTraits::ExtractState(arg); return 0 == state.CopyAssignments && 0 == state.MoveAssignments; } } diff --git a/library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp b/library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp index 81cdfd0427..7dd8c9d57e 100644 --- a/library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp +++ b/library/cpp/testing/gtest_extensions/ut/gtest_extensions_ut.cpp @@ -251,7 +251,7 @@ struct T1 { int x; }; -void PrintTo(T1 value, std::ostream* stream) { +void PrintTo(T1 value, std::ostream* stream) { *stream << "T1{" << value.x << "}"; } diff --git a/library/cpp/testing/gtest_extensions/ut/ya.make b/library/cpp/testing/gtest_extensions/ut/ya.make index 39b41cecfd..b5d696a4bd 100644 --- a/library/cpp/testing/gtest_extensions/ut/ya.make +++ b/library/cpp/testing/gtest_extensions/ut/ya.make @@ -1,4 +1,4 @@ -GTEST() +GTEST() OWNER( amatanhead bulatman diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp index 3679b768ed..c678772cc5 100644 --- a/library/cpp/testing/unittest/registar.cpp +++ b/library/cpp/testing/unittest/registar.cpp @@ -81,20 +81,20 @@ struct TDiffColorizer { { } - TString Special(TStringBuf str) const { - return ToString(Colors.YellowColor()) + str; + TString Special(TStringBuf str) const { + return ToString(Colors.YellowColor()) + str; } - TString Common(TArrayRef<const char> str) const { - return ToString(Colors.OldColor()) + TString(str.begin(), str.end()); + TString Common(TArrayRef<const char> str) const { + return ToString(Colors.OldColor()) + TString(str.begin(), str.end()); } - TString Left(TArrayRef<const char> str) const { - return ToString(GetLeftColor()) + TString(str.begin(), str.end()); + TString Left(TArrayRef<const char> str) const { + return ToString(GetLeftColor()) + TString(str.begin(), str.end()); } - TString Right(TArrayRef<const char> str) const { - return ToString(GetRightColor()) + TString(str.begin(), str.end()); + TString Right(TArrayRef<const char> str) const { + return ToString(GetRightColor()) + TString(str.begin(), str.end()); } TStringBuf GetLeftColor() const { @@ -114,21 +114,21 @@ struct TTraceDiffFormatter { { } - TString Special(TStringBuf str) const { - return ToString(str); + TString Special(TStringBuf str) const { + return ToString(str); } - TString Common(TArrayRef<const char> str) const { + TString Common(TArrayRef<const char> str) const { return TString(str.begin(), str.end()); } - TString Left(TArrayRef<const char> str) const { + TString Left(TArrayRef<const char> str) const { return NUnitTest::GetFormatTag("good") + TString(str.begin(), str.end()) + NUnitTest::GetResetTag(); } - TString Right(TArrayRef<const char> str) const { + TString Right(TArrayRef<const char> str) const { return NUnitTest::GetFormatTag("bad") + TString(str.begin(), str.end()) + NUnitTest::GetResetTag(); diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index 44517a0092..f437f201d5 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -270,7 +270,7 @@ private: \ \ public: \ static TString StaticName() noexcept { \ - return TypeName<N>(); \ + return TypeName<N>(); \ } \ \ private: \ @@ -403,13 +403,13 @@ public: \ const auto _ed = (E); \ const auto _ad = (A); \ const auto _dd = (D); \ - if (std::isnan((long double)_ed) && !std::isnan((long double)_ad)) { \ - const auto _as = ToString((long double)_ad); \ + if (std::isnan((long double)_ed) && !std::isnan((long double)_ad)) { \ + const auto _as = ToString((long double)_ad); \ auto&& failMsg = Sprintf("expected NaN, got %s %s", _as.data(), (::TStringBuilder() << C).data()); \ UNIT_FAIL_IMPL("assertion failure", failMsg); \ } \ - if (!std::isnan((long double)_ed) && std::isnan((long double)_ad)) { \ - const auto _es = ToString((long double)_ed); \ + if (!std::isnan((long double)_ed) && std::isnan((long double)_ad)) { \ + const auto _es = ToString((long double)_ed); \ auto&& failMsg = Sprintf("expected %s, got NaN %s", _es.data(), (::TStringBuilder() << C).data()); \ UNIT_FAIL_IMPL("assertion failure", failMsg); \ } \ diff --git a/library/cpp/testing/unittest/tests_data.cpp b/library/cpp/testing/unittest/tests_data.cpp index b51cbc4b87..632c098af9 100644 --- a/library/cpp/testing/unittest/tests_data.cpp +++ b/library/cpp/testing/unittest/tests_data.cpp @@ -98,7 +98,7 @@ ui16 TPortManager::GetPortsRange(const ui16 startPort, const ui16 range) { return Impl_->GetPortsRange(startPort, range); } -ui16 GetRandomPort() { +ui16 GetRandomPort() { TPortManager* pm = Singleton<TPortManager>(false); - return pm->GetPort(); -} + return pm->GetPort(); +} diff --git a/library/cpp/testing/unittest/tests_data.h b/library/cpp/testing/unittest/tests_data.h index 6536bc1ae6..4b06b24a1a 100644 --- a/library/cpp/testing/unittest/tests_data.h +++ b/library/cpp/testing/unittest/tests_data.h @@ -50,5 +50,5 @@ private: class TPortManagerImpl; THolder<TPortManagerImpl> Impl_; }; - -ui16 GetRandomPort(); + +ui16 GetRandomPort(); diff --git a/library/cpp/testing/unittest/utmain.cpp b/library/cpp/testing/unittest/utmain.cpp index 305bc6b40f..3a46c7d82c 100644 --- a/library/cpp/testing/unittest/utmain.cpp +++ b/library/cpp/testing/unittest/utmain.cpp @@ -637,7 +637,7 @@ static void GracefulShutdownHandler(int) { } #endif -int NUnitTest::RunMain(int argc, char** argv) { +int NUnitTest::RunMain(int argc, char** argv) { #if defined(_linux_) && defined(CLANG_COVERAGE) { struct sigaction sa; diff --git a/library/cpp/testing/unittest/ya.make b/library/cpp/testing/unittest/ya.make index aaa4f2ba85..c82d31838d 100644 --- a/library/cpp/testing/unittest/ya.make +++ b/library/cpp/testing/unittest/ya.make @@ -1,7 +1,7 @@ LIBRARY() -PROVIDES(test_framework) - +PROVIDES(test_framework) + OWNER( pg galaxycrab diff --git a/library/cpp/testing/ya.make b/library/cpp/testing/ya.make index 6a57ac2ee6..16f63d55d5 100644 --- a/library/cpp/testing/ya.make +++ b/library/cpp/testing/ya.make @@ -4,11 +4,11 @@ RECURSE( benchmark/examples benchmark/examples/metrics benchmark/main - boost_test - boost_test_main + boost_test + boost_test_main dump_clang_coverage gbenchmark_main - gmock + gmock gmock_in_unittest gmock_in_unittest/example_ut gtest diff --git a/library/cpp/threading/future/wait/wait_group-inl.h b/library/cpp/threading/future/wait/wait_group-inl.h index a7da536f20..26ac87a651 100644 --- a/library/cpp/threading/future/wait/wait_group-inl.h +++ b/library/cpp/threading/future/wait/wait_group-inl.h @@ -12,8 +12,8 @@ #include <library/cpp/threading/future/core/future.h> #include <util/system/spinlock.h> - -#include <atomic> + +#include <atomic> #include <exception> namespace NThreading { diff --git a/library/cpp/tvmauth/client/misc/async_updater.h b/library/cpp/tvmauth/client/misc/async_updater.h index 7b556d7a38..e360e7c400 100644 --- a/library/cpp/tvmauth/client/misc/async_updater.h +++ b/library/cpp/tvmauth/client/misc/async_updater.h @@ -18,7 +18,7 @@ #include <util/generic/ptr.h> #include <array> -#include <atomic> +#include <atomic> namespace NTvmAuth::NInternal { class TClientCaningKnife; diff --git a/library/cpp/tvmauth/client/misc/exponential_backoff.h b/library/cpp/tvmauth/client/misc/exponential_backoff.h index 89a7a3c8ad..95bc29de11 100644 --- a/library/cpp/tvmauth/client/misc/exponential_backoff.h +++ b/library/cpp/tvmauth/client/misc/exponential_backoff.h @@ -4,8 +4,8 @@ #include <util/random/normal.h> #include <util/system/event.h> -#include <atomic> - +#include <atomic> + namespace NTvmAuth { // https://habr.com/ru/post/227225/ class TExponentialBackoff { diff --git a/library/cpp/tvmauth/ya.make b/library/cpp/tvmauth/ya.make index 655336c902..3f748888d3 100644 --- a/library/cpp/tvmauth/ya.make +++ b/library/cpp/tvmauth/ya.make @@ -33,7 +33,7 @@ RESOURCE( END() RECURSE( - client + client src/rw src/ut test_all diff --git a/library/cpp/uri/ya.make b/library/cpp/uri/ya.make index 8fc808a6af..e02429ca49 100644 --- a/library/cpp/uri/ya.make +++ b/library/cpp/uri/ya.make @@ -25,8 +25,8 @@ PEERDIR( ) END() - -RECURSE( - benchmark - ut -) + +RECURSE( + benchmark + ut +) diff --git a/library/cpp/xml/document/xml-document-decl.h b/library/cpp/xml/document/xml-document-decl.h index bfda1fb7e6..28276cfb72 100644 --- a/library/cpp/xml/document/xml-document-decl.h +++ b/library/cpp/xml/document/xml-document-decl.h @@ -127,10 +127,10 @@ namespace NXml { const TConstNodes& Nodes; size_t Index; TConstNode operator*() const; - bool operator==(const TNodeIter& other) const { + bool operator==(const TNodeIter& other) const { return Index == other.Index; } - bool operator!=(const TNodeIter& other) const { + bool operator!=(const TNodeIter& other) const { return !(*this == other); } TNodeIter operator++() { diff --git a/library/cpp/yson/node/node.cpp b/library/cpp/yson/node/node.cpp index b39e070718..06a09dc180 100644 --- a/library/cpp/yson/node/node.cpp +++ b/library/cpp/yson/node/node.cpp @@ -244,11 +244,11 @@ bool TNode::IsUndefined() const return std::holds_alternative<TUndefined>(Value_); } -bool TNode::HasValue() const -{ - return !IsNull() && !IsUndefined(); -} - +bool TNode::HasValue() const +{ + return !IsNull() && !IsUndefined(); +} + bool TNode::Empty() const { switch (GetType()) { diff --git a/library/cpp/yson/node/node.h b/library/cpp/yson/node/node.h index 5f90f95df0..af12166cc2 100644 --- a/library/cpp/yson/node/node.h +++ b/library/cpp/yson/node/node.h @@ -125,8 +125,8 @@ public: bool IsEntity() const; bool IsNull() const; bool IsUndefined() const; - // Returns true if TNode is neither Null, nor Undefined - bool HasValue() const; + // Returns true if TNode is neither Null, nor Undefined + bool HasValue() const; template<typename T> bool IsOfType() const noexcept; diff --git a/library/cpp/yson/node/node_ut.cpp b/library/cpp/yson/node/node_ut.cpp index 448e99f575..1e72d96d8e 100644 --- a/library/cpp/yson/node/node_ut.cpp +++ b/library/cpp/yson/node/node_ut.cpp @@ -50,28 +50,28 @@ Y_UNIT_TEST_SUITE(YtNodeTest) { UNIT_ASSERT(nodeEntity.IsEntity()); } - Y_UNIT_TEST(TestPredicates) { - const TNode undefinedNode; - UNIT_ASSERT(undefinedNode.IsUndefined()); - UNIT_ASSERT(!undefinedNode.IsNull()); - UNIT_ASSERT(!undefinedNode.HasValue()); - - const TNode nullNode = TNode::CreateEntity(); - UNIT_ASSERT(!nullNode.IsUndefined()); - UNIT_ASSERT(nullNode.IsNull()); - UNIT_ASSERT(!nullNode.HasValue()); - - const TNode intNode(int(64)); - UNIT_ASSERT(!intNode.IsUndefined()); - UNIT_ASSERT(!intNode.IsNull()); - UNIT_ASSERT(intNode.HasValue()); - - const TNode stringNode("blah"); - UNIT_ASSERT(!stringNode.IsUndefined()); - UNIT_ASSERT(!stringNode.IsNull()); - UNIT_ASSERT(stringNode.HasValue()); - } - + Y_UNIT_TEST(TestPredicates) { + const TNode undefinedNode; + UNIT_ASSERT(undefinedNode.IsUndefined()); + UNIT_ASSERT(!undefinedNode.IsNull()); + UNIT_ASSERT(!undefinedNode.HasValue()); + + const TNode nullNode = TNode::CreateEntity(); + UNIT_ASSERT(!nullNode.IsUndefined()); + UNIT_ASSERT(nullNode.IsNull()); + UNIT_ASSERT(!nullNode.HasValue()); + + const TNode intNode(int(64)); + UNIT_ASSERT(!intNode.IsUndefined()); + UNIT_ASSERT(!intNode.IsNull()); + UNIT_ASSERT(intNode.HasValue()); + + const TNode stringNode("blah"); + UNIT_ASSERT(!stringNode.IsUndefined()); + UNIT_ASSERT(!stringNode.IsNull()); + UNIT_ASSERT(stringNode.HasValue()); + } + Y_UNIT_TEST(TestComplexConstructors) { const TNode listNode = TNode::CreateList({"one", 2, "tree"}); const auto expectedListValue = std::vector<TNode>({"one", 2, "tree"}); diff --git a/library/cpp/yson/token.cpp b/library/cpp/yson/token.cpp index c8584c8c2e..d74a1f2f1d 100644 --- a/library/cpp/yson/token.cpp +++ b/library/cpp/yson/token.cpp @@ -77,7 +77,7 @@ namespace NYson { } TString TokenTypeToString(ETokenType type) { - return TString(1, TokenTypeToChar(type)); + return TString(1, TokenTypeToChar(type)); } //////////////////////////////////////////////////////////////////////////////// diff --git a/library/cpp/yt/memory/ref_counted.h b/library/cpp/yt/memory/ref_counted.h index b683615b83..a17e1091b7 100644 --- a/library/cpp/yt/memory/ref_counted.h +++ b/library/cpp/yt/memory/ref_counted.h @@ -147,11 +147,11 @@ using TRefCountedPtr = TIntrusivePtr<TRefCounted>; */ #define DECLARE_REFCOUNTED_TYPE(type) \ - using type ## Ptr = ::NYT::TIntrusivePtr<type>; \ + using type ## Ptr = ::NYT::TIntrusivePtr<type>; \ \ - [[maybe_unused]] ATTRIBUTE_USED const ::NYT::TRefCounter* GetRefCounter(const type* obj); \ - [[maybe_unused]] ATTRIBUTE_USED void DestroyRefCounted(const type* obj); \ - [[maybe_unused]] ATTRIBUTE_USED void DeallocateRefCounted(const type* obj); + [[maybe_unused]] ATTRIBUTE_USED const ::NYT::TRefCounter* GetRefCounter(const type* obj); \ + [[maybe_unused]] ATTRIBUTE_USED void DestroyRefCounted(const type* obj); \ + [[maybe_unused]] ATTRIBUTE_USED void DeallocateRefCounted(const type* obj); //! Forward-declares a class type, defines an intrusive pointer for it, and finally //! declares Ref/Unref overloads. Use this macro in |public.h|-like files. @@ -168,15 +168,15 @@ using TRefCountedPtr = TIntrusivePtr<TRefCounted>; //! Provides implementations for Ref/Unref overloads. Use this macro right //! after the type's full definition. #define DEFINE_REFCOUNTED_TYPE(type) \ - [[maybe_unused]] ATTRIBUTE_USED Y_FORCE_INLINE const ::NYT::TRefCounter* GetRefCounter(const type* obj) \ + [[maybe_unused]] ATTRIBUTE_USED Y_FORCE_INLINE const ::NYT::TRefCounter* GetRefCounter(const type* obj) \ { \ return ::NYT::TRefCountedHelper<type>::GetRefCounter(obj); \ } \ - [[maybe_unused]] ATTRIBUTE_USED Y_FORCE_INLINE void DestroyRefCounted(const type* obj) \ + [[maybe_unused]] ATTRIBUTE_USED Y_FORCE_INLINE void DestroyRefCounted(const type* obj) \ { \ ::NYT::TRefCountedHelper<type>::Destroy(obj); \ } \ - [[maybe_unused]] ATTRIBUTE_USED Y_FORCE_INLINE void DeallocateRefCounted(const type* obj) \ + [[maybe_unused]] ATTRIBUTE_USED Y_FORCE_INLINE void DeallocateRefCounted(const type* obj) \ { \ ::NYT::TRefCountedHelper<type>::Deallocate(obj); \ } diff --git a/library/cpp/yt/memory/unittests/weak_ptr_ut.cpp b/library/cpp/yt/memory/unittests/weak_ptr_ut.cpp index 180c16b5ca..c80f4e5f59 100644 --- a/library/cpp/yt/memory/unittests/weak_ptr_ut.cpp +++ b/library/cpp/yt/memory/unittests/weak_ptr_ut.cpp @@ -71,7 +71,7 @@ class TDerivedIntricateObject { private: // Payload. - [[maybe_unused]] std::array<char, 32> Payload; + [[maybe_unused]] std::array<char, 32> Payload; }; typedef TIntrusivePtr<TDerivedIntricateObject> TDerivedIntricateObjectPtr; diff --git a/library/python/runtime_py3/main/main.c b/library/python/runtime_py3/main/main.c index 3159800615..099d3919a1 100644 --- a/library/python/runtime_py3/main/main.c +++ b/library/python/runtime_py3/main/main.c @@ -16,8 +16,8 @@ extern char** environ; void unsetenv(const char* name) { const int n = strlen(name); - char** dst = environ; - for (char** src = environ; *src; src++) + char** dst = environ; + for (char** src = environ; *src; src++) if (strncmp(*src, name, n) || (*src)[n] != '=') *dst++ = *src; *dst = NULL; |