Skip to content

Commit 7792d14

Browse files
committed
Fix shadow warnings
1 parent 1c5fc92 commit 7792d14

File tree

8 files changed

+78
-77
lines changed

8 files changed

+78
-77
lines changed

include/tao/json/pointer.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ namespace tao
3232
std::string m_key;
3333

3434
public:
35-
explicit token( const std::string& key )
36-
: m_index( internal::token_to_index( key ) ),
37-
m_key( key )
35+
explicit token( const std::string& in_key )
36+
: m_index( internal::token_to_index( in_key ) ),
37+
m_key( in_key )
3838
{
3939
}
4040

41-
explicit token( std::string&& key )
42-
: m_index( internal::token_to_index( key ) ),
43-
m_key( std::move( key ) )
41+
explicit token( std::string&& in_key )
42+
: m_index( internal::token_to_index( in_key ) ),
43+
m_key( std::move( in_key ) )
4444
{
4545
}
4646

src/test/json/create.cpp

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -458,71 +458,72 @@ namespace tao
458458
test_double( 42.0 );
459459

460460
value v;
461+
{
462+
const double a = std::numeric_limits< double >::infinity();
463+
const double b = std::numeric_limits< double >::quiet_NaN();
464+
const double c = std::numeric_limits< double >::signaling_NaN();
461465

462-
const double a = std::numeric_limits< double >::infinity();
463-
const double b = std::numeric_limits< double >::quiet_NaN();
464-
const double c = std::numeric_limits< double >::signaling_NaN();
466+
v = null;
465467

466-
v = null;
468+
TEST_ASSERT( v.type() == type::NULL_ );
467469

468-
TEST_ASSERT( v.type() == type::NULL_ );
470+
v = true;
469471

470-
v = true;
472+
TEST_ASSERT( v.type() == type::BOOLEAN );
473+
TEST_ASSERT( v.get_boolean() );
471474

472-
TEST_ASSERT( v.type() == type::BOOLEAN );
473-
TEST_ASSERT( v.get_boolean() );
475+
v = 1;
474476

475-
v = 1;
477+
TEST_ASSERT( v.type() == type::SIGNED );
478+
TEST_ASSERT( v.get_signed() == 1 );
476479

477-
TEST_ASSERT( v.type() == type::SIGNED );
478-
TEST_ASSERT( v.get_signed() == 1 );
480+
v = 1u;
479481

480-
v = 1u;
482+
TEST_ASSERT( v.type() == type::UNSIGNED );
483+
TEST_ASSERT( v.get_unsigned() == 1u );
481484

482-
TEST_ASSERT( v.type() == type::UNSIGNED );
483-
TEST_ASSERT( v.get_unsigned() == 1u );
485+
v = 2.0;
484486

485-
v = 2.0;
487+
TEST_ASSERT( v.type() == type::DOUBLE );
488+
TEST_ASSERT( v.get_double() == 2.0 );
486489

487-
TEST_ASSERT( v.type() == type::DOUBLE );
488-
TEST_ASSERT( v.get_double() == 2.0 );
490+
v = "hallo";
489491

490-
v = "hallo";
492+
TEST_ASSERT( v.type() == type::STRING );
493+
TEST_ASSERT( v.get_string() == "hallo" );
491494

492-
TEST_ASSERT( v.type() == type::STRING );
493-
TEST_ASSERT( v.get_string() == "hallo" );
495+
v = a;
494496

495-
v = a;
497+
TEST_ASSERT( v.type() == type::DOUBLE );
498+
TEST_ASSERT( v.get_double() == a );
496499

497-
TEST_ASSERT( v.type() == type::DOUBLE );
498-
TEST_ASSERT( v.get_double() == a );
500+
v = std::vector< value >();
499501

500-
v = std::vector< value >();
502+
TEST_ASSERT( v.type() == type::ARRAY );
503+
TEST_ASSERT( v.get_array().empty() );
501504

502-
TEST_ASSERT( v.type() == type::ARRAY );
503-
TEST_ASSERT( v.get_array().empty() );
504-
505-
v = b;
505+
v = b;
506506

507-
TEST_ASSERT( v.type() == type::DOUBLE );
508-
TEST_ASSERT( std::isnan( v.get_double() ) );
507+
TEST_ASSERT( v.type() == type::DOUBLE );
508+
TEST_ASSERT( std::isnan( v.get_double() ) );
509509

510-
v = std::map< std::string, value >();
510+
v = std::map< std::string, value >();
511511

512-
TEST_ASSERT( v.type() == type::OBJECT );
513-
TEST_ASSERT( v.get_object().empty() );
512+
TEST_ASSERT( v.type() == type::OBJECT );
513+
TEST_ASSERT( v.get_object().empty() );
514514

515-
v = c;
515+
v = c;
516516

517-
TEST_ASSERT( v.type() == type::DOUBLE );
518-
TEST_ASSERT( std::isnan( v.get_double() ) );
517+
TEST_ASSERT( v.type() == type::DOUBLE );
518+
TEST_ASSERT( std::isnan( v.get_double() ) );
519519

520-
v = nullptr;
520+
v = nullptr;
521521

522-
TEST_ASSERT( v.type() == type::RAW_PTR );
523-
TEST_ASSERT( v.get_raw_ptr() == nullptr );
524-
TEST_ASSERT( v.empty() );
525-
TEST_ASSERT( v == null );
522+
TEST_ASSERT( v.type() == type::RAW_PTR );
523+
TEST_ASSERT( v.get_raw_ptr() == nullptr );
524+
TEST_ASSERT( v.empty() );
525+
TEST_ASSERT( v == null );
526+
}
526527

527528
{
528529
value v2( v );
@@ -594,20 +595,20 @@ namespace tao
594595
TEST_ASSERT( b == 4.0 );
595596
}
596597
{
597-
value v = { { "foo", { { "bar", { { "baz", 42 } } } } } };
598-
TEST_ASSERT( v.at( "foo" ).at( "bar" ).at( "baz" ).is_signed() );
599-
TEST_ASSERT( v.at( "foo" ).at( "bar" ).at( "baz" ).unsafe_get_signed() == 42 );
600-
v = v.at( "foo" ).at( "bar" );
601-
TEST_ASSERT( v.at( "baz" ).is_signed() );
602-
TEST_ASSERT( v.at( "baz" ).unsafe_get_signed() == 42 );
598+
value v2 = { { "foo", { { "bar", { { "baz", 42 } } } } } };
599+
TEST_ASSERT( v2.at( "foo" ).at( "bar" ).at( "baz" ).is_signed() );
600+
TEST_ASSERT( v2.at( "foo" ).at( "bar" ).at( "baz" ).unsafe_get_signed() == 42 );
601+
v2 = v2.at( "foo" ).at( "bar" );
602+
TEST_ASSERT( v2.at( "baz" ).is_signed() );
603+
TEST_ASSERT( v2.at( "baz" ).unsafe_get_signed() == 42 );
603604
}
604605
{
605-
value v = { { "foo", { { "bar", { { "baz", 42 } } } } } };
606-
TEST_ASSERT( v.at( "foo" ).at( "bar" ).at( "baz" ).is_signed() );
607-
TEST_ASSERT( v.at( "foo" ).at( "bar" ).at( "baz" ).unsafe_get_signed() == 42 );
608-
v = std::move( v.at( "foo" ).at( "bar" ) );
609-
TEST_ASSERT( v.at( "baz" ).is_signed() );
610-
TEST_ASSERT( v.at( "baz" ).unsafe_get_signed() == 42 );
606+
value v2 = { { "foo", { { "bar", { { "baz", 42 } } } } } };
607+
TEST_ASSERT( v2.at( "foo" ).at( "bar" ).at( "baz" ).is_signed() );
608+
TEST_ASSERT( v2.at( "foo" ).at( "bar" ).at( "baz" ).unsafe_get_signed() == 42 );
609+
v2 = std::move( v2.at( "foo" ).at( "bar" ) );
610+
TEST_ASSERT( v2.at( "baz" ).is_signed() );
611+
TEST_ASSERT( v2.at( "baz" ).unsafe_get_signed() == 42 );
611612
}
612613
}
613614

src/test/json/double.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ namespace tao
1010
{
1111
namespace json
1212
{
13-
void test_double( const std::string& input, const double value )
13+
void test_double( const std::string& input, const double v )
1414
{
1515
const double d = json::from_string( input ).get_double();
16-
TEST_ASSERT( d == value );
16+
TEST_ASSERT( d == v );
1717
}
1818

1919
void unit_test()

src/test/json/escape.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ namespace tao
1010
{
1111
namespace json
1212
{
13-
void roundtrip( const std::string& value )
13+
void roundtrip( const std::string& v )
1414
{
15-
TEST_ASSERT( to_string( from_string( value ) ) == value );
15+
TEST_ASSERT( to_string( from_string( v ) ) == v );
1616
}
1717

1818
void unit_test()

src/test/json/integer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ namespace tao
1111
namespace json
1212
{
1313
template< typename T >
14-
void test_integer_s( const std::string& input, const T value )
14+
void test_integer_s( const std::string& input, const T v )
1515
{
1616
const auto j = json::from_string( input );
17-
TEST_ASSERT( j.as< T >() == value );
17+
TEST_ASSERT( j.as< T >() == v );
1818
}
1919

2020
template< typename T, typename U >
21-
void test_integer( const U input, const T value )
21+
void test_integer( const U input, const T v )
2222
{
2323
const json::value j = input;
24-
TEST_ASSERT( j.as< T >() == value );
24+
TEST_ASSERT( j.as< T >() == v );
2525
}
2626

2727
template< typename T >

src/test/json/json_patch.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ namespace tao
1111
namespace json
1212
{
1313
template< template< typename... > class Traits >
14-
basic_value< Traits > cpatch( const basic_value< Traits >& value, const basic_value< Traits >& patch )
14+
basic_value< Traits > cpatch( const basic_value< Traits >& v, const basic_value< Traits >& patch )
1515
{
16-
return json::patch( value, patch );
16+
return json::patch( v, patch );
1717
}
1818

1919
void unit_test()

src/test/json/schema.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,26 +60,26 @@ namespace tao
6060
}
6161
}
6262
}
63-
catch( const std::exception& e ) {
63+
catch( const std::exception& ex ) {
6464
++failed;
65-
std::cout << " Failed with exception: " << e.what() << std::endl;
65+
std::cout << " Failed with exception: " << ex.what() << std::endl;
6666
}
6767
}
6868
}
69-
catch( const std::exception& e ) {
69+
catch( const std::exception& ex ) {
7070
if( expected_schema ) {
7171
++failed;
72-
std::cout << " Failed with exception: " << e.what() << std::endl;
72+
std::cout << " Failed with exception: " << ex.what() << std::endl;
7373
}
7474
else {
7575
++tests;
7676
}
7777
}
7878
}
7979
}
80-
catch( const std::exception& e ) {
80+
catch( const std::exception& ex ) {
8181
++failed;
82-
std::cout << "Failed with exception: " << e.what() << std::endl;
82+
std::cout << "Failed with exception: " << ex.what() << std::endl;
8383
}
8484
}
8585

src/test/json/test_assert.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
++failed; \
2323
} \
2424
} \
25-
catch( const std::exception& e ) { \
25+
catch( const std::exception& ex ) { \
2626
std::cerr << "json: unit test [ " \
2727
<< ( #__VA_ARGS__ ) \
2828
<< " ] threw an exception [ " \
29-
<< e.what() \
29+
<< ex.what() \
3030
<< " ] in line [ " \
3131
<< __LINE__ \
3232
<< " ] file [ " \

0 commit comments

Comments
 (0)