Skip to content

Commit de726d5

Browse files
committed
clang-tidy
1 parent 0f19e06 commit de726d5

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

include/tao/json/events/from_value.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ namespace tao::json::events
9797
case type::VALUELESS_BY_EXCEPTION:
9898
throw std::logic_error( "unable to produce events from valueless-by-exception value" );
9999
}
100-
throw std::logic_error( internal::format( "invalid value '", static_cast< std::uint8_t >( v.type() ), "' for tao::json::type" ) ); // LCOV_EXCL_LINE
100+
throw std::logic_error( internal::format( "invalid value '", static_cast< std::uint8_t >( v.type() ), "' for tao::json::type" ) ); // LCOV_EXCL_LINE, NOLINT(google-readability-casting)
101101
}
102102

103103
template< typename Consumer, template< typename... > class Traits >
@@ -191,7 +191,7 @@ namespace tao::json::events
191191
case type::VALUELESS_BY_EXCEPTION:
192192
throw std::logic_error( "unable to produce events from valueless-by-exception value" );
193193
}
194-
throw std::logic_error( internal::format( "invalid value '", static_cast< std::uint8_t >( v.type() ), "' for tao::json::type" ) ); // LCOV_EXCL_LINE
194+
throw std::logic_error( internal::format( "invalid value '", static_cast< std::uint8_t >( v.type() ), "' for tao::json::type" ) ); // LCOV_EXCL_LINE, NOLINT(google-readability-casting)
195195
}
196196

197197
template< typename Consumer, template< typename... > class Traits >

include/tao/json/internal/endian_gcc.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ namespace tao::json::internal
2929
template<>
3030
struct to_and_from_le< 1 >
3131
{
32-
[[nodiscard]] static std::uint8_t convert( const std::uint8_t n ) noexcept
32+
[[nodiscard]] static std::int8_t convert( const std::int8_t n ) noexcept
3333
{
3434
return n;
3535
}
3636

37-
[[nodiscard]] static std::int8_t convert( const std::int8_t n ) noexcept
37+
[[nodiscard]] static std::uint8_t convert( const std::uint8_t n ) noexcept
3838
{
3939
return n;
4040
}
@@ -178,12 +178,12 @@ namespace tao::json::internal
178178
return n;
179179
}
180180

181-
[[nodiscard]] static std::uint64_t convert( const std::uint64_t n ) noexcept
181+
[[nodiscard]] static std::int64_t convert( const std::int64_t n ) noexcept
182182
{
183183
return static_cast< std::int64_t >( __builtin_bswap64( n ) );
184184
}
185185

186-
[[nodiscard]] static std::int64_t convert( const std::int64_t n ) noexcept
186+
[[nodiscard]] static std::uint64_t convert( const std::uint64_t n ) noexcept
187187
{
188188
return __builtin_bswap64( n );
189189
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace tao::json::msgpack::events
4040

4141
void boolean( const bool v )
4242
{
43-
os.put( static_cast< char >( 0xc2 ) + static_cast< char >( v ) );
43+
os.put( static_cast< char >( v ? 0xc3 : 0xc2 ) );
4444
}
4545

4646
template< typename Integer >

include/tao/json/msgpack/internal/grammar.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ namespace tao::json::msgpack::internal
7171
static void parse_unsafe( Input& in, Consumer& consumer )
7272
{
7373
const auto b = in.peek_uint8();
74-
if( b <= std::uint8_t( format::POSITIVE_MAX ) ) {
74+
if( b <= static_cast< std::uint8_t >( format::POSITIVE_MAX ) ) {
7575
consumer.number( static_cast< std::uint64_t >( b ) );
7676
in.bump_in_this_line();
7777
return;
7878
}
79-
if( b >= std::uint8_t( format::NEGATIVE_MIN ) ) {
79+
if( b >= static_cast< std::uint8_t >( format::NEGATIVE_MIN ) ) {
8080
consumer.number( static_cast< std::int64_t >( static_cast< std::int8_t >( b ) ) );
8181
in.bump_in_this_line();
8282
return;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ namespace tao::json::ubjson::events
8585
else {
8686
os.put( 'H' );
8787
os.put( 'U' );
88-
os.put( static_cast< char >( 19 ) + static_cast< char >( v >= 10000000000000000000ULL ) );
88+
os.put( static_cast< char >( ( v >= 10000000000000000000ULL ) ? 20 : 19 ) );
8989
os << v;
9090
}
9191
}

0 commit comments

Comments
 (0)