diff options
| author | foton <[email protected]> | 2022-02-10 16:49:25 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:49:25 +0300 | 
| commit | 1e0b5488cdce503f4d970e8163823bba9126aedc (patch) | |
| tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library | |
| parent | 80199ea5aaaa9a0af0c3845eec4a4162edc74105 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library')
| -rw-r--r-- | library/cpp/binsaver/bin_saver.cpp | 34 | ||||
| -rw-r--r-- | library/cpp/binsaver/bin_saver.h | 10 | 
2 files changed, 22 insertions, 22 deletions
| diff --git a/library/cpp/binsaver/bin_saver.cpp b/library/cpp/binsaver/bin_saver.cpp index 8ccc395b0d8..fe0775af9f2 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 ea36086ea6b..412424889f3 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: | 
