diff options
author | foton <foton@yandex-team.ru> | 2022-02-10 16:49:25 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:25 +0300 |
commit | 80199ea5aaaa9a0af0c3845eec4a4162edc74105 (patch) | |
tree | 944cc3b5dc0697a970f0ff2a236efdbee6e18125 | |
parent | ca6b8a0150d5ee4cc8fb804d1285d9c32fb4fe88 (diff) | |
download | ydb-80199ea5aaaa9a0af0c3845eec4a4162edc74105.tar.gz |
Restoring authorship annotation for <foton@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | library/cpp/binsaver/bin_saver.cpp | 34 | ||||
-rw-r--r-- | library/cpp/binsaver/bin_saver.h | 10 | ||||
-rw-r--r-- | util/datetime/base.h | 26 |
3 files changed, 35 insertions, 35 deletions
diff --git a/library/cpp/binsaver/bin_saver.cpp b/library/cpp/binsaver/bin_saver.cpp index fe0775af9f..8ccc395b0d 100644 --- a/library/cpp/binsaver/bin_saver.cpp +++ b/library/cpp/binsaver/bin_saver.cpp @@ -17,30 +17,30 @@ void IBinSaver::StoreObject(IObjectBase* pObject) { if (pObject) { Y_ASSERT(pSaverClasses->GetObjectTypeID(pObject) != -1 && "trying to save unregistered object"); } - + ui64 ptrId = ((char*)pObject) - ((char*)nullptr); - if (StableOutput) { - ui32 id = 0; - if (pObject) { - if (!PtrIds.Get()) - PtrIds.Reset(new PtrIdHash); - PtrIdHash::iterator pFound = PtrIds->find(pObject); - if (pFound != PtrIds->end()) - id = pFound->second; - else { + if (StableOutput) { + ui32 id = 0; + if (pObject) { + if (!PtrIds.Get()) + PtrIds.Reset(new PtrIdHash); + PtrIdHash::iterator pFound = PtrIds->find(pObject); + if (pFound != PtrIds->end()) + id = pFound->second; + else { id = PtrIds->ysize() + 1; PtrIds->insert(std::make_pair(pObject, id)); - } - } + } + } ptrId = id; - } - - DataChunk(&ptrId, sizeof(ptrId)); + } + + DataChunk(&ptrId, sizeof(ptrId)); if (!Objects.Get()) Objects.Reset(new CObjectsHash); - if (ptrId != 0 && Objects->find(ptrId) == Objects->end()) { + if (ptrId != 0 && Objects->find(ptrId) == Objects->end()) { ObjectQueue.push_back(pObject); - (*Objects)[ptrId]; + (*Objects)[ptrId]; int typeId = pSaverClasses->GetObjectTypeID(pObject); if (typeId == -1) { fprintf(stderr, "IBinSaver: trying to save unregistered object\n"); diff --git a/library/cpp/binsaver/bin_saver.h b/library/cpp/binsaver/bin_saver.h index 412424889f..ea36086ea6 100644 --- a/library/cpp/binsaver/bin_saver.h +++ b/library/cpp/binsaver/bin_saver.h @@ -273,14 +273,14 @@ private: TBufferedStream<> File; // maps objects addresses during save(first) to addresses during load(second) - during loading // or serves as a sign that some object has been already stored - during storing - bool StableOutput; - + bool StableOutput; + typedef THashMap<void*, ui32> PtrIdHash; - TAutoPtr<PtrIdHash> PtrIds; - + TAutoPtr<PtrIdHash> PtrIds; + typedef THashMap<ui64, TPtr<IObjectBase>> CObjectsHash; TAutoPtr<CObjectsHash> Objects; - + TVector<IObjectBase*> ObjectQueue; public: diff --git a/util/datetime/base.h b/util/datetime/base.h index 5e902b8f63..ac1c171f2a 100644 --- a/util/datetime/base.h +++ b/util/datetime/base.h @@ -2,7 +2,7 @@ #include "systime.h" -#include <util/str_stl.h> +#include <util/str_stl.h> #include <util/system/platform.h> #include <util/system/datetime.h> #include <util/generic/string.h> @@ -340,12 +340,12 @@ public: Y_DECLARE_PODTYPE(TDuration); template <> -struct THash<TDuration> { - size_t operator()(const TDuration& key) const { - return THash<TDuration::TValue>()(key.GetValue()); - } -}; - +struct THash<TDuration> { + size_t operator()(const TDuration& key) const { + return THash<TDuration::TValue>()(key.GetValue()); + } +}; + /// TInstant and TDuration are guaranteed to have same precision class TInstant: public TTimeBase<TInstant> { using TBase = TTimeBase<TInstant>; @@ -560,12 +560,12 @@ public: Y_DECLARE_PODTYPE(TInstant); template <> -struct THash<TInstant> { - size_t operator()(const TInstant& key) const { - return THash<TInstant::TValue>()(key.GetValue()); - } -}; - +struct THash<TInstant> { + size_t operator()(const TInstant& key) const { + return THash<TInstant::TValue>()(key.GetValue()); + } +}; + namespace NPrivate { template <bool PrintUpToSeconds, bool iso> struct TPrintableLocalTime { |