Skip to content

Commit f3cb73c

Browse files
rzarzynskibill-scales
authored andcommitted
common: decode_head() of encoding.h takes len as unsigned, not int
Signed-off-by: Radoslaw Zarzynski <[email protected]>
1 parent 9d38763 commit f3cb73c

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/include/encoding.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ inline void encode_nohead(const std::string& s, bufferlist& bl)
236236
{
237237
encode_nohead(std::string_view(s), bl);
238238
}
239-
inline void decode_nohead(int len, std::string& s, bufferlist::const_iterator& p)
239+
inline void decode_nohead(unsigned len, std::string& s, bufferlist::const_iterator& p)
240240
{
241241
s.clear();
242242
p.copy(len, s);
@@ -318,7 +318,7 @@ inline void encode_nohead(const bufferlist& s, bufferlist& bl)
318318
{
319319
bl.append(s);
320320
}
321-
inline void decode_nohead(int len, bufferlist& s, bufferlist::const_iterator& p)
321+
inline void decode_nohead(unsigned len, bufferlist& s, bufferlist::const_iterator& p)
322322
{
323323
s.clear();
324324
p.copy(len, s);
@@ -463,7 +463,7 @@ inline std::enable_if_t<!traits::supported>
463463
encode_nohead(const std::set<T,Comp,Alloc>& s, bufferlist& bl);
464464
template<class T, class Comp, class Alloc, typename traits=denc_traits<T>>
465465
inline std::enable_if_t<!traits::supported>
466-
decode_nohead(int len, std::set<T,Comp,Alloc>& s, bufferlist::iterator& p);
466+
decode_nohead(unsigned len, std::set<T,Comp,Alloc>& s, bufferlist::iterator& p);
467467
template<class T, class Comp, class Alloc, typename traits=denc_traits<T>>
468468
inline std::enable_if_t<!traits::supported>
469469
encode(const boost::container::flat_set<T, Comp, Alloc>& s, bufferlist& bl);
@@ -476,7 +476,7 @@ encode_nohead(const boost::container::flat_set<T, Comp, Alloc>& s,
476476
bufferlist& bl);
477477
template<class T, class Comp, class Alloc, typename traits=denc_traits<T>>
478478
inline std::enable_if_t<!traits::supported>
479-
decode_nohead(int len, boost::container::flat_set<T, Comp, Alloc>& s,
479+
decode_nohead(unsigned len, boost::container::flat_set<T, Comp, Alloc>& s,
480480
bufferlist::iterator& p);
481481
template<class T, class Comp, class Alloc>
482482
inline void encode(const std::multiset<T,Comp,Alloc>& s, bufferlist& bl);
@@ -496,7 +496,7 @@ inline std::enable_if_t<!traits::supported>
496496
encode_nohead(const std::vector<T,Alloc>& v, bufferlist& bl);
497497
template<class T, class Alloc, typename traits=denc_traits<T>>
498498
inline std::enable_if_t<!traits::supported>
499-
decode_nohead(int len, std::vector<T,Alloc>& v, bufferlist::const_iterator& p);
499+
decode_nohead(unsigned len, std::vector<T,Alloc>& v, bufferlist::const_iterator& p);
500500
template<class T,class Alloc>
501501
inline void encode(const std::vector<std::shared_ptr<T>,Alloc>& v,
502502
bufferlist& bl,
@@ -522,7 +522,7 @@ inline std::enable_if_t<!traits::supported>
522522
encode_nohead(const boost::container::small_vector<T,N,Alloc>& v, bufferlist& bl);
523523
template<class T, std::size_t N, class Alloc, typename traits=denc_traits<T>>
524524
inline std::enable_if_t<!traits::supported>
525-
decode_nohead(int len, boost::container::small_vector<T,N,Alloc>& v, bufferlist::const_iterator& p);
525+
decode_nohead(unsigned len, boost::container::small_vector<T,N,Alloc>& v, bufferlist::const_iterator& p);
526526
// std::map
527527
template<class T, class U, class Comp, class Alloc,
528528
typename t_traits=denc_traits<T>, typename u_traits=denc_traits<U>>
@@ -550,7 +550,7 @@ encode_nohead(const std::map<T,U,Comp,Alloc>& m, bufferlist& bl, uint64_t featur
550550
template<class T, class U, class Comp, class Alloc,
551551
typename t_traits=denc_traits<T>, typename u_traits=denc_traits<U>>
552552
inline std::enable_if_t<!t_traits::supported || !u_traits::supported>
553-
decode_nohead(int n, std::map<T,U,Comp,Alloc>& m, bufferlist::const_iterator& p);
553+
decode_nohead(unsigned n, std::map<T,U,Comp,Alloc>& m, bufferlist::const_iterator& p);
554554
template<class T, class U, class Comp, class Alloc,
555555
typename t_traits=denc_traits<T>, typename u_traits=denc_traits<U>>
556556
inline std::enable_if_t<!t_traits::supported || !u_traits::supported>
@@ -580,7 +580,7 @@ encode_nohead(const boost::container::flat_map<T,U,Comp,Alloc>& m,
580580
template<class T, class U, class Comp, class Alloc,
581581
typename t_traits=denc_traits<T>, typename u_traits=denc_traits<U>>
582582
inline std::enable_if_t<!t_traits::supported || !u_traits::supported>
583-
decode_nohead(int n, boost::container::flat_map<T,U,Comp,Alloc>& m,
583+
decode_nohead(unsigned n, boost::container::flat_map<T,U,Comp,Alloc>& m,
584584
bufferlist::const_iterator& p);
585585
template<class T, class U, class Comp, class Alloc>
586586
inline void encode(const std::multimap<T,U,Comp,Alloc>& m, bufferlist& bl);
@@ -844,9 +844,9 @@ inline typename std::enable_if<!traits::supported>::type
844844
}
845845
template<class T, class Comp, class Alloc, typename traits>
846846
inline std::enable_if_t<!traits::supported>
847-
decode_nohead(int len, std::set<T,Comp,Alloc>& s, bufferlist::const_iterator& p)
847+
decode_nohead(unsigned len, std::set<T,Comp,Alloc>& s, bufferlist::const_iterator& p)
848848
{
849-
for (int i=0; i<len; i++) {
849+
for (unsigned i=0; i<len; i++) {
850850
T v;
851851
decode(v, p);
852852
s.insert(v);
@@ -888,11 +888,11 @@ encode_nohead(const boost::container::flat_set<T, Comp, Alloc>& s,
888888
}
889889
template<class T, class Comp, class Alloc, typename traits>
890890
inline std::enable_if_t<!traits::supported>
891-
decode_nohead(int len, boost::container::flat_set<T, Comp, Alloc>& s,
891+
decode_nohead(unsigned len, boost::container::flat_set<T, Comp, Alloc>& s,
892892
bufferlist::iterator& p)
893893
{
894894
s.reserve(len);
895-
for (int i=0; i<len; i++) {
895+
for (unsigned i=0; i<len; i++) {
896896
T v;
897897
decode(v, p);
898898
s.insert(v);
@@ -959,7 +959,7 @@ inline std::enable_if_t<!traits::supported>
959959
}
960960
template<class T, class Alloc, typename traits>
961961
inline std::enable_if_t<!traits::supported>
962-
decode_nohead(int len, std::vector<T,Alloc>& v, bufferlist::const_iterator& p)
962+
decode_nohead(unsigned len, std::vector<T,Alloc>& v, bufferlist::const_iterator& p)
963963
{
964964
v.resize(len);
965965
for (__u32 i=0; i<v.size(); i++)
@@ -1005,7 +1005,7 @@ inline std::enable_if_t<!traits::supported>
10051005
}
10061006
template<class T, std::size_t N, class Alloc, typename traits>
10071007
inline std::enable_if_t<!traits::supported>
1008-
decode_nohead(int len, boost::container::small_vector<T,N,Alloc>& v, bufferlist::const_iterator& p)
1008+
decode_nohead(unsigned len, boost::container::small_vector<T,N,Alloc>& v, bufferlist::const_iterator& p)
10091009
{
10101010
v.resize(len);
10111011
for (auto& i : v)
@@ -1159,7 +1159,7 @@ inline std::enable_if_t<!t_traits::supported || !u_traits::supported>
11591159
template<class T, class U, class Comp, class Alloc,
11601160
typename t_traits, typename u_traits>
11611161
inline std::enable_if_t<!t_traits::supported || !u_traits::supported>
1162-
decode_nohead(int n, std::map<T,U,Comp,Alloc>& m, bufferlist::const_iterator& p)
1162+
decode_nohead(unsigned n, std::map<T,U,Comp,Alloc>& m, bufferlist::const_iterator& p)
11631163
{
11641164
m.clear();
11651165
while (n--) {
@@ -1172,7 +1172,7 @@ inline std::enable_if_t<!t_traits::supported || !u_traits::supported>
11721172
template <std::move_constructible T, std::move_constructible U, class Comp, class Alloc,
11731173
typename t_traits, typename u_traits>
11741174
inline std::enable_if_t<!t_traits::supported || !u_traits::supported>
1175-
decode_nohead(int n, std::map<T, U, Comp, Alloc>& m, bufferlist::const_iterator& p)
1175+
decode_nohead(unsigned n, std::map<T, U, Comp, Alloc>& m, bufferlist::const_iterator& p)
11761176
{
11771177
m.clear();
11781178
while (n--) {
@@ -1264,7 +1264,7 @@ template<class T, class U, class Comp, class Alloc,
12641264
template<class T, class U, class Comp, class Alloc,
12651265
typename t_traits, typename u_traits>
12661266
inline std::enable_if_t<!t_traits::supported || !u_traits::supported>
1267-
decode_nohead(int n, boost::container::flat_map<T,U,Comp,Alloc>& m,
1267+
decode_nohead(unsigned n, boost::container::flat_map<T,U,Comp,Alloc>& m,
12681268
bufferlist::const_iterator& p)
12691269
{
12701270
m.clear();

0 commit comments

Comments
 (0)