Change in libosmocore[master]: fixup for gsm48_chan_mode_to_non_vamos()

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
Sat May 29 23:49:19 UTC 2021


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

Change subject: fixup for gsm48_chan_mode_to_non_vamos()
......................................................................

fixup for gsm48_chan_mode_to_non_vamos()

When modifying chan modes, I first thought rather always fail if there
is no equivalent mode.

That is true for gsm48_chan_mode_to_vamos(), but for a change to
non-VAMOS, rather return the unchanged mode for non-VAMOS modes, so that
gsm48_chan_mode_to_non_vamos(GSM_CMODE_SIGN) works without failure.

This makes more convenient checking, e.g. in osmo-bsc's lchan_fsm.c
making sure that a non-VAMOS lchan has a non-VAMOS chan_mode, for all
types of lchans.

Change-Id: Ibf20f04d167e0e0599012ff530bc17ba8c8ab562
---
M src/gsm/gsm48.c
1 file changed, 2 insertions(+), 5 deletions(-)

Approvals:
  neels: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c
index 02489c9..ae1a21b 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -463,22 +463,19 @@
 }
 
 /*! Translate GSM48_CMODE_SPEECH_*_VAMOS to its corresponding GSM48_CMODE_SPEECH_* non-vamos mode.
- * If the mode has no equivalent non-VAMOS mode, return a negative value.
+ * If the mode is not a VAMOS mode, return the unchanged mode.
  */
 enum gsm48_chan_mode gsm48_chan_mode_to_non_vamos(enum gsm48_chan_mode mode)
 {
 	switch (mode) {
 	case GSM48_CMODE_SPEECH_V1_VAMOS:
-	case GSM48_CMODE_SPEECH_V1:
 		return GSM48_CMODE_SPEECH_V1;
 	case GSM48_CMODE_SPEECH_V2_VAMOS:
-	case GSM48_CMODE_SPEECH_EFR:
 		return GSM48_CMODE_SPEECH_EFR;
 	case GSM48_CMODE_SPEECH_V3_VAMOS:
-	case GSM48_CMODE_SPEECH_AMR:
 		return GSM48_CMODE_SPEECH_AMR;
 	default:
-		return -1;
+		return mode;
 	}
 }
 

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ibf20f04d167e0e0599012ff530bc17ba8c8ab562
Gerrit-Change-Number: 24456
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210529/89592550/attachment.htm>


More information about the gerrit-log mailing list