aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_utilities/bootstrap_file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/blockchain_utilities/bootstrap_file.cpp')
-rw-r--r--src/blockchain_utilities/bootstrap_file.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/blockchain_utilities/bootstrap_file.cpp b/src/blockchain_utilities/bootstrap_file.cpp
index a004d3547..50b56eab9 100644
--- a/src/blockchain_utilities/bootstrap_file.cpp
+++ b/src/blockchain_utilities/bootstrap_file.cpp
@@ -134,8 +134,7 @@ bool BootstrapFile::initialize_file()
bbi.block_last_pos = 0;
buffer_type buffer2;
- boost::iostreams::stream<boost::iostreams::back_insert_device<buffer_type>>* output_stream_header;
- output_stream_header = new boost::iostreams::stream<boost::iostreams::back_insert_device<buffer_type>>(buffer2);
+ boost::iostreams::stream<boost::iostreams::back_insert_device<buffer_type>> output_stream_header(buffer2);
uint32_t bd_size = 0;
@@ -147,8 +146,8 @@ bool BootstrapFile::initialize_file()
{
throw std::runtime_error("Error in serialization of bootstrap::file_info size");
}
- *output_stream_header << blob;
- *output_stream_header << bd;
+ output_stream_header << blob;
+ output_stream_header << bd;
bd = t_serializable_object_to_blob(bbi);
MDEBUG("bootstrap::blocks_info size: " << bd.size());
@@ -158,12 +157,12 @@ bool BootstrapFile::initialize_file()
{
throw std::runtime_error("Error in serialization of bootstrap::blocks_info size");
}
- *output_stream_header << blob;
- *output_stream_header << bd;
+ output_stream_header << blob;
+ output_stream_header << bd;
- output_stream_header->flush();
- *output_stream_header << std::string(header_size-buffer2.size(), 0); // fill in rest with null bytes
- output_stream_header->flush();
+ output_stream_header.flush();
+ output_stream_header << std::string(header_size-buffer2.size(), 0); // fill in rest with null bytes
+ output_stream_header.flush();
std::copy(buffer2.begin(), buffer2.end(), std::ostreambuf_iterator<char>(*m_raw_data_file));
return true;
@@ -221,7 +220,7 @@ void BootstrapFile::write_block(block& block)
// now add all regular transactions
for (const auto& tx_id : block.tx_hashes)
{
- if (tx_id == null_hash)
+ if (tx_id == crypto::null_hash)
{
throw std::runtime_error("Aborting: tx == null_hash");
}
@@ -433,7 +432,7 @@ uint64_t BootstrapFile::count_bytes(std::ifstream& import_file, uint64_t blocks,
uint64_t BootstrapFile::count_blocks(const std::string& import_file_path)
{
- streampos dummy_pos;
+ std::streampos dummy_pos;
uint64_t dummy_height = 0;
return count_blocks(import_file_path, dummy_pos, dummy_height);
}
@@ -441,7 +440,7 @@ uint64_t BootstrapFile::count_blocks(const std::string& import_file_path)
// If seek_height is non-zero on entry, return a stream position <= this height when finished.
// And return the actual height corresponding to this position. Allows the caller to locate its
// starting position without having to reread the entire file again.
-uint64_t BootstrapFile::count_blocks(const std::string& import_file_path, streampos &start_pos, uint64_t& seek_height)
+uint64_t BootstrapFile::count_blocks(const std::string& import_file_path, std::streampos &start_pos, uint64_t& seek_height)
{
boost::filesystem::path raw_file_path(import_file_path);
boost::system::error_code ec;