forked from lthn/blockchain
Merge branch 'release' into develop
This commit is contained in:
commit
54e63e875f
3 changed files with 10 additions and 7 deletions
|
|
@ -99,6 +99,7 @@ namespace net_utils
|
|||
|
||||
size_t ungzip_size = m_pre_decode.size() * 0x30;
|
||||
std::string current_decode_buff(ungzip_size, 'X');
|
||||
auto slh = misc_utils::create_scope_leave_handler([&]() { m_zstream_in.next_out = nullptr; } ); // make sure local pointer to current_decode_buff.data() won't be used out of this scope
|
||||
|
||||
//Here the cycle is introduced where we unpack the buffer, the cycle is required
|
||||
//because of the case where if after unpacking the data will exceed the awaited size, we will not halt with error
|
||||
|
|
@ -294,6 +295,8 @@ namespace net_utils
|
|||
}
|
||||
|
||||
std::string result_packed_buff;
|
||||
auto slh = misc_utils::create_scope_leave_handler([&]() { m_zstream.next_out = nullptr; } ); // make sure local pointer to result_packed_buff.data() won't be used out of this scope
|
||||
|
||||
//theoretically it supposed to be smaller
|
||||
result_packed_buff.resize(target.size(), 'X');
|
||||
while (true)
|
||||
|
|
|
|||
|
|
@ -233,12 +233,12 @@ namespace crypto {
|
|||
static constexpr size_t DATA_BLOCK_SIZE = 1024 * 1024;
|
||||
|
||||
stream_cn_hash()
|
||||
: m_p_hash(reinterpret_cast<hash*>(&m_buffer))
|
||||
, m_p_data(m_buffer + HASH_SIZE)
|
||||
: m_buffer(HASH_SIZE + DATA_BLOCK_SIZE, '\0')
|
||||
, m_p_hash(const_cast<hash*>(reinterpret_cast<const hash*>(m_buffer.data())))
|
||||
, m_p_data(const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(m_buffer.data())) + HASH_SIZE)
|
||||
, m_ready(false)
|
||||
, m_data_used(0)
|
||||
{
|
||||
memset(m_buffer, 0, HASH_SIZE + DATA_BLOCK_SIZE);
|
||||
m_ready = true;
|
||||
}
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ namespace crypto {
|
|||
if (m_data_used == DATA_BLOCK_SIZE)
|
||||
{
|
||||
// calc imtermediate hash of the whole buffer and put the result into the beginning of the buffer
|
||||
*m_p_hash = cn_fast_hash(m_buffer, HASH_SIZE + m_data_used);
|
||||
*m_p_hash = cn_fast_hash(m_buffer.data(), HASH_SIZE + m_data_used);
|
||||
// clear data buffer for new bytes
|
||||
memset(m_p_data, 0, DATA_BLOCK_SIZE);
|
||||
m_data_used = 0;
|
||||
|
|
@ -279,11 +279,11 @@ namespace crypto {
|
|||
return *m_p_hash;
|
||||
|
||||
m_ready = false;
|
||||
return cn_fast_hash(m_buffer, HASH_SIZE + m_data_used);
|
||||
return cn_fast_hash(m_buffer.data(), HASH_SIZE + m_data_used);
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t m_buffer[HASH_SIZE + DATA_BLOCK_SIZE];
|
||||
const std::string m_buffer;
|
||||
hash* const m_p_hash;
|
||||
uint8_t* const m_p_data;
|
||||
size_t m_data_used;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,6 @@
|
|||
#define PROJECT_REVISION "5"
|
||||
#define PROJECT_VERSION PROJECT_MAJOR_VERSION "." PROJECT_MINOR_VERSION "." PROJECT_REVISION
|
||||
|
||||
#define PROJECT_VERSION_BUILD_NO 79
|
||||
#define PROJECT_VERSION_BUILD_NO 81
|
||||
#define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO)
|
||||
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue