From 6fece96eaebd2e01a20a7a60a97e6b3b27ec2d76 Mon Sep 17 00:00:00 2001 From: jmjatlanta Date: Tue, 5 Feb 2019 15:44:06 -0500 Subject: [PATCH] fix std::min parameter conversion --- include/fc/container/flat.hpp | 8 ++++---- include/fc/io/raw.hpp | 12 ++++++------ include/fc/io/raw_variant.hpp | 3 ++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/fc/container/flat.hpp b/include/fc/container/flat.hpp index 5012c5d..942837a 100644 --- a/include/fc/container/flat.hpp +++ b/include/fc/container/flat.hpp @@ -25,7 +25,7 @@ namespace fc { --_max_depth; unsigned_int size; unpack( s, size, _max_depth ); value.clear(); - value.reserve( std::min( size.value, FC_MAX_PREALLOC_SIZE ) ); + value.reserve( std::min( size.value, static_cast(FC_MAX_PREALLOC_SIZE) ) ); for( uint32_t i = 0; i < size.value; ++i ) { T tmp; @@ -52,7 +52,7 @@ namespace fc { --_max_depth; unsigned_int size; unpack( s, size, _max_depth ); value.clear(); - value.reserve( std::min( size.value, FC_MAX_PREALLOC_SIZE ) ); + value.reserve( std::min( size.value, static_cast(FC_MAX_PREALLOC_SIZE) ) ); for( uint32_t i = 0; i < size.value; ++i ) { std::pair tmp; @@ -85,11 +85,11 @@ namespace fc { unsigned_int size; unpack( s, size, _max_depth ); if( !std::is_fundamental::value ) { - value.resize( std::min( size.value, FC_MAX_PREALLOC_SIZE ) ); + value.resize( std::min( size.value, static_cast(FC_MAX_PREALLOC_SIZE) ) ); for( uint64_t i = 0; i < size; i++ ) { if( i >= value.size() ) - value.resize( std::min( 2*value.size(), size.value ) ); + value.resize( std::min( static_cast(2*value.size()), size.value ) ); unpack( s, value[i], _max_depth ); } } else { diff --git a/include/fc/io/raw.hpp b/include/fc/io/raw.hpp index c9d344d..dc582d2 100644 --- a/include/fc/io/raw.hpp +++ b/include/fc/io/raw.hpp @@ -428,7 +428,7 @@ namespace fc { --_max_depth; unsigned_int size; fc::raw::unpack( s, size, _max_depth ); value.clear(); - value.reserve( std::min( size.value, FC_MAX_PREALLOC_SIZE ) ); + value.reserve( std::min( size.value, static_cast(FC_MAX_PREALLOC_SIZE) ) ); for( uint32_t i = 0; i < size.value; ++i ) { T tmp; @@ -473,7 +473,7 @@ namespace fc { --_max_depth; unsigned_int size; fc::raw::unpack( s, size, _max_depth ); value.clear(); - value.reserve( std::min( size.value, FC_MAX_PREALLOC_SIZE ) ); + value.reserve( std::min( size.value, static_cast(FC_MAX_PREALLOC_SIZE) ) ); for( uint32_t i = 0; i < size.value; ++i ) { std::pair tmp; @@ -526,11 +526,11 @@ namespace fc { FC_ASSERT( _max_depth > 0 ); --_max_depth; unsigned_int size; fc::raw::unpack( s, size, _max_depth ); - value.resize( std::min( size.value, FC_MAX_PREALLOC_SIZE ) ); + value.resize( std::min( size.value, static_cast(FC_MAX_PREALLOC_SIZE) ) ); for( uint64_t i = 0; i < size; i++ ) { if( i >= value.size() ) - value.resize( std::min( 2*value.size(), size.value ) ); + value.resize( std::min( static_cast(2*value.size()), size.value ) ); unpack( s, value[i], _max_depth ); } } @@ -553,11 +553,11 @@ namespace fc { FC_ASSERT( _max_depth > 0 ); --_max_depth; unsigned_int size; fc::raw::unpack( s, size, _max_depth ); - value.resize( std::min( size.value, FC_MAX_PREALLOC_SIZE ) ); + value.resize( std::min( size.value, static_cast(FC_MAX_PREALLOC_SIZE) ) ); for( uint64_t i = 0; i < size; i++ ) { if( i >= value.size() ) - value.resize( std::min( 2*value.size(), size.value ) ); + value.resize( std::min( static_cast(2*value.size()), size.value ) ); unpack( s, value[i], _max_depth ); } } diff --git a/include/fc/io/raw_variant.hpp b/include/fc/io/raw_variant.hpp index aa44c95..4bf9fd8 100644 --- a/include/fc/io/raw_variant.hpp +++ b/include/fc/io/raw_variant.hpp @@ -1,4 +1,5 @@ #pragma once +#include #include #include #include @@ -144,7 +145,7 @@ namespace fc { namespace raw { unsigned_int vs; unpack( s, vs, _max_depth ); mutable_variant_object mvo; - mvo.reserve( std::min( vs.value, FC_MAX_PREALLOC_SIZE ) ); + mvo.reserve( std::min( vs.value, static_cast(FC_MAX_PREALLOC_SIZE) ) ); for( uint32_t i = 0; i < vs.value; ++i ) { fc::string key;