utils: Fix c++ warn in OSMO_STRBUF_APPEND

It's really a false positive since _sb_l is compared and granted to be
psotivie by the time we compare, so we don't really care, but c++ is not
happy about it.

"""
/osmocom/core/utils.h:227:40: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare]
  227 |                 if (_sb_l < 0 || _sb_l > _sb_remain) \
      |                                  ~~~~~~^~~~~~~~~~~~
"""

Change-Id: I90e7374aa959468670f1c0ea65a427398d423ddb
This commit is contained in:
Pau Espin 2021-07-27 16:32:36 +02:00 committed by pespin
parent 053ad96600
commit 7af860fb78
1 changed files with 1 additions and 1 deletions

View File

@ -224,7 +224,7 @@ struct osmo_strbuf {
(STRBUF).pos = (STRBUF).buf; \
size_t _sb_remain = (STRBUF).buf ? (STRBUF).len - ((STRBUF).pos - (STRBUF).buf) : 0; \
int _sb_l = func((STRBUF).pos, _sb_remain, ##args); \
if (_sb_l < 0 || _sb_l > _sb_remain) \
if (_sb_l < 0 || (size_t)_sb_l > _sb_remain) \
(STRBUF).pos = (STRBUF).buf + (STRBUF).len; \
else if ((STRBUF).pos) \
(STRBUF).pos += _sb_l; \