diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/binsaver | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/binsaver')
-rw-r--r-- | library/cpp/binsaver/bin_saver.cpp | 6 | ||||
-rw-r--r-- | library/cpp/binsaver/bin_saver.h | 32 | ||||
-rw-r--r-- | library/cpp/binsaver/blob_io.h | 2 | ||||
-rw-r--r-- | library/cpp/binsaver/buffered_io.cpp | 12 | ||||
-rw-r--r-- | library/cpp/binsaver/buffered_io.h | 6 | ||||
-rw-r--r-- | library/cpp/binsaver/class_factory.h | 4 | ||||
-rw-r--r-- | library/cpp/binsaver/ut/binsaver_ut.cpp | 24 | ||||
-rw-r--r-- | library/cpp/binsaver/util_stream_io.h | 4 |
8 files changed, 45 insertions, 45 deletions
diff --git a/library/cpp/binsaver/bin_saver.cpp b/library/cpp/binsaver/bin_saver.cpp index fe0775af9f..9bc28d1490 100644 --- a/library/cpp/binsaver/bin_saver.cpp +++ b/library/cpp/binsaver/bin_saver.cpp @@ -3,7 +3,7 @@ TClassFactory<IObjectBase>* pSaverClasses; void StartRegisterSaveload() { if (!pSaverClasses) - pSaverClasses = new TClassFactory<IObjectBase>; + pSaverClasses = new TClassFactory<IObjectBase>; } struct SBasicChunkInit { ~SBasicChunkInit() { @@ -15,7 +15,7 @@ struct SBasicChunkInit { ////////////////////////////////////////////////////////////////////////// void IBinSaver::StoreObject(IObjectBase* pObject) { if (pObject) { - Y_ASSERT(pSaverClasses->GetObjectTypeID(pObject) != -1 && "trying to save unregistered object"); + Y_ASSERT(pSaverClasses->GetObjectTypeID(pObject) != -1 && "trying to save unregistered object"); } ui64 ptrId = ((char*)pObject) - ((char*)nullptr); @@ -62,7 +62,7 @@ IObjectBase* IBinSaver::LoadObject() { int typeId; DataChunk(&typeId, sizeof(typeId)); IObjectBase* pObj = pSaverClasses->CreateObject(typeId); - Y_ASSERT(pObj != nullptr); + Y_ASSERT(pObj != nullptr); if (pObj == nullptr) { fprintf(stderr, "IBinSaver: trying to load unregistered object\n"); abort(); diff --git a/library/cpp/binsaver/bin_saver.h b/library/cpp/binsaver/bin_saver.h index 412424889f..f37612c4fc 100644 --- a/library/cpp/binsaver/bin_saver.h +++ b/library/cpp/binsaver/bin_saver.h @@ -6,13 +6,13 @@ #include <library/cpp/containers/2d_array/2d_array.h> #include <util/generic/hash_set.h> -#include <util/generic/buffer.h> +#include <util/generic/buffer.h> #include <util/generic/list.h> #include <util/generic/maybe.h> #include <util/generic/bitmap.h> #include <util/generic/variant.h> #include <util/generic/ylimits.h> -#include <util/memory/blob.h> +#include <util/memory/blob.h> #include <util/digest/murmur.h> #include <array> @@ -267,7 +267,7 @@ private: // storing/loading pointers to objects void StoreObject(IObjectBase* pObject); - IObjectBase* LoadObject(); + IObjectBase* LoadObject(); bool bRead; TBufferedStream<> File; @@ -310,21 +310,21 @@ public: return 0; } int Add(const chunk_id, TBlob* blob) { - if (bRead) { - ui64 size = 0; - File.Read(&size, sizeof(size)); + if (bRead) { + ui64 size = 0; + File.Read(&size, sizeof(size)); TBuffer buffer; buffer.Advance(size); - if (size > 0) - File.Read(buffer.Data(), buffer.Size()); + if (size > 0) + File.Read(buffer.Data(), buffer.Size()); (*blob) = TBlob::FromBuffer(buffer); - } else { - const ui64 size = blob->Size(); - File.Write(&size, sizeof(size)); - File.Write(blob->Data(), blob->Size()); - } - return 0; - } + } else { + const ui64 size = blob->Size(); + File.Write(&size, sizeof(size)); + File.Write(blob->Data(), blob->Size()); + } + return 0; + } template <class T1, class TA> int Add(const chunk_id, TVector<T1, TA>* pVec) { if (HasNonTrivialSerializer<T1>(0u)) @@ -629,7 +629,7 @@ struct TRegisterSaveLoadType { int operator&(IBinSaver& f) override { \ f.AddMulti(__VA_ARGS__); \ return 0; \ - } + } #define SAVELOAD_OVERRIDE(base, ...) \ int operator&(IBinSaver& f) override { \ diff --git a/library/cpp/binsaver/blob_io.h b/library/cpp/binsaver/blob_io.h index abe518ef30..e0b7956a88 100644 --- a/library/cpp/binsaver/blob_io.h +++ b/library/cpp/binsaver/blob_io.h @@ -10,7 +10,7 @@ class TYaBlobStream: public IBinaryStream { i64 Pos; int WriteImpl(const void*, int) override { - Y_ASSERT(0); + Y_ASSERT(0); return 0; } int ReadImpl(void* userBuffer, int size) override { diff --git a/library/cpp/binsaver/buffered_io.cpp b/library/cpp/binsaver/buffered_io.cpp index dd88b04bc5..073ba0c46e 100644 --- a/library/cpp/binsaver/buffered_io.cpp +++ b/library/cpp/binsaver/buffered_io.cpp @@ -1,31 +1,31 @@ #include "buffered_io.h" i64 IBinaryStream::LongWrite(const void* userBuffer, i64 size) { - Y_VERIFY(size >= 0, "IBinaryStream::Write() called with a negative buffer size."); + Y_VERIFY(size >= 0, "IBinaryStream::Write() called with a negative buffer size."); i64 leftToWrite = size; while (leftToWrite != 0) { int writeSz = static_cast<int>(Min<i64>(leftToWrite, std::numeric_limits<int>::max())); int written = WriteImpl(userBuffer, writeSz); - Y_ASSERT(written <= writeSz); + Y_ASSERT(written <= writeSz); leftToWrite -= written; // Assumption: if WriteImpl(buf, writeSz) returns < writeSz, the stream is // full and there's no sense in continuing. if (written < writeSz) break; } - Y_ASSERT(size >= leftToWrite); + Y_ASSERT(size >= leftToWrite); return size - leftToWrite; } i64 IBinaryStream::LongRead(void* userBuffer, i64 size) { - Y_VERIFY(size >= 0, "IBinaryStream::Read() called with a negative buffer size."); + Y_VERIFY(size >= 0, "IBinaryStream::Read() called with a negative buffer size."); i64 leftToRead = size; while (leftToRead != 0) { int readSz = static_cast<int>(Min<i64>(leftToRead, std::numeric_limits<int>::max())); int read = ReadImpl(userBuffer, readSz); - Y_ASSERT(read <= readSz); + Y_ASSERT(read <= readSz); leftToRead -= read; // Assumption: if ReadImpl(buf, readSz) returns < readSz, the stream is // full and there's no sense in continuing. @@ -34,6 +34,6 @@ i64 IBinaryStream::LongRead(void* userBuffer, i64 size) { break; } } - Y_ASSERT(size >= leftToRead); + Y_ASSERT(size >= leftToRead); return size - leftToRead; } diff --git a/library/cpp/binsaver/buffered_io.h b/library/cpp/binsaver/buffered_io.h index 75465c9c5c..bc5456923d 100644 --- a/library/cpp/binsaver/buffered_io.h +++ b/library/cpp/binsaver/buffered_io.h @@ -97,7 +97,7 @@ public: Flush(); } void Flush() { - Y_ASSERT(!bIsReading); + Y_ASSERT(!bIsReading); if (bIsReading) return; Stream.Write(Buf, Pos); @@ -108,7 +108,7 @@ public: return bIsEof; } inline void Read(void* userBuffer, i64 size) { - Y_ASSERT(bIsReading); + Y_ASSERT(bIsReading); if (!bIsEof && size + Pos <= BufSize) { memcpy(userBuffer, Buf + Pos, size); Pos += size; @@ -117,7 +117,7 @@ public: ReadComplex(userBuffer, size); } inline void Write(const void* userBuffer, i64 size) { - Y_ASSERT(!bIsReading); + Y_ASSERT(!bIsReading); if (Pos + size < N_SIZE) { memcpy(Buf + Pos, userBuffer, size); Pos += size; diff --git a/library/cpp/binsaver/class_factory.h b/library/cpp/binsaver/class_factory.h index e83512331b..5069b5f161 100644 --- a/library/cpp/binsaver/class_factory.h +++ b/library/cpp/binsaver/class_factory.h @@ -77,8 +77,8 @@ public: template <class T> void TClassFactory<T>::RegisterTypeBase(int nTypeID, newFunc func, VFT vft) { if (typeInfo.find(nTypeID) != typeInfo.end()) { - TObj<IObjectBase> o1 = typeInfo[nTypeID](); - TObj<IObjectBase> o2 = func(); + TObj<IObjectBase> o1 = typeInfo[nTypeID](); + TObj<IObjectBase> o2 = func(); // stupid clang warning auto& o1v = *o1; diff --git a/library/cpp/binsaver/ut/binsaver_ut.cpp b/library/cpp/binsaver/ut/binsaver_ut.cpp index 37eba5406f..f8275d63d0 100644 --- a/library/cpp/binsaver/ut/binsaver_ut.cpp +++ b/library/cpp/binsaver/ut/binsaver_ut.cpp @@ -67,8 +67,8 @@ static bool operator==(const TBlob& l, const TBlob& r) { return TStringBuf(l.AsCharPtr(), l.Size()) == TStringBuf(r.AsCharPtr(), r.Size()); } -Y_UNIT_TEST_SUITE(BinSaver){ - Y_UNIT_TEST(HasTrivialSerializer){ +Y_UNIT_TEST_SUITE(BinSaver){ + Y_UNIT_TEST(HasTrivialSerializer){ UNIT_ASSERT(!IBinSaver::HasNonTrivialSerializer<TBinarySerializable>(0u)); UNIT_ASSERT(!IBinSaver::HasNonTrivialSerializer<TNonBinarySerializable>(0u)); UNIT_ASSERT(IBinSaver::HasNonTrivialSerializer<TCustomSerializer>(0u)); @@ -79,33 +79,33 @@ UNIT_ASSERT(IBinSaver::HasNonTrivialSerializer<TVector<TCustomSerializer>>(0u)); } -Y_UNIT_TEST(TestStroka) { +Y_UNIT_TEST(TestStroka) { TestBinSaverSerialization(TString("QWERTY")); } -Y_UNIT_TEST(TestMoveOnlyType) { +Y_UNIT_TEST(TestMoveOnlyType) { TestBinSaverSerializationToBuffer(TMoveOnlyType()); } -Y_UNIT_TEST(TestVectorStrok) { +Y_UNIT_TEST(TestVectorStrok) { TestBinSaverSerialization(TVector<TString>{"A", "B", "C"}); } -Y_UNIT_TEST(TestCArray) { +Y_UNIT_TEST(TestCArray) { TestBinSaverSerialization(TTypeWithArray()); } -Y_UNIT_TEST(TestSets) { +Y_UNIT_TEST(TestSets) { TestBinSaverSerialization(THashSet<TString>{"A", "B", "C"}); TestBinSaverSerialization(TSet<TString>{"A", "B", "C"}); } -Y_UNIT_TEST(TestMaps) { +Y_UNIT_TEST(TestMaps) { TestBinSaverSerialization(THashMap<TString, ui32>{{"A", 1}, {"B", 2}, {"C", 3}}); TestBinSaverSerialization(TMap<TString, ui32>{{"A", 1}, {"B", 2}, {"C", 3}}); } -Y_UNIT_TEST(TestBlob) { +Y_UNIT_TEST(TestBlob) { TestBinSaverSerialization(TBlob::FromStringSingleThreaded("qwerty")); } @@ -125,7 +125,7 @@ Y_UNIT_TEST(TestVariant) { } } -Y_UNIT_TEST(TestPod) { +Y_UNIT_TEST(TestPod) { struct TPod { ui32 A = 5; ui64 B = 7; @@ -141,7 +141,7 @@ Y_UNIT_TEST(TestPod) { TestBinSaverSerialization(TVector<TPod>{custom}); } -Y_UNIT_TEST(TestSubPod) { +Y_UNIT_TEST(TestSubPod) { struct TPod { struct TSub { ui32 X = 10; @@ -166,7 +166,7 @@ Y_UNIT_TEST(TestSubPod) { TestBinSaverSerialization(TVector<TPod>{custom}); } -Y_UNIT_TEST(TestMemberAndOpIsMain) { +Y_UNIT_TEST(TestMemberAndOpIsMain) { struct TBase { TString S; virtual int operator&(IBinSaver& f) { diff --git a/library/cpp/binsaver/util_stream_io.h b/library/cpp/binsaver/util_stream_io.h index d65d630b93..a00670e033 100644 --- a/library/cpp/binsaver/util_stream_io.h +++ b/library/cpp/binsaver/util_stream_io.h @@ -10,7 +10,7 @@ class TYaStreamInput: public IBinaryStream { IInputStream& Stream; int WriteImpl(const void*, int) override { - Y_ASSERT(0); + Y_ASSERT(0); return 0; } int ReadImpl(void* userBuffer, int size) override { @@ -53,7 +53,7 @@ class TYaStreamOutput: public IBinaryStream { return size; } int ReadImpl(void*, int) override { - Y_ASSERT(0); + Y_ASSERT(0); return 0; } bool IsValid() const override { |