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
This commit is contained in:
Neels Hofmeyr 2021-04-28 17:22:57 +02:00
parent 7fc58defab
commit 1605c8a18b
1 changed files with 6 additions and 6 deletions

View File

@ -681,12 +681,12 @@ static int select_codecs(struct assignment_request *req, struct gsm0808_channel_
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 @@ static int select_codecs(struct assignment_request *req, struct gsm0808_channel_
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;