Skip to content

Commit 0f19e06

Browse files
committed
clang-tidy
1 parent 22a7c30 commit 0f19e06

25 files changed

+96
-102
lines changed

include/tao/json/binding/versions.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ namespace tao::json::binding
5454
else {
5555
static_assert( std::is_void_v< V >, "neither V::to() nor V::as() found" );
5656
}
57-
return std::exception_ptr();
57+
return {};
5858
}
5959
catch( ... ) {
6060
return std::current_exception();
@@ -96,7 +96,7 @@ namespace tao::json::binding
9696
auto m = parser.mark();
9797
V::template consume< Traits >( parser, x );
9898
(void)m( true );
99-
return std::exception_ptr();
99+
return {};
100100
}
101101
catch( ... ) {
102102
return std::current_exception();

include/tao/json/cbor/events/to_stream.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ namespace tao::json::cbor::events
9595
void string( const std::string_view v )
9696
{
9797
number( internal::major::STRING, v.size() );
98-
os.write( v.data(), v.size() );
98+
os.write( v.data(), static_cast< std::streamsize >( v.size() ) );
9999
}
100100

101101
void binary( const tao::binary_view v )
102102
{
103103
number( internal::major::BINARY, v.size() );
104-
os.write( reinterpret_cast< const char* >( v.data() ), v.size() );
104+
os.write( reinterpret_cast< const char* >( v.data() ), static_cast< std::streamsize >( v.size() ) );
105105
}
106106

107107
void begin_array()

include/tao/json/contrib/schema.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ namespace tao::json
10151015
}
10161016
break;
10171017
case HAS_MULTIPLE_OF_DOUBLE:
1018-
if( !is_multiple_of( double( v ), m_node->m_multiple_of.d ) ) {
1018+
if( !is_multiple_of( static_cast< double >( v ), m_node->m_multiple_of.d ) ) {
10191019
m_match = false;
10201020
}
10211021
break;
@@ -1031,7 +1031,7 @@ namespace tao::json
10311031
}
10321032
break;
10331033
case HAS_MULTIPLE_OF_DOUBLE:
1034-
if( !is_multiple_of( double( v ), m_node->m_multiple_of.d ) ) {
1034+
if( !is_multiple_of( static_cast< double >( v ), m_node->m_multiple_of.d ) ) {
10351035
m_match = false;
10361036
}
10371037
break;

include/tao/json/contrib/vector_bool_traits.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace tao::json
2222
v.emplace_array();
2323
v.get_array().reserve( o.size() );
2424
for( const auto e : o ) {
25-
v.emplace_back( bool( e ) );
25+
v.emplace_back( static_cast< bool >( e ) );
2626
}
2727
}
2828

@@ -31,7 +31,7 @@ namespace tao::json
3131
{
3232
c.begin_array( o.size() );
3333
for( const auto i : o ) {
34-
json::events::produce< Traits >( c, bool( i ) );
34+
json::events::produce< Traits >( c, static_cast< bool >( i ) );
3535
c.element();
3636
}
3737
c.end_array( o.size() );

include/tao/json/events/hash.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ namespace tao::json::events
8888
{
8989
if( v >= 0 ) {
9090
const auto u = static_cast< std::uint64_t >( v );
91-
if( u == v ) {
91+
if( static_cast< double >( u ) == v ) {
9292
number( u );
9393
return;
9494
}
9595
}
9696
else {
9797
const auto i = static_cast< std::int64_t >( v );
98-
if( i == v ) {
98+
if( static_cast< double >( i ) == v ) {
9999
number( i );
100100
return;
101101
}

include/tao/json/events/prefer_signed.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace tao::json::events
1919
void number( const std::uint64_t v )
2020
{
2121
if( v <= 9223372036854775807ULL ) {
22-
Consumer::number( std::int64_t( v ) );
22+
Consumer::number( static_cast< std::int64_t >( v ) );
2323
}
2424
else {
2525
Consumer::number( v );

include/tao/json/events/prefer_unsigned.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace tao::json::events
1919
void number( const std::int64_t v )
2020
{
2121
if( v >= 0 ) {
22-
Consumer::number( std::uint64_t( v ) );
22+
Consumer::number( static_cast< std::uint64_t >( v ) );
2323
}
2424
else {
2525
Consumer::number( v );

include/tao/json/events/to_stream.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace tao::json::events
2727
{
2828
protected:
2929
std::ostream& os;
30-
bool first;
30+
bool first = true;
3131

3232
void next()
3333
{
@@ -38,8 +38,7 @@ namespace tao::json::events
3838

3939
public:
4040
explicit to_stream( std::ostream& in_os ) noexcept
41-
: os( in_os ),
42-
first( true )
41+
: os( in_os )
4342
{}
4443

4544
void null()

include/tao/json/events/transformer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace tao::json
3333
T,
3434
decltype( std::declval< T< B > >().null(),
3535
std::declval< T< B > >().boolean( true ),
36-
std::declval< T< B > >().number( double( 0.0 ) ),
36+
std::declval< T< B > >().number( static_cast< double >( 0.0 ) ),
3737
std::declval< T< B > >().string( "" ),
3838
std::declval< T< B > >().element(),
3939
std::declval< T< B > >().member(),

include/tao/json/internal/action.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ namespace tao::json::internal
119119
template< typename Consumer >
120120
static void apply0( Consumer& consumer )
121121
{
122-
consumer.number( std::uint64_t( 0 ) );
122+
consumer.number( static_cast< std::uint64_t >( 0 ) );
123123
}
124124
};
125125

@@ -129,7 +129,7 @@ namespace tao::json::internal
129129
template< typename Consumer >
130130
static void apply0( Consumer& consumer )
131131
{
132-
consumer.number( std::int64_t( 0 ) );
132+
consumer.number( static_cast< std::int64_t >( 0 ) );
133133
}
134134
};
135135

0 commit comments

Comments
 (0)