aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-07-27 16:32:36 +0200
committerpespin <pespin@sysmocom.de>2021-07-28 20:14:14 +0000
commit7af860fb78d6a13258d5887e7bb71276509229cb (patch)
tree6c5463d2abfc83b5084c10a169b02c6ea9c0abd1
parentvty: clear screen with ^L (diff)
downloadlibosmocore-7af860fb78d6a13258d5887e7bb71276509229cb.tar.xz
libosmocore-7af860fb78d6a13258d5887e7bb71276509229cb.zip
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
-rw-r--r--include/osmocom/core/utils.h2
1 files changed, 1 insertions, 1 deletions
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; \