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
Tue Jul 27 14:34:08 UTC 2021


pespin has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/57/25057/1

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: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210727/c4cdd980/attachment.htm>


More information about the gerrit-log mailing list