diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2014-09-25 19:25:19 -0400 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2014-09-25 19:25:19 -0400 |
commit | eee030f6bc62117b4d3c27aa78818964d95a7063 (patch) | |
tree | 53dcf29fdc8db825b84544fb692db2d16a362e9b /src | |
parent | 4b2b78b9f2bd339cc4505996258e00c186e91792 (diff) |
autofile: don't copy CAutoFile by value
Diffstat (limited to 'src')
-rw-r--r-- | src/init.cpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 8 | ||||
-rw-r--r-- | src/net.cpp | 4 | ||||
-rw-r--r-- | src/test/checkblock_tests.cpp | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/src/init.cpp b/src/init.cpp index 7299bd0f4a..27594ecbe3 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1058,7 +1058,7 @@ bool AppInit2(boost::thread_group& threadGroup) } boost::filesystem::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; - CAutoFile est_filein = CAutoFile(fopen(est_path.string().c_str(), "rb"), SER_DISK, CLIENT_VERSION); + CAutoFile est_filein(fopen(est_path.string().c_str(), "rb"), SER_DISK, CLIENT_VERSION); // Allowed to fail as this file IS missing on first startup. if (est_filein) mempool.ReadFeeEstimates(est_filein); diff --git a/src/main.cpp b/src/main.cpp index 15c3916a6f..60e2a56795 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1082,7 +1082,7 @@ bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock bool WriteBlockToDisk(CBlock& block, CDiskBlockPos& pos) { // Open history file to append - CAutoFile fileout = CAutoFile(OpenBlockFile(pos), SER_DISK, CLIENT_VERSION); + CAutoFile fileout(OpenBlockFile(pos), SER_DISK, CLIENT_VERSION); if (!fileout) return error("WriteBlockToDisk : OpenBlockFile failed"); @@ -1110,7 +1110,7 @@ bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos) block.SetNull(); // Open history file to read - CAutoFile filein = CAutoFile(OpenBlockFile(pos, true), SER_DISK, CLIENT_VERSION); + CAutoFile filein(OpenBlockFile(pos, true), SER_DISK, CLIENT_VERSION); if (!filein) return error("ReadBlockFromDisk : OpenBlockFile failed"); @@ -4503,7 +4503,7 @@ bool SendMessages(CNode* pto, bool fSendTrickle) bool CBlockUndo::WriteToDisk(CDiskBlockPos &pos, const uint256 &hashBlock) { // Open history file to append - CAutoFile fileout = CAutoFile(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION); + CAutoFile fileout(OpenUndoFile(pos), SER_DISK, CLIENT_VERSION); if (!fileout) return error("CBlockUndo::WriteToDisk : OpenUndoFile failed"); @@ -4535,7 +4535,7 @@ bool CBlockUndo::WriteToDisk(CDiskBlockPos &pos, const uint256 &hashBlock) bool CBlockUndo::ReadFromDisk(const CDiskBlockPos &pos, const uint256 &hashBlock) { // Open history file to read - CAutoFile filein = CAutoFile(OpenUndoFile(pos, true), SER_DISK, CLIENT_VERSION); + CAutoFile filein(OpenUndoFile(pos, true), SER_DISK, CLIENT_VERSION); if (!filein) return error("CBlockUndo::ReadFromDisk : OpenBlockFile failed"); diff --git a/src/net.cpp b/src/net.cpp index ab547e2fd7..866bac2c0e 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1957,7 +1957,7 @@ bool CAddrDB::Write(const CAddrMan& addr) // open temp output file, and associate with CAutoFile boost::filesystem::path pathTmp = GetDataDir() / tmpfn; FILE *file = fopen(pathTmp.string().c_str(), "wb"); - CAutoFile fileout = CAutoFile(file, SER_DISK, CLIENT_VERSION); + CAutoFile fileout(file, SER_DISK, CLIENT_VERSION); if (!fileout) return error("%s : Failed to open file %s", __func__, pathTmp.string()); @@ -1982,7 +1982,7 @@ bool CAddrDB::Read(CAddrMan& addr) { // open input file, and associate with CAutoFile FILE *file = fopen(pathAddr.string().c_str(), "rb"); - CAutoFile filein = CAutoFile(file, SER_DISK, CLIENT_VERSION); + CAutoFile filein(file, SER_DISK, CLIENT_VERSION); if (!filein) return error("%s : Failed to open file %s", __func__, pathAddr.string()); diff --git a/src/test/checkblock_tests.cpp b/src/test/checkblock_tests.cpp index fdea12846a..67d40a45c7 100644 --- a/src/test/checkblock_tests.cpp +++ b/src/test/checkblock_tests.cpp @@ -35,7 +35,7 @@ bool read_block(const std::string& filename, CBlock& block) fseek(fp, 8, SEEK_SET); // skip msgheader/size - CAutoFile filein = CAutoFile(fp, SER_DISK, CLIENT_VERSION); + CAutoFile filein(fp, SER_DISK, CLIENT_VERSION); if (!filein) return false; filein >> block; |