diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h index 75fa104be59c..fe711c74d265 100644 --- a/src/interfaces/chain.h +++ b/src/interfaces/chain.h @@ -97,7 +97,7 @@ struct BlockInfo { const uint256* prev_hash = nullptr; int height = -1; int file_number = -1; - unsigned data_pos = 0; + uint64_t data_pos = 0; const CBlock* data = nullptr; const CBlockUndo* undo_data = nullptr; // The maximum time in the chain up to and including this block. diff --git a/src/streams.cpp b/src/streams.cpp index 6921dad67733..98e29cd4d0ed 100644 --- a/src/streams.cpp +++ b/src/streams.cpp @@ -4,6 +4,7 @@ #include #include +#include #include @@ -13,7 +14,7 @@ std::size_t AutoFile::detail_fread(Span dst) if (m_xor.empty()) { return std::fread(dst.data(), 1, dst.size(), m_file); } else { - const auto init_pos{std::ftell(m_file)}; + const auto init_pos{FileTell64(m_file)}; if (init_pos < 0) throw std::ios_base::failure("AutoFile::read: ftell failed"); std::size_t ret{std::fread(dst.data(), 1, dst.size(), m_file)}; util::Xor(dst.subspan(0, ret), m_xor, init_pos); @@ -49,7 +50,7 @@ void AutoFile::write(Span src) throw std::ios_base::failure("AutoFile::write: write failed"); } } else { - auto current_pos{std::ftell(m_file)}; + auto current_pos{FileTell64(m_file)}; if (current_pos < 0) throw std::ios_base::failure("AutoFile::write: ftell failed"); std::array buf; while (src.size() > 0) {