aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/include
diff options
context:
space:
mode:
authorrfree2monero <rfreemonero@op.pl>2015-02-12 21:53:52 +0100
committerrfree2monero <rfreemonero@op.pl>2015-02-20 22:13:00 +0100
commit0f06dca83197e317384609c8c7e1413289a1be03 (patch)
treed6b3312d6c2c61d3a2552ba4cb75596fb11d1a16 /contrib/epee/include
parentremoved not needed <netinet/in.h> (diff)
downloadmonero-0f06dca83197e317384609c8c7e1413289a1be03.tar.xz
fixed size_t on windows
thought it was already fixed, apparently commit got lost somewhere
Diffstat (limited to 'contrib/epee/include')
-rw-r--r--contrib/epee/include/net/abstract_tcp_server2.inl10
1 files changed, 8 insertions, 2 deletions
diff --git a/contrib/epee/include/net/abstract_tcp_server2.inl b/contrib/epee/include/net/abstract_tcp_server2.inl
index 5855f7f86..3dff6da56 100644
--- a/contrib/epee/include/net/abstract_tcp_server2.inl
+++ b/contrib/epee/include/net/abstract_tcp_server2.inl
@@ -357,7 +357,10 @@ PRAGMA_WARNING_DISABLE_VS(4355)
const t_safe chunksize_max = chunksize_good * 2 ;
const bool allow_split = (m_connection_type == RPC) ? false : true; // TODO config
- if (allow_split && (cb > chunksize_max)) {
+ ASRT(! (chunksize_max<0) ); // make sure it is unsigned before removin sign with cast:
+ long long unsigned int chunksize_max_unsigned = static_cast<long long unsigned int>( chunksize_max ) ;
+
+ if (allow_split && (cb > chunksize_max_unsigned)) {
{ // LOCK: chunking
epee::critical_region_t<decltype(m_chunking_lock)> send_guard(m_chunking_lock); // *** critical ***
@@ -380,7 +383,10 @@ PRAGMA_WARNING_DISABLE_VS(4355)
ASRT(len<=chunksize_good);
// pos=8; len=4; all=10; len=3;
- ASRT(len>0); ASRT(len < std::numeric_limits<size_t>::max()); // yeap we want strong < then max size, to be sure
+ ASRT(! (len<0) ); // check before we cast away sign:
+ unsigned long long int len_unsigned = static_cast<long long int>( len );
+ ASRT(len>0); // (redundand)
+ ASRT(len_unsigned < std::numeric_limits<size_t>::max()); // yeap we want strong < then max size, to be sure
void *chunk_start = ((char*)ptr) + pos;
_fact_c("net/out/size","chunk_start="<<chunk_start<<" ptr="<<ptr<<" pos="<<pos);