Browse Source

Restoring authorship annotation for <foton@yandex-team.ru>. Commit 1 of 2.

foton 3 years ago
parent
commit
80199ea5aa
3 changed files with 35 additions and 35 deletions
  1. 17 17
      library/cpp/binsaver/bin_saver.cpp
  2. 5 5
      library/cpp/binsaver/bin_saver.h
  3. 13 13
      util/datetime/base.h

+ 17 - 17
library/cpp/binsaver/bin_saver.cpp

@@ -17,30 +17,30 @@ void IBinSaver::StoreObject(IObjectBase* pObject) {
     if (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);
     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;
                 id = PtrIds->ysize() + 1;
                 PtrIds->insert(std::make_pair(pObject, id));
                 PtrIds->insert(std::make_pair(pObject, id));
-            }
-        }
+            } 
+        } 
         ptrId = id;
         ptrId = id;
-    }
-
-    DataChunk(&ptrId, sizeof(ptrId));
+    } 
+ 
+    DataChunk(&ptrId, sizeof(ptrId)); 
     if (!Objects.Get())
     if (!Objects.Get())
         Objects.Reset(new CObjectsHash);
         Objects.Reset(new CObjectsHash);
-    if (ptrId != 0 && Objects->find(ptrId) == Objects->end()) {
+    if (ptrId != 0 && Objects->find(ptrId) == Objects->end()) { 
         ObjectQueue.push_back(pObject);
         ObjectQueue.push_back(pObject);
-        (*Objects)[ptrId];
+        (*Objects)[ptrId]; 
         int typeId = pSaverClasses->GetObjectTypeID(pObject);
         int typeId = pSaverClasses->GetObjectTypeID(pObject);
         if (typeId == -1) {
         if (typeId == -1) {
             fprintf(stderr, "IBinSaver: trying to save unregistered object\n");
             fprintf(stderr, "IBinSaver: trying to save unregistered object\n");

+ 5 - 5
library/cpp/binsaver/bin_saver.h

@@ -273,14 +273,14 @@ private:
     TBufferedStream<> File;
     TBufferedStream<> File;
     // maps objects addresses during save(first) to addresses during load(second) - during loading
     // 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
     // or serves as a sign that some object has been already stored - during storing
-    bool StableOutput;
-
+    bool StableOutput; 
+ 
     typedef THashMap<void*, ui32> PtrIdHash;
     typedef THashMap<void*, ui32> PtrIdHash;
-    TAutoPtr<PtrIdHash> PtrIds;
-
+    TAutoPtr<PtrIdHash> PtrIds; 
+ 
     typedef THashMap<ui64, TPtr<IObjectBase>> CObjectsHash;
     typedef THashMap<ui64, TPtr<IObjectBase>> CObjectsHash;
     TAutoPtr<CObjectsHash> Objects;
     TAutoPtr<CObjectsHash> Objects;
-
+ 
     TVector<IObjectBase*> ObjectQueue;
     TVector<IObjectBase*> ObjectQueue;
 
 
 public:
 public:

+ 13 - 13
util/datetime/base.h

@@ -2,7 +2,7 @@
 
 
 #include "systime.h"
 #include "systime.h"
 
 
-#include <util/str_stl.h>
+#include <util/str_stl.h> 
 #include <util/system/platform.h>
 #include <util/system/platform.h>
 #include <util/system/datetime.h>
 #include <util/system/datetime.h>
 #include <util/generic/string.h>
 #include <util/generic/string.h>
@@ -340,12 +340,12 @@ public:
 Y_DECLARE_PODTYPE(TDuration);
 Y_DECLARE_PODTYPE(TDuration);
 
 
 template <>
 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
 /// TInstant and TDuration are guaranteed to have same precision
 class TInstant: public TTimeBase<TInstant> {
 class TInstant: public TTimeBase<TInstant> {
     using TBase = TTimeBase<TInstant>;
     using TBase = TTimeBase<TInstant>;
@@ -560,12 +560,12 @@ public:
 Y_DECLARE_PODTYPE(TInstant);
 Y_DECLARE_PODTYPE(TInstant);
 
 
 template <>
 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 {
 namespace NPrivate {
     template <bool PrintUpToSeconds, bool iso>
     template <bool PrintUpToSeconds, bool iso>
     struct TPrintableLocalTime {
     struct TPrintableLocalTime {