diff options
| author | Pieter Wuille <[email protected]> | 2018-03-20 17:37:32 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2018-03-21 14:14:04 -0700 |
| commit | a7c45bce9264f4a8fa48f2e7ecaf102971fc026f (patch) | |
| tree | fa850900cea3277269ae3dc303b6c3cf95c7ee20 /src/validation.cpp | |
| parent | Merge #12728: [tests] rename TestNode to TestP2PConn in tests (diff) | |
| download | discoin-a7c45bce9264f4a8fa48f2e7ecaf102971fc026f.tar.xz discoin-a7c45bce9264f4a8fa48f2e7ecaf102971fc026f.zip | |
Add native support for serializing char arrays without FLATDATA
Support is added to serialize arrays of type char or unsigned char directly,
without any wrappers. All invocations of the FLATDATA wrappers that are
obsoleted by this are removed.
This includes a patch by Russell Yanofsky to make char casting type safe.
The serialization of CSubNet is changed to serialize a bool directly rather
than though FLATDATA. This makes the serialization independent of the size
of the bool type (and will use 1 byte everywhere).
Diffstat (limited to 'src/validation.cpp')
| -rw-r--r-- | src/validation.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index bee890437..368caef62 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1077,7 +1077,7 @@ static bool WriteBlockToDisk(const CBlock& block, CDiskBlockPos& pos, const CMes // Write index header unsigned int nSize = GetSerializeSize(fileout, block); - fileout << FLATDATA(messageStart) << nSize; + fileout << messageStart << nSize; // Write block long fileOutPos = ftell(fileout.Get()); @@ -1441,7 +1441,7 @@ bool UndoWriteToDisk(const CBlockUndo& blockundo, CDiskBlockPos& pos, const uint // Write index header unsigned int nSize = GetSerializeSize(fileout, blockundo); - fileout << FLATDATA(messageStart) << nSize; + fileout << messageStart << nSize; // Write undo data long fileOutPos = ftell(fileout.Get()); @@ -4283,7 +4283,7 @@ bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskB unsigned char buf[CMessageHeader::MESSAGE_START_SIZE]; blkdat.FindByte(chainparams.MessageStart()[0]); nRewind = blkdat.GetPos()+1; - blkdat >> FLATDATA(buf); + blkdat >> buf; if (memcmp(buf, chainparams.MessageStart(), CMessageHeader::MESSAGE_START_SIZE)) continue; // read size |