提交 59de549e 编写于 作者: K Kevin Heifner

db_get_i64 now supports buffer_size = 0

上级 13172d75
......@@ -421,7 +421,6 @@ int apply_context::get_context_free_data( uint32_t index, char* buffer, size_t b
if( index >= trx_meta.context_free_data.size() ) return -1;
auto s = trx_meta.context_free_data[index].size();
if( buffer_size == 0 ) return s;
auto copy_size = std::min( buffer_size, s );
......@@ -523,9 +522,14 @@ void apply_context::db_remove_i64( int iterator ) {
int apply_context::db_get_i64( int iterator, char* buffer, size_t buffer_size ) {
const key_value_object& obj = keyval_cache.get( iterator );
memcpy( buffer, obj.value.data(), std::min(obj.value.size(), buffer_size) );
return obj.value.size();
auto s = obj.value.size();
if( buffer_size == 0 ) return s;
auto copy_size = std::min( buffer_size, s );
memcpy( buffer, obj.value.data(), copy_size );
return copy_size;
}
int apply_context::db_next_i64( int iterator, uint64_t& primary ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册