@@ -172,7 +172,7 @@ class binary_reader
172
172
std::int32_t document_size{};
173
173
get_number<std::int32_t , true >(input_format_t ::bson, document_size);
174
174
175
- if (JSON_HEDLEY_UNLIKELY (!sax->start_object (static_cast <std::size_t >(- 1 ))))
175
+ if (JSON_HEDLEY_UNLIKELY (!sax->start_object (std::numeric_limits <std::size_t >:: max ( ))))
176
176
{
177
177
return false ;
178
178
}
@@ -394,7 +394,7 @@ class binary_reader
394
394
std::int32_t document_size{};
395
395
get_number<std::int32_t , true >(input_format_t ::bson, document_size);
396
396
397
- if (JSON_HEDLEY_UNLIKELY (!sax->start_array (static_cast <std::size_t >(- 1 ))))
397
+ if (JSON_HEDLEY_UNLIKELY (!sax->start_array (std::numeric_limits <std::size_t >:: max ( ))))
398
398
{
399
399
return false ;
400
400
}
@@ -654,7 +654,7 @@ class binary_reader
654
654
}
655
655
656
656
case 0x9F : // array (indefinite length)
657
- return get_cbor_array (static_cast <std::size_t >(- 1 ), tag_handler);
657
+ return get_cbor_array (std::numeric_limits <std::size_t >:: max ( ), tag_handler);
658
658
659
659
// map (0x00..0x17 pairs of data items follow)
660
660
case 0xA0 :
@@ -708,7 +708,7 @@ class binary_reader
708
708
}
709
709
710
710
case 0xBF : // map (indefinite length)
711
- return get_cbor_object (static_cast <std::size_t >(- 1 ), tag_handler);
711
+ return get_cbor_object (std::numeric_limits <std::size_t >:: max ( ), tag_handler);
712
712
713
713
case 0xC6 : // tagged item
714
714
case 0xC7 :
@@ -1096,9 +1096,9 @@ class binary_reader
1096
1096
}
1097
1097
1098
1098
/* !
1099
- @param[in] len the length of the array or static_cast <std::size_t>(-1 ) for an
1099
+ @param[in] len the length of the array or std::numeric_limits <std::size_t>::max( ) for an
1100
1100
array of indefinite size
1101
- @param[in] tag_handler how CBOR tags should be treated
1101
+ @param[in] tag_handler how CBOR tags should be treated
1102
1102
@return whether array creation completed
1103
1103
*/
1104
1104
bool get_cbor_array (const std::size_t len,
@@ -1109,7 +1109,7 @@ class binary_reader
1109
1109
return false ;
1110
1110
}
1111
1111
1112
- if (len != static_cast <std::size_t >(- 1 ))
1112
+ if (len != std::numeric_limits <std::size_t >:: max ( ))
1113
1113
{
1114
1114
for (std::size_t i = 0 ; i < len; ++i)
1115
1115
{
@@ -1134,7 +1134,7 @@ class binary_reader
1134
1134
}
1135
1135
1136
1136
/* !
1137
- @param[in] len the length of the object or static_cast <std::size_t>(-1 ) for an
1137
+ @param[in] len the length of the object or std::numeric_limits <std::size_t>::max( ) for an
1138
1138
object of indefinite size
1139
1139
@param[in] tag_handler how CBOR tags should be treated
1140
1140
@return whether object creation completed
@@ -1150,7 +1150,7 @@ class binary_reader
1150
1150
if (len != 0 )
1151
1151
{
1152
1152
string_t key;
1153
- if (len != static_cast <std::size_t >(- 1 ))
1153
+ if (len != std::numeric_limits <std::size_t >:: max ( ))
1154
1154
{
1155
1155
for (std::size_t i = 0 ; i < len; ++i)
1156
1156
{
@@ -2568,7 +2568,7 @@ class binary_reader
2568
2568
}
2569
2569
else
2570
2570
{
2571
- if (JSON_HEDLEY_UNLIKELY (!sax->start_array (static_cast <std::size_t >(- 1 ))))
2571
+ if (JSON_HEDLEY_UNLIKELY (!sax->start_array (std::numeric_limits <std::size_t >:: max ( ))))
2572
2572
{
2573
2573
return false ;
2574
2574
}
@@ -2646,7 +2646,7 @@ class binary_reader
2646
2646
}
2647
2647
else
2648
2648
{
2649
- if (JSON_HEDLEY_UNLIKELY (!sax->start_object (static_cast <std::size_t >(- 1 ))))
2649
+ if (JSON_HEDLEY_UNLIKELY (!sax->start_object (std::numeric_limits <std::size_t >:: max ( ))))
2650
2650
{
2651
2651
return false ;
2652
2652
}
@@ -2982,7 +2982,7 @@ class binary_reader
2982
2982
}
2983
2983
2984
2984
private:
2985
- static JSON_INLINE_VARIABLE constexpr std::size_t npos = static_cast <std::size_t >(- 1 );
2985
+ static JSON_INLINE_VARIABLE constexpr std::size_t npos = std::numeric_limits <std::size_t >::max( );
2986
2986
2987
2987
// / input adapter
2988
2988
InputAdapterType ia;
0 commit comments