Skip to content

Commit 0158062

Browse files
committed
Resolve some warnings from MSVC
1 parent 6431ada commit 0158062

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212

1313
#include "../../internal/endian.hpp"
1414

15+
#ifdef _MSC_VER
16+
#pragma warning( push )
17+
#pragma warning( disable : 4310 )
18+
#endif
19+
1520
namespace tao
1621
{
1722
namespace json
@@ -163,4 +168,8 @@ namespace tao
163168

164169
} // namespace tao
165170

171+
#ifdef _MSC_VER
172+
#pragma warning( pop )
173+
#endif
174+
166175
#endif

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
#include "../../external/byte.hpp"
1313
#include "../../internal/endian.hpp"
1414

15+
#ifdef _MSC_VER
16+
#pragma warning( push )
17+
#pragma warning( disable : 4310 )
18+
#endif
19+
1520
namespace tao
1621
{
1722
namespace json
@@ -52,7 +57,7 @@ namespace tao
5257
void number( const std::int64_t v )
5358
{
5459
if( ( v >= -32 ) && ( v <= -1 ) ) {
55-
const std::int8_t x = v;
60+
const std::int8_t x = static_cast< std::int8_t >( v );
5661
os.write( reinterpret_cast< const char* >( &x ), sizeof( x ) );
5762
}
5863
else if( ( v >= -128 ) && ( v <= 127 ) ) {
@@ -61,7 +66,7 @@ namespace tao
6166
else if( ( v >= -32768 ) && ( v <= 32767 ) ) {
6267
number_impl< std::uint16_t >( 0xd1, v );
6368
}
64-
else if( ( v >= -2147483648 ) && ( v <= 2147483647 ) ) {
69+
else if( ( v >= -2147483648ll ) && ( v <= 2147483647 ) ) {
6570
number_impl< std::uint32_t >( 0xd2, v );
6671
}
6772
else {
@@ -72,7 +77,7 @@ namespace tao
7277
void number( const std::uint64_t v )
7378
{
7479
if( v <= 127 ) {
75-
const std::uint8_t x = v;
80+
const std::uint8_t x = static_cast< std::uint8_t >( v );
7681
os.write( reinterpret_cast< const char* >( &x ), sizeof( x ) );
7782
}
7883
else if( v <= 255 ) {
@@ -215,4 +220,8 @@ namespace tao
215220

216221
} // namespace tao
217222

223+
#ifdef _MSC_VER
224+
#pragma warning( pop )
225+
#endif
226+
218227
#endif

0 commit comments

Comments
 (0)