Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary asserts #103

Merged
merged 3 commits into from Jan 22, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -25,7 +25,6 @@ namespace fc {
--_max_depth;
unsigned_int size; unpack( s, size, _max_depth );
value.clear();
FC_ASSERT( size.value*sizeof(T) < MAX_ARRAY_ALLOC_SIZE );
value.reserve( std::min( size.value, FC_MAX_PREALLOC_SIZE ) );
for( uint32_t i = 0; i < size.value; ++i )
{
@@ -53,7 +52,6 @@ namespace fc {
--_max_depth;
unsigned_int size; unpack( s, size, _max_depth );
value.clear();
FC_ASSERT( size.value*(sizeof(K)+sizeof(V)) < MAX_ARRAY_ALLOC_SIZE );
value.reserve( std::min( size.value, FC_MAX_PREALLOC_SIZE ) );
for( uint32_t i = 0; i < size.value; ++i )
{
@@ -261,7 +261,6 @@ namespace fc {
template<typename Stream> inline void unpack( Stream& s, std::vector<char>& value, uint32_t _max_depth ) {
FC_ASSERT( _max_depth > 0 );
unsigned_int size; fc::raw::unpack( s, size, _max_depth - 1 );
FC_ASSERT( size.value < MAX_ARRAY_ALLOC_SIZE );
This conversation was marked as resolved by pmconrad

This comment has been minimized.

Copy link
@pmconrad

pmconrad Jan 20, 2019

This one has to stay, it's not otherwise protected.

value.resize(size.value);
if( value.size() )
s.read( value.data(), value.size() );
@@ -428,7 +427,6 @@ namespace fc {
--_max_depth;
unsigned_int size; fc::raw::unpack( s, size, _max_depth );
value.clear();
FC_ASSERT( size.value*sizeof(T) < MAX_ARRAY_ALLOC_SIZE );
value.reserve( std::min( size.value, FC_MAX_PREALLOC_SIZE ) );
for( uint32_t i = 0; i < size.value; ++i )
{
@@ -474,7 +472,6 @@ namespace fc {
--_max_depth;
unsigned_int size; fc::raw::unpack( s, size, _max_depth );
value.clear();
FC_ASSERT( size.value*(sizeof(K)+sizeof(V)) < MAX_ARRAY_ALLOC_SIZE );
value.reserve( std::min( size.value, FC_MAX_PREALLOC_SIZE ) );
for( uint32_t i = 0; i < size.value; ++i )
{
@@ -502,7 +499,6 @@ namespace fc {
--_max_depth;
unsigned_int size; fc::raw::unpack( s, size, _max_depth );
value.clear();
FC_ASSERT( size.value*(sizeof(K)+sizeof(V)) < MAX_ARRAY_ALLOC_SIZE );
for( uint32_t i = 0; i < size.value; ++i )
{
std::pair<K,V> tmp;
@@ -529,7 +525,6 @@ namespace fc {
FC_ASSERT( _max_depth > 0 );
--_max_depth;
unsigned_int size; fc::raw::unpack( s, size, _max_depth );
FC_ASSERT( size.value*sizeof(T) < MAX_ARRAY_ALLOC_SIZE );
value.resize( std::min( size.value, FC_MAX_PREALLOC_SIZE ) );
for( uint64_t i = 0; i < size; i++ )
{
@@ -557,7 +552,6 @@ namespace fc {
FC_ASSERT( _max_depth > 0 );
--_max_depth;
unsigned_int size; fc::raw::unpack( s, size, _max_depth );
FC_ASSERT( size.value*sizeof(T) < MAX_ARRAY_ALLOC_SIZE );
value.resize( std::min( size.value, FC_MAX_PREALLOC_SIZE ) );
for( uint64_t i = 0; i < size; i++ )
{
@@ -12,8 +12,6 @@
#include <unordered_map>
#include <set>

#define MAX_ARRAY_ALLOC_SIZE (1024*1024*10)

namespace fc {
class time_point;
class time_point_sec;
@@ -143,7 +143,6 @@ namespace fc { namespace raw {
--_max_depth;
unsigned_int vs;
unpack( s, vs, _max_depth );
FC_ASSERT( vs.value*sizeof(variant_object::entry) < MAX_ARRAY_ALLOC_SIZE );
mutable_variant_object mvo;
mvo.reserve( std::min( vs.value, FC_MAX_PREALLOC_SIZE ) );
for( uint32_t i = 0; i < vs.value; ++i )
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.