diff options
author | tobo <tobo@yandex-team.ru> | 2022-02-10 16:47:27 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:27 +0300 |
commit | 7fe839092527589b38f014d854c51565b3c1adfa (patch) | |
tree | 309e97022d3530044b712b8f71318c78faf7856e /library/cpp | |
parent | d0d68c395c10da4cb56a1c845504570a04d7893e (diff) | |
download | ydb-7fe839092527589b38f014d854c51565b3c1adfa.tar.gz |
Restoring authorship annotation for <tobo@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
202 files changed, 1197 insertions, 1197 deletions
diff --git a/library/cpp/actors/core/actor_coroutine_ut.cpp b/library/cpp/actors/core/actor_coroutine_ut.cpp index 951512b877..558a2f7e96 100644 --- a/library/cpp/actors/core/actor_coroutine_ut.cpp +++ b/library/cpp/actors/core/actor_coroutine_ut.cpp @@ -94,7 +94,7 @@ Y_UNIT_TEST_SUITE(ActorCoro) { DoneEvent.Signal(); } - void ProcessUnexpectedEvent(TAutoPtr<IEventHandle> event) override { + void ProcessUnexpectedEvent(TAutoPtr<IEventHandle> event) override { if (event->GetTypeRewrite() == Enough) { Finish = true; } diff --git a/library/cpp/actors/core/event_pb_ut.cpp b/library/cpp/actors/core/event_pb_ut.cpp index a16c3092b3..5e434fdf63 100644 --- a/library/cpp/actors/core/event_pb_ut.cpp +++ b/library/cpp/actors/core/event_pb_ut.cpp @@ -6,20 +6,20 @@ Y_UNIT_TEST_SUITE(TEventSerialization) { struct TMockEvent: public NActors::IEventBase { TBigMessage* msg; - bool - SerializeToArcadiaStream(NActors::TChunkSerializer* chunker) const override { + bool + SerializeToArcadiaStream(NActors::TChunkSerializer* chunker) const override { return msg->SerializeToZeroCopyStream(chunker); } bool IsSerializable() const override { return true; } - TString ToStringHeader() const override { + TString ToStringHeader() const override { return TString(); } virtual TString Serialize() const { return TString(); } - ui32 Type() const override { + ui32 Type() const override { return 0; }; }; diff --git a/library/cpp/actors/core/io_dispatcher.cpp b/library/cpp/actors/core/io_dispatcher.cpp index 90699ff16c..729c3bcb16 100644 --- a/library/cpp/actors/core/io_dispatcher.cpp +++ b/library/cpp/actors/core/io_dispatcher.cpp @@ -27,7 +27,7 @@ namespace NActors { : Timestamp(timestamp) , Callback(std::move(ev->Callback)) {} - + void Execute() { Callback(); } @@ -52,7 +52,7 @@ namespace NActors { } CondVar.Signal(); } - + bool Dequeue(std::list<TTask>& list, bool *sendNotify) { with_lock (Mutex) { CondVar.Wait(Mutex, [&] { return NumThreadsToStop || !Tasks.empty(); }); @@ -169,7 +169,7 @@ namespace NActors { , ThreadsStopped(counters->GetCounter("ThreadsStopped", true)) {} - ~TIoDispatcherActor() override { + ~TIoDispatcherActor() override { TaskQueue.Stop(); } diff --git a/library/cpp/actors/core/scheduler_actor.cpp b/library/cpp/actors/core/scheduler_actor.cpp index febc5e40dd..329aeebd34 100644 --- a/library/cpp/actors/core/scheduler_actor.cpp +++ b/library/cpp/actors/core/scheduler_actor.cpp @@ -24,11 +24,11 @@ namespace NActors { Y_VERIFY(Descriptor != -1, "timerfd_create() failed with %s", strerror(errno)); } - ~TTimerDescriptor() override { + ~TTimerDescriptor() override { close(Descriptor); } - int GetDescriptor() override { + int GetDescriptor() override { return Descriptor; } }; diff --git a/library/cpp/actors/http/http_proxy_incoming.cpp b/library/cpp/actors/http/http_proxy_incoming.cpp index 80fe2af53d..a92c458c1e 100644 --- a/library/cpp/actors/http/http_proxy_incoming.cpp +++ b/library/cpp/actors/http/http_proxy_incoming.cpp @@ -56,11 +56,11 @@ public: response = nullptr; } - TAutoPtr<IEventHandle> AfterRegister(const TActorId& self, const TActorId& parent) override { + TAutoPtr<IEventHandle> AfterRegister(const TActorId& self, const TActorId& parent) override { return new IEventHandle(self, parent, new TEvents::TEvBootstrap()); } - void Die(const TActorContext& ctx) override { + void Die(const TActorContext& ctx) override { ctx.Send(Endpoint.Owner, new TEvHttpProxy::TEvHttpConnectionClosed(ctx.SelfID, std::move(RecycledRequests))); TSocketImpl::Shutdown(); TBase::Die(ctx); diff --git a/library/cpp/actors/http/http_proxy_outgoing.cpp b/library/cpp/actors/http/http_proxy_outgoing.cpp index d9189dba8a..b72ec0c2e8 100644 --- a/library/cpp/actors/http/http_proxy_outgoing.cpp +++ b/library/cpp/actors/http/http_proxy_outgoing.cpp @@ -29,7 +29,7 @@ public: TSocketImpl::SetTimeout(SOCKET_TIMEOUT); } - void Die(const NActors::TActorContext& ctx) override { + void Die(const NActors::TActorContext& ctx) override { ctx.Send(Owner, new TEvHttpProxy::TEvHttpConnectionClosed(ctx.SelfID)); TSocketImpl::Shutdown(); // to avoid errors when connection already closed TBase::Die(ctx); diff --git a/library/cpp/actors/interconnect/profiler.h b/library/cpp/actors/interconnect/profiler.h index 77a59e3179..c8ee78e5f2 100644 --- a/library/cpp/actors/interconnect/profiler.h +++ b/library/cpp/actors/interconnect/profiler.h @@ -131,7 +131,7 @@ namespace NActors { s << key << " num# " << value.size() << " sum# " << sum << "ns max# " << (i->Duration * 1000000 / cyclesPerMs) << "ns"; if (i->Interior) { s << " {" << i->Interior << "}"; - } + } } } diff --git a/library/cpp/actors/interconnect/ut_fat/main.cpp b/library/cpp/actors/interconnect/ut_fat/main.cpp index 5d19bc3003..965fce77e6 100644 --- a/library/cpp/actors/interconnect/ut_fat/main.cpp +++ b/library/cpp/actors/interconnect/ut_fat/main.cpp @@ -29,11 +29,11 @@ Y_UNIT_TEST_SUITE(InterconnectUnstableConnection) { { } - ~TSenderActor() override { + ~TSenderActor() override { Cerr << "Sent " << SequenceNumber << " messages\n"; } - void SendMessage(const TActorContext& ctx) override { + void SendMessage(const TActorContext& ctx) override { const ui32 flags = IEventHandle::MakeFlags(0, SendFlags); const ui64 cookie = SequenceNumber; const TString payload('@', RandomNumber<size_t>(65536) + 4096); @@ -43,7 +43,7 @@ Y_UNIT_TEST_SUITE(InterconnectUnstableConnection) { ++SequenceNumber; } - void Handle(TEvents::TEvUndelivered::TPtr& ev, const TActorContext& ctx) override { + void Handle(TEvents::TEvUndelivered::TPtr& ev, const TActorContext& ctx) override { auto record = std::find(InFly.begin(), InFly.end(), ev->Cookie); if (SendFlags & IEventHandle::FlagGenerateUnsureUndelivered) { if (record != InFly.end()) { @@ -56,7 +56,7 @@ Y_UNIT_TEST_SUITE(InterconnectUnstableConnection) { } } - void Handle(TEvTestResponse::TPtr& ev, const TActorContext& ctx) override { + void Handle(TEvTestResponse::TPtr& ev, const TActorContext& ctx) override { Y_VERIFY(InFly); const NInterconnectTest::TEvTestResponse& record = ev->Get()->Record; Y_VERIFY(record.HasConfirmedSequenceNumber()); @@ -85,7 +85,7 @@ Y_UNIT_TEST_SUITE(InterconnectUnstableConnection) { { } - void Handle(TEvTest::TPtr& ev, const TActorContext& /*ctx*/) override { + void Handle(TEvTest::TPtr& ev, const TActorContext& /*ctx*/) override { const NInterconnectTest::TEvTest& m = ev->Get()->Record; Y_VERIFY(m.HasSequenceNumber()); Y_VERIFY(m.GetSequenceNumber() >= ReceivedCount, "got #%" PRIu64 " expected at least #%" PRIu64, @@ -94,7 +94,7 @@ Y_UNIT_TEST_SUITE(InterconnectUnstableConnection) { SenderNode->Send(ev->Sender, new TEvTestResponse(m.GetSequenceNumber())); } - ~TReceiverActor() override { + ~TReceiverActor() override { Cerr << "Received " << ReceivedCount << " messages\n"; } }; diff --git a/library/cpp/actors/testlib/test_runtime.cpp b/library/cpp/actors/testlib/test_runtime.cpp index 6fa25b9965..af7ea2e336 100644 --- a/library/cpp/actors/testlib/test_runtime.cpp +++ b/library/cpp/actors/testlib/test_runtime.cpp @@ -242,7 +242,7 @@ namespace NActors { Y_UNUSED(Runtime); } - void Prepare(TActorSystem *actorSystem, volatile ui64 *currentTimestamp, volatile ui64 *currentMonotonic) override { + void Prepare(TActorSystem *actorSystem, volatile ui64 *currentTimestamp, volatile ui64 *currentMonotonic) override { Y_UNUSED(actorSystem); Node->ActorSystemTimestamp = currentTimestamp; Node->ActorSystemMonotonic = currentMonotonic; @@ -253,13 +253,13 @@ namespace NActors { Y_UNUSED(scheduleReadersCount); } - void Start() override { + void Start() override { } - void PrepareStop() override { + void PrepareStop() override { } - void Stop() override { + void Stop() override { } private: @@ -343,7 +343,7 @@ namespace NActors { } // for actorsystem - bool Send(TAutoPtr<IEventHandle>& ev) override { + bool Send(TAutoPtr<IEventHandle>& ev) override { TGuard<TMutex> guard(Runtime->Mutex); bool verbose = (Runtime->CurrentDispatchContext ? !Runtime->CurrentDispatchContext->Options->Quiet : true) && VERBOSE; if (Runtime->BlockedOutput.find(ev->Sender) != Runtime->BlockedOutput.end()) { @@ -393,21 +393,21 @@ namespace NActors { return true; } - void ScheduleActivation(ui32 activation) override { + void ScheduleActivation(ui32 activation) override { Y_UNUSED(activation); } - void ScheduleActivationEx(ui32 activation, ui64 revolvingCounter) override { + void ScheduleActivationEx(ui32 activation, ui64 revolvingCounter) override { Y_UNUSED(activation); Y_UNUSED(revolvingCounter); } - TActorId Register(IActor *actor, TMailboxType::EType mailboxType, ui64 revolvingCounter, + TActorId Register(IActor *actor, TMailboxType::EType mailboxType, ui64 revolvingCounter, const TActorId& parentId) override { return Runtime->Register(actor, NodeIndex, PoolId, mailboxType, revolvingCounter, parentId); } - TActorId Register(IActor *actor, TMailboxHeader *mailbox, ui32 hint, const TActorId& parentId) override { + TActorId Register(IActor *actor, TMailboxHeader *mailbox, ui32 hint, const TActorId& parentId) override { return Runtime->Register(actor, NodeIndex, PoolId, mailbox, hint, parentId); } @@ -418,13 +418,13 @@ namespace NActors { Y_UNUSED(scheduleSz); } - void Start() override { + void Start() override { } - void PrepareStop() override { + void PrepareStop() override { } - void Shutdown() override { + void Shutdown() override { } bool Cleanup() override { @@ -432,7 +432,7 @@ namespace NActors { } // generic - TAffinity* Affinity() const override { + TAffinity* Affinity() const override { Y_FAIL(); } diff --git a/library/cpp/actors/util/rope_cont_deque.h b/library/cpp/actors/util/rope_cont_deque.h index d1d122c49c..3bc3476023 100644 --- a/library/cpp/actors/util/rope_cont_deque.h +++ b/library/cpp/actors/util/rope_cont_deque.h @@ -8,7 +8,7 @@ namespace NRopeDetails { template<typename TChunk> class TChunkList { std::deque<TChunk> Chunks; - + static constexpr size_t MaxInplaceItems = 4; using TInplace = TStackVec<TChunk, MaxInplaceItems>; TInplace Inplace; diff --git a/library/cpp/actors/util/rope_ut.cpp b/library/cpp/actors/util/rope_ut.cpp index cabeed9230..f9ed32891b 100644 --- a/library/cpp/actors/util/rope_ut.cpp +++ b/library/cpp/actors/util/rope_ut.cpp @@ -40,7 +40,7 @@ TString RopeToString(const TRope& rope) { res.append(iter.ContiguousData(), iter.ContiguousSize()); iter.AdvanceToNextContiguousBlock(); } - + UNIT_ASSERT_VALUES_EQUAL(rope.GetSize(), res.size()); TString temp = TString::Uninitialized(rope.GetSize()); diff --git a/library/cpp/archive/yarchive.h b/library/cpp/archive/yarchive.h index 8120bcb940..003443ea74 100644 --- a/library/cpp/archive/yarchive.h +++ b/library/cpp/archive/yarchive.h @@ -16,7 +16,7 @@ static constexpr size_t ArchiveWriterDefaultDataAlignment = 16; class TArchiveWriter { public: - explicit TArchiveWriter(IOutputStream* out, bool compress = true); + explicit TArchiveWriter(IOutputStream* out, bool compress = true); ~TArchiveWriter(); void Flush(); @@ -31,16 +31,16 @@ private: class TArchiveReader : public IModelsArchiveReader { public: - explicit TArchiveReader(const TBlob& data); - ~TArchiveReader() override; - - size_t Count() const noexcept override; - TString KeyByIndex(size_t n) const override; - bool Has(TStringBuf key) const override; - TAutoPtr<IInputStream> ObjectByKey(TStringBuf key) const override; - TBlob ObjectBlobByKey(TStringBuf key) const override; - TBlob BlobByKey(TStringBuf key) const override; - bool Compressed() const override; + explicit TArchiveReader(const TBlob& data); + ~TArchiveReader() override; + + size_t Count() const noexcept override; + TString KeyByIndex(size_t n) const override; + bool Has(TStringBuf key) const override; + TAutoPtr<IInputStream> ObjectByKey(TStringBuf key) const override; + TBlob ObjectBlobByKey(TStringBuf key) const override; + TBlob BlobByKey(TStringBuf key) const override; + bool Compressed() const override; private: class TImpl; diff --git a/library/cpp/balloc/malloc-info.cpp b/library/cpp/balloc/malloc-info.cpp index 604b1fb145..813f93f5ee 100644 --- a/library/cpp/balloc/malloc-info.cpp +++ b/library/cpp/balloc/malloc-info.cpp @@ -9,7 +9,7 @@ extern "C" void EnableBalloc(); extern "C" bool BallocDisabled(); namespace { - bool SetAllocParam(const char* name, const char* value) { + bool SetAllocParam(const char* name, const char* value) { if (strcmp(name, "disable") == 0) { if (value == nullptr || strcmp(value, "false") != 0) { // all values other than "false" are considred to be "true" for compatibility @@ -22,7 +22,7 @@ namespace { return false; } - bool CheckAllocParam(const char* name, bool defaultValue) { + bool CheckAllocParam(const char* name, bool defaultValue) { if (strcmp(name, "disable") == 0) { return BallocDisabled(); } diff --git a/library/cpp/blockcodecs/codecs/brotli/brotli.cpp b/library/cpp/blockcodecs/codecs/brotli/brotli.cpp index 6e3cd971bd..4893fb7a00 100644 --- a/library/cpp/blockcodecs/codecs/brotli/brotli.cpp +++ b/library/cpp/blockcodecs/codecs/brotli/brotli.cpp @@ -13,7 +13,7 @@ namespace { inline TBrotliCodec(ui32 level) : Quality(level) - , MyName(TStringBuf("brotli_") + ToString(level)) + , MyName(TStringBuf("brotli_") + ToString(level)) { } @@ -63,5 +63,5 @@ namespace { } } }; - const TBrotliRegistrar Registrar{}; + const TBrotliRegistrar Registrar{}; } diff --git a/library/cpp/blockcodecs/codecs/bzip/bzip.cpp b/library/cpp/blockcodecs/codecs/bzip/bzip.cpp index 3a5cfdd0e9..3ca1f80daf 100644 --- a/library/cpp/blockcodecs/codecs/bzip/bzip.cpp +++ b/library/cpp/blockcodecs/codecs/bzip/bzip.cpp @@ -58,5 +58,5 @@ namespace { RegisterAlias("bzip2", "bzip2-6"); } }; - const TBZipRegistrar Registrar{}; + const TBZipRegistrar Registrar{}; } diff --git a/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp b/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp index da2831fbd2..9d836b87fb 100644 --- a/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp +++ b/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp @@ -34,7 +34,7 @@ namespace { const int ret = fastlz_decompress(in.data(), in.size(), out, len); if (ret < 0 || (size_t)ret != len) { - ythrow TDataError() << TStringBuf("can not decompress"); + ythrow TDataError() << TStringBuf("can not decompress"); } } @@ -50,5 +50,5 @@ namespace { RegisterAlias("fastlz", "fastlz-0"); } }; - const TFastLZRegistrar Registrar{}; + const TFastLZRegistrar Registrar{}; } diff --git a/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp b/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp index 042f031679..0e80f47cc6 100644 --- a/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp +++ b/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp @@ -11,13 +11,13 @@ namespace { struct TZStd06Codec: public TAddLengthCodec<TZStd06Codec> { inline TZStd06Codec(unsigned level) : Level(level) - , MyName(TStringBuf("zstd06_") + ToString(Level)) + , MyName(TStringBuf("zstd06_") + ToString(Level)) { } static inline size_t CheckError(size_t ret, const char* what) { if (ZSTD_isError(ret)) { - ythrow yexception() << what << TStringBuf(" zstd error: ") << ZSTD_getErrorName(ret); + ythrow yexception() << what << TStringBuf(" zstd error: ") << ZSTD_getErrorName(ret); } return ret; @@ -54,5 +54,5 @@ namespace { } } }; - const TZStd06Registrar Registrar{}; + const TZStd06Registrar Registrar{}; } diff --git a/library/cpp/blockcodecs/codecs/lz4/lz4.cpp b/library/cpp/blockcodecs/codecs/lz4/lz4.cpp index fbf0fe110f..db8d9f4019 100644 --- a/library/cpp/blockcodecs/codecs/lz4/lz4.cpp +++ b/library/cpp/blockcodecs/codecs/lz4/lz4.cpp @@ -53,7 +53,7 @@ namespace { } static inline TStringBuf DPrefix() { - return TStringBuf("fast"); + return TStringBuf("fast"); } }; @@ -66,7 +66,7 @@ namespace { } static inline TStringBuf DPrefix() { - return TStringBuf("safe"); + return TStringBuf("safe"); } }; @@ -119,5 +119,5 @@ namespace { RegisterAlias("lz4hc", "lz4-hc-safe"); } }; - const TLz4Registrar Registrar{}; + const TLz4Registrar Registrar{}; } diff --git a/library/cpp/blockcodecs/codecs/lzma/lzma.cpp b/library/cpp/blockcodecs/codecs/lzma/lzma.cpp index 6c8d5fded4..c2c3784540 100644 --- a/library/cpp/blockcodecs/codecs/lzma/lzma.cpp +++ b/library/cpp/blockcodecs/codecs/lzma/lzma.cpp @@ -39,7 +39,7 @@ namespace { inline void DoDecompress(const TData& in, void* out, size_t len) const { if (in.size() <= LZMA_PROPS_SIZE) { - ythrow TDataError() << TStringBuf("broken lzma stream"); + ythrow TDataError() << TStringBuf("broken lzma stream"); } const unsigned char* props = (const unsigned char*)in.data(); @@ -70,5 +70,5 @@ namespace { RegisterAlias("lzma", "lzma-5"); } }; - const TLzmaRegistrar Registrar{}; + const TLzmaRegistrar Registrar{}; } diff --git a/library/cpp/blockcodecs/codecs/snappy/snappy.cpp b/library/cpp/blockcodecs/codecs/snappy/snappy.cpp index f6be05a05f..18e499eea1 100644 --- a/library/cpp/blockcodecs/codecs/snappy/snappy.cpp +++ b/library/cpp/blockcodecs/codecs/snappy/snappy.cpp @@ -48,5 +48,5 @@ namespace { RegisterCodec(MakeHolder<TSnappyCodec>()); } }; - const TSnappyRegistrar Registrar{}; + const TSnappyRegistrar Registrar{}; } diff --git a/library/cpp/blockcodecs/codecs/zlib/zlib.cpp b/library/cpp/blockcodecs/codecs/zlib/zlib.cpp index cdb556c36d..8e23269f6d 100644 --- a/library/cpp/blockcodecs/codecs/zlib/zlib.cpp +++ b/library/cpp/blockcodecs/codecs/zlib/zlib.cpp @@ -60,5 +60,5 @@ namespace { RegisterAlias("zlib", "zlib-6"); } }; - const TZLibRegistrar Registrar{}; + const TZLibRegistrar Registrar{}; } diff --git a/library/cpp/blockcodecs/codecs/zstd/zstd.cpp b/library/cpp/blockcodecs/codecs/zstd/zstd.cpp index 95299b3f6d..7ea1c6371b 100644 --- a/library/cpp/blockcodecs/codecs/zstd/zstd.cpp +++ b/library/cpp/blockcodecs/codecs/zstd/zstd.cpp @@ -11,13 +11,13 @@ namespace { struct TZStd08Codec: public TAddLengthCodec<TZStd08Codec> { inline TZStd08Codec(unsigned level) : Level(level) - , MyName(TStringBuf("zstd08_") + ToString(Level)) + , MyName(TStringBuf("zstd08_") + ToString(Level)) { } static inline size_t CheckError(size_t ret, const char* what) { if (ZSTD_isError(ret)) { - ythrow yexception() << what << TStringBuf(" zstd error: ") << ZSTD_getErrorName(ret); + ythrow yexception() << what << TStringBuf(" zstd error: ") << ZSTD_getErrorName(ret); } return ret; @@ -55,5 +55,5 @@ namespace { } } }; - const TZStd08Registrar Registrar{}; + const TZStd08Registrar Registrar{}; } diff --git a/library/cpp/blockcodecs/core/codecs.cpp b/library/cpp/blockcodecs/core/codecs.cpp index 21506e812b..43421c1aa5 100644 --- a/library/cpp/blockcodecs/core/codecs.cpp +++ b/library/cpp/blockcodecs/core/codecs.cpp @@ -83,7 +83,7 @@ TCodecList NBlockCodecs::ListAllCodecs() { } TString NBlockCodecs::ListAllCodecsAsString() { - return JoinSeq(TStringBuf(","), ListAllCodecs()); + return JoinSeq(TStringBuf(","), ListAllCodecs()); } void NBlockCodecs::RegisterCodec(TCodecPtr codec) { diff --git a/library/cpp/blockcodecs/core/common.h b/library/cpp/blockcodecs/core/common.h index f05df4d334..8da81b45f9 100644 --- a/library/cpp/blockcodecs/core/common.h +++ b/library/cpp/blockcodecs/core/common.h @@ -56,7 +56,7 @@ namespace NBlockCodecs { } TStringBuf Name() const noexcept override { - return TStringBuf("null"); + return TStringBuf("null"); } }; @@ -83,7 +83,7 @@ namespace NBlockCodecs { WriteUnaligned<ui64>(ptr, (ui64) in.size()); - return Base()->DoCompress(!in ? TData(TStringBuf("")) : in, ptr + 1) + sizeof(*ptr); + return Base()->DoCompress(!in ? TData(TStringBuf("")) : in, ptr + 1) + sizeof(*ptr); } size_t Decompress(const TData& in, void* out) const override { diff --git a/library/cpp/blockcodecs/core/stream.cpp b/library/cpp/blockcodecs/core/stream.cpp index 4f7db3c32b..7a7422738b 100644 --- a/library/cpp/blockcodecs/core/stream.cpp +++ b/library/cpp/blockcodecs/core/stream.cpp @@ -12,7 +12,7 @@ using namespace NBlockCodecs; namespace { - constexpr size_t MAX_BUF_LEN = 128 * 1024 * 1024; + constexpr size_t MAX_BUF_LEN = 128 * 1024 * 1024; typedef ui16 TCodecID; typedef ui64 TBlockLen; @@ -55,11 +55,11 @@ namespace { TByID ByID; }; - TCodecID CodecID(const ICodec* c) { + TCodecID CodecID(const ICodec* c) { return TIds::CodecID(c); } - const ICodec* CodecByID(TCodecID id) { + const ICodec* CodecByID(TCodecID id) { return Singleton<TIds>()->Find(id); } } @@ -70,7 +70,7 @@ TCodedOutput::TCodedOutput(IOutputStream* out, const ICodec* c, size_t bufLen) , S_(out) { if (bufLen > MAX_BUF_LEN) { - ythrow yexception() << TStringBuf("too big buffer size: ") << bufLen; + ythrow yexception() << TStringBuf("too big buffer size: ") << bufLen; } } @@ -198,7 +198,7 @@ size_t TDecodedInput::DoUnboundedNext(const void** ptr) { auto codec = CodecByID(codecId); if (C_) { - Y_ENSURE(C_->Name() == codec->Name(), TStringBuf("incorrect stream codec")); + Y_ENSURE(C_->Name() == codec->Name(), TStringBuf("incorrect stream codec")); } if (codec->DecompressedLength(block) > MAX_BUF_LEN) { diff --git a/library/cpp/blockcodecs/ya.make b/library/cpp/blockcodecs/ya.make index b8f03d5421..acda744030 100644 --- a/library/cpp/blockcodecs/ya.make +++ b/library/cpp/blockcodecs/ya.make @@ -22,6 +22,6 @@ SRCS( END() -RECURSE_FOR_TESTS( +RECURSE_FOR_TESTS( ut ) diff --git a/library/cpp/cgiparam/cgiparam.cpp b/library/cpp/cgiparam/cgiparam.cpp index f3277b8e4b..2ecc06d3f4 100644 --- a/library/cpp/cgiparam/cgiparam.cpp +++ b/library/cpp/cgiparam/cgiparam.cpp @@ -57,7 +57,7 @@ size_t TCgiParameters::EraseAll(const TStringBuf name) { return num; } -void TCgiParameters::JoinUnescaped(const TStringBuf key, char sep, TStringBuf val) { +void TCgiParameters::JoinUnescaped(const TStringBuf key, char sep, TStringBuf val) { const auto pair = equal_range(key); auto it = pair.first; diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h index 87d1ab0ad4..f32217b7e4 100644 --- a/library/cpp/cgiparam/cgiparam.h +++ b/library/cpp/cgiparam/cgiparam.h @@ -18,7 +18,7 @@ struct TStringLess { class TCgiParameters: public TMultiMap<TString, TString> { public: - TCgiParameters() = default; + TCgiParameters() = default; explicit TCgiParameters(const TStringBuf cgiParamStr) { Scan(cgiParamStr); @@ -117,7 +117,7 @@ public: // join multiple values into a single one using a separator // if val is a [possibly empty] non-NULL string, append it as well - void JoinUnescaped(const TStringBuf key, char sep, TStringBuf val = TStringBuf()); + void JoinUnescaped(const TStringBuf key, char sep, TStringBuf val = TStringBuf()); bool Erase(const TStringBuf name, size_t numOfValue = 0); bool Erase(const TStringBuf name, const TStringBuf val); @@ -163,7 +163,7 @@ void TCgiParameters::ReplaceUnescaped(const TStringBuf key, TIter valuesBegin, c class TQuickCgiParam: public TMultiMap<TStringBuf, TStringBuf> { public: - TQuickCgiParam() = default; + TQuickCgiParam() = default; explicit TQuickCgiParam(const TStringBuf cgiParamStr); diff --git a/library/cpp/cgiparam/cgiparam_ut.cpp b/library/cpp/cgiparam/cgiparam_ut.cpp index a562342084..23d4f96472 100644 --- a/library/cpp/cgiparam/cgiparam_ut.cpp +++ b/library/cpp/cgiparam/cgiparam_ut.cpp @@ -198,7 +198,7 @@ Y_UNIT_TEST_SUITE(TCgiParametersTest) { TCgiParameters c; c.Scan("foo=1&foo=2"); - c.JoinUnescaped("foo", ';', "0"); + c.JoinUnescaped("foo", ';', "0"); UNIT_ASSERT_VALUES_EQUAL(c.Print(), "foo=1;2;0"); } diff --git a/library/cpp/charset/codepage_ut.cpp b/library/cpp/charset/codepage_ut.cpp index c3ac3ac478..5eef9cd893 100644 --- a/library/cpp/charset/codepage_ut.cpp +++ b/library/cpp/charset/codepage_ut.cpp @@ -59,13 +59,13 @@ public: const CodePage* cp = CodePageByCharset(CODES_ASCII); char tmp[100]; - TStringBuf s = "abcde"; + TStringBuf s = "abcde"; TStringBuf upper(tmp, cp->ToUpper(s.begin(), s.end(), tmp)); - UNIT_ASSERT_VALUES_EQUAL(upper, TStringBuf("ABCDE")); + UNIT_ASSERT_VALUES_EQUAL(upper, TStringBuf("ABCDE")); TStringBuf lower(tmp, cp->ToLower(upper.begin(), upper.end(), tmp)); - UNIT_ASSERT_VALUES_EQUAL(lower, TStringBuf("abcde")); + UNIT_ASSERT_VALUES_EQUAL(lower, TStringBuf("abcde")); } void TestBrokenRune() { diff --git a/library/cpp/codecs/codecs_registry.cpp b/library/cpp/codecs/codecs_registry.cpp index 17d07062ab..ec56513521 100644 --- a/library/cpp/codecs/codecs_registry.cpp +++ b/library/cpp/codecs/codecs_registry.cpp @@ -72,7 +72,7 @@ namespace NCodecs { if (TSolarCodec::MyName() == name) { return new TSolarCodec(); } - if (name.EndsWith(TStringBuf("-a"))) { + if (name.EndsWith(TStringBuf("-a"))) { return MakeCodecImpl<TAdaptiveSolarCodec>(name, name.SubStr(TSolarCodec::MyName().size()).Chop(2)); } else { return MakeCodecImpl<TSolarCodec>(name, name.SubStr(TSolarCodec::MyName().size())); @@ -81,19 +81,19 @@ namespace NCodecs { template <class TCodecCls> TCodecPtr MakeCodecImpl(const TStringBuf& name, const TStringBuf& type) const { - if (TStringBuf("-8k") == type) { + if (TStringBuf("-8k") == type) { return new TCodecCls(1 << 13); } - if (TStringBuf("-16k") == type) { + if (TStringBuf("-16k") == type) { return new TCodecCls(1 << 14); } - if (TStringBuf("-32k") == type) { + if (TStringBuf("-32k") == type) { return new TCodecCls(1 << 15); } - if (TStringBuf("-64k") == type) { + if (TStringBuf("-64k") == type) { return new TCodecCls(1 << 16); } - if (TStringBuf("-256k") == type) { + if (TStringBuf("-256k") == type) { return new TCodecCls(1 << 18); } ythrow TNoCodecException(name); diff --git a/library/cpp/codecs/solar_codec.h b/library/cpp/codecs/solar_codec.h index 7158ae7926..e80d33e443 100644 --- a/library/cpp/codecs/solar_codec.h +++ b/library/cpp/codecs/solar_codec.h @@ -65,40 +65,40 @@ namespace NCodecs { class TSolarCodec: public ICodec { public: static TStringBuf MyName8k() { - return TStringBuf("solar-8k"); + return TStringBuf("solar-8k"); } static TStringBuf MyName16k() { - return TStringBuf("solar-16k"); + return TStringBuf("solar-16k"); } static TStringBuf MyName32k() { - return TStringBuf("solar-32k"); + return TStringBuf("solar-32k"); } static TStringBuf MyName64k() { - return TStringBuf("solar-64k"); + return TStringBuf("solar-64k"); } static TStringBuf MyName256k() { - return TStringBuf("solar-256k"); + return TStringBuf("solar-256k"); } static TStringBuf MyName() { - return TStringBuf("solar"); + return TStringBuf("solar"); } static TStringBuf MyName8kAdapt() { - return TStringBuf("solar-8k-a"); + return TStringBuf("solar-8k-a"); } static TStringBuf MyName16kAdapt() { - return TStringBuf("solar-16k-a"); + return TStringBuf("solar-16k-a"); } static TStringBuf MyName32kAdapt() { - return TStringBuf("solar-32k-a"); + return TStringBuf("solar-32k-a"); } static TStringBuf MyName64kAdapt() { - return TStringBuf("solar-64k-a"); + return TStringBuf("solar-64k-a"); } static TStringBuf MyName256kAdapt() { - return TStringBuf("solar-256k-a"); + return TStringBuf("solar-256k-a"); } static TStringBuf MyNameShortInt() { - return TStringBuf("solar-si"); + return TStringBuf("solar-si"); } explicit TSolarCodec(ui32 maxentries = 1 << 14, ui32 maxiter = 16, const NGreedyDict::TBuildSettings& s = NGreedyDict::TBuildSettings()) diff --git a/library/cpp/codecs/static/static.cpp b/library/cpp/codecs/static/static.cpp index 44a07dd73a..d741e46f7d 100644 --- a/library/cpp/codecs/static/static.cpp +++ b/library/cpp/codecs/static/static.cpp @@ -13,10 +13,10 @@ #include <util/ysaveload.h> namespace NCodecs { - static constexpr TStringBuf STATIC_CODEC_INFO_MAGIC = "CodecInf"; + static constexpr TStringBuf STATIC_CODEC_INFO_MAGIC = "CodecInf"; static TStringBuf GetStaticCodecInfoMagic() { - return STATIC_CODEC_INFO_MAGIC; + return STATIC_CODEC_INFO_MAGIC; } void SaveCodecInfoToStream(IOutputStream& out, const TStaticCodecInfo& info) { diff --git a/library/cpp/codecs/static/ut/static_ut.cpp b/library/cpp/codecs/static/ut/static_ut.cpp index 57e1e62887..999da7702b 100644 --- a/library/cpp/codecs/static/ut/static_ut.cpp +++ b/library/cpp/codecs/static/ut/static_ut.cpp @@ -8,7 +8,7 @@ class TStaticCodecUsageTest: public NUnitTest::TTestBase { private: void DoTestUsage(NStaticCodecExample::EDictVersion dv, size_t expectedSize) { - const TStringBuf letov = "Всё идёт по плану"; + const TStringBuf letov = "Всё идёт по плану"; TBuffer outEnc, outDec; NStaticCodecExample::Encode(outEnc, letov, dv); diff --git a/library/cpp/colorizer/colors.cpp b/library/cpp/colorizer/colors.cpp index decc5c9847..358764fce3 100644 --- a/library/cpp/colorizer/colors.cpp +++ b/library/cpp/colorizer/colors.cpp @@ -16,124 +16,124 @@ namespace { constexpr TStringBuf ToStringBufC(NColorizer::EAnsiCode x) { switch(x) { case RESET: - return "\033[0m"; + return "\033[0m"; case ST_LIGHT: - return "\033[1m"; + return "\033[1m"; case ST_DARK: - return "\033[2m"; + return "\033[2m"; case ST_NORMAL: - return "\033[22m"; + return "\033[22m"; case ITALIC_ON: - return "\033[3m"; + return "\033[3m"; case ITALIC_OFF: - return "\033[23m"; + return "\033[23m"; case UNDERLINE_ON: - return "\033[4m"; + return "\033[4m"; case UNDERLINE_OFF: - return "\033[24m"; + return "\033[24m"; case FG_DEFAULT: - return "\033[39m"; + return "\033[39m"; case FG_BLACK: - return "\033[30m"; + return "\033[30m"; case FG_RED: - return "\033[31m"; + return "\033[31m"; case FG_GREEN: - return "\033[32m"; + return "\033[32m"; case FG_YELLOW: - return "\033[33m"; + return "\033[33m"; case FG_BLUE: - return "\033[34m"; + return "\033[34m"; case FG_MAGENTA: - return "\033[35m"; + return "\033[35m"; case FG_CYAN: - return "\033[36m"; + return "\033[36m"; case FG_WHITE: - return "\033[37m"; + return "\033[37m"; case BG_DEFAULT: - return "\033[49m"; + return "\033[49m"; case BG_BLACK: - return "\033[40m"; + return "\033[40m"; case BG_RED: - return "\033[41m"; + return "\033[41m"; case BG_GREEN: - return "\033[42m"; + return "\033[42m"; case BG_YELLOW: - return "\033[43m"; + return "\033[43m"; case BG_BLUE: - return "\033[44m"; + return "\033[44m"; case BG_MAGENTA: - return "\033[45m"; + return "\033[45m"; case BG_CYAN: - return "\033[46m"; + return "\033[46m"; case BG_WHITE: - return "\033[47m"; + return "\033[47m"; // Note: the following codes are split into two escabe sequences because of how ya.make handles them. case DEFAULT: - return "\033[0m\033[0;39m"; + return "\033[0m\033[0;39m"; case BLACK: - return "\033[0m\033[0;30m"; + return "\033[0m\033[0;30m"; case RED: - return "\033[0m\033[0;31m"; + return "\033[0m\033[0;31m"; case GREEN: - return "\033[0m\033[0;32m"; + return "\033[0m\033[0;32m"; case YELLOW: - return "\033[0m\033[0;33m"; + return "\033[0m\033[0;33m"; case BLUE: - return "\033[0m\033[0;34m"; + return "\033[0m\033[0;34m"; case MAGENTA: - return "\033[0m\033[0;35m"; + return "\033[0m\033[0;35m"; case CYAN: - return "\033[0m\033[0;36m"; + return "\033[0m\033[0;36m"; case WHITE: - return "\033[0m\033[0;37m"; + return "\033[0m\033[0;37m"; case LIGHT_DEFAULT: - return "\033[0m\033[1;39m"; + return "\033[0m\033[1;39m"; case LIGHT_BLACK: - return "\033[0m\033[1;30m"; + return "\033[0m\033[1;30m"; case LIGHT_RED: - return "\033[0m\033[1;31m"; + return "\033[0m\033[1;31m"; case LIGHT_GREEN: - return "\033[0m\033[1;32m"; + return "\033[0m\033[1;32m"; case LIGHT_YELLOW: - return "\033[0m\033[1;33m"; + return "\033[0m\033[1;33m"; case LIGHT_BLUE: - return "\033[0m\033[1;34m"; + return "\033[0m\033[1;34m"; case LIGHT_MAGENTA: - return "\033[0m\033[1;35m"; + return "\033[0m\033[1;35m"; case LIGHT_CYAN: - return "\033[0m\033[1;36m"; + return "\033[0m\033[1;36m"; case LIGHT_WHITE: - return "\033[0m\033[1;37m"; + return "\033[0m\033[1;37m"; case DARK_DEFAULT: - return "\033[0m\033[2;39m"; + return "\033[0m\033[2;39m"; case DARK_BLACK: - return "\033[0m\033[2;30m"; + return "\033[0m\033[2;30m"; case DARK_RED: - return "\033[0m\033[2;31m"; + return "\033[0m\033[2;31m"; case DARK_GREEN: - return "\033[0m\033[2;32m"; + return "\033[0m\033[2;32m"; case DARK_YELLOW: - return "\033[0m\033[2;33m"; + return "\033[0m\033[2;33m"; case DARK_BLUE: - return "\033[0m\033[2;34m"; + return "\033[0m\033[2;34m"; case DARK_MAGENTA: - return "\033[0m\033[2;35m"; + return "\033[0m\033[2;35m"; case DARK_CYAN: - return "\033[0m\033[2;36m"; + return "\033[0m\033[2;36m"; case DARK_WHITE: - return "\033[0m\033[2;37m"; + return "\033[0m\033[2;37m"; case INVALID: default: - return ""; + return ""; } } } @@ -346,75 +346,75 @@ TStringBuf TColors::DarkWhite() const noexcept { } TStringBuf TColors::OldColor() const noexcept { - return IsTTY() ? "\033[22;39m" : ""; + return IsTTY() ? "\033[22;39m" : ""; } TStringBuf TColors::BoldColor() const noexcept { - return IsTTY() ? "\033[1m" : ""; + return IsTTY() ? "\033[1m" : ""; } TStringBuf TColors::BlackColor() const noexcept { - return IsTTY() ? "\033[22;30m" : ""; + return IsTTY() ? "\033[22;30m" : ""; } TStringBuf TColors::BlueColor() const noexcept { - return IsTTY() ? "\033[22;34m" : ""; + return IsTTY() ? "\033[22;34m" : ""; } TStringBuf TColors::GreenColor() const noexcept { - return IsTTY() ? "\033[22;32m" : ""; + return IsTTY() ? "\033[22;32m" : ""; } TStringBuf TColors::CyanColor() const noexcept { - return IsTTY() ? "\033[22;36m" : ""; + return IsTTY() ? "\033[22;36m" : ""; } TStringBuf TColors::RedColor() const noexcept { - return IsTTY() ? "\033[22;31m" : ""; + return IsTTY() ? "\033[22;31m" : ""; } TStringBuf TColors::PurpleColor() const noexcept { - return IsTTY() ? "\033[22;35m" : ""; + return IsTTY() ? "\033[22;35m" : ""; } TStringBuf TColors::BrownColor() const noexcept { - return IsTTY() ? "\033[22;33m" : ""; + return IsTTY() ? "\033[22;33m" : ""; } TStringBuf TColors::LightGrayColor() const noexcept { - return IsTTY() ? "\033[22;37m" : ""; + return IsTTY() ? "\033[22;37m" : ""; } TStringBuf TColors::DarkGrayColor() const noexcept { - return IsTTY() ? "\033[1;30m" : ""; + return IsTTY() ? "\033[1;30m" : ""; } TStringBuf TColors::LightBlueColor() const noexcept { - return IsTTY() ? "\033[1;34m" : ""; + return IsTTY() ? "\033[1;34m" : ""; } TStringBuf TColors::LightGreenColor() const noexcept { - return IsTTY() ? "\033[1;32m" : ""; + return IsTTY() ? "\033[1;32m" : ""; } TStringBuf TColors::LightCyanColor() const noexcept { - return IsTTY() ? "\033[1;36m" : ""; + return IsTTY() ? "\033[1;36m" : ""; } TStringBuf TColors::LightRedColor() const noexcept { - return IsTTY() ? "\033[1;31m" : ""; + return IsTTY() ? "\033[1;31m" : ""; } TStringBuf TColors::LightPurpleColor() const noexcept { - return IsTTY() ? "\033[1;35m" : ""; + return IsTTY() ? "\033[1;35m" : ""; } TStringBuf TColors::YellowColor() const noexcept { - return IsTTY() ? "\033[1;33m" : ""; + return IsTTY() ? "\033[1;33m" : ""; } TStringBuf TColors::WhiteColor() const noexcept { - return IsTTY() ? "\033[1;37m" : ""; + return IsTTY() ? "\033[1;37m" : ""; } diff --git a/library/cpp/containers/comptrie/comptrie_builder.h b/library/cpp/containers/comptrie/comptrie_builder.h index cf7d2e39a3..7939a86601 100644 --- a/library/cpp/containers/comptrie/comptrie_builder.h +++ b/library/cpp/containers/comptrie/comptrie_builder.h @@ -24,7 +24,7 @@ enum ECompactTrieBuilderFlags { CTBF_UNIQUE = 1 << 2, }; -using TCompactTrieBuilderFlags = ECompactTrieBuilderFlags; +using TCompactTrieBuilderFlags = ECompactTrieBuilderFlags; inline TCompactTrieBuilderFlags operator|(TCompactTrieBuilderFlags first, TCompactTrieBuilderFlags second) { return static_cast<TCompactTrieBuilderFlags>(static_cast<int>(first) | second); diff --git a/library/cpp/containers/comptrie/comptrie_trie.h b/library/cpp/containers/comptrie/comptrie_trie.h index 40ec1e52b3..6a6ccaf3bb 100644 --- a/library/cpp/containers/comptrie/comptrie_trie.h +++ b/library/cpp/containers/comptrie/comptrie_trie.h @@ -66,9 +66,9 @@ public: // Skipper should be initialized with &Packer, not with &other.Packer, so you have to redefine these. TCompactTrie(const TCompactTrie& other); - TCompactTrie(TCompactTrie&& other) noexcept; + TCompactTrie(TCompactTrie&& other) noexcept; TCompactTrie& operator=(const TCompactTrie& other); - TCompactTrie& operator=(TCompactTrie&& other) noexcept; + TCompactTrie& operator=(TCompactTrie&& other) noexcept; explicit operator bool() const { return !IsEmpty(); @@ -166,7 +166,7 @@ public: TKey GetKey() const; size_t GetKeySize() const; TData GetValue() const; - void GetValue(TData& data) const; + void GetValue(TData& data) const; const char* GetValuePtr() const; private: @@ -259,7 +259,7 @@ TCompactTrie<T, D, S>::TCompactTrie(const TCompactTrie& other) } template <class T, class D, class S> -TCompactTrie<T, D, S>::TCompactTrie(TCompactTrie&& other) noexcept +TCompactTrie<T, D, S>::TCompactTrie(TCompactTrie&& other) noexcept : DataHolder(std::move(other.DataHolder)) , EmptyValue(std::move(other.EmptyValue)) , Packer(std::move(other.Packer)) @@ -277,7 +277,7 @@ TCompactTrie<T, D, S>& TCompactTrie<T, D, S>::operator=(const TCompactTrie& othe } template <class T, class D, class S> -TCompactTrie<T, D, S>& TCompactTrie<T, D, S>::operator=(TCompactTrie&& other) noexcept { +TCompactTrie<T, D, S>& TCompactTrie<T, D, S>::operator=(TCompactTrie&& other) noexcept { if (this != &other) { DataHolder = std::move(other.DataHolder); EmptyValue = std::move(other.EmptyValue); @@ -499,7 +499,7 @@ bool TCompactTrie<T, D, S>::LookupLongestPrefix(const TSymbol* key, size_t keyle while (key != keyend) { T label = *(key++); for (i64 i = (i64)ExtraBits<TSymbol>(); i >= 0; i -= 8) { - const char flags = LeapByte(datapos, dataend, (char)(label >> i)); + const char flags = LeapByte(datapos, dataend, (char)(label >> i)); if (!datapos) { return found; // no such arc } diff --git a/library/cpp/containers/comptrie/comptrie_ut.cpp b/library/cpp/containers/comptrie/comptrie_ut.cpp index 74bee09b5d..3cac5f104f 100644 --- a/library/cpp/containers/comptrie/comptrie_ut.cpp +++ b/library/cpp/containers/comptrie/comptrie_ut.cpp @@ -1327,10 +1327,10 @@ void TCompactTrieTest::TestSearchIterImpl() { { TCompactTrieBuilder<TChar, ui32> builder; TStringBuf data[] = { - TStringBuf("abaab"), - TStringBuf("abcdef"), - TStringBuf("abbbc"), - TStringBuf("bdfaa"), + TStringBuf("abaab"), + TStringBuf("abcdef"), + TStringBuf("abbbc"), + TStringBuf("bdfaa"), }; for (size_t i = 0; i < Y_ARRAY_SIZE(data); ++i) { builder.Add(TConvertKey<TChar>::Convert(data[i]), i + 1); @@ -1341,26 +1341,26 @@ void TCompactTrieTest::TestSearchIterImpl() { TCompactTrie<TChar, ui32> trie(buffer.Buffer().Data(), buffer.Buffer().Size()); ui32 value = 0; auto iter(MakeSearchIterator(trie)); - MoveIter(iter, TConvertKey<TChar>::Convert(TStringBuf("abc"))); + MoveIter(iter, TConvertKey<TChar>::Convert(TStringBuf("abc"))); UNIT_ASSERT(!iter.GetValue(&value)); iter = MakeSearchIterator(trie); - MoveIter(iter, TConvertKey<TChar>::Convert(TStringBuf("abbbc"))); + MoveIter(iter, TConvertKey<TChar>::Convert(TStringBuf("abbbc"))); UNIT_ASSERT(iter.GetValue(&value)); UNIT_ASSERT_EQUAL(value, 3); iter = MakeSearchIterator(trie); - UNIT_ASSERT(iter.Advance(TConvertKey<TChar>::Convert(TStringBuf("bdfa")))); + UNIT_ASSERT(iter.Advance(TConvertKey<TChar>::Convert(TStringBuf("bdfa")))); UNIT_ASSERT(!iter.GetValue(&value)); iter = MakeSearchIterator(trie); - UNIT_ASSERT(iter.Advance(TConvertKey<TChar>::Convert(TStringBuf("bdfaa")))); + UNIT_ASSERT(iter.Advance(TConvertKey<TChar>::Convert(TStringBuf("bdfaa")))); UNIT_ASSERT(iter.GetValue(&value)); UNIT_ASSERT_EQUAL(value, 4); UNIT_ASSERT(!MakeSearchIterator(trie).Advance(TChar('z'))); - UNIT_ASSERT(!MakeSearchIterator(trie).Advance(TConvertKey<TChar>::Convert(TStringBuf("cdf")))); - UNIT_ASSERT(!MakeSearchIterator(trie).Advance(TConvertKey<TChar>::Convert(TStringBuf("abca")))); + UNIT_ASSERT(!MakeSearchIterator(trie).Advance(TConvertKey<TChar>::Convert(TStringBuf("cdf")))); + UNIT_ASSERT(!MakeSearchIterator(trie).Advance(TConvertKey<TChar>::Convert(TStringBuf("abca")))); } void TCompactTrieTest::TestSearchIterChar() { @@ -1411,9 +1411,9 @@ void TCompactTrieTest::TestFirstSymbolIterator() { typedef TCompactTrie<TSymbol> TTrie; CreateTrie<TSymbol>(bufout, false, false); TTrie trie(bufout.Buffer().Data(), bufout.Buffer().Size()); - TStringBuf rootAnswers = "abcdf"; + TStringBuf rootAnswers = "abcdf"; TestFirstSymbolIteratorForTrie(trie, rootAnswers); - TStringBuf aAnswers = "abcd"; + TStringBuf aAnswers = "abcd"; TestFirstSymbolIteratorForTrie(trie.FindTails(MakeWideKey<TSymbol>("a", 1)), aAnswers); } diff --git a/library/cpp/containers/comptrie/make_fast_layout.cpp b/library/cpp/containers/comptrie/make_fast_layout.cpp index ade78d7899..42228ebcc6 100644 --- a/library/cpp/containers/comptrie/make_fast_layout.cpp +++ b/library/cpp/containers/comptrie/make_fast_layout.cpp @@ -35,7 +35,7 @@ namespace NCompactTrie { namespace { class TTrieNodeSet { public: - TTrieNodeSet() = default; + TTrieNodeSet() = default; explicit TTrieNodeSet(const TOpaqueTrie& trie) : Body(trie.Length / (8 * MinNodeSize) + 1, 0) @@ -83,7 +83,7 @@ namespace NCompactTrie { class TTrieNodeCounts { public: - TTrieNodeCounts() = default; + TTrieNodeCounts() = default; explicit TTrieNodeCounts(const TOpaqueTrie& trie) : Body(trie.Length / MinNodeSize, 0) diff --git a/library/cpp/containers/flat_hash/lib/ut/probings_ut.cpp b/library/cpp/containers/flat_hash/lib/ut/probings_ut.cpp index 593f8cbb1b..dfd971b2dc 100644 --- a/library/cpp/containers/flat_hash/lib/ut/probings_ut.cpp +++ b/library/cpp/containers/flat_hash/lib/ut/probings_ut.cpp @@ -11,7 +11,7 @@ namespace { } }; - constexpr TDummySizeFitter SIZE_FITTER; + constexpr TDummySizeFitter SIZE_FITTER; auto atLeast13 = [](size_t idx) { return idx >= 13; }; } diff --git a/library/cpp/containers/sorted_vector/sorted_vector_ut.cpp b/library/cpp/containers/sorted_vector/sorted_vector_ut.cpp index 893862f098..d7de58321d 100644 --- a/library/cpp/containers/sorted_vector/sorted_vector_ut.cpp +++ b/library/cpp/containers/sorted_vector/sorted_vector_ut.cpp @@ -14,8 +14,8 @@ Y_UNIT_TEST_SUITE(TestSimpleMap) { UNIT_ASSERT_VALUES_UNEQUAL(map.FindPtr(TString("a")), nullptr); UNIT_ASSERT_VALUES_EQUAL(map.FindPtr(TString("c")), nullptr); - UNIT_ASSERT_VALUES_UNEQUAL(map.FindPtr(TStringBuf("a")), nullptr); - UNIT_ASSERT_VALUES_EQUAL(map.FindPtr(TStringBuf("c")), nullptr); + UNIT_ASSERT_VALUES_UNEQUAL(map.FindPtr(TStringBuf("a")), nullptr); + UNIT_ASSERT_VALUES_EQUAL(map.FindPtr(TStringBuf("c")), nullptr); UNIT_ASSERT_VALUES_UNEQUAL(map.FindPtr("a"), nullptr); UNIT_ASSERT_VALUES_EQUAL(map.FindPtr("c"), nullptr); diff --git a/library/cpp/containers/stack_array/stack_array.h b/library/cpp/containers/stack_array/stack_array.h index 28e49bfc3c..3a844be17b 100644 --- a/library/cpp/containers/stack_array/stack_array.h +++ b/library/cpp/containers/stack_array/stack_array.h @@ -3,7 +3,7 @@ #include "range_ops.h" #include <util/generic/array_ref.h> -#include <util/system/defaults.h> /* For alloca. */ +#include <util/system/defaults.h> /* For alloca. */ namespace NStackArray { /** diff --git a/library/cpp/containers/ya.make b/library/cpp/containers/ya.make index 4b1b315e6a..72875c2da7 100644 --- a/library/cpp/containers/ya.make +++ b/library/cpp/containers/ya.make @@ -66,6 +66,6 @@ RECURSE( top_keeper/ut two_level_hash two_level_hash/ut - vp_tree - vp_tree/ut + vp_tree + vp_tree/ut ) diff --git a/library/cpp/coroutine/engine/poller.cpp b/library/cpp/coroutine/engine/poller.cpp index 61164fa56b..e2dc336cbb 100644 --- a/library/cpp/coroutine/engine/poller.cpp +++ b/library/cpp/coroutine/engine/poller.cpp @@ -188,7 +188,7 @@ namespace { }; - inline short PollFlags(ui16 flags) noexcept { + inline short PollFlags(ui16 flags) noexcept { short ret = 0; if (flags & CONT_POLL_READ) { diff --git a/library/cpp/coroutine/engine/sockpool.cpp b/library/cpp/coroutine/engine/sockpool.cpp index b9482e780f..a7ae874b22 100644 --- a/library/cpp/coroutine/engine/sockpool.cpp +++ b/library/cpp/coroutine/engine/sockpool.cpp @@ -34,7 +34,7 @@ TPooledSocket TSocketPool::AllocateMore(TConnectData* conn) { TSocketHolder s(NCoro::Socket(Addr_->Addr()->sa_family, SOCK_STREAM, 0)); if (s == INVALID_SOCKET) { - ythrow TSystemError(errno) << TStringBuf("can not create socket"); + ythrow TSystemError(errno) << TStringBuf("can not create socket"); } SetCommonSockOpts(s, Addr_->Addr()); @@ -45,7 +45,7 @@ TPooledSocket TSocketPool::AllocateMore(TConnectData* conn) { if (ret == EINTR) { continue; } else if (ret) { - ythrow TSystemError(ret) << TStringBuf("can not connect(") << cont->Name() << ')'; + ythrow TSystemError(ret) << TStringBuf("can not connect(") << cont->Name() << ')'; } THolder<TPooledSocket::TImpl> res(new TPooledSocket::TImpl(s, this)); diff --git a/library/cpp/coroutine/engine/stack/stack_guards.h b/library/cpp/coroutine/engine/stack/stack_guards.h index 3a7ef26481..d2b5c9487d 100644 --- a/library/cpp/coroutine/engine/stack/stack_guards.h +++ b/library/cpp/coroutine/engine/stack/stack_guards.h @@ -69,7 +69,7 @@ namespace NCoro::NStack { } private: - static constexpr TStringBuf Canary = "[ThisIsACanaryCoroutineStackGuardIfYouReadThisTheStackIsStillOK]"; + static constexpr TStringBuf Canary = "[ThisIsACanaryCoroutineStackGuardIfYouReadThisTheStackIsStillOK]"; static_assert(Canary.size() == 64); static constexpr uint64_t AlignedSize_ = (Canary.size() + PageSize - 1) & ~PageSizeMask; }; diff --git a/library/cpp/coroutine/listener/listen.cpp b/library/cpp/coroutine/listener/listen.cpp index 3d4e711d1d..4614783e98 100644 --- a/library/cpp/coroutine/listener/listen.cpp +++ b/library/cpp/coroutine/listener/listen.cpp @@ -240,7 +240,7 @@ public: L_.PushBack(new TOneSocketListener(this, MakeHolder<TIPv6Addr>(*sa.In6))); break; default: - ythrow yexception() << TStringBuf("unknown protocol"); + ythrow yexception() << TStringBuf("unknown protocol"); } } diff --git a/library/cpp/dbg_output/colorscheme.h b/library/cpp/dbg_output/colorscheme.h index a5b9cf749a..ef966666e0 100644 --- a/library/cpp/dbg_output/colorscheme.h +++ b/library/cpp/dbg_output/colorscheme.h @@ -71,17 +71,17 @@ namespace NDbgDump { // TODO: support backgrounds in library/cpp/colorizer DBG_OUTPUT_COLOR_HANDLER(Key) { if (Depth++ == 0 && Colors.IsTTY()) { - stream << DumpRaw(TStringBuf("\033[42m")); + stream << DumpRaw(TStringBuf("\033[42m")); } } DBG_OUTPUT_COLOR_HANDLER(Value) { if (Depth++ == 0 && Colors.IsTTY()) { - stream << DumpRaw(TStringBuf("\033[44m")); + stream << DumpRaw(TStringBuf("\033[44m")); } } DBG_OUTPUT_COLOR_HANDLER(ResetRole) { if (--Depth == 0 && Colors.IsTTY()) { - stream << DumpRaw(TStringBuf("\033[49m")); + stream << DumpRaw(TStringBuf("\033[49m")); } } diff --git a/library/cpp/deprecated/kmp/kmp.h b/library/cpp/deprecated/kmp/kmp.h index a7f72eece6..5c62a5ec81 100644 --- a/library/cpp/deprecated/kmp/kmp.h +++ b/library/cpp/deprecated/kmp/kmp.h @@ -7,7 +7,7 @@ template <typename T> void ComputePrefixFunction(const T* begin, const T* end, ssize_t** result) { - Y_ENSURE(begin != end, TStringBuf("empty pattern")); + Y_ENSURE(begin != end, TStringBuf("empty pattern")); ssize_t len = end - begin; TArrayHolder<ssize_t> resultHolder(new ssize_t[len + 1]); ssize_t i = 0; diff --git a/library/cpp/deprecated/split/split_iterator.h b/library/cpp/deprecated/split/split_iterator.h index 0eacc29228..34af7f9843 100644 --- a/library/cpp/deprecated/split/split_iterator.h +++ b/library/cpp/deprecated/split/split_iterator.h @@ -273,7 +273,7 @@ public: } inline TSizeTRegion Next() { - Y_ENSURE(!Eof(), TStringBuf("eof reached")); + Y_ENSURE(!Eof(), TStringBuf("eof reached")); return Split.Next(Pos); } diff --git a/library/cpp/digest/crc32c/crc32c.cpp b/library/cpp/digest/crc32c/crc32c.cpp index 369b46a213..913d4c9300 100644 --- a/library/cpp/digest/crc32c/crc32c.cpp +++ b/library/cpp/digest/crc32c/crc32c.cpp @@ -19,7 +19,7 @@ namespace { Pimpl->Delete(); } - inline ui32 Extend(ui32 init, const void* data, size_t n) const noexcept { + inline ui32 Extend(ui32 init, const void* data, size_t n) const noexcept { crcutil_interface::UINT64 sum = init; Pimpl->Compute(data, n, &sum); return (ui32)sum; diff --git a/library/cpp/digest/lower_case/hash_ops_ut.cpp b/library/cpp/digest/lower_case/hash_ops_ut.cpp index a7ab0b86ea..f4a730a00c 100644 --- a/library/cpp/digest/lower_case/hash_ops_ut.cpp +++ b/library/cpp/digest/lower_case/hash_ops_ut.cpp @@ -30,7 +30,7 @@ Y_UNIT_TEST_SUITE(TestCIHash) { } Y_UNIT_TEST(Test1) { - UNIT_ASSERT_VALUES_EQUAL(TCIOps()("aBc3"), TCIOps()(TStringBuf("AbC3"))); + UNIT_ASSERT_VALUES_EQUAL(TCIOps()("aBc3"), TCIOps()(TStringBuf("AbC3"))); UNIT_ASSERT(TCIOps()("aBc4", "AbC4")); } } diff --git a/library/cpp/digest/md5/md5_ut.cpp b/library/cpp/digest/md5/md5_ut.cpp index 1c3e4ad0a9..9c466eab00 100644 --- a/library/cpp/digest/md5/md5_ut.cpp +++ b/library/cpp/digest/md5/md5_ut.cpp @@ -8,7 +8,7 @@ Y_UNIT_TEST_SUITE(TMD5Test) { Y_UNIT_TEST(TestMD5) { // echo -n 'qwertyuiopqwertyuiopasdfghjklasdfghjkl' | md5sum - constexpr const char* b = "qwertyuiopqwertyuiopasdfghjklasdfghjkl"; + constexpr const char* b = "qwertyuiopqwertyuiopasdfghjklasdfghjkl"; MD5 r; r.Update((const unsigned char*)b, 15); @@ -20,7 +20,7 @@ Y_UNIT_TEST_SUITE(TMD5Test) { UNIT_ASSERT_NO_DIFF(s, TStringBuf("3ac00dd696b966fd74deee3c35a59d8f")); - TString result = r.Calc(TStringBuf(b)); + TString result = r.Calc(TStringBuf(b)); result.to_lower(); UNIT_ASSERT_NO_DIFF(result, TStringBuf("3ac00dd696b966fd74deee3c35a59d8f")); } @@ -51,12 +51,12 @@ Y_UNIT_TEST_SUITE(TMD5Test) { Y_UNIT_TEST(TestIsMD5) { UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf())); - UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa0"))); // length 31 - UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa000"))); // length 33 - UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa0g"))); // wrong character 'g' - UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136EBB0E4C45D21E2B09294C75CFA08"))); - UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136ebb0E4C45D21e2b09294C75CfA08"))); - UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa08"))); + UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa0"))); // length 31 + UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa000"))); // length 33 + UNIT_ASSERT_EQUAL(false, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa0g"))); // wrong character 'g' + UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136EBB0E4C45D21E2B09294C75CFA08"))); + UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136ebb0E4C45D21e2b09294C75CfA08"))); + UNIT_ASSERT_EQUAL(true, MD5::IsMD5(TStringBuf("4136ebb0e4c45d21e2b09294c75cfa08"))); } Y_UNIT_TEST(TestMd5HalfMix) { diff --git a/library/cpp/dns/cache.cpp b/library/cpp/dns/cache.cpp index 05c14e82fc..6c1f55e4f8 100644 --- a/library/cpp/dns/cache.cpp +++ b/library/cpp/dns/cache.cpp @@ -123,7 +123,7 @@ namespace { na = ThreadedResolve(host, rt.Info.Port); } else { Y_ASSERT(0); - throw yexception() << TStringBuf("invalid resolve method"); + throw yexception() << TStringBuf("invalid resolve method"); } return new TResolvedHost(originalHost, *na); @@ -174,7 +174,7 @@ namespace { } }; - inline IDns* ThrDns() { + inline IDns* ThrDns() { return FastTlsSingleton<TThreadedDns>(); } } diff --git a/library/cpp/dns/thread.cpp b/library/cpp/dns/thread.cpp index 8b27d2d527..b5a5237004 100644 --- a/library/cpp/dns/thread.cpp +++ b/library/cpp/dns/thread.cpp @@ -25,7 +25,7 @@ namespace { if (!Error) { if (!Result) { - ythrow TNetworkResolutionError(EAI_AGAIN) << TStringBuf(": resolver down"); + ythrow TNetworkResolutionError(EAI_AGAIN) << TStringBuf(": resolver down"); } return Result; @@ -33,7 +33,7 @@ namespace { Error->Raise(); - ythrow TNetworkResolutionError(EAI_FAIL) << TStringBuf(": shit happen"); + ythrow TNetworkResolutionError(EAI_FAIL) << TStringBuf(": shit happen"); } inline void Resolve() noexcept { diff --git a/library/cpp/enumbitset/enumbitset_ut.cpp b/library/cpp/enumbitset/enumbitset_ut.cpp index e55b3251c3..4b11a4078c 100644 --- a/library/cpp/enumbitset/enumbitset_ut.cpp +++ b/library/cpp/enumbitset/enumbitset_ut.cpp @@ -19,7 +19,7 @@ enum ETestEnum { TE_OVERFLOW, // to test overflow }; -using TTestBitSet = TEnumBitSet<ETestEnum, TE_FIRST, TE_MAX>; +using TTestBitSet = TEnumBitSet<ETestEnum, TE_FIRST, TE_MAX>; Y_UNIT_TEST_SUITE(TEnumBitSetTest) { Y_UNIT_TEST(TestMainFunctions) { diff --git a/library/cpp/execprofile/autostart/start.cpp b/library/cpp/execprofile/autostart/start.cpp index 4fffb03ae1..35e06cafa4 100644 --- a/library/cpp/execprofile/autostart/start.cpp +++ b/library/cpp/execprofile/autostart/start.cpp @@ -11,5 +11,5 @@ namespace { } }; - const TInit initer; + const TInit initer; } diff --git a/library/cpp/getopt/last_getopt_demo/demo.cpp b/library/cpp/getopt/last_getopt_demo/demo.cpp index 79426a9cc9..325d359de5 100644 --- a/library/cpp/getopt/last_getopt_demo/demo.cpp +++ b/library/cpp/getopt/last_getopt_demo/demo.cpp @@ -11,12 +11,12 @@ Y_COMPLETER(HeaderCompleter) { bool addPostHeaders = false; for (int i = 0; i < argc; ++i) { - if (argv[i] == TStringBuf("--method") && i + 1 < argc) { + if (argv[i] == TStringBuf("--method") && i + 1 < argc) { auto method = TString(argv[i + 1]); method.to_upper(); addPostHeaders = method == "POST" || method == "PUT"; break; - } else if (argv[i] == TStringBuf("--post-data") || argv[i] == TStringBuf("--post-file")) { + } else if (argv[i] == TStringBuf("--post-data") || argv[i] == TStringBuf("--post-file")) { addPostHeaders = true; break; } diff --git a/library/cpp/getopt/small/completer.cpp b/library/cpp/getopt/small/completer.cpp index 3fff684adb..01169dc081 100644 --- a/library/cpp/getopt/small/completer.cpp +++ b/library/cpp/getopt/small/completer.cpp @@ -219,7 +219,7 @@ namespace NLastGetopt::NComp { namespace { TCustomCompleter* Head = nullptr; - TStringBuf SpecialFlag = "---CUSTOM-COMPLETION---"; + TStringBuf SpecialFlag = "---CUSTOM-COMPLETION---"; } void TCustomCompleter::FireCustomCompleter(int argc, const char** argv) { diff --git a/library/cpp/getopt/small/last_getopt_opt.cpp b/library/cpp/getopt/small/last_getopt_opt.cpp index 9a99437f4b..841a499cb8 100644 --- a/library/cpp/getopt/small/last_getopt_opt.cpp +++ b/library/cpp/getopt/small/last_getopt_opt.cpp @@ -8,8 +8,8 @@ #include <ctype.h> namespace NLastGetopt { - static const TStringBuf ExcludedShortNameChars = "= -\t\n"; - static const TStringBuf ExcludedLongNameChars = "= \t\n"; + static const TStringBuf ExcludedShortNameChars = "= -\t\n"; + static const TStringBuf ExcludedLongNameChars = "= \t\n"; bool TOpt::NameIs(const TString& name) const { for (const auto& next : LongNames_) { diff --git a/library/cpp/getopt/small/last_getopt_opts.cpp b/library/cpp/getopt/small/last_getopt_opts.cpp index 03c432849f..efdf68eecc 100644 --- a/library/cpp/getopt/small/last_getopt_opts.cpp +++ b/library/cpp/getopt/small/last_getopt_opts.cpp @@ -22,7 +22,7 @@ namespace NLastGetoptPrivate { } namespace NLastGetopt { - static const TStringBuf SPad = " "; + static const TStringBuf SPad = " "; void PrintVersionAndExit(const TOptsParser*) { Cout << (NLastGetoptPrivate::VersionString() ? NLastGetoptPrivate::VersionString() : "program version: not linked with library/cpp/getopt") << Endl; diff --git a/library/cpp/getopt/small/modchooser.h b/library/cpp/getopt/small/modchooser.h index 0a8de6d50b..8e32423ab4 100644 --- a/library/cpp/getopt/small/modchooser.h +++ b/library/cpp/getopt/small/modchooser.h @@ -9,12 +9,12 @@ #include <functional> //! Mode function with vector of cli arguments. -using TMainFunctionPtrV = std::function<int(const TVector<TString>&)> ; -using TMainFunctionRawPtrV = int (*)(const TVector<TString>& argv); +using TMainFunctionPtrV = std::function<int(const TVector<TString>&)> ; +using TMainFunctionRawPtrV = int (*)(const TVector<TString>& argv); //! Mode function with classic argc and argv arguments. -using TMainFunctionPtr = std::function<int(int, const char**)> ; -using TMainFunctionRawPtr = int (*)(const int argc, const char** argv); +using TMainFunctionPtr = std::function<int(int, const char**)> ; +using TMainFunctionRawPtr = int (*)(const int argc, const char** argv); //! Mode class with vector of cli arguments. class TMainClassV { @@ -26,7 +26,7 @@ public: //! Mode class with classic argc and argv arguments. class TMainClass { public: - virtual int operator()(int argc, const char** argv) = 0; + virtual int operator()(int argc, const char** argv) = 0; virtual ~TMainClass() = default; }; @@ -47,10 +47,10 @@ public: ~TModChooser(); public: - void AddMode(const TString& mode, TMainFunctionRawPtr func, const TString& description, bool hidden = false, bool noCompletion = false); - void AddMode(const TString& mode, TMainFunctionRawPtrV func, const TString& description, bool hidden = false, bool noCompletion = false); - void AddMode(const TString& mode, TMainFunctionPtr func, const TString& description, bool hidden = false, bool noCompletion = false); - void AddMode(const TString& mode, TMainFunctionPtrV func, const TString& description, bool hidden = false, bool noCompletion = false); + void AddMode(const TString& mode, TMainFunctionRawPtr func, const TString& description, bool hidden = false, bool noCompletion = false); + void AddMode(const TString& mode, TMainFunctionRawPtrV func, const TString& description, bool hidden = false, bool noCompletion = false); + void AddMode(const TString& mode, TMainFunctionPtr func, const TString& description, bool hidden = false, bool noCompletion = false); + void AddMode(const TString& mode, TMainFunctionPtrV func, const TString& description, bool hidden = false, bool noCompletion = false); void AddMode(const TString& mode, TMainClass* func, const TString& description, bool hidden = false, bool noCompletion = false); void AddMode(const TString& mode, TMainClassV* func, const TString& description, bool hidden = false, bool noCompletion = false); @@ -95,7 +95,7 @@ public: * call it and return its return code. * 4) If appropriate mode is not found - return non-zero code. */ - int Run(int argc, const char** argv) const; + int Run(int argc, const char** argv) const; //! Run appropriate mode. Same as Run(const int, const char**) int Run(const TVector<TString>& argv) const; @@ -174,7 +174,7 @@ private: //! Mode class that allows introspecting its console arguments. class TMainClassArgs: public TMainClass { public: - int operator()(int argc, const char** argv) final; + int operator()(int argc, const char** argv) final; public: //! Run this mode. @@ -197,7 +197,7 @@ private: //! Mode class that uses sub-modes to dispatch commands further. class TMainClassModes: public TMainClass { public: - int operator()(int argc, const char** argv) final; + int operator()(int argc, const char** argv) final; public: //! Run this mode. diff --git a/library/cpp/getopt/ut/last_getopt_ut.cpp b/library/cpp/getopt/ut/last_getopt_ut.cpp index c99a1d053d..aa4f469aa4 100644 --- a/library/cpp/getopt/ut/last_getopt_ut.cpp +++ b/library/cpp/getopt/ut/last_getopt_ut.cpp @@ -126,7 +126,7 @@ struct TOptsParserTester { }; namespace { - bool gSimpleFlag = false; + bool gSimpleFlag = false; void SimpleHander(void) { gSimpleFlag = true; } diff --git a/library/cpp/grpc/client/grpc_client_low.cpp b/library/cpp/grpc/client/grpc_client_low.cpp index 73cc908ef8..49825f9725 100644 --- a/library/cpp/grpc/client/grpc_client_low.cpp +++ b/library/cpp/grpc/client/grpc_client_low.cpp @@ -203,7 +203,7 @@ class TGRpcClientLow::TContextImpl final using TContextPtr = std::shared_ptr<TContextImpl>; public: - ~TContextImpl() override { + ~TContextImpl() override { Y_VERIFY(CountChildren() == 0, "Destructor called with non-empty children"); diff --git a/library/cpp/grpc/server/grpc_request.h b/library/cpp/grpc/server/grpc_request.h index 5bd8d3902b..659d3868d8 100644 --- a/library/cpp/grpc/server/grpc_request.h +++ b/library/cpp/grpc/server/grpc_request.h @@ -374,11 +374,11 @@ private: } //TODO: Move this in to grpc_request_proxy - auto maybeDatabase = GetPeerMetaValues(TStringBuf("x-ydb-database")); + auto maybeDatabase = GetPeerMetaValues(TStringBuf("x-ydb-database")); if (maybeDatabase.empty()) { Counters_->CountRequestsWithoutDatabase(); } - auto maybeToken = GetPeerMetaValues(TStringBuf("x-ydb-auth-ticket")); + auto maybeToken = GetPeerMetaValues(TStringBuf("x-ydb-auth-ticket")); if (maybeToken.empty() || maybeToken[0].empty()) { TString db{maybeDatabase ? maybeDatabase[0] : TStringBuf{}}; Counters_->CountRequestsWithoutToken(); diff --git a/library/cpp/html/escape/escape.cpp b/library/cpp/html/escape/escape.cpp index 5b8ed60f04..8d0b5c2a1e 100644 --- a/library/cpp/html/escape/escape.cpp +++ b/library/cpp/html/escape/escape.cpp @@ -11,14 +11,14 @@ namespace NHtml { TStringBuf Entity; }; - TReplace Escapable[] = { - {'"', false, TStringBuf(""")}, - {'&', true, TStringBuf("&")}, - {'<', true, TStringBuf("<")}, - {'>', true, TStringBuf(">")}, + TReplace Escapable[] = { + {'"', false, TStringBuf(""")}, + {'&', true, TStringBuf("&")}, + {'<', true, TStringBuf("<")}, + {'>', true, TStringBuf(">")}, }; - TString EscapeImpl(const TString& value, bool isText) { + TString EscapeImpl(const TString& value, bool isText) { auto ci = value.begin(); // Looking for escapable characters. for (; ci != value.end(); ++ci) { diff --git a/library/cpp/html/pcdata/pcdata.cpp b/library/cpp/html/pcdata/pcdata.cpp index 740c240fd2..43c150c4bf 100644 --- a/library/cpp/html/pcdata/pcdata.cpp +++ b/library/cpp/html/pcdata/pcdata.cpp @@ -19,31 +19,31 @@ static void EncodeHtmlPcdataAppendInternal(const TStringBuf str, TString& strout switch (*s) { case '\"': - strout += TStringBuf("""); - ++s; + strout += TStringBuf("""); + ++s; break; case '<': - strout += TStringBuf("<"); - ++s; + strout += TStringBuf("<"); + ++s; break; case '>': - strout += TStringBuf(">"); - ++s; + strout += TStringBuf(">"); + ++s; break; case '\'': - strout += TStringBuf("'"); - ++s; + strout += TStringBuf("'"); + ++s; break; case '&': if (qAmp) - strout += TStringBuf("&"); + strout += TStringBuf("&"); else - strout += TStringBuf("&"); - ++s; + strout += TStringBuf("&"); + ++s; break; } } diff --git a/library/cpp/http/fetch/exthttpcodes.cpp b/library/cpp/http/fetch/exthttpcodes.cpp index acc05650c8..8710b1ba3a 100644 --- a/library/cpp/http/fetch/exthttpcodes.cpp +++ b/library/cpp/http/fetch/exthttpcodes.cpp @@ -178,89 +178,89 @@ TStringBuf ExtHttpCodeStr(int code) noexcept { } switch (code) { case HTTP_BAD_RESPONSE_HEADER: - return TStringBuf("Bad response header"); + return TStringBuf("Bad response header"); case HTTP_CONNECTION_LOST: - return TStringBuf("Connection lost"); + return TStringBuf("Connection lost"); case HTTP_BODY_TOO_LARGE: - return TStringBuf("Body too large"); + return TStringBuf("Body too large"); case HTTP_ROBOTS_TXT_DISALLOW: - return TStringBuf("robots.txt disallow"); + return TStringBuf("robots.txt disallow"); case HTTP_BAD_URL: - return TStringBuf("Bad url"); + return TStringBuf("Bad url"); case HTTP_BAD_MIME: - return TStringBuf("Bad mime type"); + return TStringBuf("Bad mime type"); case HTTP_DNS_FAILURE: - return TStringBuf("Dns failure"); + return TStringBuf("Dns failure"); case HTTP_BAD_STATUS_CODE: - return TStringBuf("Bad status code"); + return TStringBuf("Bad status code"); case HTTP_BAD_HEADER_STRING: - return TStringBuf("Bad header string"); + return TStringBuf("Bad header string"); case HTTP_BAD_CHUNK: - return TStringBuf("Bad chunk"); + return TStringBuf("Bad chunk"); case HTTP_CONNECT_FAILED: - return TStringBuf("Connect failed"); + return TStringBuf("Connect failed"); case HTTP_FILTER_DISALLOW: - return TStringBuf("Filter disallow"); + return TStringBuf("Filter disallow"); case HTTP_LOCAL_EIO: - return TStringBuf("Local eio"); + return TStringBuf("Local eio"); case HTTP_BAD_CONTENT_LENGTH: - return TStringBuf("Bad content length"); + return TStringBuf("Bad content length"); case HTTP_BAD_ENCODING: - return TStringBuf("Bad encoding"); + return TStringBuf("Bad encoding"); case HTTP_LENGTH_UNKNOWN: - return TStringBuf("Length unknown"); + return TStringBuf("Length unknown"); case HTTP_HEADER_EOF: - return TStringBuf("Header EOF"); + return TStringBuf("Header EOF"); case HTTP_MESSAGE_EOF: - return TStringBuf("Message EOF"); + return TStringBuf("Message EOF"); case HTTP_CHUNK_EOF: - return TStringBuf("Chunk EOF"); + return TStringBuf("Chunk EOF"); case HTTP_PAST_EOF: - return TStringBuf("Past EOF"); + return TStringBuf("Past EOF"); case HTTP_HEADER_TOO_LARGE: - return TStringBuf("Header is too large"); + return TStringBuf("Header is too large"); case HTTP_URL_TOO_LARGE: - return TStringBuf("Url is too large"); + return TStringBuf("Url is too large"); case HTTP_INTERRUPTED: - return TStringBuf("Interrupted"); + return TStringBuf("Interrupted"); case HTTP_CUSTOM_NOT_MODIFIED: - return TStringBuf("Signature detector thinks that doc is not modified"); + return TStringBuf("Signature detector thinks that doc is not modified"); case HTTP_BAD_CONTENT_ENCODING: - return TStringBuf("Bad content encoding"); + return TStringBuf("Bad content encoding"); case HTTP_NO_RESOURCES: - return TStringBuf("No resources"); + return TStringBuf("No resources"); case HTTP_FETCHER_SHUTDOWN: - return TStringBuf("Fetcher shutdown"); + return TStringBuf("Fetcher shutdown"); case HTTP_CHUNK_TOO_LARGE: - return TStringBuf("Chunk size is too big"); + return TStringBuf("Chunk size is too big"); case HTTP_SERVER_BUSY: - return TStringBuf("Server is busy"); + return TStringBuf("Server is busy"); case HTTP_SERVICE_UNKNOWN: - return TStringBuf("Service is unknown"); + return TStringBuf("Service is unknown"); case HTTP_PROXY_UNKNOWN: - return TStringBuf("Zora: unknown error"); + return TStringBuf("Zora: unknown error"); case HTTP_PROXY_REQUEST_TIME_OUT: - return TStringBuf("Zora: request time out"); + return TStringBuf("Zora: request time out"); case HTTP_PROXY_INTERNAL_ERROR: - return TStringBuf("Zora: internal server error"); + return TStringBuf("Zora: internal server error"); case HTTP_PROXY_CONNECT_FAILED: - return TStringBuf("Spider proxy connect failed"); + return TStringBuf("Spider proxy connect failed"); case HTTP_PROXY_CONNECTION_LOST: - return TStringBuf("Spider proxy connection lost"); + return TStringBuf("Spider proxy connection lost"); case HTTP_PROXY_NO_PROXY: - return TStringBuf("Spider proxy no proxy alive in region"); + return TStringBuf("Spider proxy no proxy alive in region"); case HTTP_PROXY_ERROR: - return TStringBuf("Spider proxy returned custom error"); + return TStringBuf("Spider proxy returned custom error"); case HTTP_SSL_ERROR: - return TStringBuf("Ssl library returned error"); + return TStringBuf("Ssl library returned error"); case HTTP_CACHED_COPY_NOT_FOUND: - return TStringBuf("Cached copy for the url is not available"); + return TStringBuf("Cached copy for the url is not available"); case HTTP_TIMEDOUT_WHILE_BYTES_RECEIVING: - return TStringBuf("Timed out while bytes receiving"); + return TStringBuf("Timed out while bytes receiving"); // TODO: messages for >2000 codes default: - return TStringBuf("Unknown HTTP code"); + return TStringBuf("Unknown HTTP code"); } } diff --git a/library/cpp/http/fetch/httpload.h b/library/cpp/http/fetch/httpload.h index e22e4b809e..1f9530af79 100644 --- a/library/cpp/http/fetch/httpload.h +++ b/library/cpp/http/fetch/httpload.h @@ -103,7 +103,7 @@ public: /********************************************************/ // Here is httpAgent that uses socketAbstractHandler class // ant its derivatives -using httpSpecialAgent = THttpAgent<TSocketHandlerPtr>; +using httpSpecialAgent = THttpAgent<TSocketHandlerPtr>; /********************************************************/ // Regular handler is used as implementation of diff --git a/library/cpp/http/io/headers.h b/library/cpp/http/io/headers.h index a71793d1c6..133adc3ddb 100644 --- a/library/cpp/http/io/headers.h +++ b/library/cpp/http/io/headers.h @@ -35,7 +35,7 @@ public: /// Возвращает строку "имя параметра: значение". inline TString ToString() const { - return Name_ + TStringBuf(": ") + Value_; + return Name_ + TStringBuf(": ") + Value_; } private: diff --git a/library/cpp/http/io/headers_ut.cpp b/library/cpp/http/io/headers_ut.cpp index 1d23ef8fdc..34f2270421 100644 --- a/library/cpp/http/io/headers_ut.cpp +++ b/library/cpp/http/io/headers_ut.cpp @@ -9,7 +9,7 @@ namespace { class THeadersExistence { public: - THeadersExistence() = default; + THeadersExistence() = default; THeadersExistence(const THttpHeaders& headers) { for (THttpHeaders::TConstIterator it = headers.Begin(); @@ -155,7 +155,7 @@ void THttpHeadersTest::TestAddHeaderTemplateness() { THttpHeaders h1; h1.AddHeader("h1", "v1"); h1.AddHeader("h2", TString("v2")); - h1.AddHeader("h3", TStringBuf("v3")); + h1.AddHeader("h3", TStringBuf("v3")); h1.AddHeader("h4", TStringBuf("v4")); THeadersExistence h2; diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp index 6689be684f..966c937832 100644 --- a/library/cpp/http/io/stream.cpp +++ b/library/cpp/http/io/stream.cpp @@ -27,15 +27,15 @@ if (!stricmp((header).Name().data(), str)) namespace { - inline size_t SuggestBufferSize() { + inline size_t SuggestBufferSize() { return 8192; } - inline TStringBuf Trim(const char* b, const char* e) noexcept { + inline TStringBuf Trim(const char* b, const char* e) noexcept { return StripString(TStringBuf(b, e)); } - inline TStringBuf RmSemiColon(const TStringBuf& s) { + inline TStringBuf RmSemiColon(const TStringBuf& s) { return s.Before(';'); } @@ -235,7 +235,7 @@ private: struct TTrEnc { inline void operator()(const TStringBuf& s) { - if (s == TStringBuf("chunked")) { + if (s == TStringBuf("chunked")) { p->Chunked = true; } } @@ -642,7 +642,7 @@ private: inline bool HasResponseBody() const noexcept { if (IsHttpResponse()) { - if (Request_ && Request_->FirstLine().StartsWith(TStringBuf("HEAD"))) + if (Request_ && Request_->FirstLine().StartsWith(TStringBuf("HEAD"))) return false; if (FirstLine_.size() > 9 && strncmp(FirstLine_.data() + 9, "204", 3) == 0) return false; @@ -815,13 +815,13 @@ private: const THttpInputHeader& header = *h; const TString hl = to_lower(header.Name()); - if (hl == TStringBuf("connection")) { - keepAlive = to_lower(header.Value()) == TStringBuf("keep-alive"); - } else if (IsCompressionHeaderEnabled() && hl == TStringBuf("content-encoding")) { + if (hl == TStringBuf("connection")) { + keepAlive = to_lower(header.Value()) == TStringBuf("keep-alive"); + } else if (IsCompressionHeaderEnabled() && hl == TStringBuf("content-encoding")) { encoder = TCompressionCodecFactory::Instance().FindEncoder(to_lower(header.Value())); - } else if (hl == TStringBuf("transfer-encoding")) { - chunked = to_lower(header.Value()) == TStringBuf("chunked"); - } else if (hl == TStringBuf("content-length")) { + } else if (hl == TStringBuf("transfer-encoding")) { + chunked = to_lower(header.Value()) == TStringBuf("chunked"); + } else if (hl == TStringBuf("content-length")) { haveContentLength = true; } } @@ -980,17 +980,17 @@ void SendMinimalHttpRequest(TSocket& s, const TStringBuf& host, const TStringBuf output.EnableCompression(false); const IOutputStream::TPart parts[] = { - IOutputStream::TPart(TStringBuf("GET ")), + IOutputStream::TPart(TStringBuf("GET ")), IOutputStream::TPart(request), - IOutputStream::TPart(TStringBuf(" HTTP/1.1")), + IOutputStream::TPart(TStringBuf(" HTTP/1.1")), IOutputStream::TPart::CrLf(), - IOutputStream::TPart(TStringBuf("Host: ")), + IOutputStream::TPart(TStringBuf("Host: ")), IOutputStream::TPart(host), IOutputStream::TPart::CrLf(), - IOutputStream::TPart(TStringBuf("User-Agent: ")), + IOutputStream::TPart(TStringBuf("User-Agent: ")), IOutputStream::TPart(agent), IOutputStream::TPart::CrLf(), - IOutputStream::TPart(TStringBuf("From: ")), + IOutputStream::TPart(TStringBuf("From: ")), IOutputStream::TPart(from), IOutputStream::TPart::CrLf(), IOutputStream::TPart::CrLf(), diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp index 1ea35df675..2256eb9f71 100644 --- a/library/cpp/http/io/stream_ut.cpp +++ b/library/cpp/http/io/stream_ut.cpp @@ -634,7 +634,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { } private: - TString Data_{TStringBuf("HEAD / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n")}; + TString Data_{TStringBuf("HEAD / HTTP/1.1\r\nHost: yandex.ru\r\n\r\n")}; size_t Pos_{0}; bool Eof_{false}; }; @@ -662,7 +662,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { out << ""; out.Finish(); TString result = outBuf.Str(); - UNIT_ASSERT(!result.Contains(TStringBuf("0\r\n"))); + UNIT_ASSERT(!result.Contains(TStringBuf("0\r\n"))); } Y_UNIT_TEST(TestHttpOutputDisableCompressionHeader) { diff --git a/library/cpp/http/io/stream_ut_medium.cpp b/library/cpp/http/io/stream_ut_medium.cpp index 2c125eb21e..c1e42b97d1 100644 --- a/library/cpp/http/io/stream_ut_medium.cpp +++ b/library/cpp/http/io/stream_ut_medium.cpp @@ -7,11 +7,11 @@ Y_UNIT_TEST_SUITE(THttpTestMedium) { TStringBuf data = "aaaaaaaaaaaaaaaaaaaaaaa"; for (auto codec : SupportedCodings()) { - if (codec == TStringBuf("z-zlib-0")) { + if (codec == TStringBuf("z-zlib-0")) { continue; } - if (codec == TStringBuf("z-null")) { + if (codec == TStringBuf("z-null")) { continue; } diff --git a/library/cpp/http/misc/http_headers.h b/library/cpp/http/misc/http_headers.h index ff359937fa..9c17ef1c66 100644 --- a/library/cpp/http/misc/http_headers.h +++ b/library/cpp/http/misc/http_headers.h @@ -9,64 +9,64 @@ * https://github.com/spring-projects/spring-framework/blob/816bbee8de584676250e2bc5dcff6da6cd81623f/spring-web/src/main/java/org/springframework/http/HttpHeaders.java */ namespace NHttpHeaders { - constexpr TStringBuf ACCEPT = "Accept"; - constexpr TStringBuf ACCEPT_CHARSET = "Accept-Charset"; - constexpr TStringBuf ACCEPT_ENCODING = "Accept-Encoding"; - constexpr TStringBuf ACCEPT_LANGUAGE = "Accept-Language"; - constexpr TStringBuf ACCEPT_RANGES = "Accept-Ranges"; - constexpr TStringBuf ACCESS_CONTROL_ALLOW_CREDENTIALS = "Access-Control-Allow-Credentials"; - constexpr TStringBuf ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers"; - constexpr TStringBuf ACCESS_CONTROL_ALLOW_METHODS = "Access-Control-Allow-Methods"; - constexpr TStringBuf ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin"; - constexpr TStringBuf ACCESS_CONTROL_EXPOSE_HEADERS = "Access-Control-Expose-Headers"; - constexpr TStringBuf ACCESS_CONTROL_MAX_AGE = "Access-Control-Max-Age"; - constexpr TStringBuf ACCESS_CONTROL_REQUEST_HEADERS = "Access-Control-Request-Headers"; - constexpr TStringBuf ACCESS_CONTROL_REQUEST_METHOD = "Access-Control-Request-Method"; - constexpr TStringBuf AGE = "Age"; - constexpr TStringBuf ALLOW = "Allow"; - constexpr TStringBuf AUTHORIZATION = "Authorization"; - constexpr TStringBuf CACHE_CONTROL = "Cache-Control"; - constexpr TStringBuf CONNECTION = "Connection"; - constexpr TStringBuf CONTENT_ENCODING = "Content-Encoding"; - constexpr TStringBuf CONTENT_DISPOSITION = "Content-Disposition"; - constexpr TStringBuf CONTENT_LANGUAGE = "Content-Language"; - constexpr TStringBuf CONTENT_LENGTH = "Content-Length"; - constexpr TStringBuf CONTENT_LOCATION = "Content-Location"; - constexpr TStringBuf CONTENT_RANGE = "Content-Range"; - constexpr TStringBuf CONTENT_TYPE = "Content-Type"; - constexpr TStringBuf COOKIE = "Cookie"; - constexpr TStringBuf DATE = "Date"; - constexpr TStringBuf ETAG = "ETag"; - constexpr TStringBuf EXPECT = "Expect"; - constexpr TStringBuf EXPIRES = "Expires"; - constexpr TStringBuf FROM = "From"; - constexpr TStringBuf HOST = "Host"; - constexpr TStringBuf IF_MATCH = "If-Match"; - constexpr TStringBuf IF_MODIFIED_SINCE = "If-Modified-Since"; - constexpr TStringBuf IF_NONE_MATCH = "If-None-Match"; - constexpr TStringBuf IF_RANGE = "If-Range"; - constexpr TStringBuf IF_UNMODIFIED_SINCE = "If-Unmodified-Since"; - constexpr TStringBuf LAST_MODIFIED = "Last-Modified"; - constexpr TStringBuf LINK = "Link"; - constexpr TStringBuf LOCATION = "Location"; - constexpr TStringBuf MAX_FORWARDS = "Max-Forwards"; - constexpr TStringBuf ORIGIN = "Origin"; - constexpr TStringBuf PRAGMA = "Pragma"; - constexpr TStringBuf PROXY_AUTHENTICATE = "Proxy-Authenticate"; - constexpr TStringBuf PROXY_AUTHORIZATION = "Proxy-Authorization"; - constexpr TStringBuf RANGE = "Range"; - constexpr TStringBuf REFERER = "Referer"; - constexpr TStringBuf RETRY_AFTER = "Retry-After"; - constexpr TStringBuf SERVER = "Server"; - constexpr TStringBuf SET_COOKIE = "Set-Cookie"; - constexpr TStringBuf SET_COOKIE2 = "Set-Cookie2"; - constexpr TStringBuf TE = "TE"; - constexpr TStringBuf TRAILER = "Trailer"; - constexpr TStringBuf TRANSFER_ENCODING = "Transfer-Encoding"; - constexpr TStringBuf UPGRADE = "Upgrade"; - constexpr TStringBuf USER_AGENT = "User-Agent"; - constexpr TStringBuf VARY = "Vary"; - constexpr TStringBuf VIA = "Via"; - constexpr TStringBuf WARNING = "Warning"; - constexpr TStringBuf WWW_AUTHENTICATE = "WWW-Authenticate"; + constexpr TStringBuf ACCEPT = "Accept"; + constexpr TStringBuf ACCEPT_CHARSET = "Accept-Charset"; + constexpr TStringBuf ACCEPT_ENCODING = "Accept-Encoding"; + constexpr TStringBuf ACCEPT_LANGUAGE = "Accept-Language"; + constexpr TStringBuf ACCEPT_RANGES = "Accept-Ranges"; + constexpr TStringBuf ACCESS_CONTROL_ALLOW_CREDENTIALS = "Access-Control-Allow-Credentials"; + constexpr TStringBuf ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers"; + constexpr TStringBuf ACCESS_CONTROL_ALLOW_METHODS = "Access-Control-Allow-Methods"; + constexpr TStringBuf ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin"; + constexpr TStringBuf ACCESS_CONTROL_EXPOSE_HEADERS = "Access-Control-Expose-Headers"; + constexpr TStringBuf ACCESS_CONTROL_MAX_AGE = "Access-Control-Max-Age"; + constexpr TStringBuf ACCESS_CONTROL_REQUEST_HEADERS = "Access-Control-Request-Headers"; + constexpr TStringBuf ACCESS_CONTROL_REQUEST_METHOD = "Access-Control-Request-Method"; + constexpr TStringBuf AGE = "Age"; + constexpr TStringBuf ALLOW = "Allow"; + constexpr TStringBuf AUTHORIZATION = "Authorization"; + constexpr TStringBuf CACHE_CONTROL = "Cache-Control"; + constexpr TStringBuf CONNECTION = "Connection"; + constexpr TStringBuf CONTENT_ENCODING = "Content-Encoding"; + constexpr TStringBuf CONTENT_DISPOSITION = "Content-Disposition"; + constexpr TStringBuf CONTENT_LANGUAGE = "Content-Language"; + constexpr TStringBuf CONTENT_LENGTH = "Content-Length"; + constexpr TStringBuf CONTENT_LOCATION = "Content-Location"; + constexpr TStringBuf CONTENT_RANGE = "Content-Range"; + constexpr TStringBuf CONTENT_TYPE = "Content-Type"; + constexpr TStringBuf COOKIE = "Cookie"; + constexpr TStringBuf DATE = "Date"; + constexpr TStringBuf ETAG = "ETag"; + constexpr TStringBuf EXPECT = "Expect"; + constexpr TStringBuf EXPIRES = "Expires"; + constexpr TStringBuf FROM = "From"; + constexpr TStringBuf HOST = "Host"; + constexpr TStringBuf IF_MATCH = "If-Match"; + constexpr TStringBuf IF_MODIFIED_SINCE = "If-Modified-Since"; + constexpr TStringBuf IF_NONE_MATCH = "If-None-Match"; + constexpr TStringBuf IF_RANGE = "If-Range"; + constexpr TStringBuf IF_UNMODIFIED_SINCE = "If-Unmodified-Since"; + constexpr TStringBuf LAST_MODIFIED = "Last-Modified"; + constexpr TStringBuf LINK = "Link"; + constexpr TStringBuf LOCATION = "Location"; + constexpr TStringBuf MAX_FORWARDS = "Max-Forwards"; + constexpr TStringBuf ORIGIN = "Origin"; + constexpr TStringBuf PRAGMA = "Pragma"; + constexpr TStringBuf PROXY_AUTHENTICATE = "Proxy-Authenticate"; + constexpr TStringBuf PROXY_AUTHORIZATION = "Proxy-Authorization"; + constexpr TStringBuf RANGE = "Range"; + constexpr TStringBuf REFERER = "Referer"; + constexpr TStringBuf RETRY_AFTER = "Retry-After"; + constexpr TStringBuf SERVER = "Server"; + constexpr TStringBuf SET_COOKIE = "Set-Cookie"; + constexpr TStringBuf SET_COOKIE2 = "Set-Cookie2"; + constexpr TStringBuf TE = "TE"; + constexpr TStringBuf TRAILER = "Trailer"; + constexpr TStringBuf TRANSFER_ENCODING = "Transfer-Encoding"; + constexpr TStringBuf UPGRADE = "Upgrade"; + constexpr TStringBuf USER_AGENT = "User-Agent"; + constexpr TStringBuf VARY = "Vary"; + constexpr TStringBuf VIA = "Via"; + constexpr TStringBuf WARNING = "Warning"; + constexpr TStringBuf WWW_AUTHENTICATE = "WWW-Authenticate"; } // namespace HttpHeaders diff --git a/library/cpp/http/misc/httpcodes.cpp b/library/cpp/http/misc/httpcodes.cpp index ad8c80ac1e..2514be1fa3 100644 --- a/library/cpp/http/misc/httpcodes.cpp +++ b/library/cpp/http/misc/httpcodes.cpp @@ -3,139 +3,139 @@ TStringBuf HttpCodeStrEx(int code) noexcept { switch (code) { case HTTP_CONTINUE: - return TStringBuf("100 Continue"); + return TStringBuf("100 Continue"); case HTTP_SWITCHING_PROTOCOLS: - return TStringBuf("101 Switching protocols"); + return TStringBuf("101 Switching protocols"); case HTTP_PROCESSING: - return TStringBuf("102 Processing"); + return TStringBuf("102 Processing"); case HTTP_OK: - return TStringBuf("200 Ok"); + return TStringBuf("200 Ok"); case HTTP_CREATED: - return TStringBuf("201 Created"); + return TStringBuf("201 Created"); case HTTP_ACCEPTED: - return TStringBuf("202 Accepted"); + return TStringBuf("202 Accepted"); case HTTP_NON_AUTHORITATIVE_INFORMATION: - return TStringBuf("203 None authoritative information"); + return TStringBuf("203 None authoritative information"); case HTTP_NO_CONTENT: - return TStringBuf("204 No content"); + return TStringBuf("204 No content"); case HTTP_RESET_CONTENT: - return TStringBuf("205 Reset content"); + return TStringBuf("205 Reset content"); case HTTP_PARTIAL_CONTENT: - return TStringBuf("206 Partial content"); + return TStringBuf("206 Partial content"); case HTTP_MULTI_STATUS: - return TStringBuf("207 Multi status"); + return TStringBuf("207 Multi status"); case HTTP_ALREADY_REPORTED: - return TStringBuf("208 Already reported"); + return TStringBuf("208 Already reported"); case HTTP_IM_USED: - return TStringBuf("226 IM used"); + return TStringBuf("226 IM used"); case HTTP_MULTIPLE_CHOICES: - return TStringBuf("300 Multiple choices"); + return TStringBuf("300 Multiple choices"); case HTTP_MOVED_PERMANENTLY: - return TStringBuf("301 Moved permanently"); + return TStringBuf("301 Moved permanently"); case HTTP_FOUND: - return TStringBuf("302 Moved temporarily"); + return TStringBuf("302 Moved temporarily"); case HTTP_SEE_OTHER: - return TStringBuf("303 See other"); + return TStringBuf("303 See other"); case HTTP_NOT_MODIFIED: - return TStringBuf("304 Not modified"); + return TStringBuf("304 Not modified"); case HTTP_USE_PROXY: - return TStringBuf("305 Use proxy"); + return TStringBuf("305 Use proxy"); case HTTP_TEMPORARY_REDIRECT: - return TStringBuf("307 Temporarily redirect"); + return TStringBuf("307 Temporarily redirect"); case HTTP_PERMANENT_REDIRECT: - return TStringBuf("308 Permanent redirect"); + return TStringBuf("308 Permanent redirect"); case HTTP_BAD_REQUEST: - return TStringBuf("400 Bad request"); + return TStringBuf("400 Bad request"); case HTTP_UNAUTHORIZED: - return TStringBuf("401 Unauthorized"); + return TStringBuf("401 Unauthorized"); case HTTP_PAYMENT_REQUIRED: - return TStringBuf("402 Payment required"); + return TStringBuf("402 Payment required"); case HTTP_FORBIDDEN: - return TStringBuf("403 Forbidden"); + return TStringBuf("403 Forbidden"); case HTTP_NOT_FOUND: - return TStringBuf("404 Not found"); + return TStringBuf("404 Not found"); case HTTP_METHOD_NOT_ALLOWED: - return TStringBuf("405 Method not allowed"); + return TStringBuf("405 Method not allowed"); case HTTP_NOT_ACCEPTABLE: - return TStringBuf("406 Not acceptable"); + return TStringBuf("406 Not acceptable"); case HTTP_PROXY_AUTHENTICATION_REQUIRED: - return TStringBuf("407 Proxy Authentication required"); + return TStringBuf("407 Proxy Authentication required"); case HTTP_REQUEST_TIME_OUT: - return TStringBuf("408 Request time out"); + return TStringBuf("408 Request time out"); case HTTP_CONFLICT: - return TStringBuf("409 Conflict"); + return TStringBuf("409 Conflict"); case HTTP_GONE: - return TStringBuf("410 Gone"); + return TStringBuf("410 Gone"); case HTTP_LENGTH_REQUIRED: - return TStringBuf("411 Length required"); + return TStringBuf("411 Length required"); case HTTP_PRECONDITION_FAILED: - return TStringBuf("412 Precondition failed"); + return TStringBuf("412 Precondition failed"); case HTTP_REQUEST_ENTITY_TOO_LARGE: - return TStringBuf("413 Request entity too large"); + return TStringBuf("413 Request entity too large"); case HTTP_REQUEST_URI_TOO_LARGE: - return TStringBuf("414 Request uri too large"); + return TStringBuf("414 Request uri too large"); case HTTP_UNSUPPORTED_MEDIA_TYPE: - return TStringBuf("415 Unsupported media type"); + return TStringBuf("415 Unsupported media type"); case HTTP_REQUESTED_RANGE_NOT_SATISFIABLE: - return TStringBuf("416 Requested Range Not Satisfiable"); + return TStringBuf("416 Requested Range Not Satisfiable"); case HTTP_EXPECTATION_FAILED: - return TStringBuf("417 Expectation Failed"); + return TStringBuf("417 Expectation Failed"); case HTTP_I_AM_A_TEAPOT: - return TStringBuf("418 I Am A Teapot"); + return TStringBuf("418 I Am A Teapot"); case HTTP_AUTHENTICATION_TIMEOUT: - return TStringBuf("419 Authentication Timeout"); + return TStringBuf("419 Authentication Timeout"); case HTTP_MISDIRECTED_REQUEST: - return TStringBuf("421 Misdirected Request"); + return TStringBuf("421 Misdirected Request"); case HTTP_UNPROCESSABLE_ENTITY: - return TStringBuf("422 Unprocessable Entity"); + return TStringBuf("422 Unprocessable Entity"); case HTTP_LOCKED: - return TStringBuf("423 Locked"); + return TStringBuf("423 Locked"); case HTTP_FAILED_DEPENDENCY: - return TStringBuf("424 Failed Dependency"); + return TStringBuf("424 Failed Dependency"); case HTTP_UNORDERED_COLLECTION: - return TStringBuf("425 Unordered Collection"); + return TStringBuf("425 Unordered Collection"); case HTTP_UPGRADE_REQUIRED: - return TStringBuf("426 Upgrade Required"); + return TStringBuf("426 Upgrade Required"); case HTTP_PRECONDITION_REQUIRED: - return TStringBuf("428 Precondition Required"); + return TStringBuf("428 Precondition Required"); case HTTP_TOO_MANY_REQUESTS: - return TStringBuf("429 Too Many Requests"); + return TStringBuf("429 Too Many Requests"); case HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE: - return TStringBuf("431 Request Header Fields Too Large"); + return TStringBuf("431 Request Header Fields Too Large"); case HTTP_UNAVAILABLE_FOR_LEGAL_REASONS: - return TStringBuf("451 Unavailable For Legal Reason"); + return TStringBuf("451 Unavailable For Legal Reason"); case HTTP_INTERNAL_SERVER_ERROR: - return TStringBuf("500 Internal server error"); + return TStringBuf("500 Internal server error"); case HTTP_NOT_IMPLEMENTED: - return TStringBuf("501 Not implemented"); + return TStringBuf("501 Not implemented"); case HTTP_BAD_GATEWAY: - return TStringBuf("502 Bad gateway"); + return TStringBuf("502 Bad gateway"); case HTTP_SERVICE_UNAVAILABLE: - return TStringBuf("503 Service unavailable"); + return TStringBuf("503 Service unavailable"); case HTTP_GATEWAY_TIME_OUT: - return TStringBuf("504 Gateway time out"); + return TStringBuf("504 Gateway time out"); case HTTP_HTTP_VERSION_NOT_SUPPORTED: - return TStringBuf("505 HTTP version not supported"); + return TStringBuf("505 HTTP version not supported"); case HTTP_VARIANT_ALSO_NEGOTIATES: - return TStringBuf("506 Variant also negotiates"); + return TStringBuf("506 Variant also negotiates"); case HTTP_INSUFFICIENT_STORAGE: - return TStringBuf("507 Insufficient storage"); + return TStringBuf("507 Insufficient storage"); case HTTP_LOOP_DETECTED: - return TStringBuf("508 Loop Detected"); + return TStringBuf("508 Loop Detected"); case HTTP_BANDWIDTH_LIMIT_EXCEEDED: - return TStringBuf("509 Bandwidth Limit Exceeded"); + return TStringBuf("509 Bandwidth Limit Exceeded"); case HTTP_NOT_EXTENDED: - return TStringBuf("510 Not Extended"); + return TStringBuf("510 Not Extended"); case HTTP_NETWORK_AUTHENTICATION_REQUIRED: - return TStringBuf("511 Network Authentication Required"); + return TStringBuf("511 Network Authentication Required"); case HTTP_UNASSIGNED_512: - return TStringBuf("512 Unassigned"); + return TStringBuf("512 Unassigned"); default: - return TStringBuf("000 Unknown HTTP code"); + return TStringBuf("000 Unknown HTTP code"); } } diff --git a/library/cpp/http/misc/httpreqdata.cpp b/library/cpp/http/misc/httpreqdata.cpp index f6951f68cd..0d3ed0ecee 100644 --- a/library/cpp/http/misc/httpreqdata.cpp +++ b/library/cpp/http/misc/httpreqdata.cpp @@ -64,7 +64,7 @@ const char* TBaseServerRequestData::RemoteAddr() const { return Addr; } -const char* TBaseServerRequestData::HeaderIn(TStringBuf key) const { +const char* TBaseServerRequestData::HeaderIn(TStringBuf key) const { auto it = HeadersIn_.find(key); if (it == HeadersIn_.end()) { @@ -86,7 +86,7 @@ TString TBaseServerRequestData::HeaderByIndex(size_t n) const noexcept { --n; } - return TString(i->first) + TStringBuf(": ") + i->second; + return TString(i->first) + TStringBuf(": ") + i->second; } const char* TBaseServerRequestData::Environment(const char* key) const { diff --git a/library/cpp/http/misc/httpreqdata.h b/library/cpp/http/misc/httpreqdata.h index 16e59c4d78..938a8f54e1 100644 --- a/library/cpp/http/misc/httpreqdata.h +++ b/library/cpp/http/misc/httpreqdata.h @@ -58,7 +58,7 @@ public: void AppendQueryString(const char* str, size_t length); const char* RemoteAddr() const; void SetRemoteAddr(TStringBuf addr); - const char* HeaderIn(TStringBuf key) const; + const char* HeaderIn(TStringBuf key) const; const THttpHeadersContainer& HeadersIn() const { return HeadersIn_; diff --git a/library/cpp/http/misc/httpreqdata_ut.cpp b/library/cpp/http/misc/httpreqdata_ut.cpp index e7f16ef27c..13e493a76f 100644 --- a/library/cpp/http/misc/httpreqdata_ut.cpp +++ b/library/cpp/http/misc/httpreqdata_ut.cpp @@ -13,8 +13,8 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) { sd.AddHeader("x-XxX", "y-yyy"); UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 2); - UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XX")), TStringBuf("y-yy")); - UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XXX")), TStringBuf("y-yyy")); + UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XX")), TStringBuf("y-yy")); + UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XXX")), TStringBuf("y-yyy")); } Y_UNIT_TEST(ComplexHeaders) { @@ -23,21 +23,21 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) { sd.AddHeader("x-Xx", "y-yy"); UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 1); - UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XX")), TStringBuf("y-yy")); + UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XX")), TStringBuf("y-yy")); sd.AddHeader("x-Xz", "y-yy"); UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 2); - UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-Xz")), TStringBuf("y-yy")); + UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-Xz")), TStringBuf("y-yy")); UNIT_ASSERT_VALUES_EQUAL(sd.ServerName(), "zzz"); UNIT_ASSERT_VALUES_EQUAL(sd.ServerPort(), "1"); sd.AddHeader("Host", "1234"); UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 3); - UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("Host")), TStringBuf("1234")); + UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("Host")), TStringBuf("1234")); UNIT_ASSERT_VALUES_EQUAL(sd.ServerName(), "1234"); sd.AddHeader("Host", "12345:678"); UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 3); - UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("Host")), TStringBuf("12345:678")); + UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("Host")), TStringBuf("12345:678")); UNIT_ASSERT_VALUES_EQUAL(sd.ServerName(), "12345"); UNIT_ASSERT_VALUES_EQUAL(sd.ServerPort(), "678"); } @@ -122,7 +122,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) { UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs); UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), rd.OrigQueryStringBuf()); - constexpr TStringBuf appendix = "gta=true>a=new"; + constexpr TStringBuf appendix = "gta=true>a=new"; rd.AppendQueryString(appendix.data(), appendix.size()); UNIT_ASSERT_STRINGS_EQUAL(rd.QueryStringBuf(), qs + '&' + appendix); diff --git a/library/cpp/http/server/options.cpp b/library/cpp/http/server/options.cpp index 05c954384a..0d645b9d73 100644 --- a/library/cpp/http/server/options.cpp +++ b/library/cpp/http/server/options.cpp @@ -7,14 +7,14 @@ #include <util/generic/hash_set.h> #include <util/generic/yexception.h> -using TAddr = THttpServerOptions::TAddr; +using TAddr = THttpServerOptions::TAddr; static inline TString AddrToString(const TAddr& addr) { return addr.Addr + ":" + ToString(addr.Port); } static inline TNetworkAddress ToNetworkAddr(const TString& address, ui16 port) { - if (address.empty() || address == TStringBuf("*")) { + if (address.empty() || address == TStringBuf("*")) { return TNetworkAddress(port); } diff --git a/library/cpp/http/server/response.cpp b/library/cpp/http/server/response.cpp index 52d64c91ce..28581427e1 100644 --- a/library/cpp/http/server/response.cpp +++ b/library/cpp/http/server/response.cpp @@ -25,14 +25,14 @@ void THttpResponse::OutTo(IOutputStream& os) const { parts.reserve(FIRST_LINE_PARTS + HEADERS_PARTS + CONTENT_PARTS); // first line - parts.push_back(IOutputStream::TPart(TStringBuf("HTTP/1.1 "))); + parts.push_back(IOutputStream::TPart(TStringBuf("HTTP/1.1 "))); parts.push_back(IOutputStream::TPart(HttpCodeStrEx(Code))); parts.push_back(IOutputStream::TPart::CrLf()); // headers for (THttpHeaders::TConstIterator i = Headers.Begin(); i != Headers.End(); ++i) { parts.push_back(IOutputStream::TPart(i->Name())); - parts.push_back(IOutputStream::TPart(TStringBuf(": "))); + parts.push_back(IOutputStream::TPart(TStringBuf(": "))); parts.push_back(IOutputStream::TPart(i->Value())); parts.push_back(IOutputStream::TPart::CrLf()); } @@ -44,7 +44,7 @@ void THttpResponse::OutTo(IOutputStream& os) const { mo << Content.size(); - parts.push_back(IOutputStream::TPart(TStringBuf("Content-Length: "))); + parts.push_back(IOutputStream::TPart(TStringBuf("Content-Length: "))); parts.push_back(IOutputStream::TPart(buf, mo.Buf() - buf)); parts.push_back(IOutputStream::TPart::CrLf()); } diff --git a/library/cpp/int128/int128.h b/library/cpp/int128/int128.h index f1121fc0c6..7a21021bcd 100644 --- a/library/cpp/int128/int128.h +++ b/library/cpp/int128/int128.h @@ -1030,7 +1030,7 @@ inline ui128 FromStringImpl<ui128>(const char* data, size_t length) { const TStringBuf string(data, length); for (auto&& c : string) { if (!std::isdigit(c)) { - ythrow TFromStringException() << "Unexpected symbol \""sv << c << "\""sv; + ythrow TFromStringException() << "Unexpected symbol \""sv << c << "\""sv; } ui128 x1 = result; @@ -1042,7 +1042,7 @@ inline ui128 FromStringImpl<ui128>(const char* data, size_t length) { result = x10 + s; if (GetHigh(result) < GetHigh(x1)) { - ythrow TFromStringException() << TStringBuf("Integer overflow"); + ythrow TFromStringException() << TStringBuf("Integer overflow"); } } @@ -1237,7 +1237,7 @@ inline i128 FromStringImpl<i128>(const char* data, size_t length) { const TStringBuf string(data, length); for (auto&& c : string) { if (!std::isdigit(c)) { - ythrow TFromStringException() << "Unexpected symbol \""sv << c << "\""sv; + ythrow TFromStringException() << "Unexpected symbol \""sv << c << "\""sv; } i128 x1 = result; @@ -1249,7 +1249,7 @@ inline i128 FromStringImpl<i128>(const char* data, size_t length) { result = x10 + s; if (GetHigh(result) < GetHigh(x1)) { - ythrow TFromStringException() << TStringBuf("Integer overflow"); + ythrow TFromStringException() << TStringBuf("Integer overflow"); } } diff --git a/library/cpp/ipmath/ipmath.cpp b/library/cpp/ipmath/ipmath.cpp index b8cca00c80..3ed365c16c 100644 --- a/library/cpp/ipmath/ipmath.cpp +++ b/library/cpp/ipmath/ipmath.cpp @@ -10,11 +10,11 @@ namespace { TStringBuf TypeToString(TIpv6Address::TIpType type) { switch (type) { case TIpv6Address::Ipv4: - return TStringBuf("IPv4"); + return TStringBuf("IPv4"); case TIpv6Address::Ipv6: - return TStringBuf("IPv6"); + return TStringBuf("IPv6"); default: - return TStringBuf("UNKNOWN"); + return TStringBuf("UNKNOWN"); } } diff --git a/library/cpp/json/fast_sax/parser.rl6 b/library/cpp/json/fast_sax/parser.rl6 index edb4e9ee1b..b7280594d2 100644 --- a/library/cpp/json/fast_sax/parser.rl6 +++ b/library/cpp/json/fast_sax/parser.rl6 @@ -41,7 +41,7 @@ struct TParserCtx { return b && e && b <= e; } - bool OnError(TStringBuf reason = TStringBuf(""), bool end = false) const { + bool OnError(TStringBuf reason = TStringBuf(""), bool end = false) const { size_t off = 0; TStringBuf token; diff --git a/library/cpp/json/flex_buffers/cvt.cpp b/library/cpp/json/flex_buffers/cvt.cpp index fee0cea0b8..c0c8d97edb 100644 --- a/library/cpp/json/flex_buffers/cvt.cpp +++ b/library/cpp/json/flex_buffers/cvt.cpp @@ -19,49 +19,49 @@ namespace { { } - bool OnNull() override { + bool OnNull() override { B.Null(); return true; } - bool OnBoolean(bool v) override { + bool OnBoolean(bool v) override { B.Bool(v); return true; } - bool OnInteger(long long v) override { + bool OnInteger(long long v) override { B.Int(v); return true; } - bool OnUInteger(unsigned long long v) override { + bool OnUInteger(unsigned long long v) override { B.UInt(v); return true; } - bool OnDouble(double v) override { + bool OnDouble(double v) override { B.Double(v); return true; } - bool OnString(const TStringBuf& v) override { + bool OnString(const TStringBuf& v) override { B.String(v.data(), v.size()); return true; } - bool OnOpenMap() override { + bool OnOpenMap() override { S.push_back(B.StartMap()); return true; } - bool OnMapKey(const TStringBuf& v) override { + bool OnMapKey(const TStringBuf& v) override { auto iv = P.AppendCString(v); B.Key(iv.data(), iv.size()); @@ -69,33 +69,33 @@ namespace { return true; } - bool OnCloseMap() override { + bool OnCloseMap() override { B.EndMap(PopOffset()); return true; } - bool OnOpenArray() override { + bool OnOpenArray() override { S.push_back(B.StartVector()); return true; } - bool OnCloseArray() override { + bool OnCloseArray() override { B.EndVector(PopOffset(), false, false); return true; } - bool OnStringNoCopy(const TStringBuf& s) override { + bool OnStringNoCopy(const TStringBuf& s) override { return OnString(s); } - bool OnMapKeyNoCopy(const TStringBuf& s) override { + bool OnMapKeyNoCopy(const TStringBuf& s) override { return OnMapKey(s); } - bool OnEnd() override { + bool OnEnd() override { B.Finish(); Y_ENSURE(S.empty()); @@ -103,7 +103,7 @@ namespace { return true; } - void OnError(size_t, TStringBuf reason) override { + void OnError(size_t, TStringBuf reason) override { ythrow yexception() << reason; } diff --git a/library/cpp/json/json_prettifier.cpp b/library/cpp/json/json_prettifier.cpp index bb16aab44e..e0b5bedf31 100644 --- a/library/cpp/json/json_prettifier.cpp +++ b/library/cpp/json/json_prettifier.cpp @@ -161,11 +161,11 @@ namespace NJson { } bool OnNull() override { - return WriteVal(TStringBuf("null")); + return WriteVal(TStringBuf("null")); } bool OnBoolean(bool v) override { - return WriteVal(v ? TStringBuf("true") : TStringBuf("false")); + return WriteVal(v ? TStringBuf("true") : TStringBuf("false")); } bool OnInteger(long long i) override { diff --git a/library/cpp/json/json_reader.cpp b/library/cpp/json/json_reader.cpp index 072c8deafe..8c03656685 100644 --- a/library/cpp/json/json_reader.cpp +++ b/library/cpp/json/json_reader.cpp @@ -14,9 +14,9 @@ namespace NJson { namespace { TString PrintError(const rapidjson::ParseResult& result) { - return TStringBuilder() << TStringBuf("Offset: ") << result.Offset() - << TStringBuf(", Code: ") << (int)result.Code() - << TStringBuf(", Error: ") << GetParseError_En(result.Code()); + return TStringBuilder() << TStringBuf("Offset: ") << result.Offset() + << TStringBuf(", Code: ") << (int)result.Code() + << TStringBuf(", Error: ") << GetParseError_En(result.Code()); } } diff --git a/library/cpp/json/writer/json.cpp b/library/cpp/json/writer/json.cpp index 02370c2d79..b5c0d517ea 100644 --- a/library/cpp/json/writer/json.cpp +++ b/library/cpp/json/writer/json.cpp @@ -214,13 +214,13 @@ namespace NJsonWriter { } TValueContext TBuf::WriteNull() { - UnsafeWriteValue(TStringBuf("null")); + UnsafeWriteValue(TStringBuf("null")); return TValueContext(*this); } TValueContext TBuf::WriteBool(bool b) { - constexpr TStringBuf trueVal = "true"; - constexpr TStringBuf falseVal = "false"; + constexpr TStringBuf trueVal = "true"; + constexpr TStringBuf falseVal = "false"; UnsafeWriteValue(b ? trueVal : falseVal); return TValueContext(*this); } @@ -323,7 +323,7 @@ namespace NJsonWriter { #define MATCH(sym, string) \ case sym: \ UnsafeWriteRawBytes(beg, cur - beg); \ - UnsafeWriteRawBytes(TStringBuf(string)); \ + UnsafeWriteRawBytes(TStringBuf(string)); \ return true inline bool TBuf::EscapedWriteChar(const char* beg, const char* cur, EHtmlEscapeMode hem) { diff --git a/library/cpp/json/writer/json_value.cpp b/library/cpp/json/writer/json_value.cpp index c61e8d1dc4..e22f0a0b38 100644 --- a/library/cpp/json/writer/json_value.cpp +++ b/library/cpp/json/writer/json_value.cpp @@ -531,7 +531,7 @@ namespace NJson { case JSON_NULL: case JSON_UNDEFINED: default: - return false; + return false; case JSON_BOOLEAN: return Value.Boolean; } diff --git a/library/cpp/lfalloc/lf_allocX64.h b/library/cpp/lfalloc/lf_allocX64.h index fd2a906d6f..41284233e5 100644 --- a/library/cpp/lfalloc/lf_allocX64.h +++ b/library/cpp/lfalloc/lf_allocX64.h @@ -31,7 +31,7 @@ #define _win_ #define Y_FORCE_INLINE __forceinline -using TAtomic = volatile long; +using TAtomic = volatile long; static inline long AtomicAdd(TAtomic& a, long b) { return _InterlockedExchangeAdd(&a, b) + b; diff --git a/library/cpp/linear_regression/linear_regression.cpp b/library/cpp/linear_regression/linear_regression.cpp index 150f9d214e..a48eb9661a 100644 --- a/library/cpp/linear_regression/linear_regression.cpp +++ b/library/cpp/linear_regression/linear_regression.cpp @@ -369,7 +369,7 @@ namespace { } namespace { - inline double ArgMinPrecise(std::function<double(double)> func, double left, double right) { + inline double ArgMinPrecise(std::function<double(double)> func, double left, double right) { const size_t intervalsCount = 20; double points[intervalsCount + 1]; double values[intervalsCount + 1]; diff --git a/library/cpp/linear_regression/linear_regression.h b/library/cpp/linear_regression/linear_regression.h index e57de5ff6c..a7c56ac3cb 100644 --- a/library/cpp/linear_regression/linear_regression.h +++ b/library/cpp/linear_regression/linear_regression.h @@ -253,7 +253,7 @@ private: public: Y_SAVELOAD_DEFINE(TransformationType, TransformationParameters); - TFeaturesTransformer() = default; + TFeaturesTransformer() = default; TFeaturesTransformer(const ETransformationType transformationType, const TTransformationParameters transformationParameters) diff --git a/library/cpp/linear_regression/unimodal.h b/library/cpp/linear_regression/unimodal.h index e11b1118f6..48d2f3f8e4 100644 --- a/library/cpp/linear_regression/unimodal.h +++ b/library/cpp/linear_regression/unimodal.h @@ -19,7 +19,7 @@ struct TOptimizationParams { size_t IterationsCount = 1000; - TOptimizationParams() = default; + TOptimizationParams() = default; static TOptimizationParams Default(const TVector<double>& values) { TOptimizationParams optimizationParams; diff --git a/library/cpp/logger/global/common.cpp b/library/cpp/logger/global/common.cpp index 4fb05c19b4..cfb8ccfe2d 100644 --- a/library/cpp/logger/global/common.cpp +++ b/library/cpp/logger/global/common.cpp @@ -15,7 +15,7 @@ namespace NLoggingImpl { TString newPath = Sprintf("%s_%s_%" PRIu64, logType.data(), NLoggingImpl::GetLocalTimeSSimple().data(), static_cast<ui64>(Now().MicroSeconds())); TFsPath(logType).RenameTo(newPath); } - if (startAsDaemon && (logType == "console"sv || logType == "cout"sv || logType == "cerr"sv)) { + if (startAsDaemon && (logType == "console"sv || logType == "cout"sv || logType == "cerr"sv)) { logType = "null"; } diff --git a/library/cpp/logger/global/common.h b/library/cpp/logger/global/common.h index 7dcf650dec..c794933216 100644 --- a/library/cpp/logger/global/common.h +++ b/library/cpp/logger/global/common.h @@ -69,7 +69,7 @@ namespace NLoggingImpl { TString GetLocalTimeSSimple(); // Returns correct log type to use - TString PrepareToOpenLog(TString logType, int logLevel, bool rotation, bool startAsDaemon); + TString PrepareToOpenLog(TString logType, int logLevel, bool rotation, bool startAsDaemon); template <class TLoggerType> void InitLogImpl(TString logType, const int logLevel, const bool rotation, const bool startAsDaemon) { @@ -78,11 +78,11 @@ namespace NLoggingImpl { } struct TLogRecordContext { - constexpr TLogRecordContext(const TSourceLocation& sourceLocation, TStringBuf customMessage, ELogPriority priority) - : SourceLocation(sourceLocation) - , CustomMessage(customMessage) - , Priority(priority) - {} + constexpr TLogRecordContext(const TSourceLocation& sourceLocation, TStringBuf customMessage, ELogPriority priority) + : SourceLocation(sourceLocation) + , CustomMessage(customMessage) + , Priority(priority) + {} TSourceLocation SourceLocation; TStringBuf CustomMessage; diff --git a/library/cpp/lwtrace/rwspinlock.h b/library/cpp/lwtrace/rwspinlock.h index 7c518ec49e..9d467cd616 100644 --- a/library/cpp/lwtrace/rwspinlock.h +++ b/library/cpp/lwtrace/rwspinlock.h @@ -84,5 +84,5 @@ struct TRWSpinLockWriteOps { } }; -using TReadSpinLockGuard = TGuard<TRWSpinLock, TRWSpinLockReadOps>; -using TWriteSpinLockGuard = TGuard<TRWSpinLock, TRWSpinLockWriteOps>; +using TReadSpinLockGuard = TGuard<TRWSpinLock, TRWSpinLockReadOps>; +using TWriteSpinLockGuard = TGuard<TRWSpinLock, TRWSpinLockWriteOps>; diff --git a/library/cpp/lwtrace/trace_ut.cpp b/library/cpp/lwtrace/trace_ut.cpp index cb03e4fbde..e42d00e4cb 100644 --- a/library/cpp/lwtrace/trace_ut.cpp +++ b/library/cpp/lwtrace/trace_ut.cpp @@ -462,7 +462,7 @@ Y_UNIT_TEST_SUITE(LWTraceTrace) { : TCustomActionExecutor(probe, false /* not destructive */) {} private: - bool DoExecute(TOrbit&, const TParams& params) override { + bool DoExecute(TOrbit&, const TParams& params) override { (void)params; nCustomActionsCalls++; return true; diff --git a/library/cpp/malloc/api/malloc.cpp b/library/cpp/malloc/api/malloc.cpp index eed1c58a38..a319878b25 100644 --- a/library/cpp/malloc/api/malloc.cpp +++ b/library/cpp/malloc/api/malloc.cpp @@ -4,15 +4,15 @@ #include "malloc.h" namespace { - bool SetEmptyParam(const char*, const char*) { + bool SetEmptyParam(const char*, const char*) { return false; } - const char* GetEmptyParam(const char*) { + const char* GetEmptyParam(const char*) { return nullptr; } - bool CheckEmptyParam(const char*, bool defaultValue) { + bool CheckEmptyParam(const char*, bool defaultValue) { return defaultValue; } } diff --git a/library/cpp/malloc/jemalloc/malloc-info.cpp b/library/cpp/malloc/jemalloc/malloc-info.cpp index 2643ca4766..655515b8c2 100644 --- a/library/cpp/malloc/jemalloc/malloc-info.cpp +++ b/library/cpp/malloc/jemalloc/malloc-info.cpp @@ -16,7 +16,7 @@ TMallocInfo NMalloc::MallocInfo() { #include <contrib/libs/jemalloc/include/jemalloc/jemalloc.h> namespace { - bool JESetParam(const char* param, const char*) { + bool JESetParam(const char* param, const char*) { if (param) { if (strcmp(param, "j:reset_epoch") == 0) { uint64_t epoch = 1; diff --git a/library/cpp/messagebus/coreconn.h b/library/cpp/messagebus/coreconn.h index fca228d82e..c509af9055 100644 --- a/library/cpp/messagebus/coreconn.h +++ b/library/cpp/messagebus/coreconn.h @@ -54,7 +54,7 @@ namespace NBus { struct TMaxConnectedException: public yexception { TMaxConnectedException(unsigned maxConnect) { yexception& exc = *this; - exc << TStringBuf("Exceeded maximum number of outstanding connections: "); + exc << TStringBuf("Exceeded maximum number of outstanding connections: "); exc << maxConnect; } }; diff --git a/library/cpp/messagebus/rain_check/http/client_ut.cpp b/library/cpp/messagebus/rain_check/http/client_ut.cpp index 1628114391..bb5560debd 100644 --- a/library/cpp/messagebus/rain_check/http/client_ut.cpp +++ b/library/cpp/messagebus/rain_check/http/client_ut.cpp @@ -182,24 +182,24 @@ Y_UNIT_TEST_SUITE(RainCheckHttpClient) { UNIT_ASSERT(!!TryGetHttpCodeFromErrorDescription(line)); \ UNIT_ASSERT_EQUAL(*TryGetHttpCodeFromErrorDescription(line), code) - CHECK_VALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.0 200 Some random message"), 200); - CHECK_VALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.0 404 Some random message"), 404); - CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.0 100 Some random message"), 100); - CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.0 105)"), 105); - CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.1 2004 Some random message"), 200); + CHECK_VALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.0 200 Some random message"), 200); + CHECK_VALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.0 404 Some random message"), 404); + CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.0 100 Some random message"), 100); + CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.0 105)"), 105); + CHECK_VALID_LINE(TStringBuf("request failed(HTTP/1.1 2004 Some random message"), 200); #undef CHECK_VALID_LINE #define CHECK_INVALID_LINE(line) \ UNIT_ASSERT_NO_EXCEPTION(TryGetHttpCodeFromErrorDescription(line)); \ UNIT_ASSERT(!TryGetHttpCodeFromErrorDescription(line)) - CHECK_INVALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.1 1 Some random message")); - CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.0 asdf Some random message")); - CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200 Some random message")); - CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.0 2x00 Some random message")); - CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200 Some random message")); - CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200")); - CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.1 3334 Some random message")); + CHECK_INVALID_LINE(TStringBuf("library/cpp/neh/http.cpp:<LINE>: request failed(HTTP/1.1 1 Some random message")); + CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.0 asdf Some random message")); + CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200 Some random message")); + CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.0 2x00 Some random message")); + CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200 Some random message")); + CHECK_INVALID_LINE(TStringBuf("HTTP/1.0 200")); + CHECK_INVALID_LINE(TStringBuf("request failed(HTTP/1.1 3334 Some random message")); #undef CHECK_INVALID_LINE } } diff --git a/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp b/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp index 51d75762f6..44f515d1c3 100644 --- a/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp +++ b/library/cpp/messagebus/rain_check/http/http_code_extractor.cpp @@ -14,9 +14,9 @@ namespace NRainCheck { // "library/cpp/neh/http.cpp:<LINE>: request failed(<FIRST-HTTP-RESPONSE-LINE>)" // (see library/cpp/neh/http.cpp:625). So, we will try to parse this message and // find out HttpCode in it. It is bad temporary solution, but we have no choice. - const TStringBuf SUBSTR = "request failed("; + const TStringBuf SUBSTR = "request failed("; const size_t SUBSTR_LEN = SUBSTR.size(); - const size_t FIRST_LINE_LEN = TStringBuf("HTTP/1.X NNN").size(); + const size_t FIRST_LINE_LEN = TStringBuf("HTTP/1.X NNN").size(); TMaybe<HttpCodes> httpCode; diff --git a/library/cpp/messagebus/remote_connection.cpp b/library/cpp/messagebus/remote_connection.cpp index 22932569db..3066a6ccea 100644 --- a/library/cpp/messagebus/remote_connection.cpp +++ b/library/cpp/messagebus/remote_connection.cpp @@ -676,14 +676,14 @@ namespace NBus { } namespace { - inline void WriteHeader(const TBusHeader& header, TBuffer& data) { + inline void WriteHeader(const TBusHeader& header, TBuffer& data) { data.Reserve(data.Size() + sizeof(TBusHeader)); /// \todo hton instead of memcpy memcpy(data.Data() + data.Size(), &header, sizeof(TBusHeader)); data.Advance(sizeof(TBusHeader)); } - inline void WriteDummyHeader(TBuffer& data) { + inline void WriteDummyHeader(TBuffer& data) { data.Resize(data.Size() + sizeof(TBusHeader)); } diff --git a/library/cpp/messagebus/test/helper/example.cpp b/library/cpp/messagebus/test/helper/example.cpp index 7c6d704042..985c135b95 100644 --- a/library/cpp/messagebus/test/helper/example.cpp +++ b/library/cpp/messagebus/test/helper/example.cpp @@ -8,11 +8,11 @@ using namespace NBus; using namespace NBus::NTest; static void FillWithJunk(TArrayRef<char> data) { - TStringBuf junk = + TStringBuf junk = "01234567890123456789012345678901234567890123456789012345678901234567890123456789" "01234567890123456789012345678901234567890123456789012345678901234567890123456789" "01234567890123456789012345678901234567890123456789012345678901234567890123456789" - "01234567890123456789012345678901234567890123456789012345678901234567890123456789"; + "01234567890123456789012345678901234567890123456789012345678901234567890123456789"; for (size_t i = 0; i < data.size(); i += junk.size()) { memcpy(data.data() + i, junk.data(), Min(junk.size(), data.size() - i)); diff --git a/library/cpp/messagebus/test/perftest/perftest.cpp b/library/cpp/messagebus/test/perftest/perftest.cpp index 8489319278..b8f79b9220 100644 --- a/library/cpp/messagebus/test/perftest/perftest.cpp +++ b/library/cpp/messagebus/test/perftest/perftest.cpp @@ -125,8 +125,8 @@ TConfig Config; //////////////////////////////////////////////////////////////// /// \brief Fast message -using TPerftestRequest = TBusBufferMessage<TPerftestRequestRecord, 77>; -using TPerftestResponse = TBusBufferMessage<TPerftestResponseRecord, 79>; +using TPerftestRequest = TBusBufferMessage<TPerftestRequestRecord, 77>; +using TPerftestResponse = TBusBufferMessage<TPerftestResponseRecord, 79>; static size_t RequestSize() { return RandomNumber<size_t>(TheConfig->MessageSize * 2 + 1); diff --git a/library/cpp/messagebus/test/ut/one_way_ut.cpp b/library/cpp/messagebus/test/ut/one_way_ut.cpp index 9c21227e2b..5ff09b74ed 100644 --- a/library/cpp/messagebus/test/ut/one_way_ut.cpp +++ b/library/cpp/messagebus/test/ut/one_way_ut.cpp @@ -64,7 +64,7 @@ struct NullClient : TBusClientHandlerError { Session->RegisterService("localhost"); } - ~NullClient() override { + ~NullClient() override { Session->Shutdown(); } @@ -106,7 +106,7 @@ public: Session = TBusServerSession::Create(&Proto, this, sessionConfig, Queue); } - ~NullServer() override { + ~NullServer() override { Session->Shutdown(); } diff --git a/library/cpp/messagebus/www/www.cpp b/library/cpp/messagebus/www/www.cpp index 62ec241d85..af3ed2761c 100644 --- a/library/cpp/messagebus/www/www.cpp +++ b/library/cpp/messagebus/www/www.cpp @@ -121,23 +121,23 @@ namespace { } namespace { - TString RootHref() { + TString RootHref() { return ConcatStrings("?"); } - TString QueueHref(TStringBuf name) { + TString QueueHref(TStringBuf name) { return ConcatStrings("?q=", name); } - TString ServerSessionHref(TStringBuf name) { + TString ServerSessionHref(TStringBuf name) { return ConcatStrings("?ss=", name); } - TString ClientSessionHref(TStringBuf name) { + TString ClientSessionHref(TStringBuf name) { return ConcatStrings("?cs=", name); } - TString OldModuleHref(TStringBuf name) { + TString OldModuleHref(TStringBuf name) { return ConcatStrings("?om=", name); } @@ -147,19 +147,19 @@ namespace { } */ - void QueueLink(TStringBuf name) { + void QueueLink(TStringBuf name) { A(QueueHref(name), name); } - void ServerSessionLink(TStringBuf name) { + void ServerSessionLink(TStringBuf name) { A(ServerSessionHref(name), name); } - void ClientSessionLink(TStringBuf name) { + void ClientSessionLink(TStringBuf name) { A(ClientSessionHref(name), name); } - void OldModuleLink(TStringBuf name) { + void OldModuleLink(TStringBuf name) { A(OldModuleHref(name), name); } diff --git a/library/cpp/monlib/dynamic_counters/contention_ut.cpp b/library/cpp/monlib/dynamic_counters/contention_ut.cpp index 8798044ee3..575a4f0e6d 100644 --- a/library/cpp/monlib/dynamic_counters/contention_ut.cpp +++ b/library/cpp/monlib/dynamic_counters/contention_ut.cpp @@ -24,7 +24,7 @@ Y_UNIT_TEST_SUITE(TDynamicCountersContentionTest) { Thread.Start(); } - ~TConsumer() override { + ~TConsumer() override { Thread.Join(); } diff --git a/library/cpp/monlib/dynamic_counters/counters.cpp b/library/cpp/monlib/dynamic_counters/counters.cpp index 3635d87d0d..a1e7883c1d 100644 --- a/library/cpp/monlib/dynamic_counters/counters.cpp +++ b/library/cpp/monlib/dynamic_counters/counters.cpp @@ -44,7 +44,7 @@ namespace { } } -static constexpr TStringBuf INDENT = " "; +static constexpr TStringBuf INDENT = " "; TDynamicCounters::TDynamicCounters(EVisibility vis) { @@ -223,10 +223,10 @@ void TDynamicCounters::OutputPlainText(IOutputStream& os, const TString& indent) auto snapshot = histogram->Snapshot(); for (ui32 i = 0, count = snapshot->Count(); i < count; i++) { - os << indent << INDENT << TStringBuf("bin="); + os << indent << INDENT << TStringBuf("bin="); TBucketBound bound = snapshot->UpperBound(i); if (bound == Max<TBucketBound>()) { - os << TStringBuf("inf"); + os << TStringBuf("inf"); } else { os << bound; } diff --git a/library/cpp/monlib/dynamic_counters/golovan_page.cpp b/library/cpp/monlib/dynamic_counters/golovan_page.cpp index 49cf2d39bb..67680484c9 100644 --- a/library/cpp/monlib/dynamic_counters/golovan_page.cpp +++ b/library/cpp/monlib/dynamic_counters/golovan_page.cpp @@ -22,7 +22,7 @@ public: FirstCounter = true; } - void OnCounter(const TString&, const TString& value, const TCounterForPtr* counter) override { + void OnCounter(const TString&, const TString& value, const TCounterForPtr* counter) override { if (FirstCounter) { FirstCounter = false; } else { @@ -42,14 +42,14 @@ public: void OnHistogram(const TString&, const TString&, IHistogramSnapshotPtr, bool) override { } - void OnGroupBegin(const TString&, const TString& value, const TDynamicCounters*) override { + void OnGroupBegin(const TString&, const TString& value, const TDynamicCounters*) override { prefix += value; if (!value.empty()) { prefix += "_"; } } - void OnGroupEnd(const TString&, const TString&, const TDynamicCounters*) override { + void OnGroupEnd(const TString&, const TString&, const TDynamicCounters*) override { prefix = ""; } diff --git a/library/cpp/monlib/dynamic_counters/page.cpp b/library/cpp/monlib/dynamic_counters/page.cpp index 5124a47bb3..eecf536623 100644 --- a/library/cpp/monlib/dynamic_counters/page.cpp +++ b/library/cpp/monlib/dynamic_counters/page.cpp @@ -15,9 +15,9 @@ namespace { } TMaybe<EFormat> ParseFormat(TStringBuf str) { - if (str == TStringBuf("json")) { + if (str == TStringBuf("json")) { return EFormat::JSON; - } else if (str == TStringBuf("spack")) { + } else if (str == TStringBuf("spack")) { return EFormat::SPACK; } else if (str == TStringBuf("prometheus")) { return EFormat::PROMETHEUS; @@ -46,7 +46,7 @@ void TDynamicCountersPage::Output(NMonitoring::IMonHttpRequest& request) { parts.pop_back(); } - if (!parts.empty() && parts.back() == TStringBuf("private")) { + if (!parts.empty() && parts.back() == TStringBuf("private")) { visibility = TCountableBase::EVisibility::Private; parts.pop_back(); } diff --git a/library/cpp/monlib/encode/format.cpp b/library/cpp/monlib/encode/format.cpp index 400ce5a643..d366b32681 100644 --- a/library/cpp/monlib/encode/format.cpp +++ b/library/cpp/monlib/encode/format.cpp @@ -116,17 +116,17 @@ template <> NMonitoring::EFormat FromStringImpl<NMonitoring::EFormat>(const char* str, size_t len) { using NMonitoring::EFormat; TStringBuf value(str, len); - if (value == TStringBuf("SPACK")) { + if (value == TStringBuf("SPACK")) { return EFormat::SPACK; - } else if (value == TStringBuf("JSON")) { + } else if (value == TStringBuf("JSON")) { return EFormat::JSON; - } else if (value == TStringBuf("PROTOBUF")) { + } else if (value == TStringBuf("PROTOBUF")) { return EFormat::PROTOBUF; - } else if (value == TStringBuf("TEXT")) { + } else if (value == TStringBuf("TEXT")) { return EFormat::TEXT; - } else if (value == TStringBuf("PROMETHEUS")) { + } else if (value == TStringBuf("PROMETHEUS")) { return EFormat::PROMETHEUS; - } else if (value == TStringBuf("UNKNOWN")) { + } else if (value == TStringBuf("UNKNOWN")) { return EFormat::UNKNOWN; } ythrow yexception() << "unknown format: " << value; @@ -137,22 +137,22 @@ void Out<NMonitoring::EFormat>(IOutputStream& o, NMonitoring::EFormat f) { using NMonitoring::EFormat; switch (f) { case EFormat::SPACK: - o << TStringBuf("SPACK"); + o << TStringBuf("SPACK"); return; case EFormat::JSON: - o << TStringBuf("JSON"); + o << TStringBuf("JSON"); return; case EFormat::PROTOBUF: - o << TStringBuf("PROTOBUF"); + o << TStringBuf("PROTOBUF"); return; case EFormat::TEXT: - o << TStringBuf("TEXT"); + o << TStringBuf("TEXT"); return; case EFormat::PROMETHEUS: - o << TStringBuf("PROMETHEUS"); + o << TStringBuf("PROMETHEUS"); return; case EFormat::UNKNOWN: - o << TStringBuf("UNKNOWN"); + o << TStringBuf("UNKNOWN"); return; } @@ -163,15 +163,15 @@ template <> NMonitoring::ECompression FromStringImpl<NMonitoring::ECompression>(const char* str, size_t len) { using NMonitoring::ECompression; TStringBuf value(str, len); - if (value == TStringBuf("IDENTITY")) { + if (value == TStringBuf("IDENTITY")) { return ECompression::IDENTITY; - } else if (value == TStringBuf("ZLIB")) { + } else if (value == TStringBuf("ZLIB")) { return ECompression::ZLIB; - } else if (value == TStringBuf("LZ4")) { + } else if (value == TStringBuf("LZ4")) { return ECompression::LZ4; - } else if (value == TStringBuf("ZSTD")) { + } else if (value == TStringBuf("ZSTD")) { return ECompression::ZSTD; - } else if (value == TStringBuf("UNKNOWN")) { + } else if (value == TStringBuf("UNKNOWN")) { return ECompression::UNKNOWN; } ythrow yexception() << "unknown compression: " << value; @@ -182,19 +182,19 @@ void Out<NMonitoring::ECompression>(IOutputStream& o, NMonitoring::ECompression using NMonitoring::ECompression; switch (c) { case ECompression::IDENTITY: - o << TStringBuf("IDENTITY"); + o << TStringBuf("IDENTITY"); return; case ECompression::ZLIB: - o << TStringBuf("ZLIB"); + o << TStringBuf("ZLIB"); return; case ECompression::LZ4: - o << TStringBuf("LZ4"); + o << TStringBuf("LZ4"); return; case ECompression::ZSTD: - o << TStringBuf("ZSTD"); + o << TStringBuf("ZSTD"); return; case ECompression::UNKNOWN: - o << TStringBuf("UNKNOWN"); + o << TStringBuf("UNKNOWN"); return; } diff --git a/library/cpp/monlib/encode/format.h b/library/cpp/monlib/encode/format.h index 495d42d786..d0e2143e3a 100644 --- a/library/cpp/monlib/encode/format.h +++ b/library/cpp/monlib/encode/format.h @@ -4,18 +4,18 @@ namespace NMonitoring { namespace NFormatContenType { - constexpr TStringBuf TEXT = "application/x-solomon-txt"; - constexpr TStringBuf JSON = "application/json"; - constexpr TStringBuf PROTOBUF = "application/x-solomon-pb"; - constexpr TStringBuf SPACK = "application/x-solomon-spack"; - constexpr TStringBuf PROMETHEUS = "text/plain"; + constexpr TStringBuf TEXT = "application/x-solomon-txt"; + constexpr TStringBuf JSON = "application/json"; + constexpr TStringBuf PROTOBUF = "application/x-solomon-pb"; + constexpr TStringBuf SPACK = "application/x-solomon-spack"; + constexpr TStringBuf PROMETHEUS = "text/plain"; } namespace NFormatContentEncoding { - constexpr TStringBuf IDENTITY = "identity"; - constexpr TStringBuf ZLIB = "zlib"; - constexpr TStringBuf LZ4 = "lz4"; - constexpr TStringBuf ZSTD = "zstd"; + constexpr TStringBuf IDENTITY = "identity"; + constexpr TStringBuf ZLIB = "zlib"; + constexpr TStringBuf LZ4 = "lz4"; + constexpr TStringBuf ZSTD = "zstd"; } /** diff --git a/library/cpp/monlib/encode/json/json_decoder.cpp b/library/cpp/monlib/encode/json/json_decoder.cpp index d44ff5fd28..8777caa021 100644 --- a/library/cpp/monlib/encode/json/json_decoder.cpp +++ b/library/cpp/monlib/encode/json/json_decoder.cpp @@ -172,11 +172,11 @@ private: }; std::pair<double, bool> ParseSpecDouble(TStringBuf string) { - if (string == TStringBuf("nan") || string == TStringBuf("NaN")) { + if (string == TStringBuf("nan") || string == TStringBuf("NaN")) { return {std::numeric_limits<double>::quiet_NaN(), true}; - } else if (string == TStringBuf("inf") || string == TStringBuf("Infinity")) { + } else if (string == TStringBuf("inf") || string == TStringBuf("Infinity")) { return {std::numeric_limits<double>::infinity(), true}; - } else if (string == TStringBuf("-inf") || string == TStringBuf("-Infinity")) { + } else if (string == TStringBuf("-inf") || string == TStringBuf("-Infinity")) { return {-std::numeric_limits<double>::infinity(), true}; } else { return {0, false}; @@ -762,7 +762,7 @@ if (Y_UNLIKELY(!(CONDITION))) { \ break; case TState::METRIC_MODE: - if (value == TStringBuf("deriv")) { + if (value == TStringBuf("deriv")) { LastMetric_.Type = EMetricType::RATE; } State_.ToPrev(); @@ -814,11 +814,11 @@ if (Y_UNLIKELY(!(CONDITION))) { \ bool OnMapKey(const TStringBuf& key) override { switch (State_.Current()) { case TState::ROOT_OBJECT: - if (key == TStringBuf("commonLabels") || key == TStringBuf("labels")) { + if (key == TStringBuf("commonLabels") || key == TStringBuf("labels")) { State_.ToNext(TState::COMMON_LABELS); - } else if (key == TStringBuf("ts")) { + } else if (key == TStringBuf("ts")) { State_.ToNext(TState::COMMON_TS); - } else if (key == TStringBuf("sensors") || key == TStringBuf("metrics")) { + } else if (key == TStringBuf("sensors") || key == TStringBuf("metrics")) { State_.ToNext(TState::METRICS_ARRAY); } break; @@ -829,36 +829,36 @@ if (Y_UNLIKELY(!(CONDITION))) { \ break; case TState::METRIC_OBJECT: - if (key == TStringBuf("labels")) { + if (key == TStringBuf("labels")) { State_.ToNext(TState::METRIC_LABELS); } else if (key == TStringBuf("name")) { State_.ToNext(TState::METRIC_NAME); - } else if (key == TStringBuf("ts")) { + } else if (key == TStringBuf("ts")) { PARSE_ENSURE(!LastMetric_.SeenTimeseries, "mixed timeseries and ts attributes"); LastMetric_.SeenTsOrValue = true; State_.ToNext(TState::METRIC_TS); - } else if (key == TStringBuf("value")) { + } else if (key == TStringBuf("value")) { PARSE_ENSURE(!LastMetric_.SeenTimeseries, "mixed timeseries and value attributes"); LastMetric_.SeenTsOrValue = true; State_.ToNext(TState::METRIC_VALUE); - } else if (key == TStringBuf("timeseries")) { + } else if (key == TStringBuf("timeseries")) { PARSE_ENSURE(!LastMetric_.SeenTsOrValue, "mixed timeseries and ts/value attributes"); LastMetric_.SeenTimeseries = true; State_.ToNext(TState::METRIC_TIMESERIES); - } else if (key == TStringBuf("mode")) { + } else if (key == TStringBuf("mode")) { State_.ToNext(TState::METRIC_MODE); - } else if (key == TStringBuf("kind") || key == TStringBuf("type")) { + } else if (key == TStringBuf("kind") || key == TStringBuf("type")) { State_.ToNext(TState::METRIC_TYPE); - } else if (key == TStringBuf("hist")) { + } else if (key == TStringBuf("hist")) { State_.ToNext(TState::METRIC_HIST); - } else if (key == TStringBuf("summary")) { + } else if (key == TStringBuf("summary")) { State_.ToNext(TState::METRIC_DSUMMARY); - } else if (key == TStringBuf("log_hist")) { + } else if (key == TStringBuf("log_hist")) { State_.ToNext(TState::METRIC_LOG_HIST); - } else if (key == TStringBuf("memOnly")) { + } else if (key == TStringBuf("memOnly")) { // deprecated. Skip it without errors for backward compatibility } else { ErrorMsg_ = TStringBuilder() << "unexpected key \"" << key << "\" in a metric schema"; @@ -867,51 +867,51 @@ if (Y_UNLIKELY(!(CONDITION))) { \ break; case TState::METRIC_TIMESERIES: - if (key == TStringBuf("ts")) { + if (key == TStringBuf("ts")) { State_.ToNext(TState::METRIC_TS); - } else if (key == TStringBuf("value")) { + } else if (key == TStringBuf("value")) { State_.ToNext(TState::METRIC_VALUE); - } else if (key == TStringBuf("hist")) { + } else if (key == TStringBuf("hist")) { State_.ToNext(TState::METRIC_HIST); - } else if (key == TStringBuf("summary")) { + } else if (key == TStringBuf("summary")) { State_.ToNext(TState::METRIC_DSUMMARY); - } else if (key == TStringBuf("log_hist")) { + } else if (key == TStringBuf("log_hist")) { State_.ToNext(TState::METRIC_LOG_HIST); } break; case TState::METRIC_HIST: - if (key == TStringBuf("bounds")) { + if (key == TStringBuf("bounds")) { State_.ToNext(TState::METRIC_HIST_BOUNDS); - } else if (key == TStringBuf("buckets")) { + } else if (key == TStringBuf("buckets")) { State_.ToNext(TState::METRIC_HIST_BUCKETS); - } else if (key == TStringBuf("inf")) { + } else if (key == TStringBuf("inf")) { State_.ToNext(TState::METRIC_HIST_INF); } break; case TState::METRIC_LOG_HIST: - if (key == TStringBuf("base")) { + if (key == TStringBuf("base")) { State_.ToNext(TState::METRIC_LOG_HIST_BASE); - } else if (key == TStringBuf("zeros_count")) { + } else if (key == TStringBuf("zeros_count")) { State_.ToNext(TState::METRIC_LOG_HIST_ZEROS); - } else if (key == TStringBuf("start_power")) { + } else if (key == TStringBuf("start_power")) { State_.ToNext(TState::METRIC_LOG_HIST_START_POWER); - } else if (key == TStringBuf("buckets")) { + } else if (key == TStringBuf("buckets")) { State_.ToNext(TState::METRIC_LOG_HIST_BUCKETS); } break; case TState::METRIC_DSUMMARY: - if (key == TStringBuf("sum")) { + if (key == TStringBuf("sum")) { State_.ToNext(TState::METRIC_DSUMMARY_SUM); - } else if (key == TStringBuf("min")) { + } else if (key == TStringBuf("min")) { State_.ToNext(TState::METRIC_DSUMMARY_MIN); - } else if (key == TStringBuf("max")) { + } else if (key == TStringBuf("max")) { State_.ToNext(TState::METRIC_DSUMMARY_MAX); - } else if (key == TStringBuf("last")) { + } else if (key == TStringBuf("last")) { State_.ToNext(TState::METRIC_DSUMMARY_LAST); - } else if (key == TStringBuf("count")) { + } else if (key == TStringBuf("count")) { State_.ToNext(TState::METRIC_DSUMMARY_COUNT); } diff --git a/library/cpp/monlib/encode/json/json_decoder_ut.cpp b/library/cpp/monlib/encode/json/json_decoder_ut.cpp index 4464e1d26a..6c047f96e5 100644 --- a/library/cpp/monlib/encode/json/json_decoder_ut.cpp +++ b/library/cpp/monlib/encode/json/json_decoder_ut.cpp @@ -15,15 +15,15 @@ enum EJsonPart : ui8 { }; constexpr std::array<TStringBuf, 3> JSON_PARTS = { - TStringBuf(R"("metrics": [{ + TStringBuf(R"("metrics": [{ "labels": { "key": "value" }, "type": "GAUGE", "value": 123 }])"), - TStringBuf(R"("ts": 1)"), + TStringBuf(R"("ts": 1)"), - TStringBuf(R"("commonLabels": { + TStringBuf(R"("commonLabels": { "key1": "value1", "key2": "value2" })"), @@ -52,10 +52,10 @@ void ValidateCommonParts(TCommonParts&& commonParts, bool checkLabels, bool chec if (checkLabels) { auto& labels = commonParts.CommonLabels; UNIT_ASSERT_VALUES_EQUAL(labels.Size(), 2); - UNIT_ASSERT(labels.Has(TStringBuf("key1"))); - UNIT_ASSERT(labels.Has(TStringBuf("key2"))); - UNIT_ASSERT_VALUES_EQUAL(labels.Get(TStringBuf("key1")).value()->Value(), "value1"); - UNIT_ASSERT_VALUES_EQUAL(labels.Get(TStringBuf("key2")).value()->Value(), "value2"); + UNIT_ASSERT(labels.Has(TStringBuf("key1"))); + UNIT_ASSERT(labels.Has(TStringBuf("key2"))); + UNIT_ASSERT_VALUES_EQUAL(labels.Get(TStringBuf("key1")).value()->Value(), "value1"); + UNIT_ASSERT_VALUES_EQUAL(labels.Get(TStringBuf("key2")).value()->Value(), "value2"); } } diff --git a/library/cpp/monlib/encode/json/json_encoder.cpp b/library/cpp/monlib/encode/json/json_encoder.cpp index 20d2bb6283..7a6d6406e7 100644 --- a/library/cpp/monlib/encode/json/json_encoder.cpp +++ b/library/cpp/monlib/encode/json/json_encoder.cpp @@ -36,7 +36,7 @@ namespace NMonitoring { void WriteTime(TInstant time) { if (time != TInstant::Zero()) { - Buf_.WriteKey(TStringBuf("ts")); + Buf_.WriteKey(TStringBuf("ts")); if (Style_ == EJsonStyle::Solomon) { Buf_.WriteULongLong(time.Seconds()); } else { @@ -46,24 +46,24 @@ namespace NMonitoring { } void WriteValue(double value) { - Buf_.WriteKey(TStringBuf("value")); + Buf_.WriteKey(TStringBuf("value")); Buf_.WriteDouble(value); } void WriteValue(i64 value) { - Buf_.WriteKey(TStringBuf("value")); + Buf_.WriteKey(TStringBuf("value")); Buf_.WriteLongLong(value); } void WriteValue(ui64 value) { - Buf_.WriteKey(TStringBuf("value")); + Buf_.WriteKey(TStringBuf("value")); Buf_.WriteULongLong(value); } void WriteValue(IHistogramSnapshot* s) { Y_ENSURE(Style_ == EJsonStyle::Solomon); - Buf_.WriteKey(TStringBuf("hist")); + Buf_.WriteKey(TStringBuf("hist")); Buf_.BeginObject(); if (ui32 count = s->Count()) { bool hasInf = (s->UpperBound(count - 1) == Max<double>()); @@ -71,14 +71,14 @@ namespace NMonitoring { count--; } - Buf_.WriteKey(TStringBuf("bounds")); + Buf_.WriteKey(TStringBuf("bounds")); Buf_.BeginList(); for (ui32 i = 0; i < count; i++) { Buf_.WriteDouble(s->UpperBound(i)); } Buf_.EndList(); - Buf_.WriteKey(TStringBuf("buckets")); + Buf_.WriteKey(TStringBuf("buckets")); Buf_.BeginList(); for (ui32 i = 0; i < count; i++) { Buf_.WriteULongLong(s->Value(i)); @@ -86,7 +86,7 @@ namespace NMonitoring { Buf_.EndList(); if (hasInf) { - Buf_.WriteKey(TStringBuf("inf")); + Buf_.WriteKey(TStringBuf("inf")); Buf_.WriteULongLong(s->Value(count)); } } @@ -96,22 +96,22 @@ namespace NMonitoring { void WriteValue(ISummaryDoubleSnapshot* s) { Y_ENSURE(Style_ == EJsonStyle::Solomon); - Buf_.WriteKey(TStringBuf("summary")); + Buf_.WriteKey(TStringBuf("summary")); Buf_.BeginObject(); - Buf_.WriteKey(TStringBuf("sum")); + Buf_.WriteKey(TStringBuf("sum")); Buf_.WriteDouble(s->GetSum()); - Buf_.WriteKey(TStringBuf("min")); + Buf_.WriteKey(TStringBuf("min")); Buf_.WriteDouble(s->GetMin()); - Buf_.WriteKey(TStringBuf("max")); + Buf_.WriteKey(TStringBuf("max")); Buf_.WriteDouble(s->GetMax()); - Buf_.WriteKey(TStringBuf("last")); + Buf_.WriteKey(TStringBuf("last")); Buf_.WriteDouble(s->GetLast()); - Buf_.WriteKey(TStringBuf("count")); + Buf_.WriteKey(TStringBuf("count")); Buf_.WriteULongLong(s->GetCount()); Buf_.EndObject(); @@ -120,19 +120,19 @@ namespace NMonitoring { void WriteValue(TLogHistogramSnapshot* s) { Y_ENSURE(Style_ == EJsonStyle::Solomon); - Buf_.WriteKey(TStringBuf("log_hist")); + Buf_.WriteKey(TStringBuf("log_hist")); Buf_.BeginObject(); - Buf_.WriteKey(TStringBuf("base")); + Buf_.WriteKey(TStringBuf("base")); Buf_.WriteDouble(s->Base()); - Buf_.WriteKey(TStringBuf("zeros_count")); + Buf_.WriteKey(TStringBuf("zeros_count")); Buf_.WriteULongLong(s->ZerosCount()); - Buf_.WriteKey(TStringBuf("start_power")); + Buf_.WriteKey(TStringBuf("start_power")); Buf_.WriteInt(s->StartPower()); - Buf_.WriteKey(TStringBuf("buckets")); + Buf_.WriteKey(TStringBuf("buckets")); Buf_.BeginList(); for (size_t i = 0; i < s->Count(); ++i) { Buf_.WriteDouble(s->Bucket(i)); @@ -239,7 +239,7 @@ namespace NMonitoring { { } - ~TEncoderJson() override { + ~TEncoderJson() override { Close(); } @@ -303,7 +303,7 @@ namespace NMonitoring { Buf_.WriteKey(TStringBuf(Style_ == EJsonStyle::Solomon ? "commonLabels" : "labels")); } else if (State_ == TEncoderState::EState::METRIC) { State_ = TEncoderState::EState::METRIC_LABELS; - Buf_.WriteKey(TStringBuf("labels")); + Buf_.WriteKey(TStringBuf("labels")); } else { State_.ThrowInvalid("expected METRIC or ROOT"); } @@ -381,7 +381,7 @@ namespace NMonitoring { "mixed metric value types in one metric"); if (!TimeSeries_) { - Buf_.WriteKey(TStringBuf("timeseries")); + Buf_.WriteKey(TStringBuf("timeseries")); Buf_.BeginList(); Buf_.BeginObject(); Y_ENSURE(LastPoint_.GetTime() != TInstant::Zero(), @@ -426,7 +426,7 @@ namespace NMonitoring { MetricsMergingMode_ = EMetricsMergingMode::MERGE_METRICS; } - ~TBufferedJsonEncoder() override { + ~TBufferedJsonEncoder() override { Close(); } @@ -490,7 +490,7 @@ namespace NMonitoring { WriteMetricType(metric.MetricType); - Buf_.WriteKey(TStringBuf("labels")); + Buf_.WriteKey(TStringBuf("labels")); WriteLabels(metric.Labels, false); metric.TimeSeries.SortByTs(); @@ -499,7 +499,7 @@ namespace NMonitoring { WriteTime(point.GetTime()); WriteValue(metric.TimeSeries.GetValueType(), point.GetValue()); } else if (metric.TimeSeries.Size() > 1) { - Buf_.WriteKey(TStringBuf("timeseries")); + Buf_.WriteKey(TStringBuf("timeseries")); Buf_.BeginList(); metric.TimeSeries.ForEach([this](TInstant time, EMetricValueType type, TMetricValue value) { Buf_.BeginObject(); 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..f74cade8e8 100644 --- a/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp +++ b/library/cpp/monlib/encode/legacy_protobuf/legacy_proto_decoder.cpp @@ -163,10 +163,10 @@ namespace NMonitoring { TRACE("found fixed label " << l); } - EType Type() const override { + EType Type() const override { return EType::Fixed; } - TLabel Get(const NProtoBuf::Message&) override { + TLabel Get(const NProtoBuf::Message&) override { return Label_; } @@ -184,10 +184,10 @@ namespace NMonitoring { TRACE("found lazy label"); } - EType Type() const override { + EType Type() const override { return EType::Lazy; } - TLabel Get(const NProtoBuf::Message& msg) override { + TLabel Get(const NProtoBuf::Message& msg) override { return Fn_(msg); } @@ -289,7 +289,7 @@ namespace NMonitoring { TStringBuf lhs, rhs; const bool isDynamic = str.TrySplit(':', lhs, rhs); - const bool isIndexing = isDynamic && rhs == TStringBuf("#"); + const bool isIndexing = isDynamic && rhs == TStringBuf("#"); if (isIndexing) { TRACE("parsed index labels"); diff --git a/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp b/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp index 7e81357dbd..0cdecebcfa 100644 --- a/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp +++ b/library/cpp/monlib/encode/prometheus/prometheus_decoder.cpp @@ -22,7 +22,7 @@ namespace NMonitoring { namespace { - constexpr ui32 MAX_LABEL_VALUE_LEN = 256; + constexpr ui32 MAX_LABEL_VALUE_LEN = 256; using TLabelsMap = THashMap<TString, TString>; @@ -225,7 +225,7 @@ namespace NMonitoring { SkipSpaces(); TStringBuf keyword = ReadToken(); - if (keyword == TStringBuf("TYPE")) { + if (keyword == TStringBuf("TYPE")) { SkipSpaces(); TStringBuf nextName = ReadTokenAsMetricName(); @@ -561,11 +561,11 @@ namespace NMonitoring { } double ParseGoDouble(TStringBuf str) { - if (str == TStringBuf("+Inf")) { + if (str == TStringBuf("+Inf")) { return std::numeric_limits<double>::infinity(); - } else if (str == TStringBuf("-Inf")) { + } else if (str == TStringBuf("-Inf")) { return -std::numeric_limits<double>::infinity(); - } else if (str == TStringBuf("NaN")) { + } else if (str == TStringBuf("NaN")) { return NAN; } diff --git a/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp b/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp index 15efeb8c03..7eee2d709d 100644 --- a/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp +++ b/library/cpp/monlib/encode/prometheus/prometheus_encoder.cpp @@ -71,7 +71,7 @@ namespace NMonitoring { TBucketBound bound = h->UpperBound(i); TStringBuf boundStr; if (bound == HISTOGRAM_INF_BOUND) { - boundStr = TStringBuf("+Inf"); + boundStr = TStringBuf("+Inf"); } else { size_t len = FloatToString(bound, TmpBuf_, Y_ARRAY_SIZE(TmpBuf_)); boundStr = TStringBuf(TmpBuf_, len); diff --git a/library/cpp/monlib/encode/prometheus/prometheus_model.h b/library/cpp/monlib/encode/prometheus/prometheus_model.h index cb7f2cb15b..377934f8b4 100644 --- a/library/cpp/monlib/encode/prometheus/prometheus_model.h +++ b/library/cpp/monlib/encode/prometheus/prometheus_model.h @@ -13,16 +13,16 @@ namespace NPrometheus { // and https://github.com/prometheus/common/blob/master/expfmt/text_parse.go // - inline constexpr TStringBuf BUCKET_SUFFIX = "_bucket"; - inline constexpr TStringBuf COUNT_SUFFIX = "_count"; - inline constexpr TStringBuf SUM_SUFFIX = "_sum"; - inline constexpr TStringBuf MIN_SUFFIX = "_min"; - inline constexpr TStringBuf MAX_SUFFIX = "_max"; - inline constexpr TStringBuf LAST_SUFFIX = "_last"; + inline constexpr TStringBuf BUCKET_SUFFIX = "_bucket"; + inline constexpr TStringBuf COUNT_SUFFIX = "_count"; + inline constexpr TStringBuf SUM_SUFFIX = "_sum"; + inline constexpr TStringBuf MIN_SUFFIX = "_min"; + inline constexpr TStringBuf MAX_SUFFIX = "_max"; + inline constexpr TStringBuf LAST_SUFFIX = "_last"; // Used for the label that defines the upper bound of a bucket of a // histogram ("le" -> "less or equal"). - inline constexpr TStringBuf BUCKET_LABEL = "le"; + inline constexpr TStringBuf BUCKET_LABEL = "le"; inline bool IsValidLabelNameStart(char ch) { diff --git a/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp b/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp index 2d11b9d5ba..1b4a1a23b4 100644 --- a/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp +++ b/library/cpp/monlib/encode/protobuf/protobuf_encoder.cpp @@ -213,7 +213,7 @@ namespace NMonitoring { FillHistogram(*snapshot, point->MutableHistogram()); } - void OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr snapshot) override { + void OnSummaryDouble(TInstant time, ISummaryDoubleSnapshotPtr snapshot) override { Y_ENSURE(Sample_, "metric not started"); NProto::TPoint* point = Sample_->AddPoints(); point->SetTime(time.MilliSeconds()); diff --git a/library/cpp/monlib/encode/spack/compression.cpp b/library/cpp/monlib/encode/spack/compression.cpp index 0d2152fc85..d7223203ad 100644 --- a/library/cpp/monlib/encode/spack/compression.cpp +++ b/library/cpp/monlib/encode/spack/compression.cpp @@ -124,7 +124,7 @@ namespace NMonitoring { static size_t Compress(TBlock in, TBlock out) { size_t rc = ZSTD_compress(out.data(), out.size(), in.data(), in.size(), LEVEL); if (Y_UNLIKELY(ZSTD_isError(rc))) { - ythrow yexception() << TStringBuf("zstd compression failed: ") + ythrow yexception() << TStringBuf("zstd compression failed: ") << ZSTD_getErrorName(rc); } return rc; @@ -133,7 +133,7 @@ namespace NMonitoring { static void Decompress(TBlock in, TBlock out) { size_t rc = ZSTD_decompress(out.data(), out.size(), in.data(), in.size()); if (Y_UNLIKELY(ZSTD_isError(rc))) { - ythrow yexception() << TStringBuf("zstd decompression failed: ") + ythrow yexception() << TStringBuf("zstd decompression failed: ") << ZSTD_getErrorName(rc); } Y_ENSURE(rc == out.size(), "zstd decompressed wrong size"); @@ -249,7 +249,7 @@ namespace NMonitoring { { } - ~TFramedCompressStream() override { + ~TFramedCompressStream() override { try { Finish(); } catch (...) { diff --git a/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp b/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp index a2b0bb5f50..7d5766d728 100644 --- a/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp +++ b/library/cpp/monlib/encode/spack/spack_v1_encoder.cpp @@ -39,7 +39,7 @@ namespace NMonitoring { LabelValuesPool_.SetSorted(true); } - ~TEncoderSpackV1() override { + ~TEncoderSpackV1() override { Close(); } diff --git a/library/cpp/monlib/encode/text/text_encoder.cpp b/library/cpp/monlib/encode/text/text_encoder.cpp index 10336261f0..e60caf2144 100644 --- a/library/cpp/monlib/encode/text/text_encoder.cpp +++ b/library/cpp/monlib/encode/text/text_encoder.cpp @@ -30,7 +30,7 @@ namespace NMonitoring { State_.Expect(TEncoderState::EState::ROOT); CommonTime_ = time; if (time != TInstant::Zero()) { - Out_->Write(TStringBuf("common time: ")); + Out_->Write(TStringBuf("common time: ")); WriteTime(time); Out_->Write('\n'); } @@ -62,7 +62,7 @@ namespace NMonitoring { State_ = TEncoderState::EState::METRIC; } else if (State_ == TEncoderState::EState::COMMON_LABELS) { State_ = TEncoderState::EState::ROOT; - Out_->Write(TStringBuf("common labels: ")); + Out_->Write(TStringBuf("common labels: ")); WriteLabels(); Out_->Write('\n'); } else { @@ -149,11 +149,11 @@ namespace NMonitoring { out << '{'; for (auto&& l : Labels_) { - out << l.Name() << TStringBuf("='") << l.Value() << '\''; + out << l.Name() << TStringBuf("='") << l.Value() << '\''; ++i; if (i < size) { - out << TStringBuf(", "); + out << TStringBuf(", "); } }; @@ -166,7 +166,7 @@ namespace NMonitoring { (*Out_) << LeftPad(typeStr, MaxMetricTypeNameLength) << ' '; // (2) name and labels - auto name = Labels_.Extract(TStringBuf("sensor")); + auto name = Labels_.Extract(TStringBuf("sensor")); if (name) { if (name->Value().find(' ') != TString::npos) { (*Out_) << '"' << name->Value() << '"'; @@ -179,10 +179,10 @@ namespace NMonitoring { // (3) values if (!TimeSeries_.Empty()) { TimeSeries_.SortByTs(); - Out_->Write(TStringBuf(" [")); + Out_->Write(TStringBuf(" [")); for (size_t i = 0; i < TimeSeries_.Size(); i++) { if (i > 0) { - Out_->Write(TStringBuf(", ")); + Out_->Write(TStringBuf(", ")); } const auto& point = TimeSeries_[i]; @@ -191,7 +191,7 @@ namespace NMonitoring { } else { Out_->Write('('); WriteTime(point.GetTime()); - Out_->Write(TStringBuf(", ")); + Out_->Write(TStringBuf(", ")); WriteValue(TimeSeries_.GetValueType(), point.GetValue()); Out_->Write(')'); } diff --git a/library/cpp/monlib/encode/unistat/unistat_decoder.cpp b/library/cpp/monlib/encode/unistat/unistat_decoder.cpp index b2344b0905..7497ae1f79 100644 --- a/library/cpp/monlib/encode/unistat/unistat_decoder.cpp +++ b/library/cpp/monlib/encode/unistat/unistat_decoder.cpp @@ -156,9 +156,9 @@ namespace NMonitoring { Y_ENSURE(suffix.size() >= 3 && suffix.size() <= 5, "Disallowed suffix value: " << suffix); - if (suffix == TStringBuf("summ") || suffix == TStringBuf("hgram")) { + if (suffix == TStringBuf("summ") || suffix == TStringBuf("hgram")) { return true; - } else if (suffix == TStringBuf("max")) { + } else if (suffix == TStringBuf("max")) { return false; } diff --git a/library/cpp/monlib/encode/unistat/unistat_ut.cpp b/library/cpp/monlib/encode/unistat/unistat_ut.cpp index dbbc238bf3..7da071a587 100644 --- a/library/cpp/monlib/encode/unistat/unistat_ut.cpp +++ b/library/cpp/monlib/encode/unistat/unistat_ut.cpp @@ -9,7 +9,7 @@ using namespace NMonitoring; Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { Y_UNIT_TEST(ScalarMetric) { - constexpr auto input = TStringBuf(R"([["something_axxx", 42]])"); + constexpr auto input = TStringBuf(R"([["something_axxx", 42]])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -57,7 +57,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { } Y_UNIT_TEST(ThrowsOnTopLevelObject) { - constexpr auto input = TStringBuf(R"({["something_axxx", 42]})"); + constexpr auto input = TStringBuf(R"({["something_axxx", 42]})"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -66,7 +66,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { } Y_UNIT_TEST(ThrowsOnUnwrappedMetric) { - constexpr auto input = TStringBuf(R"(["something_axxx", 42])"); + constexpr auto input = TStringBuf(R"(["something_axxx", 42])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -75,7 +75,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { } Y_UNIT_TEST(HistogramMetric) { - constexpr auto input = TStringBuf(R"([["something_hgram", [[0, 1], [200, 2], [500, 3]] ]])"); + constexpr auto input = TStringBuf(R"([["something_hgram", [[0, 1], [200, 2], [500, 3]] ]])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -106,7 +106,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { } Y_UNIT_TEST(AbsoluteHistogram) { - constexpr auto input = TStringBuf(R"([["something_ahhh", [[0, 1], [200, 2], [500, 3]] ]])"); + constexpr auto input = TStringBuf(R"([["something_ahhh", [[0, 1], [200, 2], [500, 3]] ]])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -134,23 +134,23 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { auto encoder = EncoderProtobuf(&samples); { - constexpr auto input = TStringBuf(R"([["someth!ng_ahhh", [[0, 1], [200, 2], [500, 3]] ]])"); + constexpr auto input = TStringBuf(R"([["someth!ng_ahhh", [[0, 1], [200, 2], [500, 3]] ]])"); UNIT_ASSERT_EXCEPTION(DecodeUnistat(input, encoder.Get()), yexception); } { - constexpr auto input = TStringBuf(R"([["foo_a", [[0, 1], [200, 2], [500, 3]] ]])"); + constexpr auto input = TStringBuf(R"([["foo_a", [[0, 1], [200, 2], [500, 3]] ]])"); UNIT_ASSERT_EXCEPTION(DecodeUnistat(input, encoder.Get()), yexception); } { - constexpr auto input = TStringBuf(R"([["foo_ahhh;tag=value", [[0, 1], [200, 2], [500, 3]] ]])"); + constexpr auto input = TStringBuf(R"([["foo_ahhh;tag=value", [[0, 1], [200, 2], [500, 3]] ]])"); UNIT_ASSERT_EXCEPTION(DecodeUnistat(input, encoder.Get()), yexception); } } Y_UNIT_TEST(MultipleMetrics) { - constexpr auto input = TStringBuf(R"([["something_axxx", 42], ["some-other_dhhh", 53]])"); + constexpr auto input = TStringBuf(R"([["something_axxx", 42], ["some-other_dhhh", 53]])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -182,7 +182,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { } Y_UNIT_TEST(UnderscoreName) { - constexpr auto input = TStringBuf(R"([["something_anything_dmmm", 42]])"); + constexpr auto input = TStringBuf(R"([["something_anything_dmmm", 42]])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); @@ -202,7 +202,7 @@ Y_UNIT_TEST_SUITE(TUnistatDecoderTest) { } Y_UNIT_TEST(MaxAggr) { - constexpr auto input = TStringBuf(R"([["something_anything_max", 42]])"); + constexpr auto input = TStringBuf(R"([["something_anything_max", 42]])"); NProto::TMultiSamplesList samples; auto encoder = EncoderProtobuf(&samples); diff --git a/library/cpp/monlib/metrics/ewma.cpp b/library/cpp/monlib/metrics/ewma.cpp index 8a296c3225..1c170ff394 100644 --- a/library/cpp/monlib/metrics/ewma.cpp +++ b/library/cpp/monlib/metrics/ewma.cpp @@ -22,7 +22,7 @@ namespace { Y_VERIFY(metric != nullptr, "Passing nullptr metric is not allowed"); } - ~TExpMovingAverage() override = default; + ~TExpMovingAverage() override = default; // This method NOT thread safe void Tick() override { diff --git a/library/cpp/monlib/metrics/histogram_snapshot.cpp b/library/cpp/monlib/metrics/histogram_snapshot.cpp index 75b5811546..488505b1cc 100644 --- a/library/cpp/monlib/metrics/histogram_snapshot.cpp +++ b/library/cpp/monlib/metrics/histogram_snapshot.cpp @@ -28,25 +28,25 @@ namespace { template <typename TStream> auto& Output(TStream& os, const NMonitoring::IHistogramSnapshot& hist) { - os << TStringBuf("{"); + os << TStringBuf("{"); ui32 i = 0; ui32 count = hist.Count(); if (count > 0) { for (; i < count - 1; ++i) { - os << hist.UpperBound(i) << TStringBuf(": ") << hist.Value(i); - os << TStringBuf(", "); + os << hist.UpperBound(i) << TStringBuf(": ") << hist.Value(i); + os << TStringBuf(", "); } if (hist.UpperBound(i) == Max<NMonitoring::TBucketBound>()) { - os << TStringBuf("inf: ") << hist.Value(i); + os << TStringBuf("inf: ") << hist.Value(i); } else { - os << hist.UpperBound(i) << TStringBuf(": ") << hist.Value(i); + os << hist.UpperBound(i) << TStringBuf(": ") << hist.Value(i); } } - os << TStringBuf("}"); + os << TStringBuf("}"); return os; } diff --git a/library/cpp/monlib/metrics/labels.cpp b/library/cpp/monlib/metrics/labels.cpp index 1eaadb7cba..1beeb00ad1 100644 --- a/library/cpp/monlib/metrics/labels.cpp +++ b/library/cpp/monlib/metrics/labels.cpp @@ -8,7 +8,7 @@ static void OutputLabels(IOutputStream& out, const NMonitoring::ILabels& labels) out << '{'; for (const auto& label: labels) { if (i++ > 0) { - out << TStringBuf(", "); + out << TStringBuf(", "); } out << label; } diff --git a/library/cpp/monlib/metrics/labels_ut.cpp b/library/cpp/monlib/metrics/labels_ut.cpp index f0e4f532ab..e1a4f0c392 100644 --- a/library/cpp/monlib/metrics/labels_ut.cpp +++ b/library/cpp/monlib/metrics/labels_ut.cpp @@ -93,9 +93,9 @@ Y_UNIT_TEST_SUITE(TLabelsTest) { Y_UNIT_TEST(Labels) { TLabels labels; - UNIT_ASSERT(labels.Add(TStringBuf("name1"), TStringBuf("value1"))); + UNIT_ASSERT(labels.Add(TStringBuf("name1"), TStringBuf("value1"))); UNIT_ASSERT(labels.Size() == 1); - UNIT_ASSERT(labels.Has(TStringBuf("name1"))); + UNIT_ASSERT(labels.Has(TStringBuf("name1"))); { auto l = labels.Find("name1"); UNIT_ASSERT(l.Defined()); @@ -108,12 +108,12 @@ Y_UNIT_TEST_SUITE(TLabelsTest) { } // duplicated name - UNIT_ASSERT(!labels.Add(TStringBuf("name1"), TStringBuf("value2"))); + UNIT_ASSERT(!labels.Add(TStringBuf("name1"), TStringBuf("value2"))); UNIT_ASSERT(labels.Size() == 1); - UNIT_ASSERT(labels.Add(TStringBuf("name2"), TStringBuf("value2"))); + UNIT_ASSERT(labels.Add(TStringBuf("name2"), TStringBuf("value2"))); UNIT_ASSERT(labels.Size() == 2); - UNIT_ASSERT(labels.Has(TStringBuf("name2"))); + UNIT_ASSERT(labels.Has(TStringBuf("name2"))); { auto l = labels.Find("name2"); UNIT_ASSERT(l.Defined()); diff --git a/library/cpp/monlib/metrics/log_histogram_snapshot.cpp b/library/cpp/monlib/metrics/log_histogram_snapshot.cpp index 21cf2ca2bb..fae201f269 100644 --- a/library/cpp/monlib/metrics/log_histogram_snapshot.cpp +++ b/library/cpp/monlib/metrics/log_histogram_snapshot.cpp @@ -9,16 +9,16 @@ namespace { template <typename TStream> auto& Output(TStream& o, const NMonitoring::TLogHistogramSnapshot& hist) { - o << TStringBuf("{"); + o << TStringBuf("{"); for (auto i = 0u; i < hist.Count(); ++i) { - o << hist.UpperBound(i) << TStringBuf(": ") << hist.Bucket(i); - o << TStringBuf(", "); + o << hist.UpperBound(i) << TStringBuf(": ") << hist.Bucket(i); + o << TStringBuf(", "); } - o << TStringBuf("zeros: ") << hist.ZerosCount(); + o << TStringBuf("zeros: ") << hist.ZerosCount(); - o << TStringBuf("}"); + o << TStringBuf("}"); return o; } diff --git a/library/cpp/monlib/metrics/metric_type.cpp b/library/cpp/monlib/metrics/metric_type.cpp index a8a546e843..ca1d32f7c6 100644 --- a/library/cpp/monlib/metrics/metric_type.cpp +++ b/library/cpp/monlib/metrics/metric_type.cpp @@ -8,42 +8,42 @@ namespace NMonitoring { TStringBuf MetricTypeToStr(EMetricType type) { switch (type) { case EMetricType::GAUGE: - return TStringBuf("GAUGE"); + return TStringBuf("GAUGE"); case EMetricType::COUNTER: - return TStringBuf("COUNTER"); + return TStringBuf("COUNTER"); case EMetricType::RATE: - return TStringBuf("RATE"); + return TStringBuf("RATE"); case EMetricType::IGAUGE: - return TStringBuf("IGAUGE"); + return TStringBuf("IGAUGE"); case EMetricType::HIST: - return TStringBuf("HIST"); + return TStringBuf("HIST"); case EMetricType::HIST_RATE: - return TStringBuf("HIST_RATE"); + return TStringBuf("HIST_RATE"); case EMetricType::DSUMMARY: - return TStringBuf("DSUMMARY"); + return TStringBuf("DSUMMARY"); case EMetricType::LOGHIST: - return TStringBuf("LOGHIST"); + return TStringBuf("LOGHIST"); default: - return TStringBuf("UNKNOWN"); + return TStringBuf("UNKNOWN"); } } EMetricType MetricTypeFromStr(TStringBuf str) { - if (str == TStringBuf("GAUGE") || str == TStringBuf("DGAUGE")) { + if (str == TStringBuf("GAUGE") || str == TStringBuf("DGAUGE")) { return EMetricType::GAUGE; - } else if (str == TStringBuf("COUNTER")) { + } else if (str == TStringBuf("COUNTER")) { return EMetricType::COUNTER; - } else if (str == TStringBuf("RATE")) { + } else if (str == TStringBuf("RATE")) { return EMetricType::RATE; - } else if (str == TStringBuf("IGAUGE")) { + } else if (str == TStringBuf("IGAUGE")) { return EMetricType::IGAUGE; - } else if (str == TStringBuf("HIST")) { + } else if (str == TStringBuf("HIST")) { return EMetricType::HIST; - } else if (str == TStringBuf("HIST_RATE")) { + } else if (str == TStringBuf("HIST_RATE")) { return EMetricType::HIST_RATE; - } else if (str == TStringBuf("DSUMMARY")) { + } else if (str == TStringBuf("DSUMMARY")) { return EMetricType::DSUMMARY; - } else if (str == TStringBuf("LOGHIST")) { + } else if (str == TStringBuf("LOGHIST")) { return EMetricType::LOGHIST; } else { ythrow yexception() << "unknown metric type: " << str; diff --git a/library/cpp/monlib/metrics/summary_snapshot.cpp b/library/cpp/monlib/metrics/summary_snapshot.cpp index 0b13263337..7d90846bfe 100644 --- a/library/cpp/monlib/metrics/summary_snapshot.cpp +++ b/library/cpp/monlib/metrics/summary_snapshot.cpp @@ -9,15 +9,15 @@ namespace { template <typename TStream> auto& Output(TStream& o, const NMonitoring::ISummaryDoubleSnapshot& s) { - o << TStringBuf("{"); + o << TStringBuf("{"); - o << TStringBuf("sum: ") << s.GetSum() << TStringBuf(", "); - o << TStringBuf("min: ") << s.GetMin() << TStringBuf(", "); - o << TStringBuf("max: ") << s.GetMax() << TStringBuf(", "); - o << TStringBuf("last: ") << s.GetLast() << TStringBuf(", "); - o << TStringBuf("count: ") << s.GetCount(); + o << TStringBuf("sum: ") << s.GetSum() << TStringBuf(", "); + o << TStringBuf("min: ") << s.GetMin() << TStringBuf(", "); + o << TStringBuf("max: ") << s.GetMax() << TStringBuf(", "); + o << TStringBuf("last: ") << s.GetLast() << TStringBuf(", "); + o << TStringBuf("count: ") << s.GetCount(); - o << TStringBuf("}"); + o << TStringBuf("}"); return o; } diff --git a/library/cpp/monlib/service/format.h b/library/cpp/monlib/service/format.h index 0044b586b1..5eb3261966 100644 --- a/library/cpp/monlib/service/format.h +++ b/library/cpp/monlib/service/format.h @@ -21,9 +21,9 @@ namespace NMonitoring { auto it = FindIf(std::begin(headers), std::end(headers), [=] (const auto& h) { if constexpr (NPrivate::THasName<std::decay_t<decltype(h)>>::value) { - return AsciiCompareIgnoreCase(h.Name(), TStringBuf("accept-encoding")) == 0; + return AsciiCompareIgnoreCase(h.Name(), TStringBuf("accept-encoding")) == 0; } else if (isPlainPair) { - return AsciiCompareIgnoreCase(h.first, TStringBuf("accept-encoding")) == 0; + return AsciiCompareIgnoreCase(h.first, TStringBuf("accept-encoding")) == 0; } }); @@ -46,14 +46,14 @@ namespace NMonitoring { template <typename TRequest> NMonitoring::EFormat ParseFormat(const TRequest& req) { auto&& formatStr = req.GetParams() - .Get(TStringBuf("format")); + .Get(TStringBuf("format")); if (!formatStr.empty()) { - if (formatStr == TStringBuf("SPACK")) { + if (formatStr == TStringBuf("SPACK")) { return EFormat::SPACK; - } else if (formatStr == TStringBuf("TEXT")) { + } else if (formatStr == TStringBuf("TEXT")) { return EFormat::TEXT; - } else if (formatStr == TStringBuf("JSON")) { + } else if (formatStr == TStringBuf("JSON")) { return EFormat::JSON; } else { ythrow yexception() << "unknown format: " << formatStr << ". Only spack is supported here"; @@ -66,9 +66,9 @@ namespace NMonitoring { auto it = FindIf(std::begin(headers), std::end(headers), [=] (const auto& h) { if constexpr (NPrivate::THasName<std::decay_t<decltype(h)>>::value) { - return AsciiCompareIgnoreCase(h.Name(), TStringBuf("accept")) == 0; + return AsciiCompareIgnoreCase(h.Name(), TStringBuf("accept")) == 0; } else if (isPlainPair) { - return AsciiCompareIgnoreCase(h.first, TStringBuf("accept")) == 0; + return AsciiCompareIgnoreCase(h.first, TStringBuf("accept")) == 0; } }); diff --git a/library/cpp/monlib/service/pages/index_mon_page.cpp b/library/cpp/monlib/service/pages/index_mon_page.cpp index 83ff8b529a..3e2db86b9e 100644 --- a/library/cpp/monlib/service/pages/index_mon_page.cpp +++ b/library/cpp/monlib/service/pages/index_mon_page.cpp @@ -15,7 +15,7 @@ void TIndexMonPage::OutputIndexPage(IMonHttpRequest& request) { void TIndexMonPage::Output(IMonHttpRequest& request) { TStringBuf pathInfo = request.GetPathInfo(); - if (pathInfo.empty() || pathInfo == TStringBuf("/")) { + if (pathInfo.empty() || pathInfo == TStringBuf("/")) { OutputIndexPage(request); return; } diff --git a/library/cpp/monlib/service/pages/registry_mon_page.cpp b/library/cpp/monlib/service/pages/registry_mon_page.cpp index c59e50f622..ecdba2e827 100644 --- a/library/cpp/monlib/service/pages/registry_mon_page.cpp +++ b/library/cpp/monlib/service/pages/registry_mon_page.cpp @@ -15,10 +15,10 @@ namespace NMonitoring { IMetricEncoderPtr encoder; TString resp; - if (formatStr == TStringBuf("json")) { + if (formatStr == TStringBuf("json")) { resp = HTTPOKJSON; encoder = NMonitoring::EncoderJson(&out); - } else if (formatStr == TStringBuf("spack")) { + } else if (formatStr == TStringBuf("spack")) { resp = HTTPOKSPACK; const auto compression = ParseCompression(request); encoder = NMonitoring::EncoderSpackV1(&out, ETimePrecision::SECONDS, compression); diff --git a/library/cpp/on_disk/chunks/chunked_helpers.h b/library/cpp/on_disk/chunks/chunked_helpers.h index 5fa96afdca..b5da9d11df 100644 --- a/library/cpp/on_disk/chunks/chunked_helpers.h +++ b/library/cpp/on_disk/chunks/chunked_helpers.h @@ -14,7 +14,7 @@ #include "reader.h" #include "writer.h" -#include <cmath> +#include <cmath> #include <cstddef> template <typename T> @@ -48,7 +48,7 @@ public: return sizeof(ui64) + Size * sizeof(T); } - ~TYVector() = default; + ~TYVector() = default; }; template <typename T> @@ -57,7 +57,7 @@ private: TVector<T> Vector; public: - TYVectorWriter() = default; + TYVectorWriter() = default; void PushBack(const T& value) { Vector.push_back(value); @@ -423,7 +423,7 @@ private: T Value; public: - TSingleValueWriter() = default; + TSingleValueWriter() = default; TSingleValueWriter(const T& value) : Value(value) diff --git a/library/cpp/openssl/holders/bio.cpp b/library/cpp/openssl/holders/bio.cpp index 42cc5fc1ef..e6473ec758 100644 --- a/library/cpp/openssl/holders/bio.cpp +++ b/library/cpp/openssl/holders/bio.cpp @@ -16,7 +16,7 @@ namespace NOpenSSL { ) : THolder(type, name) { - BIO_meth_set_write(*this, write); + BIO_meth_set_write(*this, write); BIO_meth_set_read(*this, read); BIO_meth_set_puts(*this, puts); BIO_meth_set_gets(*this, gets); diff --git a/library/cpp/openssl/io/stream.cpp b/library/cpp/openssl/io/stream.cpp index 0b4be38c0e..f9fdeb2746 100644 --- a/library/cpp/openssl/io/stream.cpp +++ b/library/cpp/openssl/io/stream.cpp @@ -25,15 +25,15 @@ namespace { } }; - int GetLastSslError() noexcept { + int GetLastSslError() noexcept { return ERR_peek_last_error(); } - const char* SslErrorText(int error) noexcept { + const char* SslErrorText(int error) noexcept { return ERR_error_string(error, nullptr); } - inline TStringBuf SslLastError() noexcept { + inline TStringBuf SslLastError() noexcept { return SslErrorText(GetLastSslError()); } @@ -69,7 +69,7 @@ namespace { using TBioPtr = TSslHolderPtr<bio_st>; using TX509Ptr = TSslHolderPtr<x509_st>; - inline TSslContextPtr CreateSslCtx(const ssl_method_st* method) { + inline TSslContextPtr CreateSslCtx(const ssl_method_st* method) { TSslContextPtr ctx(SSL_CTX_new(method)); if (!ctx) { diff --git a/library/cpp/packedtypes/packedfloat.h b/library/cpp/packedtypes/packedfloat.h index f178912ed3..829e283ddc 100644 --- a/library/cpp/packedtypes/packedfloat.h +++ b/library/cpp/packedtypes/packedfloat.h @@ -8,7 +8,7 @@ #include <cfloat> #include <limits> #include <algorithm> -#include <cassert> +#include <cassert> namespace NPackedFloat { /* @@ -146,66 +146,66 @@ namespace NPackedFloat { }; } -using f64 = double; -using f32 = float; +using f64 = double; +using f32 = float; static_assert(sizeof(f32) == 4, "expect sizeof(f32) == 4"); static_assert(sizeof(f64) == 8, "expect sizeof(f64) == 8"); -using f16 = NPackedFloat::float16<1>; -using uf16 = NPackedFloat::float16<0>; -using f8 = NPackedFloat::float8<1>; -using uf8 = NPackedFloat::float8<0>; -using f8d = NPackedFloat::float8<1, 1>; -using uf8d = NPackedFloat::float8<0, 1>; +using f16 = NPackedFloat::float16<1>; +using uf16 = NPackedFloat::float16<0>; +using f8 = NPackedFloat::float8<1>; +using uf8 = NPackedFloat::float8<0>; +using f8d = NPackedFloat::float8<1, 1>; +using uf8d = NPackedFloat::float8<0, 1>; // [0,1) value in 1/255s. -using frac8 = ui8; +using frac8 = ui8; -using frac16 = ui16; +using frac16 = ui16; template <class T> -inline constexpr T Float2Frac(float fac) { +inline constexpr T Float2Frac(float fac) { return T(fac * float(Max<T>())); } template <class T> -inline constexpr T Float2FracR(float fac) { +inline constexpr T Float2FracR(float fac) { float v = fac * float(Max<T>()); return T(v + 0.5f); } template <class T> -inline constexpr float Frac2Float(T pf) { - constexpr float multiplier = float(1.0 / Max<T>()); - return pf * multiplier; +inline constexpr float Frac2Float(T pf) { + constexpr float multiplier = float(1.0 / Max<T>()); + return pf * multiplier; } -class TUi82FloatMapping { -private: - float Mapping[Max<ui8>() + 1] = {}; - -public: - constexpr TUi82FloatMapping() noexcept { - for (ui32 i = 0; i < Y_ARRAY_SIZE(Mapping); ++i) { - Mapping[i] = static_cast<float>(i) / Max<ui8>(); - } - } - - inline float operator [] (ui8 index) const { - return Mapping[index]; - } -}; - -constexpr TUi82FloatMapping Ui82FloatMapping{}; - -template <> -inline float Frac2Float(ui8 pf) { - return Ui82FloatMapping[pf]; -} - -// Probably you don't want to use it, since sizeof(float) == sizeof(ui32) -template <> -inline float Frac2Float(ui32 pf) = delete; - +class TUi82FloatMapping { +private: + float Mapping[Max<ui8>() + 1] = {}; + +public: + constexpr TUi82FloatMapping() noexcept { + for (ui32 i = 0; i < Y_ARRAY_SIZE(Mapping); ++i) { + Mapping[i] = static_cast<float>(i) / Max<ui8>(); + } + } + + inline float operator [] (ui8 index) const { + return Mapping[index]; + } +}; + +constexpr TUi82FloatMapping Ui82FloatMapping{}; + +template <> +inline float Frac2Float(ui8 pf) { + return Ui82FloatMapping[pf]; +} + +// Probably you don't want to use it, since sizeof(float) == sizeof(ui32) +template <> +inline float Frac2Float(ui32 pf) = delete; + template <class T> inline float FracOrFloatToFloat(T t) { return Frac2Float(t); diff --git a/library/cpp/packers/packers.h b/library/cpp/packers/packers.h index 1bde1b59aa..41ae430022 100644 --- a/library/cpp/packers/packers.h +++ b/library/cpp/packers/packers.h @@ -105,7 +105,7 @@ namespace NPackers { template <> inline size_t TIntegralPacker<ui64>::MeasureLeaf(const ui64& val) const { - constexpr size_t MAX_SIZE = sizeof(ui64) + sizeof(ui64) / 8; + constexpr size_t MAX_SIZE = sizeof(ui64) + sizeof(ui64) / 8; ui64 value = val; size_t len = 1; diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp index 0dfe57bc7a..cdc8bc87be 100644 --- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp +++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp @@ -123,7 +123,7 @@ Y_UNIT_TEST(TestNameGenerator) { cfg.SetNameGenerator([](const NProtoBuf::FieldDescriptor&) { return "42"; }); TNameGeneratorType proto; - Json2Proto(TStringBuf(R"({"42":42})"), proto, cfg); + Json2Proto(TStringBuf(R"({"42":42})"), proto, cfg); TNameGeneratorType expected; expected.SetField(42); @@ -524,7 +524,7 @@ Y_UNIT_TEST(TestInvalidRepeatedFieldWithMapAsObject) { TCompositeRepeated proto; TJson2ProtoConfig config; config.MapAsObject = true; - UNIT_ASSERT_EXCEPTION(Json2Proto(TStringBuf(R"({"Part":{"Boo":{}}})"), proto, config), yexception); + UNIT_ASSERT_EXCEPTION(Json2Proto(TStringBuf(R"({"Part":{"Boo":{}}})"), proto, config), yexception); } Y_UNIT_TEST(TestStringTransforms) { diff --git a/library/cpp/random_provider/random_provider.cpp b/library/cpp/random_provider/random_provider.cpp index 64cb48b8b7..d9399a4f38 100644 --- a/library/cpp/random_provider/random_provider.cpp +++ b/library/cpp/random_provider/random_provider.cpp @@ -25,7 +25,7 @@ public: return ret; } - TGUID GenUuid4() noexcept override { + TGUID GenUuid4() noexcept override { TGUID ret; WriteUnaligned<ui64>(ret.dw, RandomNumber<ui64>()); WriteUnaligned<ui64>(ret.dw + 2, RandomNumber<ui64>()); @@ -53,7 +53,7 @@ public: return ret; } - TGUID GenUuid4() noexcept override { + TGUID GenUuid4() noexcept override { TGUID ret; WriteUnaligned<ui64>(ret.dw, Gen.GenRand()); WriteUnaligned<ui64>(ret.dw + 2, Gen.GenRand()); diff --git a/library/cpp/regex/pcre/README.md b/library/cpp/regex/pcre/README.md index b5b09a3715..7a143b2616 100644 --- a/library/cpp/regex/pcre/README.md +++ b/library/cpp/regex/pcre/README.md @@ -8,7 +8,7 @@ This library allows us to erase these charset conversions. # Interface Before starting with interface details, let's consider simplest library usage example: -`UNIT_ASSERT(NPcre::TPcre<wchar16>(u"ba+d").Matches(TWtringBuf(u"baaad")));` +`UNIT_ASSERT(NPcre::TPcre<wchar16>(u"ba+d").Matches(TWtringBuf(u"baaad")));` Here we see regular expression construction for UTF-16 charset: @@ -16,7 +16,7 @@ Here we see regular expression construction for UTF-16 charset: and matching of the subject string `baaad` against this pattern: -`.Matches(TWtringBuf(u"baaad"))`; +`.Matches(TWtringBuf(u"baaad"))`; Let's consider both of them in details. diff --git a/library/cpp/regex/pire/ut/regexp_ut.cpp b/library/cpp/regex/pire/ut/regexp_ut.cpp index e7206de9ad..7ff84e0a26 100644 --- a/library/cpp/regex/pire/ut/regexp_ut.cpp +++ b/library/cpp/regex/pire/ut/regexp_ut.cpp @@ -19,16 +19,16 @@ Y_UNIT_TEST_SUITE(TRegExp) { Y_UNIT_TEST(Boundaries) { UNIT_ASSERT(!TMatcher(TFsm("qwb$", TFsm::TOptions().SetSurround(true))).Match("aqwb").Final()); UNIT_ASSERT(!TMatcher(TFsm("^aqw", TFsm::TOptions().SetSurround(true))).Match("aqwb").Final()); - UNIT_ASSERT(TMatcher(TFsm("qwb$", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final()); - UNIT_ASSERT(TMatcher(TFsm("^aqw", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final()); - UNIT_ASSERT(!TMatcher(TFsm("qw$", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final()); - UNIT_ASSERT(!TMatcher(TFsm("^qw", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final()); + UNIT_ASSERT(TMatcher(TFsm("qwb$", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final()); + UNIT_ASSERT(TMatcher(TFsm("^aqw", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final()); + UNIT_ASSERT(!TMatcher(TFsm("qw$", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final()); + UNIT_ASSERT(!TMatcher(TFsm("^qw", TFsm::TOptions().SetSurround(true))).Match(TStringBuf("aqwb"), true, true).Final()); UNIT_ASSERT(TMatcher(TFsm("^aqwb$", TFsm::TOptions().SetSurround(true))) - .Match(TStringBuf("a"), true, false) - .Match(TStringBuf("q"), false, false) - .Match(TStringBuf("w"), false, false) - .Match(TStringBuf("b"), false, true) + .Match(TStringBuf("a"), true, false) + .Match(TStringBuf("q"), false, false) + .Match(TStringBuf("w"), false, false) + .Match(TStringBuf("b"), false, true) .Final()); } @@ -100,7 +100,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSearcher searcher(fsm); searcher.Search("in db and here we have user_id=0x0d0a; same as CRLF"); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("0x0d0a")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("0x0d0a")); } Y_UNIT_TEST(Capture2) { @@ -109,7 +109,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSearcher searcher(fsm); searcher.Search("wabcdef"); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("abcde")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("abcde")); } Y_UNIT_TEST(Capture3) { @@ -119,7 +119,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSearcher searcher(fsm); searcher.Search("http://vkontakte.ru/id100500"); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("100500")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("100500")); } Y_UNIT_TEST(Capture4) { @@ -129,7 +129,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSearcher searcher(fsm); searcher.Search(" Здравствуйте, Уважаемый (-ая)! "); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("Уважаемый (-ая)")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("Уважаемый (-ая)")); } Y_UNIT_TEST(Capture5) { @@ -137,7 +137,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSearcher searcher(fsm); searcher.Search("\"/away.php?to=http:some.addr\"&id=1"); UNIT_ASSERT(searcher.Captured()); - //UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("some.addr")); + //UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("some.addr")); } Y_UNIT_TEST(Capture6) { @@ -145,7 +145,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSearcher searcher(fsm); searcher.Search("/some/table/path/to-match-with"); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("/to-match-with")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("/to-match-with")); } Y_UNIT_TEST(Capture7) { @@ -153,7 +153,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSearcher searcher(fsm); searcher.Search("ala pref bla suff cla"); UNIT_ASSERT(searcher.Captured()); - //UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref bla suff")); + //UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref bla suff")); } Y_UNIT_TEST(CaptureXA) { @@ -162,7 +162,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSearcher searcher(fsm); searcher.Search("xa"); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xa")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xa")); } Y_UNIT_TEST(CaptureWrongXX) { @@ -175,7 +175,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { // TCapturingFsm uses a fast - O(|text|) - but incorrect algorithm. // It works more or less for a particular class of regexps to which ".*(xx).*" does not belong. // So it returns not the expected "xx" but just the second "x" instead. - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("x")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("x")); } Y_UNIT_TEST(CaptureRight1XX) { @@ -194,7 +194,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { searcher.Search("axx"); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx")); } Y_UNIT_TEST(CaptureRight3XX) { @@ -204,7 +204,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { searcher.Search("axxb"); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx")); } Y_UNIT_TEST(SlowCaptureXX) { @@ -213,7 +213,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSlowSearcher searcher(fsm); searcher.Search("xx"); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("xx")); } Y_UNIT_TEST(SlowCapture) { @@ -222,7 +222,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSlowSearcher searcher(fsm); searcher.Search("http://vkontakte.ru/id100500"); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("100500")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("100500")); } Y_UNIT_TEST(SlowCaptureGreedy) { @@ -230,7 +230,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSlowSearcher searcher(fsm); searcher.Search("pref ala bla pref cla suff dla"); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref cla suff")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref cla suff")); } Y_UNIT_TEST(SlowCaptureNonGreedy) { @@ -238,7 +238,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSlowSearcher searcher(fsm); searcher.Search("pref ala bla pref cla suff dla"); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref ala bla pref cla suff")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("pref ala bla pref cla suff")); } Y_UNIT_TEST(SlowCapture2) { @@ -248,7 +248,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSlowSearcher searcher(fsm); searcher.Search(" Здравствуйте, Уважаемый (-ая)! "); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("Уважаемый (-ая)")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("Уважаемый (-ая)")); } Y_UNIT_TEST(SlowCapture3) { @@ -256,7 +256,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSlowSearcher searcher(fsm); searcher.Search("in db and here we have user_id=0x0d0a; same as CRLF"); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("0x0d0a")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("0x0d0a")); } Y_UNIT_TEST(SlowCapture4) { @@ -264,7 +264,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSlowSearcher searcher(fsm); searcher.Search("\"/away.php?to=http:some.addr\"&id=1"); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("some.addr")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("some.addr")); } Y_UNIT_TEST(CapturedEmptySlow) { @@ -272,7 +272,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSlowSearcher searcher(fsm); searcher.Search("And Comments="); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("")); } Y_UNIT_TEST(CaptureInOrFirst) { @@ -294,7 +294,7 @@ Y_UNIT_TEST_SUITE(TRegExp) { TSlowSearcher searcher(fsm); searcher.Search("ID="); UNIT_ASSERT(searcher.Captured()); - UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("")); + UNIT_ASSERT_VALUES_EQUAL(searcher.GetCaptured(), TStringBuf("")); } Y_UNIT_TEST(CaptureInside) { diff --git a/library/cpp/resource/registry.cpp b/library/cpp/resource/registry.cpp index 66001c4769..537d8e5126 100644 --- a/library/cpp/resource/registry.cpp +++ b/library/cpp/resource/registry.cpp @@ -12,7 +12,7 @@ using namespace NResource; using namespace NBlockCodecs; namespace { - inline const ICodec* GetCodec() noexcept { + inline const ICodec* GetCodec() noexcept { static const ICodec* ret = Codec("zstd08_5"); return ret; diff --git a/library/cpp/scheme/scimpl_json_write.cpp b/library/cpp/scheme/scimpl_json_write.cpp index aadd7e6cd5..164ccbec31 100644 --- a/library/cpp/scheme/scimpl_json_write.cpp +++ b/library/cpp/scheme/scimpl_json_write.cpp @@ -70,7 +70,7 @@ namespace NSc { NImpl::TSelfLoopContext::TGuard loopCheck(loopCtx, core); if (!loopCheck.Ok) { - out << TStringBuf("null"); // a loop encountered (and asserted), skip the back reference + out << TStringBuf("null"); // a loop encountered (and asserted), skip the back reference return; } @@ -80,11 +80,11 @@ namespace NSc { [[fallthrough]]; /* no break */ } case EType::Null: { - out << TStringBuf("null"); + out << TStringBuf("null"); break; } case EType::Bool: { - out << (core.IntNumber ? TStringBuf("true") : TStringBuf("false")); + out << (core.IntNumber ? TStringBuf("true") : TStringBuf("false")); break; } case EType::IntNumber: { @@ -96,7 +96,7 @@ namespace NSc { if (!jopts.NumberPolicy || jopts.NumberPolicy(d)) { out << d; } else { - out << TStringBuf("null"); + out << TStringBuf("null"); } break; } @@ -105,7 +105,7 @@ namespace NSc { if (!jopts.StringPolicy || jopts.StringPolicy(s)) { WriteString(out, s); } else { - out << TStringBuf("null"); + out << TStringBuf("null"); } break; } diff --git a/library/cpp/scheme/tests/fuzz_ops/ut/vm_parse_ut.cpp b/library/cpp/scheme/tests/fuzz_ops/ut/vm_parse_ut.cpp index ce3786a671..9a1a4fa738 100644 --- a/library/cpp/scheme/tests/fuzz_ops/ut/vm_parse_ut.cpp +++ b/library/cpp/scheme/tests/fuzz_ops/ut/vm_parse_ut.cpp @@ -48,27 +48,27 @@ Y_UNIT_TEST_SUITE(TestParseNextAction) { Y_UNIT_TEST(TestParsePos) { DoTestParsePosFailure("", 1, 0); - UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x00"sv), 1, 0), 0); - UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x01"sv), 1, 0), 0); + UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x00"sv), 1, 0), 0); + UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x01"sv), 1, 0), 0); - DoTestParsePosFailure(TStringBuf("\x02"sv), 1, 0); - DoTestParsePosFailure(TStringBuf("\x03"sv), 2, 0); + DoTestParsePosFailure(TStringBuf("\x02"sv), 1, 0); + DoTestParsePosFailure(TStringBuf("\x03"sv), 2, 0); - UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x02"sv), 2, 0), 1); - UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x03"sv), 2, 1), 0); + UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x02"sv), 2, 0), 1); + UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x03"sv), 2, 1), 0); - UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x0E"sv), 8, 0), 7); - UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x0F"sv), 8, 7), 0); + UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x0E"sv), 8, 0), 7); + UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(TStringBuf("\x0F"sv), 8, 7), 0); { - TVMState st{TStringBuf("\xDE\x7B"), 16, 0}; + TVMState st{TStringBuf("\xDE\x7B"), 16, 0}; UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(st), 15); UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(st), 15); UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(st), 15); UNIT_ASSERT(!ParsePos(st)); } { - TVMState st{TStringBuf("\xFF\x7F"), 16, 15}; + TVMState st{TStringBuf("\xFF\x7F"), 16, 15}; UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(st), 0); UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(st), 0); UNIT_ASSERT_VALUES_EQUAL(DoTestParsePosSuccess(st), 0); @@ -97,15 +97,15 @@ Y_UNIT_TEST_SUITE(TestParseNextAction) { Y_UNIT_TEST(TestParseRef) { DoTestParseRefFailure("", 1, 0); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(TStringBuf("\x00"sv), 1, 0), std::make_pair((ui32)-1, TRef::T_CREATE_FRONT)); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(TStringBuf("\x01"sv), 1, 0), std::make_pair((ui32)-1, TRef::T_CREATE_BACK)); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(TStringBuf("\x0A"sv), 2, 0), std::make_pair(1u, TRef::T_REF__POS)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(TStringBuf("\x00"sv), 1, 0), std::make_pair((ui32)-1, TRef::T_CREATE_FRONT)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(TStringBuf("\x01"sv), 1, 0), std::make_pair((ui32)-1, TRef::T_CREATE_BACK)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(TStringBuf("\x0A"sv), 2, 0), std::make_pair(1u, TRef::T_REF__POS)); - DoTestParseRefFailure(TStringBuf("\x12"), 1, 0); - DoTestParseRefFailure(TStringBuf("\x03"sv), 1, 0); + DoTestParseRefFailure(TStringBuf("\x12"), 1, 0); + DoTestParseRefFailure(TStringBuf("\x03"sv), 1, 0); { - TVMState st{TStringBuf("\x7A\x7D"), 16, 0}; + TVMState st{TStringBuf("\x7A\x7D"), 16, 0}; UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(st), std::make_pair(15u, TRef::T_REF__POS)); UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(st), std::make_pair(15u, TRef::T_REF__POS)); UNIT_ASSERT_VALUES_EQUAL(DoTestParseRefSuccess(st), std::make_pair((ui32)-1, TRef::T_CREATE_BACK)); @@ -134,14 +134,14 @@ Y_UNIT_TEST_SUITE(TestParseNextAction) { Y_UNIT_TEST(TestParseSrc) { DoTestParseSrcFailure("", 1, 0); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(TStringBuf("\x08"sv), 2, 0), std::make_pair(1u, TSrc::T_LREF__POS)); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(TStringBuf("\x09"sv), 2, 0), std::make_pair(1u, TSrc::T_CREF__POS)); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(TStringBuf("\x0A"sv), 2, 0), std::make_pair(1u, TSrc::T_RREF__POS)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(TStringBuf("\x08"sv), 2, 0), std::make_pair(1u, TSrc::T_LREF__POS)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(TStringBuf("\x09"sv), 2, 0), std::make_pair(1u, TSrc::T_CREF__POS)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(TStringBuf("\x0A"sv), 2, 0), std::make_pair(1u, TSrc::T_RREF__POS)); - DoTestParseSrcFailure(TStringBuf("\x03"sv), 1, 0); + DoTestParseSrcFailure(TStringBuf("\x03"sv), 1, 0); { - TVMState st{TStringBuf("\x7A\x7D"), 16, 0}; + TVMState st{TStringBuf("\x7A\x7D"), 16, 0}; UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(st), std::make_pair(15u, TSrc::T_RREF__POS)); UNIT_ASSERT_VALUES_EQUAL(DoTestParseSrcSuccess(st), std::make_pair(15u, TSrc::T_RREF__POS)); UNIT_ASSERT(!ParseSrc(st)); @@ -169,21 +169,21 @@ Y_UNIT_TEST_SUITE(TestParseNextAction) { Y_UNIT_TEST(TestParseDst) { DoTestParseDstFailure("", 1, 0); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x00"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_FRONT_LREF)); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x01"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_FRONT_CREF)); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x02"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_FRONT_RREF)); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x03"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_LREF)); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x04"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_CREF)); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x05"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_RREF)); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x26\x00"sv), 2, 0), std::make_pair(1u, TDst::T_LREF__POS)); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x27\x00"sv), 2, 0), std::make_pair(1u, TDst::T_CREF__POS)); - UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x28\x00"sv), 2, 0), std::make_pair(1u, TDst::T_RREF__POS)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x00"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_FRONT_LREF)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x01"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_FRONT_CREF)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x02"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_FRONT_RREF)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x03"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_LREF)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x04"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_CREF)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x05"sv), 1, 0), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_RREF)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x26\x00"sv), 2, 0), std::make_pair(1u, TDst::T_LREF__POS)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x27\x00"sv), 2, 0), std::make_pair(1u, TDst::T_CREF__POS)); + UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(TStringBuf("\x28\x00"sv), 2, 0), std::make_pair(1u, TDst::T_RREF__POS)); - DoTestParseDstFailure(TStringBuf("\x06"sv), 1, 0); - DoTestParseDstFailure(TStringBuf("\x09\x00"sv), 1, 0); + DoTestParseDstFailure(TStringBuf("\x06"sv), 1, 0); + DoTestParseDstFailure(TStringBuf("\x09\x00"sv), 1, 0); { - TVMState st{TStringBuf("\x14\xE7\x09"sv), 16, 0}; + TVMState st{TStringBuf("\x14\xE7\x09"sv), 16, 0}; // 4=4 UNIT_ASSERT_VALUES_EQUAL(DoTestParseDstSuccess(st), std::make_pair((ui32)-1, TDst::T_CREATE_BACK_CREF)); // 4=8 @@ -217,8 +217,8 @@ Y_UNIT_TEST_SUITE(TestParseNextAction) { Y_UNIT_TEST(TestParsePath) { DoTestParsePathFailure("", 1, 0); - UNIT_ASSERT_VALUES_EQUAL(DoTestParsePathSuccess(TStringBuf("\x00"sv), 1, 0), TStringBuf("")); - UNIT_ASSERT_VALUES_EQUAL(DoTestParsePathSuccess(TStringBuf("\x21\x0C"sv), 1, 0), TStringBuf("a")); + UNIT_ASSERT_VALUES_EQUAL(DoTestParsePathSuccess(TStringBuf("\x00"sv), 1, 0), TStringBuf("")); + UNIT_ASSERT_VALUES_EQUAL(DoTestParsePathSuccess(TStringBuf("\x21\x0C"sv), 1, 0), TStringBuf("a")); DoTestParsePathFailure("\x22\x0C", 1, 0); } diff --git a/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp b/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp index 4f907157e9..84fa453ffc 100644 --- a/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_cast_ut.cpp @@ -14,7 +14,7 @@ using THI = THashMap<int, int>; using TMI = TMap<int, int>; using THSI = THashSet<int>; using TSI = TSet<int>; -using TPI = std::pair<int, int>; +using TPI = std::pair<int, int>; Y_UNIT_TEST_SUITE(TSchemeCastTest) { Y_UNIT_TEST(TestYVector) { diff --git a/library/cpp/scheme/tests/ut/scheme_json_ut.cpp b/library/cpp/scheme/tests/ut/scheme_json_ut.cpp index daeb2654f9..429add3030 100644 --- a/library/cpp/scheme/tests/ut/scheme_json_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_json_ut.cpp @@ -9,8 +9,8 @@ #include <type_traits> #include <library/cpp/string_utils/quote/quote.h> -using namespace std::string_view_literals; - +using namespace std::string_view_literals; + Y_UNIT_TEST_SUITE(TSchemeJsonTest) { Y_UNIT_TEST(TestJson) { const char* json = "[\n" @@ -122,7 +122,7 @@ Y_UNIT_TEST_SUITE(TSchemeJsonTest) { } Y_UNIT_TEST(TestJsonEscape) { - NSc::TValue v("\10\7\6\5\4\3\2\1\0"sv); + NSc::TValue v("\10\7\6\5\4\3\2\1\0"sv); UNIT_ASSERT_VALUES_EQUAL(v.ToJson(), "\"\\b\\u0007\\u0006\\u0005\\u0004\\u0003\\u0002\\u0001\\u0000\""); } diff --git a/library/cpp/scheme/tests/ut/scheme_merge_ut.cpp b/library/cpp/scheme/tests/ut/scheme_merge_ut.cpp index 2a06cf110d..d7e2f75818 100644 --- a/library/cpp/scheme/tests/ut/scheme_merge_ut.cpp +++ b/library/cpp/scheme/tests/ut/scheme_merge_ut.cpp @@ -42,8 +42,8 @@ Y_UNIT_TEST_SUITE(TSchemeMergeTest) { UNIT_ASSERT(0. == v["a"][1]["f"]); UNIT_ASSERT(v["a"][1]["g"].IsArray()); UNIT_ASSERT(v["a"][1]["g"].Has(1)); - UNIT_ASSERT(TStringBuf("h") == v["a"][1]["g"][0]); - UNIT_ASSERT(TStringBuf("i") == v["a"][1]["g"][1]); + UNIT_ASSERT(TStringBuf("h") == v["a"][1]["g"][0]); + UNIT_ASSERT(TStringBuf("i") == v["a"][1]["g"][1]); { TStringBuf data = "{ a : [ { d : 42 }, { g : [ 3 ] } ], q : r }"; @@ -64,7 +64,7 @@ Y_UNIT_TEST_SUITE(TSchemeMergeTest) { UNIT_ASSERT(v.Has("a")); UNIT_ASSERT(v.Has("q")); - UNIT_ASSERT(TStringBuf("r") == v["q"]); + UNIT_ASSERT(TStringBuf("r") == v["q"]); UNIT_ASSERT(v["a"].Has(1)); UNIT_ASSERT(!v["a"][0].Has("b")); UNIT_ASSERT(v["a"][0].Has("d")); diff --git a/library/cpp/sighandler/async_signals_handler.cpp b/library/cpp/sighandler/async_signals_handler.cpp index 00ce1c18fb..ee75e157e5 100644 --- a/library/cpp/sighandler/async_signals_handler.cpp +++ b/library/cpp/sighandler/async_signals_handler.cpp @@ -25,9 +25,9 @@ #include <util/generic/hash.h> namespace { - volatile int SIGNAL_PIPE_WRITE_FD = 0; // will be initialized in ctor + volatile int SIGNAL_PIPE_WRITE_FD = 0; // will be initialized in ctor - void WriteAllOrDie(const int fd, const void* buf, size_t bufsize) { + void WriteAllOrDie(const int fd, const void* buf, size_t bufsize) { size_t totalBytesWritten = 0; while (totalBytesWritten != bufsize) { @@ -38,7 +38,7 @@ namespace { } } - void PipeWriterSignalHandler(int, siginfo_t* info, void*) { + void PipeWriterSignalHandler(int, siginfo_t* info, void*) { const ui8 signum = static_cast<ui8>(info->si_signo); WriteAllOrDie(SIGNAL_PIPE_WRITE_FD, &signum, 1); @@ -188,7 +188,7 @@ namespace { // It such situation we have 2 options: // - wait for auxiliary thread to die - which will cause dead lock // - destruct variable, ignoring thread - which will cause data corruption. - TAsyncSignalsHandler* SIGNALS_HANDLER = nullptr; + TAsyncSignalsHandler* SIGNALS_HANDLER = nullptr; } void SetAsyncSignalHandler(int signum, TAutoPtr<TEventHandler> handler) { diff --git a/library/cpp/sse/ut/test.cpp b/library/cpp/sse/ut/test.cpp index 33c999d284..ad07abe063 100644 --- a/library/cpp/sse/ut/test.cpp +++ b/library/cpp/sse/ut/test.cpp @@ -60,15 +60,15 @@ struct T_mm_CallWrapper { T_mm_CallWrapper<__m128, decltype(_mm_func), _mm_func> #define WrapD(_mm_func) \ T_mm_CallWrapper<__m128d, decltype(_mm_func), _mm_func> -using int8x16_t = std::array<i8, 16>; -using int16x8_t = std::array<i16, 8>; -using int32x4_t = std::array<i32, 4>; -using int64x2_t = std::array<i64, 2>; -using uint8x16_t = std::array<ui8, 16>; -using uint16x8_t = std::array<ui16, 8>; -using uint32x4_t = std::array<ui32, 4>; -using uint64x2_t = std::array<ui64, 2>; -using float32x4_t = std::array<float, 4>; +using int8x16_t = std::array<i8, 16>; +using int16x8_t = std::array<i16, 8>; +using int32x4_t = std::array<i32, 4>; +using int64x2_t = std::array<i64, 2>; +using uint8x16_t = std::array<ui8, 16>; +using uint16x8_t = std::array<ui16, 8>; +using uint32x4_t = std::array<ui32, 4>; +using uint64x2_t = std::array<ui64, 2>; +using float32x4_t = std::array<float, 4>; using float64x2_t = std::array<double, 2>; template <typename TVectorType> diff --git a/library/cpp/streams/lz/lz.cpp b/library/cpp/streams/lz/lz.cpp index b65bb3ed96..82b7b33248 100644 --- a/library/cpp/streams/lz/lz.cpp +++ b/library/cpp/streams/lz/lz.cpp @@ -180,7 +180,7 @@ class TDecompressorBaseImpl: public TDecompressor, public TCommonData { public: static inline ui32 CheckVer(ui32 v) { if (v != 1) { - ythrow yexception() << TStringBuf("incorrect stream version: ") << v; + ythrow yexception() << TStringBuf("incorrect stream version: ") << v; } return v; diff --git a/library/cpp/streams/zstd/zstd.cpp b/library/cpp/streams/zstd/zstd.cpp index 29816f6d4c..45fad9f5c5 100644 --- a/library/cpp/streams/zstd/zstd.cpp +++ b/library/cpp/streams/zstd/zstd.cpp @@ -9,7 +9,7 @@ namespace { inline void CheckError(const char* op, size_t code) { if (::ZSTD_isError(code)) { - ythrow yexception() << op << TStringBuf(" zstd error: ") << ::ZSTD_getErrorName(code); + ythrow yexception() << op << TStringBuf(" zstd error: ") << ::ZSTD_getErrorName(code); } } diff --git a/library/cpp/string_utils/base64/base64.cpp b/library/cpp/string_utils/base64/base64.cpp index 05c201f0de..c85ad417ce 100644 --- a/library/cpp/string_utils/base64/base64.cpp +++ b/library/cpp/string_utils/base64/base64.cpp @@ -65,7 +65,7 @@ namespace { } }; - const TImpl GetImpl() { + const TImpl GetImpl() { static const TImpl IMPL; return IMPL; } diff --git a/library/cpp/string_utils/base64/base64_ut.cpp b/library/cpp/string_utils/base64/base64_ut.cpp index bcc1e65879..4dbefc74e8 100644 --- a/library/cpp/string_utils/base64/base64_ut.cpp +++ b/library/cpp/string_utils/base64/base64_ut.cpp @@ -16,8 +16,8 @@ #include <array> -using namespace std::string_view_literals; - +using namespace std::string_view_literals; + #define BASE64_UT_DECLARE_BASE64_IMPL(prefix, encFunction, decFunction) \ Y_DECLARE_UNUSED \ static size_t prefix##Base64Decode(void* dst, const char* b, const char* e) { \ @@ -298,7 +298,7 @@ Y_UNIT_TEST_SUITE(TBase64) { } Y_UNIT_TEST(TestAllPossibleOctets) { - const TString x("\0\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0B\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7F"sv); + const TString x("\0\x01\x02\x03\x04\x05\x06\x07\b\t\n\x0B\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7F"sv); const TString xEnc = "AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn8="; const TString y = Base64Decode(xEnc); const TString yEnc = Base64Encode(x); @@ -307,7 +307,7 @@ Y_UNIT_TEST_SUITE(TBase64) { } Y_UNIT_TEST(TestTwoPaddingCharacters) { - const TString x("a"); + const TString x("a"); const TString xEnc = "YQ=="; const TString y = Base64Decode(xEnc); const TString yEnc = Base64Encode(x); @@ -316,7 +316,7 @@ Y_UNIT_TEST_SUITE(TBase64) { } Y_UNIT_TEST(TestOnePaddingCharacter) { - const TString x("aa"); + const TString x("aa"); const TString xEnc = "YWE="; const TString y = Base64Decode(xEnc); const TString yEnc = Base64Encode(x); @@ -325,7 +325,7 @@ Y_UNIT_TEST_SUITE(TBase64) { } Y_UNIT_TEST(TestNoPaddingCharacters) { - const TString x("aaa"); + const TString x("aaa"); const TString xEnc = "YWFh"; const TString y = Base64Decode(xEnc); const TString yEnc = Base64Encode(x); @@ -334,7 +334,7 @@ Y_UNIT_TEST_SUITE(TBase64) { } Y_UNIT_TEST(TestTrailingZero) { - const TString x("foo\0"sv); + const TString x("foo\0"sv); const TString xEnc = "Zm9vAA=="; const TString y = Base64Decode(xEnc); const TString yEnc = Base64Encode(x); @@ -343,7 +343,7 @@ Y_UNIT_TEST_SUITE(TBase64) { } Y_UNIT_TEST(TestTwoTrailingZeroes) { - const TString x("foo\0\0"sv); + const TString x("foo\0\0"sv); const TString xEnc = "Zm9vAAA="; const TString y = Base64Decode(xEnc); const TString yEnc = Base64Encode(x); @@ -352,7 +352,7 @@ Y_UNIT_TEST_SUITE(TBase64) { } Y_UNIT_TEST(TestZero) { - const TString x("\0"sv); + const TString x("\0"sv); const TString xEnc = "AA=="; const TString y = Base64Decode(xEnc); const TString yEnc = Base64Encode(x); @@ -361,7 +361,7 @@ Y_UNIT_TEST_SUITE(TBase64) { } Y_UNIT_TEST(TestSymbolsAfterZero) { - const TString x("\0a"sv); + const TString x("\0a"sv); const TString xEnc = "AGE="; const TString y = Base64Decode(xEnc); const TString yEnc = Base64Encode(x); diff --git a/library/cpp/string_utils/indent_text/indent_text.h b/library/cpp/string_utils/indent_text/indent_text.h index 7117d6c0ee..2e8b450ec9 100644 --- a/library/cpp/string_utils/indent_text/indent_text.h +++ b/library/cpp/string_utils/indent_text/indent_text.h @@ -3,4 +3,4 @@ #include <util/generic/string.h> #include <util/generic/strbuf.h> -TString IndentText(TStringBuf text, TStringBuf indent = TStringBuf(" ")); +TString IndentText(TStringBuf text, TStringBuf indent = TStringBuf(" ")); diff --git a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp index cf0f78637f..a2705d6ba3 100644 --- a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp +++ b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp @@ -26,8 +26,8 @@ namespace { Y_UNIT_TEST_SUITE(Levenstein) { Y_UNIT_TEST(Distance) { - UNIT_ASSERT_VALUES_EQUAL(NLevenshtein::Distance(TStringBuf("hello"), TStringBuf("hulloah")), 3); - UNIT_ASSERT_VALUES_EQUAL(NLevenshtein::Distance(TStringBuf("yeoman"), TStringBuf("yo man")), 2); + UNIT_ASSERT_VALUES_EQUAL(NLevenshtein::Distance(TStringBuf("hello"), TStringBuf("hulloah")), 3); + UNIT_ASSERT_VALUES_EQUAL(NLevenshtein::Distance(TStringBuf("yeoman"), TStringBuf("yo man")), 2); } } diff --git a/library/cpp/string_utils/quote/quote.cpp b/library/cpp/string_utils/quote/quote.cpp index e523350b80..26693c44b3 100644 --- a/library/cpp/string_utils/quote/quote.cpp +++ b/library/cpp/string_utils/quote/quote.cpp @@ -114,7 +114,7 @@ static inline It1 Escape(It1 to, It2 from, It3 end, const bool* escape_map = cha *to++ = (*from == ' ' ? '+' : *from); } - ++from; + ++from; } *to = 0; @@ -129,12 +129,12 @@ static inline It1 Unescape(It1 to, It2 from, It3 end, FromHex fromHex) { while (from != end) { switch (*from) { case '%': - ++from; + ++from; *to++ = fromHex.x2c(from); break; case '+': *to++ = ' '; - ++from; + ++from; break; default: *to++ = *from++; @@ -289,7 +289,7 @@ char* UrlEscape(char* to, const char* from, bool forceEscape) { *to++ = d2x((unsigned char)*from & 0xF); } else *to++ = *from; - ++from; + ++from; } *to = 0; diff --git a/library/cpp/string_utils/quote/quote_ut.cpp b/library/cpp/string_utils/quote/quote_ut.cpp index 6c552b279e..1c682efda0 100644 --- a/library/cpp/string_utils/quote/quote_ut.cpp +++ b/library/cpp/string_utils/quote/quote_ut.cpp @@ -22,7 +22,7 @@ Y_UNIT_TEST_SUITE(TCGIEscapeTest) { Y_UNIT_TEST(StringBuf) { char tmp[100]; - UNIT_ASSERT_VALUES_EQUAL(CgiEscape(tmp, "!@#$%^&*(){}[]\" "), TStringBuf("!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+")); + UNIT_ASSERT_VALUES_EQUAL(CgiEscape(tmp, "!@#$%^&*(){}[]\" "), TStringBuf("!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+")); } Y_UNIT_TEST(StrokaRet) { @@ -51,7 +51,7 @@ Y_UNIT_TEST_SUITE(TCGIUnescapeTest) { Y_UNIT_TEST(StringBuf) { char tmp[100]; - UNIT_ASSERT_VALUES_EQUAL(CgiUnescape(tmp, "!@%23$%25^%26*%28%29"), TStringBuf("!@#$%^&*()")); + UNIT_ASSERT_VALUES_EQUAL(CgiUnescape(tmp, "!@%23$%25^%26*%28%29"), TStringBuf("!@#$%^&*()")); } Y_UNIT_TEST(TestValidZeroTerm) { diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp index 85f4ac5d69..ae70184c31 100644 --- a/library/cpp/string_utils/url/url.cpp +++ b/library/cpp/string_utils/url/url.cpp @@ -17,14 +17,14 @@ namespace { struct TUncheckedSize { - static bool Has(size_t) { + static bool Has(size_t) { return true; } }; struct TKnownSize { size_t MySize; - explicit TKnownSize(size_t sz) + explicit TKnownSize(size_t sz) : MySize(sz) { } @@ -158,17 +158,17 @@ TStringBuf GetSchemeHostAndPort(const TStringBuf url, bool trimHttp, bool trimDe const size_t schemeSize = GetSchemePrefixSize(url); const TStringBuf scheme = url.Head(schemeSize); - const bool isHttp = (schemeSize == 0 || scheme == TStringBuf("http://")); + const bool isHttp = (schemeSize == 0 || scheme == TStringBuf("http://")); TStringBuf hostAndPort = GetHostAndPort(url.Tail(schemeSize)); if (trimDefaultPort) { const size_t pos = hostAndPort.find(':'); if (pos != TStringBuf::npos) { - const bool isHttps = (scheme == TStringBuf("https://")); + const bool isHttps = (scheme == TStringBuf("https://")); const TStringBuf port = hostAndPort.Tail(pos + 1); - if ((isHttp && port == TStringBuf("80")) || (isHttps && port == TStringBuf("443"))) { + if ((isHttp && port == TStringBuf("80")) || (isHttps && port == TStringBuf("443"))) { // trimming default port hostAndPort = hostAndPort.Head(pos); } @@ -221,9 +221,9 @@ bool TryGetSchemeHostAndPort(const TStringBuf url, TStringBuf& scheme, TStringBu } } else { host = hostAndPort; - if (scheme == TStringBuf("https://")) { + if (scheme == TStringBuf("https://")) { port = 443; - } else if (scheme == TStringBuf("http://")) { + } else if (scheme == TStringBuf("http://")) { port = 80; } } @@ -254,7 +254,7 @@ TStringBuf GetDomain(const TStringBuf host) noexcept { for (bool wasPoint = false; c != host.data(); --c) { if (*c == '.') { if (wasPoint) { - ++c; + ++c; break; } wasPoint = true; @@ -316,14 +316,14 @@ static inline bool IsSchemeChar(char c) noexcept { static bool HasPrefix(const TStringBuf url) noexcept { TStringBuf scheme, unused; - if (!url.TrySplit(TStringBuf("://"), scheme, unused)) + if (!url.TrySplit(TStringBuf("://"), scheme, unused)) return false; return AllOf(scheme, IsSchemeChar); } TString AddSchemePrefix(const TString& url) { - return AddSchemePrefix(url, TStringBuf("http")); + return AddSchemePrefix(url, TStringBuf("http")); } TString AddSchemePrefix(const TString& url, TStringBuf scheme) { @@ -331,7 +331,7 @@ TString AddSchemePrefix(const TString& url, TStringBuf scheme) { return url; } - return TString::Join(scheme, TStringBuf("://"), url); + return TString::Join(scheme, TStringBuf("://"), url); } #define X(c) (c >= 'A' ? ((c & 0xdf) - 'A') + 10 : (c - '0')) diff --git a/library/cpp/testing/benchmark/bench.cpp b/library/cpp/testing/benchmark/bench.cpp index 08d8708005..24299e6b12 100644 --- a/library/cpp/testing/benchmark/bench.cpp +++ b/library/cpp/testing/benchmark/bench.cpp @@ -73,7 +73,7 @@ namespace { const TStringBuf N; }; - inline TString DoFmtTime(double t) { + inline TString DoFmtTime(double t) { if (t > 0.1) { return ToString(t) + " seconds"; } @@ -173,7 +173,7 @@ namespace { } }; - TLinFunc CalcModel(const TSamples& s) { + TLinFunc CalcModel(const TSamples& s) { TKahanSLRSolver solver; for (const auto& p : s) { @@ -188,7 +188,7 @@ namespace { return TLinFunc{c, i}; } - inline TSamples RemoveOutliers(const TSamples& s, double fraction) { + inline TSamples RemoveOutliers(const TSamples& s, double fraction) { if (s.size() < 20) { return s; } @@ -263,7 +263,7 @@ namespace { using TTests = TIntrusiveListWithAutoDelete<ITestRunner, TDestructor>; - inline TTests& Tests() { + inline TTests& Tests() { return *Singleton<TTests>(); } @@ -285,7 +285,7 @@ namespace { F_JSON /* "json" */ }; - TAdaptiveLock STDOUT_LOCK; + TAdaptiveLock STDOUT_LOCK; struct IReporter { virtual void Report(TResult&& result) = 0; @@ -420,7 +420,7 @@ namespace { TAdaptiveLock ResultsLock_; }; - THolder<IReporter> MakeReporter(const EOutFormat type) { + THolder<IReporter> MakeReporter(const EOutFormat type) { switch (type) { case F_CONSOLE: return MakeHolder<TConsoleReporter>(); @@ -438,11 +438,11 @@ namespace { return MakeHolder<TConsoleReporter>(); // make compiler happy } - THolder<IReporter> MakeOrderedReporter(const EOutFormat type) { + THolder<IReporter> MakeOrderedReporter(const EOutFormat type) { return MakeHolder<TOrderedReporter>(MakeReporter(type)); } - void EnumerateTests(TVector<ITestRunner*>& tests) { + void EnumerateTests(TVector<ITestRunner*>& tests) { for (size_t id : xrange(tests.size())) { tests[id]->SequentialId = id; } @@ -453,11 +453,11 @@ template <> EOutFormat FromStringImpl<EOutFormat>(const char* data, size_t len) { const auto s = TStringBuf{data, len}; - if (TStringBuf("console") == s) { + if (TStringBuf("console") == s) { return F_CONSOLE; - } else if (TStringBuf("csv") == s) { + } else if (TStringBuf("csv") == s) { return F_CSV; - } else if (TStringBuf("json") == s) { + } else if (TStringBuf("json") == s) { return F_JSON; } diff --git a/library/cpp/testing/benchmark/bench.h b/library/cpp/testing/benchmark/bench.h index 21551ad0dd..d2fab33709 100644 --- a/library/cpp/testing/benchmark/bench.h +++ b/library/cpp/testing/benchmark/bench.h @@ -84,9 +84,9 @@ namespace NBench { int Main(int argc, char** argv); } -#define Y_CPU_BENCHMARK(name, cnt) \ - namespace N_bench_##name { \ - static void Run(::NBench::NCpu::TParams&); \ - const ::NBench::NCpu::TRegistar benchmark(#name, &Run); \ - } \ +#define Y_CPU_BENCHMARK(name, cnt) \ + namespace N_bench_##name { \ + static void Run(::NBench::NCpu::TParams&); \ + const ::NBench::NCpu::TRegistar benchmark(#name, &Run); \ + } \ static void N_bench_##name::Run(::NBench::NCpu::TParams& cnt) diff --git a/library/cpp/testing/common/env.h b/library/cpp/testing/common/env.h index 7b89aa1bed..af1c807e3c 100644 --- a/library/cpp/testing/common/env.h +++ b/library/cpp/testing/common/env.h @@ -11,7 +11,7 @@ TString ArcadiaSourceRoot(); // @brief return full path for file or folder specified by known source location `where` and `path` which is relative to parent folder of `where` -// for the instance: there is 2 files in folder test example_ut.cpp and example.data, so full path to test/example.data can be obtained +// for the instance: there is 2 files in folder test example_ut.cpp and example.data, so full path to test/example.data can be obtained // from example_ut.cpp as ArcadiaFromCurrentLocation(__SOURCE_FILE__, "example.data") TString ArcadiaFromCurrentLocation(TStringBuf where, TStringBuf path); diff --git a/library/cpp/testing/common/network.cpp b/library/cpp/testing/common/network.cpp index 230c50ee6d..40965779fb 100644 --- a/library/cpp/testing/common/network.cpp +++ b/library/cpp/testing/common/network.cpp @@ -37,7 +37,7 @@ namespace { { } - ~TPortGuard() override { + ~TPortGuard() override { Y_VERIFY_SYSERROR(NFs::Remove(Lock_->GetName())); } diff --git a/library/cpp/testing/gmock_in_unittest/events.cpp b/library/cpp/testing/gmock_in_unittest/events.cpp index dbd65b727d..5f3e21b23e 100644 --- a/library/cpp/testing/gmock_in_unittest/events.cpp +++ b/library/cpp/testing/gmock_in_unittest/events.cpp @@ -12,18 +12,18 @@ void TGMockTestEventListener::OnTestPartResult(const testing::TestPartResult& re const TString summary = result.summary(); TStringBuilder msg; if (result.file_name()) - msg << result.file_name() << TStringBuf(":"); + msg << result.file_name() << TStringBuf(":"); if (result.line_number() != -1) - msg << result.line_number() << TStringBuf(":"); + msg << result.line_number() << TStringBuf(":"); if (summary) { if (msg) { - msg << TStringBuf("\n"); + msg << TStringBuf("\n"); } msg << summary; } if (message && summary != message) { if (msg) { - msg << TStringBuf("\n"); + msg << TStringBuf("\n"); } msg << message; } diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp index 3679b768ed..0fe5ef9700 100644 --- a/library/cpp/testing/unittest/registar.cpp +++ b/library/cpp/testing/unittest/registar.cpp @@ -364,7 +364,7 @@ void NUnitTest::TTestBase::AtEnd() { Processor()->UnitStop(unit); } -void NUnitTest::TTestBase::Run(std::function<void()> f, const TString& suite, const char* name, const bool forceFork) { +void NUnitTest::TTestBase::Run(std::function<void()> f, const TString& suite, const char* name, const bool forceFork) { TestErrors_ = 0; CurrentSubtest_ = name; Processor()->Run(f, suite, name, forceFork); diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index 44517a0092..76f48372bc 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -135,7 +135,7 @@ namespace NUnitTest { // Should execute a test whitin suite? virtual bool CheckAccessTest(TString /*suite*/, const char* /*name*/); - virtual void Run(std::function<void()> f, const TString& /*suite*/, const char* /*name*/, bool /*forceFork*/); + virtual void Run(std::function<void()> f, const TString& /*suite*/, const char* /*name*/, bool /*forceFork*/); // This process is forked for current test virtual bool GetIsForked() const; @@ -219,11 +219,11 @@ namespace NUnitTest { void AtEnd(); - void Run(std::function<void()> f, const TString& suite, const char* name, bool forceFork); + void Run(std::function<void()> f, const TString& suite, const char* name, bool forceFork); class TCleanUp { public: - explicit TCleanUp(TTestBase* base); + explicit TCleanUp(TTestBase* base); ~TCleanUp(); @@ -771,7 +771,7 @@ public: \ ITestSuiteProcessor* Processor() const noexcept; private: - explicit TTestFactory(ITestSuiteProcessor* processor); + explicit TTestFactory(ITestSuiteProcessor* processor); ~TTestFactory(); @@ -805,15 +805,15 @@ public: \ { } - inline TBaseTestCase(const char* name, std::function<void(TTestContext&)> body, bool forceFork) + inline TBaseTestCase(const char* name, std::function<void(TTestContext&)> body, bool forceFork) : Name_(name) - , Body_(std::move(body)) + , Body_(std::move(body)) , ForceFork_(forceFork) { } virtual ~TBaseTestCase() = default; - + // Each test case is executed in 3 steps: // // 1. SetUp() (from fixture) @@ -850,7 +850,7 @@ public: \ Parent->SetHandler(); } - TInvokeGuard(TInvokeGuard&& guard) noexcept + TInvokeGuard(TInvokeGuard&& guard) noexcept : Parent(guard.Parent) { guard.Parent = nullptr; @@ -912,7 +912,7 @@ public: \ }; #define UNIT_TEST_SUITE_REGISTRATION(T) \ - static const ::NUnitTest::TTestBaseFactory<T> Y_GENERATE_UNIQUE_ID(UTREG_); + static const ::NUnitTest::TTestBaseFactory<T> Y_GENERATE_UNIQUE_ID(UTREG_); #define Y_UNIT_TEST_SUITE_IMPL_F(N, T, F) \ namespace NTestSuite##N { \ @@ -936,9 +936,9 @@ public: \ return StaticName(); \ } \ \ - static void AddTest(const char* name, \ - const std::function<void(NUnitTest::TTestContext&)>& body, bool forceFork) \ - { \ + static void AddTest(const char* name, \ + const std::function<void(NUnitTest::TTestContext&)>& body, bool forceFork) \ + { \ Tests().push_back([=]{ return MakeHolder<NUnitTest::TBaseTestCase>(name, body, forceFork); }); \ } \ \ @@ -1005,7 +1005,7 @@ public: \ TCurrentTest::AddTest(TTestCase##N::Create); \ } \ }; \ - static const TTestRegistration##N testRegistration##N; + static const TTestRegistration##N testRegistration##N; #define Y_UNIT_TEST_IMPL(N, FF, F) \ Y_UNIT_TEST_IMPL_REGISTER(N, FF, F) \ diff --git a/library/cpp/testing/unittest/registar_ut.cpp b/library/cpp/testing/unittest/registar_ut.cpp index 1f36d53abb..b06a3f7a68 100644 --- a/library/cpp/testing/unittest/registar_ut.cpp +++ b/library/cpp/testing/unittest/registar_ut.cpp @@ -43,9 +43,9 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) { UNIT_ASSERT_TEST_FAILS(stringsEqual("q", TString("w"))); UNIT_ASSERT_TEST_FAILS(stringsEqual(TString("q"), "w")); UNIT_ASSERT_TEST_FAILS(stringsEqual(TString("a"), TString("b"))); - UNIT_ASSERT_TEST_FAILS(stringsEqual(TString("a"), TStringBuf("b"))); - UNIT_ASSERT_TEST_FAILS(stringsEqual("a", TStringBuf("b"))); - UNIT_ASSERT_TEST_FAILS(stringsEqual(TStringBuf("a"), "b")); + UNIT_ASSERT_TEST_FAILS(stringsEqual(TString("a"), TStringBuf("b"))); + UNIT_ASSERT_TEST_FAILS(stringsEqual("a", TStringBuf("b"))); + UNIT_ASSERT_TEST_FAILS(stringsEqual(TStringBuf("a"), "b")); TString empty; TStringBuf emptyBuf; @@ -86,19 +86,19 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) { UNIT_ASSERT_TEST_FAILS(stringsUnequal("", "")); UNIT_ASSERT_TEST_FAILS(stringsUnequal("42", TString("42"))); UNIT_ASSERT_TEST_FAILS(stringsUnequal(TString("4"), "4")); - UNIT_ASSERT_TEST_FAILS(stringsUnequal("d", TStringBuf("d"))); - UNIT_ASSERT_TEST_FAILS(stringsUnequal(TStringBuf("yandex"), "yandex")); - UNIT_ASSERT_TEST_FAILS(stringsUnequal(TStringBuf("index"), TString("index"))); - UNIT_ASSERT_TEST_FAILS(stringsUnequal(TString("diff"), TStringBuf("diff"))); + UNIT_ASSERT_TEST_FAILS(stringsUnequal("d", TStringBuf("d"))); + UNIT_ASSERT_TEST_FAILS(stringsUnequal(TStringBuf("yandex"), "yandex")); + UNIT_ASSERT_TEST_FAILS(stringsUnequal(TStringBuf("index"), TString("index"))); + UNIT_ASSERT_TEST_FAILS(stringsUnequal(TString("diff"), TStringBuf("diff"))); UNIT_ASSERT_STRINGS_UNEQUAL("1", "2"); UNIT_ASSERT_STRINGS_UNEQUAL("", "3"); - UNIT_ASSERT_STRINGS_UNEQUAL("green", TStringBuf("red")); - UNIT_ASSERT_STRINGS_UNEQUAL(TStringBuf("solomon"), "golovan"); + UNIT_ASSERT_STRINGS_UNEQUAL("green", TStringBuf("red")); + UNIT_ASSERT_STRINGS_UNEQUAL(TStringBuf("solomon"), "golovan"); UNIT_ASSERT_STRINGS_UNEQUAL("d", TString("f")); UNIT_ASSERT_STRINGS_UNEQUAL(TString("yandex"), "index"); - UNIT_ASSERT_STRINGS_UNEQUAL(TString("mail"), TStringBuf("yandex")); - UNIT_ASSERT_STRINGS_UNEQUAL(TStringBuf("C++"), TString("python")); + UNIT_ASSERT_STRINGS_UNEQUAL(TString("mail"), TStringBuf("yandex")); + UNIT_ASSERT_STRINGS_UNEQUAL(TStringBuf("C++"), TString("python")); } Y_UNIT_TEST(Equal) { @@ -352,7 +352,7 @@ Y_UNIT_TEST_SUITE(TUnitTestMacroTest) { Y_UNIT_TEST(ExceptionContains) { UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>("cba")); - UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>(TStringBuf("cba"))); + UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>(TStringBuf("cba"))); UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>(TString("cba"))); UNIT_ASSERT_TEST_FAILS(TTestException("abc").AssertExceptionContains<TTestException>(TStringBuilder() << "cba")); diff --git a/library/cpp/testing/unittest/utmain.cpp b/library/cpp/testing/unittest/utmain.cpp index 305bc6b40f..7f345ba7ca 100644 --- a/library/cpp/testing/unittest/utmain.cpp +++ b/library/cpp/testing/unittest/utmain.cpp @@ -151,12 +151,12 @@ private: TStringBuilder msgs; for (const TString& m : ErrorMessages) { if (msgs) { - msgs << TStringBuf("\n"); + msgs << TStringBuf("\n"); } msgs << m; } if (msgs) { - msgs << TStringBuf("\n"); + msgs << TStringBuf("\n"); } TraceSubtestFinished(descr->test->unit->name.data(), descr->test->name, "fail", msgs, descr->Context); ErrorMessages.clear(); diff --git a/library/cpp/threading/equeue/equeue.cpp b/library/cpp/threading/equeue/equeue.cpp index 54a848e912..9d3b2785db 100644 --- a/library/cpp/threading/equeue/equeue.cpp +++ b/library/cpp/threading/equeue/equeue.cpp @@ -29,7 +29,7 @@ public: AtomicIncrement(Queue_->ObjectCount_); } - ~TDecrementingWrapper() override { + ~TDecrementingWrapper() override { AtomicDecrement(Queue_->ObjectCount_); AtomicDecrement(Queue_->GuardCount_); } diff --git a/library/cpp/threading/equeue/equeue_ut.cpp b/library/cpp/threading/equeue/equeue_ut.cpp index 9cf2aced44..5ff4c69347 100644 --- a/library/cpp/threading/equeue/equeue_ut.cpp +++ b/library/cpp/threading/equeue/equeue_ut.cpp @@ -41,7 +41,7 @@ Y_UNIT_TEST_SUITE(TElasticQueueTest) { Counters.Reset(); struct TWaitJob: public IObjectInQueue { - void Process(void*) override { + void Process(void*) override { WaitEvent.Wait(); AtomicIncrement(Counters.Processed); } @@ -72,7 +72,7 @@ Y_UNIT_TEST_SUITE(TElasticQueueTest) { //concurrent test -- send many jobs from different threads struct TJob: public IObjectInQueue { - void Process(void*) override { + void Process(void*) override { AtomicIncrement(Counters.Processed); }; }; @@ -96,7 +96,7 @@ Y_UNIT_TEST_SUITE(TElasticQueueTest) { TryCounter = 0; struct TSender: public IThreadFactory::IThreadAble { - void DoExecute() override { + void DoExecute() override { while ((size_t)AtomicIncrement(TryCounter) <= N) { if (!TryAdd()) { Sleep(TDuration::MicroSeconds(50)); diff --git a/library/cpp/threading/future/subscription/wait_all_or_exception_ut.cpp b/library/cpp/threading/future/subscription/wait_all_or_exception_ut.cpp index 34ae9edb4e..0a9f84ab69 100644 --- a/library/cpp/threading/future/subscription/wait_all_or_exception_ut.cpp +++ b/library/cpp/threading/future/subscription/wait_all_or_exception_ut.cpp @@ -29,7 +29,7 @@ Y_UNIT_TEST_SUITE(TWaitAllOrExceptionTest) { auto w = NWait::WaitAllOrException(p1.GetFuture(), p2.GetFuture()); UNIT_ASSERT(!w.HasValue() && !w.HasException()); - constexpr TStringBuf message = "Test exception"; + constexpr TStringBuf message = "Test exception"; p1.SetException(std::make_exception_ptr(yexception() << message)); UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) { return message == e.what(); @@ -54,7 +54,7 @@ Y_UNIT_TEST_SUITE(TWaitAllOrExceptionTest) { auto w = NWait::WaitAllOrException(f, p.GetFuture()); UNIT_ASSERT(!w.HasValue() && !w.HasException()); - constexpr TStringBuf message = "Test exception 2"; + constexpr TStringBuf message = "Test exception 2"; p.SetException(std::make_exception_ptr(yexception() << message)); UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) { return message == e.what(); @@ -85,7 +85,7 @@ Y_UNIT_TEST_SUITE(TWaitAllOrExceptionTest) { auto w = NWait::WaitAllOrException(TVector<TFuture<void>>{ p.GetFuture() }); UNIT_ASSERT(!w.HasValue() && !w.HasException()); - constexpr TStringBuf message = "Test exception 3"; + constexpr TStringBuf message = "Test exception 3"; p.SetException(std::make_exception_ptr(yexception() << message)); UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) { return message == e.what(); @@ -112,7 +112,7 @@ Y_UNIT_TEST_SUITE(TWaitAllOrExceptionTest) { auto w = NWait::WaitAllOrException(TVector<TFuture<int>>{ p1.GetFuture(), f, p2.GetFuture() }); UNIT_ASSERT(!w.HasValue() && !w.HasException()); - constexpr TStringBuf message = "Test exception 4"; + constexpr TStringBuf message = "Test exception 4"; p1.SetException(std::make_exception_ptr(yexception() << message)); UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) { return message == e.what(); @@ -124,7 +124,7 @@ Y_UNIT_TEST_SUITE(TWaitAllOrExceptionTest) { Y_UNIT_TEST(TestManyWithVectorAndIntialError) { auto p1 = NewPromise(); auto p2 = NewPromise(); - constexpr TStringBuf message = "Test exception 5"; + constexpr TStringBuf message = "Test exception 5"; auto f = MakeErrorFuture<void>(std::make_exception_ptr(yexception() << message)); auto w = NWait::WaitAllOrException(TVector<TFuture<void>>{ p1.GetFuture(), p2.GetFuture(), f }); UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) { diff --git a/library/cpp/threading/future/subscription/wait_all_ut.cpp b/library/cpp/threading/future/subscription/wait_all_ut.cpp index 3bc9762671..73e2d4d6e4 100644 --- a/library/cpp/threading/future/subscription/wait_all_ut.cpp +++ b/library/cpp/threading/future/subscription/wait_all_ut.cpp @@ -29,7 +29,7 @@ Y_UNIT_TEST_SUITE(TWaitAllTest) { auto w = NWait::WaitAll(p1.GetFuture(), p2.GetFuture()); UNIT_ASSERT(!w.HasValue() && !w.HasException()); - constexpr TStringBuf message = "Test exception"; + constexpr TStringBuf message = "Test exception"; p1.SetException(std::make_exception_ptr(yexception() << message)); UNIT_ASSERT(!w.HasValue() && !w.HasException()); @@ -55,7 +55,7 @@ Y_UNIT_TEST_SUITE(TWaitAllTest) { auto w = NWait::WaitAll(f, p.GetFuture()); UNIT_ASSERT(!w.HasValue() && !w.HasException()); - constexpr TStringBuf message = "Test exception 2"; + constexpr TStringBuf message = "Test exception 2"; p.SetException(std::make_exception_ptr(yexception() << message)); UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) { return message == e.what(); @@ -86,7 +86,7 @@ Y_UNIT_TEST_SUITE(TWaitAllTest) { auto w = NWait::WaitAll(TVector<TFuture<void>>{ p.GetFuture() }); UNIT_ASSERT(!w.HasValue() && !w.HasException()); - constexpr TStringBuf message = "Test exception 3"; + constexpr TStringBuf message = "Test exception 3"; p.SetException(std::make_exception_ptr(yexception() << message)); UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) { return message == e.what(); @@ -113,7 +113,7 @@ Y_UNIT_TEST_SUITE(TWaitAllTest) { auto w = NWait::WaitAll(TVector<TFuture<int>>{ p1.GetFuture(), f, p2.GetFuture() }); UNIT_ASSERT(!w.HasValue() && !w.HasException()); - constexpr TStringBuf message = "Test exception 4"; + constexpr TStringBuf message = "Test exception 4"; p1.SetException(std::make_exception_ptr(yexception() << message)); UNIT_ASSERT(!w.HasValue() && !w.HasException()); diff --git a/library/cpp/threading/future/subscription/wait_any_ut.cpp b/library/cpp/threading/future/subscription/wait_any_ut.cpp index 262080e8d1..745072b892 100644 --- a/library/cpp/threading/future/subscription/wait_any_ut.cpp +++ b/library/cpp/threading/future/subscription/wait_any_ut.cpp @@ -27,7 +27,7 @@ Y_UNIT_TEST_SUITE(TWaitAnyTest) { auto w = NWait::WaitAny(p1.GetFuture(), p2.GetFuture()); UNIT_ASSERT(!w.HasValue() && !w.HasException()); - constexpr TStringBuf message = "Test exception"; + constexpr TStringBuf message = "Test exception"; p2.SetException(std::make_exception_ptr(yexception() << message)); UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) { return message == e.what(); @@ -47,7 +47,7 @@ Y_UNIT_TEST_SUITE(TWaitAnyTest) { Y_UNIT_TEST(TestOneUnsignaledOneSignaledWithException) { auto p = NewPromise(); - constexpr TStringBuf message = "Test exception 2"; + constexpr TStringBuf message = "Test exception 2"; auto f = MakeErrorFuture<void>(std::make_exception_ptr(yexception() << message)); auto w = NWait::WaitAny(f, p.GetFuture()); UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) { @@ -81,7 +81,7 @@ Y_UNIT_TEST_SUITE(TWaitAnyTest) { auto w = NWait::WaitAny(TVector<TFuture<void>>{ p.GetFuture() }); UNIT_ASSERT(!w.HasValue() && !w.HasException()); - constexpr TStringBuf message = "Test exception 3"; + constexpr TStringBuf message = "Test exception 3"; p.SetException(std::make_exception_ptr(yexception() << message)); UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) { return message == e.what(); @@ -121,7 +121,7 @@ Y_UNIT_TEST_SUITE(TWaitAnyTest) { auto w = NWait::WaitAny(TVector<TFuture<void>>{ p1.GetFuture(), p2.GetFuture(), p3.GetFuture() }); UNIT_ASSERT(!w.HasValue() && !w.HasException()); - constexpr TStringBuf message = "Test exception 4"; + constexpr TStringBuf message = "Test exception 4"; p2.SetException(std::make_exception_ptr(yexception() << message)); UNIT_ASSERT_EXCEPTION_SATISFIES(w.TryRethrow(), yexception, [message](auto const& e) { return message == e.what(); diff --git a/library/cpp/threading/skip_list/perf/main.cpp b/library/cpp/threading/skip_list/perf/main.cpp index 4ad52049e7..8b6365d233 100644 --- a/library/cpp/threading/skip_list/perf/main.cpp +++ b/library/cpp/threading/skip_list/perf/main.cpp @@ -18,11 +18,11 @@ namespace { //////////////////////////////////////////////////////////////////////////////// - IOutputStream& LogInfo() { + IOutputStream& LogInfo() { return Cerr << TInstant::Now() << " INFO: "; } - IOutputStream& LogError() { + IOutputStream& LogError() { return Cerr << TInstant::Now() << " ERROR: "; } diff --git a/library/cpp/threading/task_scheduler/task_scheduler.cpp b/library/cpp/threading/task_scheduler/task_scheduler.cpp index 174dde4bf7..e3a847b234 100644 --- a/library/cpp/threading/task_scheduler/task_scheduler.cpp +++ b/library/cpp/threading/task_scheduler/task_scheduler.cpp @@ -85,7 +85,7 @@ namespace { AtomicIncrement(Counter_); } - ~TTaskWrapper() override { + ~TTaskWrapper() override { AtomicDecrement(Counter_); } private: diff --git a/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp b/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp index 3b5203194a..50e40316d0 100644 --- a/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp +++ b/library/cpp/threading/task_scheduler/task_scheduler_ut.cpp @@ -21,10 +21,10 @@ class TTaskSchedulerTest: public TTestBase { AtomicIncrement(ScheduledTaskCounter_); } - ~TCheckTask() override { + ~TCheckTask() override { } - bool Process() override { + bool Process() override { const TDuration delay = Now() - Start_; if (delay < Delay_) { diff --git a/library/cpp/timezone_conversion/civil.cpp b/library/cpp/timezone_conversion/civil.cpp index 5986318b9a..756b2a2b01 100644 --- a/library/cpp/timezone_conversion/civil.cpp +++ b/library/cpp/timezone_conversion/civil.cpp @@ -20,7 +20,7 @@ namespace { return true; } - bool TryParseUTCOffsetTimezone(TStringBuf name, int& offset) { + bool TryParseUTCOffsetTimezone(TStringBuf name, int& offset) { static constexpr TStringBuf OFFSET_PREFIX = "UTC"; if (!name.SkipPrefix(OFFSET_PREFIX)) { return false; @@ -210,25 +210,25 @@ void Out<NDatetime::TWeekday>(IOutputStream& out, NDatetime::TWeekday wd) { using namespace cctz; switch (wd) { case weekday::monday: - out << TStringBuf("Monday"); + out << TStringBuf("Monday"); break; case weekday::tuesday: - out << TStringBuf("Tuesday"); + out << TStringBuf("Tuesday"); break; case weekday::wednesday: - out << TStringBuf("Wednesday"); + out << TStringBuf("Wednesday"); break; case weekday::thursday: - out << TStringBuf("Thursday"); + out << TStringBuf("Thursday"); break; case weekday::friday: - out << TStringBuf("Friday"); + out << TStringBuf("Friday"); break; case weekday::saturday: - out << TStringBuf("Saturday"); + out << TStringBuf("Saturday"); break; case weekday::sunday: - out << TStringBuf("Sunday"); + out << TStringBuf("Sunday"); break; } } diff --git a/library/cpp/unicode/punycode/punycode.cpp b/library/cpp/unicode/punycode/punycode.cpp index 800d1f19fe..f524cfbbf6 100644 --- a/library/cpp/unicode/punycode/punycode.cpp +++ b/library/cpp/unicode/punycode/punycode.cpp @@ -130,7 +130,7 @@ bool CanBePunycodeHostName(const TStringBuf& host) { if (!IsStringASCII(host.begin(), host.end())) return false; - static constexpr TStringBuf ACE = "xn--"; + static constexpr TStringBuf ACE = "xn--"; TStringBuf tail(host); while (tail) { diff --git a/library/cpp/uri/assign.cpp b/library/cpp/uri/assign.cpp index ae9125c727..edc5d9f99e 100644 --- a/library/cpp/uri/assign.cpp +++ b/library/cpp/uri/assign.cpp @@ -195,7 +195,7 @@ namespace NUri { // process #! fragments // https://developers.google.com/webmasters/ajax-crawling/docs/specification - static const TStringBuf escFragPrefix(TStringBuf("_escaped_fragment_=")); + static const TStringBuf escFragPrefix(TStringBuf("_escaped_fragment_=")); bool encHashBangFrag = false; TStringBuf qryBeforeEscapedFragment; diff --git a/library/cpp/uri/common.cpp b/library/cpp/uri/common.cpp index 05af1e57d1..2047bfb78e 100644 --- a/library/cpp/uri/common.cpp +++ b/library/cpp/uri/common.cpp @@ -8,12 +8,12 @@ namespace NUri { const TSchemeInfo TSchemeInfo::Registry[] = { TSchemeInfo(TScheme::SchemeEmpty, TStringBuf()), // scheme is empty and inited - TSchemeInfo(TScheme::SchemeHTTP, TStringBuf("http"), TField::FlagHost | TField::FlagPath, 80), - TSchemeInfo(TScheme::SchemeHTTPS, TStringBuf("https"), TField::FlagHost | TField::FlagPath, 443), - TSchemeInfo(TScheme::SchemeFTP, TStringBuf("ftp"), TField::FlagHost | TField::FlagPath, 20), - TSchemeInfo(TScheme::SchemeFILE, TStringBuf("file"), TField::FlagPath), - TSchemeInfo(TScheme::SchemeWS, TStringBuf("ws"), TField::FlagHost | TField::FlagPath, 80), - TSchemeInfo(TScheme::SchemeWSS, TStringBuf("wss"), TField::FlagHost | TField::FlagPath, 443), + TSchemeInfo(TScheme::SchemeHTTP, TStringBuf("http"), TField::FlagHost | TField::FlagPath, 80), + TSchemeInfo(TScheme::SchemeHTTPS, TStringBuf("https"), TField::FlagHost | TField::FlagPath, 443), + TSchemeInfo(TScheme::SchemeFTP, TStringBuf("ftp"), TField::FlagHost | TField::FlagPath, 20), + TSchemeInfo(TScheme::SchemeFILE, TStringBuf("file"), TField::FlagPath), + TSchemeInfo(TScheme::SchemeWS, TStringBuf("ws"), TField::FlagHost | TField::FlagPath, 80), + TSchemeInfo(TScheme::SchemeWSS, TStringBuf("wss"), TField::FlagHost | TField::FlagPath, 443), // add above TSchemeInfo(TScheme::SchemeUnknown, TStringBuf()) // scheme is empty and uninited }; diff --git a/library/cpp/uri/uri.cpp b/library/cpp/uri/uri.cpp index 56a9a4e5ef..8e759c04be 100644 --- a/library/cpp/uri/uri.cpp +++ b/library/cpp/uri/uri.cpp @@ -190,7 +190,7 @@ namespace NUri { // ... and the scheme requires a path... if (GetSchemeInfo().FldReq & FlagPath) // ... set path - FldSetNoDirty(FieldPath, TStringBuf("/")); + FldSetNoDirty(FieldPath, TStringBuf("/")); } /********************************************************/ @@ -210,7 +210,7 @@ namespace NUri { const ui32 cleanFields = ~FieldsDirty; do { - static constexpr TStringBuf rootPath = "/"; + static constexpr TStringBuf rootPath = "/"; if (noscheme) { if (!basescheme.empty()) { @@ -408,7 +408,7 @@ namespace NUri { v = Fields[FieldPath]; // for relative, empty path is not the same as missing if (v.empty() && 0 == (flags & FlagHost)) - v = TStringBuf("."); + v = TStringBuf("."); out << v; } diff --git a/library/cpp/uri/uri.h b/library/cpp/uri/uri.h index 3b6c19fe4a..12f6adb875 100644 --- a/library/cpp/uri/uri.h +++ b/library/cpp/uri/uri.h @@ -183,8 +183,8 @@ namespace NUri { // uses directly, doesn't mark dirty template <size_t size> bool FldMemSet(EField field, const char (&value)[size]) { - static_assert(size > 0); - return FldSetImpl(field, TStringBuf(value, size - 1), true); + static_assert(size > 0); + return FldSetImpl(field, TStringBuf(value, size - 1), true); } // duplicate one field to another diff --git a/library/cpp/uri/uri_ut.cpp b/library/cpp/uri/uri_ut.cpp index 2ebd83fc93..f80f88ae4e 100644 --- a/library/cpp/uri/uri_ut.cpp +++ b/library/cpp/uri/uri_ut.cpp @@ -323,7 +323,7 @@ namespace NUri { // cause a dirty field url.FldMemSet(TField::FieldUser, "use"); // it is now shorter UNIT_ASSERT(!url.FldIsDirty()); - url.FldMemSet(TField::FieldUser, TStringBuf("user")); + url.FldMemSet(TField::FieldUser, TStringBuf("user")); UNIT_ASSERT(url.FldIsDirty()); // copy again diff --git a/library/cpp/xml/document/xml-document.cpp b/library/cpp/xml/document/xml-document.cpp index 18a554d732..c14c18bd48 100644 --- a/library/cpp/xml/document/xml-document.cpp +++ b/library/cpp/xml/document/xml-document.cpp @@ -9,7 +9,7 @@ #include <util/folder/dirut.h> namespace { - struct TInit { + struct TInit { inline TInit() { NXml::InitEngine(); } diff --git a/library/cpp/xml/init/init.cpp b/library/cpp/xml/init/init.cpp index aa96c2dd31..50a59fa44c 100644 --- a/library/cpp/xml/init/init.cpp +++ b/library/cpp/xml/init/init.cpp @@ -9,7 +9,7 @@ #include <util/generic/singleton.h> namespace { - int CharEncodingInput(unsigned char* out, int* outlen, const unsigned char* in, int* inlen) { + int CharEncodingInput(unsigned char* out, int* outlen, const unsigned char* in, int* inlen) { size_t read = 0, written = 0; RECODE_RESULT r = Recode(CODES_WIN, CODES_UTF8, (const char*)in, (char*)out, (size_t)*inlen, (size_t)*outlen, read, written); if (r == RECODE_EOOUTPUT) diff --git a/library/cpp/ya.make b/library/cpp/ya.make index 8c1193b007..baea39e7f1 100644 --- a/library/cpp/ya.make +++ b/library/cpp/ya.make @@ -64,7 +64,7 @@ RECURSE( consistent_hash_ring/ut consistent_hashing consistent_hashing/ut - containers + containers coroutine cppparser cpuid_check @@ -394,9 +394,9 @@ RECURSE( vec4 vec4/ut vl_feat - vowpalwabbit - vowpalwabbit/tools - vowpalwabbit/ut + vowpalwabbit + vowpalwabbit/tools + vowpalwabbit/ut watchdog watchdog/timeout/ut wordlistreader diff --git a/library/cpp/yson/detail.h b/library/cpp/yson/detail.h index 27f5e8ffff..a4c3fa769b 100644 --- a/library/cpp/yson/detail.h +++ b/library/cpp/yson/detail.h @@ -425,10 +425,10 @@ namespace NYson { template <bool AllowFinish> double ReadNanOrInf() { - static const TStringBuf nanString = "nan"; - static const TStringBuf infString = "inf"; - static const TStringBuf plusInfString = "+inf"; - static const TStringBuf minusInfString = "-inf"; + static const TStringBuf nanString = "nan"; + static const TStringBuf infString = "inf"; + static const TStringBuf plusInfString = "+inf"; + static const TStringBuf minusInfString = "-inf"; TStringBuf expectedString; double expectedValue; @@ -560,8 +560,8 @@ namespace NYson { bool ReadBoolean() { Buffer_.clear(); - static TStringBuf trueString = "true"; - static TStringBuf falseString = "false"; + static TStringBuf trueString = "true"; + static TStringBuf falseString = "false"; auto throwIncorrectBoolean = [&]() { ythrow TYsonException() << "Incorrect boolean string " << TString(Buffer_.data(), Buffer_.size()); diff --git a/library/cpp/yson/node/node.cpp b/library/cpp/yson/node/node.cpp index b39e070718..262708a2d0 100644 --- a/library/cpp/yson/node/node.cpp +++ b/library/cpp/yson/node/node.cpp @@ -99,18 +99,18 @@ TNode::TNode(const char* s) : Value_(TString(s)) { } -TNode::TNode(TStringBuf s) +TNode::TNode(TStringBuf s) : Value_(TString(s)) { } -TNode::TNode(std::string_view s) +TNode::TNode(std::string_view s) : Value_(TString(s)) -{ } - -TNode::TNode(const std::string& s) +{ } + +TNode::TNode(const std::string& s) : Value_(TString(s)) -{ } - +{ } + TNode::TNode(TString s) : Value_(std::move(s)) { } diff --git a/library/cpp/yson/node/node.h b/library/cpp/yson/node/node.h index 5f90f95df0..772100bd36 100644 --- a/library/cpp/yson/node/node.h +++ b/library/cpp/yson/node/node.h @@ -73,9 +73,9 @@ public: TNode(); TNode(const char* s); - TNode(TStringBuf s); - explicit TNode(std::string_view s); - explicit TNode(const std::string& s); + TNode(TStringBuf s); + explicit TNode(std::string_view s); + explicit TNode(const std::string& s); TNode(TString s); TNode(int i); diff --git a/library/cpp/yson/writer.cpp b/library/cpp/yson/writer.cpp index 054459f9f5..43402eb506 100644 --- a/library/cpp/yson/writer.cpp +++ b/library/cpp/yson/writer.cpp @@ -15,7 +15,7 @@ namespace NYson { // Copied from <util/string/escape.cpp> namespace { - inline char HexDigit(char value) { + inline char HexDigit(char value) { Y_ASSERT(value < 16); if (value < 10) return '0' + value; @@ -23,26 +23,26 @@ namespace NYson { return 'A' + value - 10; } - inline char OctDigit(char value) { + inline char OctDigit(char value) { Y_ASSERT(value < 8); return '0' + value; } - inline bool IsPrintable(char c) { + inline bool IsPrintable(char c) { return c >= 32 && c <= 126; } - inline bool IsHexDigit(char c) { + inline bool IsHexDigit(char c) { return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); } - inline bool IsOctDigit(char c) { + inline bool IsOctDigit(char c) { return c >= '0' && c <= '7'; } - const size_t ESCAPE_C_BUFFER_SIZE = 4; + const size_t ESCAPE_C_BUFFER_SIZE = 4; - inline size_t EscapeC(unsigned char c, char next, char r[ESCAPE_C_BUFFER_SIZE]) { + inline size_t EscapeC(unsigned char c, char next, char r[ESCAPE_C_BUFFER_SIZE]) { // (1) Printable characters go as-is, except backslash and double quote. // (2) Characters \r, \n, \t and \0 ... \7 replaced by their simple escape characters (if possible). // (3) Otherwise, character is encoded using hexadecimal escape sequence (if possible), or octal. @@ -114,9 +114,9 @@ namespace NYson { return ::ToString(value); } - static const TStringBuf nanLiteral = "%nan"; - static const TStringBuf infLiteral = "%inf"; - static const TStringBuf negativeInfLiteral = "%-inf"; + static const TStringBuf nanLiteral = "%nan"; + static const TStringBuf infLiteral = "%inf"; + static const TStringBuf negativeInfLiteral = "%-inf"; TStringBuf str; if (std::isnan(value)) { diff --git a/library/cpp/yson_pull/detail/percent_scalar.h b/library/cpp/yson_pull/detail/percent_scalar.h index ff4571842e..4dfb57d36b 100644 --- a/library/cpp/yson_pull/detail/percent_scalar.h +++ b/library/cpp/yson_pull/detail/percent_scalar.h @@ -10,12 +10,12 @@ namespace NYsonPull::NDetail { struct percent_scalar { //! Text boolean literals - static constexpr TStringBuf true_literal = "%true"; - static constexpr TStringBuf false_literal = "%false"; + static constexpr TStringBuf true_literal = "%true"; + static constexpr TStringBuf false_literal = "%false"; //! Text floating-point literals - static constexpr TStringBuf nan_literal = "%nan"; - static constexpr TStringBuf positive_inf_literal = "%inf"; - static constexpr TStringBuf negative_inf_literal = "%-inf"; + static constexpr TStringBuf nan_literal = "%nan"; + static constexpr TStringBuf positive_inf_literal = "%inf"; + static constexpr TStringBuf negative_inf_literal = "%-inf"; percent_scalar_type type; union { diff --git a/library/cpp/yson_pull/read_ops.cpp b/library/cpp/yson_pull/read_ops.cpp index 9d7e6a4a2d..6ca8313d54 100644 --- a/library/cpp/yson_pull/read_ops.cpp +++ b/library/cpp/yson_pull/read_ops.cpp @@ -4,7 +4,7 @@ using namespace NYsonPull; using namespace NYsonPull::NReadOps; namespace { - bool TrySkipValueUntil(EEventType end, TReader& reader) { + bool TrySkipValueUntil(EEventType end, TReader& reader) { const auto& event = reader.NextEvent(); if (event.Type() == end) { return false; @@ -13,7 +13,7 @@ namespace { return true; } - bool TrySkipKeyValueUntil(EEventType end, TReader& reader) { + bool TrySkipKeyValueUntil(EEventType end, TReader& reader) { const auto& event = reader.NextEvent(); if (event.Type() == end) { return false; diff --git a/library/cpp/yson_pull/ut/reader_ut.cpp b/library/cpp/yson_pull/ut/reader_ut.cpp index 1184265ddb..c40f05e551 100644 --- a/library/cpp/yson_pull/ut/reader_ut.cpp +++ b/library/cpp/yson_pull/ut/reader_ut.cpp @@ -75,15 +75,15 @@ namespace { Y_UNIT_TEST_SUITE(Reader) { Y_UNIT_TEST(ScalarEntity) { - test_scalar(TStringBuf("#"), NYsonPull::TScalar{}); + test_scalar(TStringBuf("#"), NYsonPull::TScalar{}); } Y_UNIT_TEST(ScalarBoolean) { - test_scalar(TStringBuf("%true"), true); - test_scalar(TStringBuf("%false"), false); + test_scalar(TStringBuf("%true"), true); + test_scalar(TStringBuf("%false"), false); - test_scalar(TStringBuf("\x05"sv), true); - test_scalar(TStringBuf("\x04"sv), false); + test_scalar(TStringBuf("\x05"sv), true); + test_scalar(TStringBuf("\x04"sv), false); REJECT("%"); REJECT("%trueth"); @@ -94,18 +94,18 @@ Y_UNIT_TEST_SUITE(Reader) { } Y_UNIT_TEST(ScalarInt64) { - test_scalar(TStringBuf("1"), i64{1}); - test_scalar(TStringBuf("+1"), i64{1}); - test_scalar(TStringBuf("100000"), i64{100000}); - test_scalar(TStringBuf("+100000"), i64{100000}); - test_scalar(TStringBuf("-100000"), i64{-100000}); - test_scalar(TStringBuf("9223372036854775807"), i64{9223372036854775807}); - test_scalar(TStringBuf("+9223372036854775807"), i64{9223372036854775807}); - - test_scalar(TStringBuf("\x02\x02"sv), i64{1}); - test_scalar(TStringBuf("\x02\xc0\x9a\x0c"sv), i64{100000}); - test_scalar(TStringBuf("\x02\xbf\x9a\x0c"sv), i64{-100000}); - test_scalar(TStringBuf("\x02\xfe\xff\xff\xff\xff\xff\xff\xff\xff\x01"sv), i64{9223372036854775807}); + test_scalar(TStringBuf("1"), i64{1}); + test_scalar(TStringBuf("+1"), i64{1}); + test_scalar(TStringBuf("100000"), i64{100000}); + test_scalar(TStringBuf("+100000"), i64{100000}); + test_scalar(TStringBuf("-100000"), i64{-100000}); + test_scalar(TStringBuf("9223372036854775807"), i64{9223372036854775807}); + test_scalar(TStringBuf("+9223372036854775807"), i64{9223372036854775807}); + + test_scalar(TStringBuf("\x02\x02"sv), i64{1}); + test_scalar(TStringBuf("\x02\xc0\x9a\x0c"sv), i64{100000}); + test_scalar(TStringBuf("\x02\xbf\x9a\x0c"sv), i64{-100000}); + test_scalar(TStringBuf("\x02\xfe\xff\xff\xff\xff\xff\xff\xff\xff\x01"sv), i64{9223372036854775807}); REJECT("1a2"); REJECT("1-1-1-1"); @@ -113,14 +113,14 @@ Y_UNIT_TEST_SUITE(Reader) { } Y_UNIT_TEST(SclarUInt64) { - test_scalar(TStringBuf("1u"), ui64{1}); - test_scalar(TStringBuf("+1u"), ui64{1}); - test_scalar(TStringBuf("100000u"), ui64{100000}); - test_scalar(TStringBuf("+100000u"), ui64{100000}); - test_scalar(TStringBuf("9223372036854775807u"), ui64{9223372036854775807u}); - test_scalar(TStringBuf("+9223372036854775807u"), ui64{9223372036854775807u}); - test_scalar(TStringBuf("18446744073709551615u"), ui64{18446744073709551615u}); - test_scalar(TStringBuf("+18446744073709551615u"), ui64{18446744073709551615u}); + test_scalar(TStringBuf("1u"), ui64{1}); + test_scalar(TStringBuf("+1u"), ui64{1}); + test_scalar(TStringBuf("100000u"), ui64{100000}); + test_scalar(TStringBuf("+100000u"), ui64{100000}); + test_scalar(TStringBuf("9223372036854775807u"), ui64{9223372036854775807u}); + test_scalar(TStringBuf("+9223372036854775807u"), ui64{9223372036854775807u}); + test_scalar(TStringBuf("18446744073709551615u"), ui64{18446744073709551615u}); + test_scalar(TStringBuf("+18446744073709551615u"), ui64{18446744073709551615u}); REJECT("1a2u"); REJECT("1-1-1-1u"); @@ -130,45 +130,45 @@ Y_UNIT_TEST_SUITE(Reader) { } Y_UNIT_TEST(ScalarFloat64) { - test_scalar(TStringBuf("0.0"), double{0.0}); - test_scalar(TStringBuf("+0.0"), double{0.0}); - test_scalar(TStringBuf("+.0"), double{0.0}); - test_scalar(TStringBuf("+.5"), double{0.5}); - test_scalar(TStringBuf("-.5"), double{-0.5}); - test_scalar(TStringBuf("1.0"), double{1.0}); - test_scalar(TStringBuf("+1.0"), double{1.0}); - test_scalar(TStringBuf("-1.0"), double{-1.0}); - test_scalar(TStringBuf("1000.0"), double{1000.0}); - test_scalar(TStringBuf("+1000.0"), double{1000.0}); - test_scalar(TStringBuf("-1000.0"), double{-1000.0}); - test_scalar(TStringBuf("1e12"), double{1e12}); - test_scalar(TStringBuf("1e+12"), double{1e12}); - test_scalar(TStringBuf("+1e+12"), double{1e12}); - test_scalar(TStringBuf("-1e+12"), double{-1e12}); - test_scalar(TStringBuf("1e-12"), double{1e-12}); - test_scalar(TStringBuf("+1e-12"), double{1e-12}); - test_scalar(TStringBuf("-1e-12"), double{-1e-12}); - - test_scalar(TStringBuf("\x03\x00\x00\x00\x00\x00\x00\x00\x00"sv), double{0.0}); + test_scalar(TStringBuf("0.0"), double{0.0}); + test_scalar(TStringBuf("+0.0"), double{0.0}); + test_scalar(TStringBuf("+.0"), double{0.0}); + test_scalar(TStringBuf("+.5"), double{0.5}); + test_scalar(TStringBuf("-.5"), double{-0.5}); + test_scalar(TStringBuf("1.0"), double{1.0}); + test_scalar(TStringBuf("+1.0"), double{1.0}); + test_scalar(TStringBuf("-1.0"), double{-1.0}); + test_scalar(TStringBuf("1000.0"), double{1000.0}); + test_scalar(TStringBuf("+1000.0"), double{1000.0}); + test_scalar(TStringBuf("-1000.0"), double{-1000.0}); + test_scalar(TStringBuf("1e12"), double{1e12}); + test_scalar(TStringBuf("1e+12"), double{1e12}); + test_scalar(TStringBuf("+1e+12"), double{1e12}); + test_scalar(TStringBuf("-1e+12"), double{-1e12}); + test_scalar(TStringBuf("1e-12"), double{1e-12}); + test_scalar(TStringBuf("+1e-12"), double{1e-12}); + test_scalar(TStringBuf("-1e-12"), double{-1e-12}); + + test_scalar(TStringBuf("\x03\x00\x00\x00\x00\x00\x00\x00\x00"sv), double{0.0}); test_scalar( - TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf8\x7f"sv), + TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf8\x7f"sv), double{std::numeric_limits<double>::quiet_NaN()}); test_scalar( - TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\x7f"sv), + TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\x7f"sv), double{std::numeric_limits<double>::infinity()}); test_scalar( - TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\xff"sv), + TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\xff"sv), double{-std::numeric_limits<double>::infinity()}); test_scalar( - TStringBuf("%nan"), + TStringBuf("%nan"), double{std::numeric_limits<double>::quiet_NaN()}); test_scalar( - TStringBuf("%inf"), + TStringBuf("%inf"), double{std::numeric_limits<double>::infinity()}); test_scalar( - TStringBuf("%-inf"), + TStringBuf("%-inf"), double{-std::numeric_limits<double>::infinity()}); REJECT("++0.0"); @@ -176,7 +176,7 @@ Y_UNIT_TEST_SUITE(Reader) { REJECT("++.1"); REJECT("1.0.0"); //REJECT("1e+10000"); - REJECT(TStringBuf("\x03\x00\x00\x00\x00\x00\x00\x00"sv)); + REJECT(TStringBuf("\x03\x00\x00\x00\x00\x00\x00\x00"sv)); // XXX: Questionable behaviour? ACCEPT("+.0"); @@ -194,16 +194,16 @@ Y_UNIT_TEST_SUITE(Reader) { } Y_UNIT_TEST(ScalarString) { - test_scalar(TStringBuf(R"(foobar)"), TStringBuf("foobar")); - test_scalar(TStringBuf(R"(foobar11)"), TStringBuf("foobar11")); - test_scalar(TStringBuf(R"("foobar")"), TStringBuf("foobar")); + test_scalar(TStringBuf(R"(foobar)"), TStringBuf("foobar")); + test_scalar(TStringBuf(R"(foobar11)"), TStringBuf("foobar11")); + test_scalar(TStringBuf(R"("foobar")"), TStringBuf("foobar")); // wat? "\x0cf" parsed as a single char? no way! - test_scalar("\x01\x0c" "foobar"sv, - TStringBuf("foobar")); + test_scalar("\x01\x0c" "foobar"sv, + TStringBuf("foobar")); REJECT(R"("foobar)"); - REJECT("\x01\x0c" "fooba"sv); - REJECT("\x01\x0d" "foobar"sv); // negative length + REJECT("\x01\x0c" "fooba"sv); + REJECT("\x01\x0d" "foobar"sv); // negative length } Y_UNIT_TEST(EmptyList) { @@ -241,7 +241,7 @@ Y_UNIT_TEST_SUITE(Reader) { { auto& e = reader.NextEvent(); UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::Key, e.Type()); - UNIT_ASSERT_VALUES_EQUAL(TStringBuf("11"), e.AsString()); + UNIT_ASSERT_VALUES_EQUAL(TStringBuf("11"), e.AsString()); } { auto& e = reader.NextEvent(); @@ -252,7 +252,7 @@ Y_UNIT_TEST_SUITE(Reader) { { auto& e = reader.NextEvent(); UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::Key, e.Type()); - UNIT_ASSERT_VALUES_EQUAL(TStringBuf("nothing"), e.AsString()); + UNIT_ASSERT_VALUES_EQUAL(TStringBuf("nothing"), e.AsString()); } { auto& e = reader.NextEvent(); @@ -263,7 +263,7 @@ Y_UNIT_TEST_SUITE(Reader) { { auto& e = reader.NextEvent(); UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::Key, e.Type()); - UNIT_ASSERT_VALUES_EQUAL(TStringBuf("zero"), e.AsString()); + UNIT_ASSERT_VALUES_EQUAL(TStringBuf("zero"), e.AsString()); } { auto& e = reader.NextEvent(); @@ -274,18 +274,18 @@ Y_UNIT_TEST_SUITE(Reader) { { auto& e = reader.NextEvent(); UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::Key, e.Type()); - UNIT_ASSERT_VALUES_EQUAL(TStringBuf("foo"), e.AsString()); + UNIT_ASSERT_VALUES_EQUAL(TStringBuf("foo"), e.AsString()); } { auto& e = reader.NextEvent(); UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::Scalar, e.Type()); - UNIT_ASSERT_VALUES_EQUAL(NYsonPull::TScalar{TStringBuf("bar")}, e.AsScalar()); + UNIT_ASSERT_VALUES_EQUAL(NYsonPull::TScalar{TStringBuf("bar")}, e.AsScalar()); } { auto& e = reader.NextEvent(); UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::Key, e.Type()); - UNIT_ASSERT_VALUES_EQUAL(TStringBuf("list"), e.AsString()); + UNIT_ASSERT_VALUES_EQUAL(TStringBuf("list"), e.AsString()); } UNIT_ASSERT_VALUES_EQUAL(NYsonPull::EEventType::BeginList, reader.NextEvent().Type()); { diff --git a/library/cpp/yson_pull/ut/writer_ut.cpp b/library/cpp/yson_pull/ut/writer_ut.cpp index 5c304bad0f..aa9aa1cff9 100644 --- a/library/cpp/yson_pull/ut/writer_ut.cpp +++ b/library/cpp/yson_pull/ut/writer_ut.cpp @@ -8,8 +8,8 @@ #include <climits> #include <limits> -using namespace std::string_view_literals; - +using namespace std::string_view_literals; + namespace { template <typename Writer, typename Function> TString with_writer(Function&& function) { @@ -155,101 +155,101 @@ Y_UNIT_TEST_SUITE(Writer) { Y_UNIT_TEST(BinaryBoolean) { UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x4"), + TStringBuf("\x4"), to_yson_binary_string(NYsonPull::TScalar{false})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x5"), + TStringBuf("\x5"), to_yson_binary_string(NYsonPull::TScalar{true})); } Y_UNIT_TEST(BinaryInt64) { UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x2\0"sv), + TStringBuf("\x2\0"sv), to_yson_binary_string(NYsonPull::TScalar{i64{0}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x2\x90\x3"), + TStringBuf("\x2\x90\x3"), to_yson_binary_string(NYsonPull::TScalar{i64{200}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x2\xC0\xB8\x2"), + TStringBuf("\x2\xC0\xB8\x2"), to_yson_binary_string(NYsonPull::TScalar{i64{20000}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x2\x80\x88\xDE\xBE\x1"), + TStringBuf("\x2\x80\x88\xDE\xBE\x1"), to_yson_binary_string(NYsonPull::TScalar{i64{200000000}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x2\x80\x80\x90\xF8\x9B\xF9\x86G"), + TStringBuf("\x2\x80\x80\x90\xF8\x9B\xF9\x86G"), to_yson_binary_string(NYsonPull::TScalar{i64{20000000000000000}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x2\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1"), + TStringBuf("\x2\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1"), to_yson_binary_string(NYsonPull::TScalar{i64{INT64_MAX}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x2\x8F\x3"), + TStringBuf("\x2\x8F\x3"), to_yson_binary_string(NYsonPull::TScalar{i64{-200}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x2\xBF\xB8\x2"), + TStringBuf("\x2\xBF\xB8\x2"), to_yson_binary_string(NYsonPull::TScalar{i64{-20000}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x2\xFF\x87\xDE\xBE\x1"), + TStringBuf("\x2\xFF\x87\xDE\xBE\x1"), to_yson_binary_string(NYsonPull::TScalar{i64{-200000000}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x2\xFF\xFF\x8F\xF8\x9B\xF9\x86G"), + TStringBuf("\x2\xFF\xFF\x8F\xF8\x9B\xF9\x86G"), to_yson_binary_string(NYsonPull::TScalar{i64{-20000000000000000}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x2\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1"), + TStringBuf("\x2\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1"), to_yson_binary_string(NYsonPull::TScalar{i64{INT64_MIN}})); } Y_UNIT_TEST(BinaryUInt64) { UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x6\0"sv), + TStringBuf("\x6\0"sv), to_yson_binary_string(NYsonPull::TScalar{ui64{0}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x6\xC8\x1"), + TStringBuf("\x6\xC8\x1"), to_yson_binary_string(NYsonPull::TScalar{ui64{200}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x6\xA0\x9C\x1"), + TStringBuf("\x6\xA0\x9C\x1"), to_yson_binary_string(NYsonPull::TScalar{ui64{20000}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x6\x80\x84\xAF_"), + TStringBuf("\x6\x80\x84\xAF_"), to_yson_binary_string(NYsonPull::TScalar{ui64{200000000}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x6\x80\x80\x88\xFC\xCD\xBC\xC3#"), + TStringBuf("\x6\x80\x80\x88\xFC\xCD\xBC\xC3#"), to_yson_binary_string(NYsonPull::TScalar{ui64{20000000000000000}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x6\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x7F"), + TStringBuf("\x6\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x7F"), to_yson_binary_string(NYsonPull::TScalar{ui64{INT64_MAX}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x6\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1"), + TStringBuf("\x6\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x1"), to_yson_binary_string(NYsonPull::TScalar{ui64{UINT64_MAX}})); } Y_UNIT_TEST(BinaryFloat64) { UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\x7f"sv), + TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\x7f"sv), to_yson_binary_string(NYsonPull::TScalar{std::numeric_limits<double>::infinity()})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\xff"sv), + TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf0\xff"sv), to_yson_binary_string(NYsonPull::TScalar{-std::numeric_limits<double>::infinity()})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf8\x7f"sv), + TStringBuf("\x03\x00\x00\x00\x00\x00\x00\xf8\x7f"sv), to_yson_binary_string(NYsonPull::TScalar{std::numeric_limits<double>::quiet_NaN()})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x03\x9a\x99\x99\x99\x99\x99\xf1\x3f"), + TStringBuf("\x03\x9a\x99\x99\x99\x99\x99\xf1\x3f"), to_yson_binary_string(NYsonPull::TScalar{double{1.1}})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x03\x9a\x99\x99\x99\x99\x99\xf1\xbf"), + TStringBuf("\x03\x9a\x99\x99\x99\x99\x99\xf1\xbf"), to_yson_binary_string(NYsonPull::TScalar{double{-1.1}})); } Y_UNIT_TEST(BinaryString) { UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x1\0"sv), + TStringBuf("\x1\0"sv), to_yson_binary_string(NYsonPull::TScalar{""})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x1\nhello"), + TStringBuf("\x1\nhello"), to_yson_binary_string(NYsonPull::TScalar{"hello"})); UNIT_ASSERT_VALUES_EQUAL( - TStringBuf("\x1\x16hello\nworld"), + TStringBuf("\x1\x16hello\nworld"), to_yson_binary_string(NYsonPull::TScalar{"hello\nworld"})); } diff --git a/library/cpp/yt/misc/enum-inl.h b/library/cpp/yt/misc/enum-inl.h index 59ef704775..9557432b3b 100644 --- a/library/cpp/yt/misc/enum-inl.h +++ b/library/cpp/yt/misc/enum-inl.h @@ -73,7 +73,7 @@ static constexpr bool AreValuesDistinct(const TValues& values) \ static TStringBuf GetTypeName() \ { \ - static constexpr TStringBuf typeName = PP_STRINGIZE(name); \ + static constexpr TStringBuf typeName = PP_STRINGIZE(name); \ return typeName; \ } \ \ @@ -143,7 +143,7 @@ static constexpr bool AreValuesDistinct(const TValues& values) ENUM__GET_DOMAIN_NAMES_ITEM_ATOMIC(PP_ELEMENT(seq, 0)) #define ENUM__GET_DOMAIN_NAMES_ITEM_ATOMIC(item) \ - TStringBuf(PP_STRINGIZE(item)), + TStringBuf(PP_STRINGIZE(item)), #define ENUM__DECOMPOSE \ static std::vector<TType> Decompose(TType value) \ diff --git a/library/cpp/yt/string/format-inl.h b/library/cpp/yt/string/format-inl.h index 5484d4a216..93b0aadac5 100644 --- a/library/cpp/yt/string/format-inl.h +++ b/library/cpp/yt/string/format-inl.h @@ -49,7 +49,7 @@ inline void FormatValue(TStringBuilderBase* builder, TStringBuf value, TStringBu hasAlign = true; alignSize = 10 * alignSize + (*current - '0'); if (alignSize > 1000000) { - builder->AppendString(TStringBuf("<alignment overflow>")); + builder->AppendString(TStringBuf("<alignment overflow>")); return; } ++current; @@ -144,8 +144,8 @@ inline void FormatValue(TStringBuilderBase* builder, bool value, TStringBuf form } auto str = lowercase - ? (value ? TStringBuf("true") : TStringBuf("false")) - : (value ? TStringBuf("True") : TStringBuf("False")); + ? (value ? TStringBuf("true") : TStringBuf("false")) + : (value ? TStringBuf("True") : TStringBuf("False")); builder->AppendString(str); } @@ -406,7 +406,7 @@ struct TValueFormatter<std::pair<T1, T2>> { builder->AppendChar('{'); FormatValue(builder, value.first, format); - builder->AppendString(TStringBuf(", ")); + builder->AppendString(TStringBuf(", ")); FormatValue(builder, value.second, format); builder->AppendChar('}'); } @@ -415,7 +415,7 @@ struct TValueFormatter<std::pair<T1, T2>> // std::optional inline void FormatValue(TStringBuilderBase* builder, std::nullopt_t, TStringBuf /*format*/) { - builder->AppendString(TStringBuf("<null>")); + builder->AppendString(TStringBuf("<null>")); } template <class T> @@ -487,7 +487,7 @@ char* WriteIntToBufferBackwards(char* buffer, TValue value); template <class TValue> void FormatValueViaHelper(TStringBuilderBase* builder, TValue value, TStringBuf format, TStringBuf genericSpec) { - if (format == TStringBuf("v")) { + if (format == TStringBuf("v")) { const int MaxResultSize = 64; char buffer[MaxResultSize]; char* end = buffer + MaxResultSize; @@ -504,14 +504,14 @@ void FormatValueViaHelper(TStringBuilderBase* builder, TValue value, TStringBuf FormatValueViaHelper(builder, static_cast<castType>(value), format, genericSpec); \ } -XX(i8, int, TStringBuf("d")) -XX(ui8, unsigned int, TStringBuf("u")) -XX(i16, int, TStringBuf("d")) -XX(ui16, unsigned int, TStringBuf("u")) -XX(i32, int, TStringBuf("d")) -XX(ui32, unsigned int, TStringBuf("u")) -XX(long, long, TStringBuf("ld")) -XX(unsigned long, unsigned long, TStringBuf("lu")) +XX(i8, int, TStringBuf("d")) +XX(ui8, unsigned int, TStringBuf("u")) +XX(i16, int, TStringBuf("d")) +XX(ui16, unsigned int, TStringBuf("u")) +XX(i32, int, TStringBuf("d")) +XX(ui32, unsigned int, TStringBuf("u")) +XX(long, long, TStringBuf("ld")) +XX(unsigned long, unsigned long, TStringBuf("lu")) #undef XX @@ -521,8 +521,8 @@ XX(unsigned long, unsigned long, TStringBuf("lu")) FormatValueViaSprintf(builder, static_cast<castType>(value), format, genericSpec); \ } -XX(double, double, TStringBuf("lf")) -XX(float, float, TStringBuf("f")) +XX(double, double, TStringBuf("lf")) +XX(float, float, TStringBuf("f")) #undef XX @@ -530,7 +530,7 @@ XX(float, float, TStringBuf("f")) template <class T> void FormatValue(TStringBuilderBase* builder, T* value, TStringBuf format) { - FormatValueViaSprintf(builder, value, format, TStringBuf("p")); + FormatValueViaSprintf(builder, value, format, TStringBuf("p")); } // TDuration (specialize for performance reasons) @@ -672,7 +672,7 @@ struct TArgFormatterImpl<IndexBase> { void operator() (size_t /*index*/, TStringBuilderBase* builder, TStringBuf /*format*/) const { - builder->AppendString(TStringBuf("<missing argument>")); + builder->AppendString(TStringBuf("<missing argument>")); } }; diff --git a/library/cpp/yt/string/string.cpp b/library/cpp/yt/string/string.cpp index 7440ac3fdd..5564627098 100644 --- a/library/cpp/yt/string/string.cpp +++ b/library/cpp/yt/string/string.cpp @@ -191,13 +191,13 @@ char* WriteUnsignedIntToBufferBackwardsImpl(char* ptr, T value) template <> char* WriteIntToBufferBackwards(char* ptr, i32 value) { - return WriteSignedIntToBufferBackwardsImpl(ptr, value, TStringBuf("-2147483647")); + return WriteSignedIntToBufferBackwardsImpl(ptr, value, TStringBuf("-2147483647")); } template <> char* WriteIntToBufferBackwards(char* ptr, i64 value) { - return WriteSignedIntToBufferBackwardsImpl(ptr, value, TStringBuf("-9223372036854775808")); + return WriteSignedIntToBufferBackwardsImpl(ptr, value, TStringBuf("-9223372036854775808")); } template <> diff --git a/library/cpp/yt/string/string.h b/library/cpp/yt/string/string.h index ae6c99caab..c9199117e6 100644 --- a/library/cpp/yt/string/string.h +++ b/library/cpp/yt/string/string.h @@ -25,13 +25,13 @@ struct TDefaultFormatter template <class T> void operator()(TStringBuilderBase* builder, const T& obj) const { - FormatValue(builder, obj, TStringBuf("v")); + FormatValue(builder, obj, TStringBuf("v")); } }; -static constexpr TStringBuf DefaultJoinToStringDelimiter = ", "; -static constexpr TStringBuf DefaultKeyValueDelimiter = ": "; -static constexpr TStringBuf DefaultRangeEllipsisFormat = "..."; +static constexpr TStringBuf DefaultJoinToStringDelimiter = ", "; +static constexpr TStringBuf DefaultKeyValueDelimiter = ": "; +static constexpr TStringBuf DefaultRangeEllipsisFormat = "..."; // ASCII characters from 0x20 = ' ' to 0x7e = '~' are printable. static constexpr char PrintableASCIILow = 0x20; diff --git a/library/cpp/yt/string/string_builder.h b/library/cpp/yt/string/string_builder.h index 0e13e70904..2d9dd6edc7 100644 --- a/library/cpp/yt/string/string_builder.h +++ b/library/cpp/yt/string/string_builder.h @@ -75,7 +75,7 @@ protected: //////////////////////////////////////////////////////////////////////////////// template <class T> -TString ToStringViaBuilder(const T& value, TStringBuf spec = TStringBuf("v")); +TString ToStringViaBuilder(const T& value, TStringBuf spec = TStringBuf("v")); //////////////////////////////////////////////////////////////////////////////// @@ -86,7 +86,7 @@ class TDelimitedStringBuilderWrapper public: TDelimitedStringBuilderWrapper( TStringBuilderBase* builder, - TStringBuf delimiter = TStringBuf(", ")) + TStringBuf delimiter = TStringBuf(", ")) : Builder_(builder) , Delimiter_(delimiter) { } |