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
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;
}
}