From 7af860fb78d6a13258d5887e7bb71276509229cb Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 27 Jul 2021 16:32:36 +0200 Subject: utils: Fix c++ warn in OSMO_STRBUF_APPEND MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- include/osmocom/core/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h index c9d5560d..1c603904 100644 --- a/include/osmocom/core/utils.h +++ b/include/osmocom/core/utils.h @@ -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; \ -- cgit v1.2.3