Change in libosmocore[master]: utils: Fix c++ warn in OSMO_STRBUF_APPEND

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Wed Jul 28 20:14:14 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/25057 )

Change subject: utils: Fix c++ warn in OSMO_STRBUF_APPEND
......................................................................

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
---
M include/osmocom/core/utils.h
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  osmith: Looks good to me, but someone else must approve
  Hoernchen: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index c9d5560..1c60390 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -224,7 +224,7 @@
 			(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; \

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25057
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I90e7374aa959468670f1c0ea65a427398d423ddb
Gerrit-Change-Number: 25057
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Hoernchen <ewild at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210728/c6d6cc52/attachment.htm>


More information about the gerrit-log mailing list