From ee998fb5b1155a977446c36abaa12eabd5f1a615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Fri, 12 Jun 2015 23:51:02 +0200 Subject: [PATCH] Remove uninitialized variable warnings --- test/alloc_basic_test.cpp | 2 +- test/alloc_full_test.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/alloc_basic_test.cpp b/test/alloc_basic_test.cpp index 69dcdb7..8413d79 100644 --- a/test/alloc_basic_test.cpp +++ b/test/alloc_basic_test.cpp @@ -17,7 +17,7 @@ using namespace boost::container; bool basic_test() { - size_t received; + size_t received = 0; if(!boost_cont_all_deallocated()) return false; void *ptr = boost_cont_alloc(50, 98, &received); diff --git a/test/alloc_full_test.cpp b/test/alloc_full_test.cpp index 1ffc2a9..9147047 100644 --- a/test/alloc_full_test.cpp +++ b/test/alloc_full_test.cpp @@ -110,12 +110,12 @@ bool test_allocation_shrink() for(int i = 0, max = (int)buffers.size() ;i < max ; ++i){ - std::size_t try_received_size; + std::size_t try_received_size = 0; void* try_result = boost_cont_allocation_command ( BOOST_CONTAINER_TRY_SHRINK_IN_PLACE, 1, i*2 , i, &try_received_size, (char*)buffers[i]).first; - std::size_t received_size; + std::size_t received_size = 0; void* result = boost_cont_allocation_command ( BOOST_CONTAINER_SHRINK_IN_PLACE, 1, i*2 , i, &received_size, (char*)buffers[i]).first; @@ -169,7 +169,7 @@ bool test_allocation_expand() for(int i = 0, max = (int)buffers.size() ;i < max ;++i){ - std::size_t received_size; + std::size_t received_size = 0; std::size_t min_size = i+1; std::size_t preferred_size = i*2; preferred_size = min_size > preferred_size ? min_size : preferred_size; @@ -209,7 +209,7 @@ bool test_allocation_shrink_and_expand() //Allocate buffers wand store received sizes for(int i = 0; i != NumIt; ++i){ - std::size_t received_size; + std::size_t received_size = 0; void *ptr = boost_cont_allocation_command (BOOST_CONTAINER_ALLOCATE_NEW, 1, i, i*2, &received_size, 0).first; if(!ptr){ @@ -226,7 +226,7 @@ bool test_allocation_shrink_and_expand() for(int i = 0, max = (int)buffers.size() ; i < max ; ++i){ - std::size_t received_size; + std::size_t received_size = 0; bool size_reduced_flag; if(true == (size_reduced_flag = !! boost_cont_allocation_command @@ -247,7 +247,7 @@ bool test_allocation_shrink_and_expand() ;i < max ;++i){ if(!size_reduced[i]) continue; - std::size_t received_size; + std::size_t received_size = 0; std::size_t request_size = received_sizes[i]; if(boost_cont_allocation_command ( BOOST_CONTAINER_EXPAND_FWD, 1, request_size @@ -308,7 +308,7 @@ bool test_allocation_deallocation_expand() ;++i){ // if(buffers[i]){ - std::size_t received_size; + std::size_t received_size = 0; std::size_t min_size = i+1; std::size_t preferred_size = i*2; preferred_size = min_size > preferred_size ? min_size : preferred_size;