Change in osmo-bsc[master]: select_codecs(): do not confuse bool 'true' with integer value 1

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/.

neels gerrit-no-reply at lists.osmocom.org
Wed May 19 17:11:29 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/24295 )


Change subject: select_codecs(): do not confuse bool 'true' with integer value 1
......................................................................

select_codecs(): do not confuse bool 'true' with integer value 1

In practice, '+ true' may result in '+ 1', but that is not type safe. We
rely on the number of items added by summing up booleans, rather make it
explicitly 1.

Change-Id: I17a82f4f208203b748ba2d6ace0ddc06f87c1cef
---
M src/osmo-bsc/osmo_bsc_bssap.c
1 file changed, 6 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/95/24295/1

diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index c3716ce..7a7579b 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -681,12 +681,12 @@
 	case GSM0808_SPEECH_FULL_BM:
 		rc = match_codec_pref(&req->ch_mode_rate[nc], ct, &conn->codec_list, msc, bts,
 				      RATE_PREF_FR);
-		nc += (rc == 0);
+		nc += (rc == 0) ? 1 : 0;
 		break;
 	case GSM0808_SPEECH_HALF_LM:
 		rc = match_codec_pref(&req->ch_mode_rate[nc], ct, &conn->codec_list, msc, bts,
 				      RATE_PREF_HR);
-		nc += (rc == 0);
+		nc += (rc == 0) ? 1 : 0;
 		break;
 	case GSM0808_SPEECH_PERM:
 	case GSM0808_SPEECH_PERM_NO_CHANGE:
@@ -694,19 +694,19 @@
 	case GSM0808_SPEECH_FULL_PREF:
 		rc = match_codec_pref(&req->ch_mode_rate[nc], ct, &conn->codec_list, msc, bts,
 				      RATE_PREF_FR);
-		nc += (rc == 0);
+		nc += (rc == 0) ? 1 : 0;
 		rc = match_codec_pref(&req->ch_mode_rate[nc], ct, &conn->codec_list, msc, bts,
 				      RATE_PREF_HR);
-		nc += (rc == 0);
+		nc += (rc == 0) ? 1 : 0;
 		break;
 	case GSM0808_SPEECH_HALF_PREF_NO_CHANGE:
 	case GSM0808_SPEECH_HALF_PREF:
 		rc = match_codec_pref(&req->ch_mode_rate[nc], ct, &conn->codec_list, msc, bts,
 				      RATE_PREF_HR);
-		nc += (rc == 0);
+		nc += (rc == 0) ? 1 : 0;
 		rc = match_codec_pref(&req->ch_mode_rate[nc], ct, &conn->codec_list, msc, bts,
 				      RATE_PREF_FR);
-		nc += (rc == 0);
+		nc += (rc == 0) ? 1 : 0;
 		break;
 	default:
 		rc = -EINVAL;

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I17a82f4f208203b748ba2d6ace0ddc06f87c1cef
Gerrit-Change-Number: 24295
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210519/6ab72dfb/attachment.htm>


More information about the gerrit-log mailing list