Attention is currently required from: fixeria.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30579 )
Change subject: gsm0808: remove over-defensive assert()s for function parameters
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30579
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If9b4c92ace68191f5ddcc0a8a340fccbfe0f3dc0
Gerrit-Change-Number: 30579
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 13 Dec 2022 20:56:03 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: fixeria.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30576 )
Change subject: gsm0808: cosmetic: switch is not a function
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30576
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2f58711675c5c9511c4f4fe4bf0d6e6f7dd093b1
Gerrit-Change-Number: 30576
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 13 Dec 2022 20:54:54 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: neels.
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30574 )
Change subject: gsm0808: add gsm0808_enc_speech_codec[_list]2()
......................................................................
Patch Set 2:
(11 comments)
This change is ready for review.
File include/osmocom/gsm/gsm0808_utils.h:
https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/5d80956b_12346afc
PS1, Line 114: ;
> doesn't the DEPRECATED go before the comma?
Ack
https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/5e14294d_810d6406
PS1, Line 115: OSMO_DEPRECATED("use gsm0808_enc_speech_codec2() instead")
> add […]
It's the first time I see such a suggestion/requirement. Usually we don't explain why something is deprecated in the compiler warnings. One can always do git-blame and see why the new API should be used. Also, IMO this is the kind of API that should have not been made public... None of the Osmocom projects are using it directly, so I would keep this as-is if you don't insist.
https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/77f06de8_cd7aedb1
PS1, Line 122: OSMO_DEPRECATED("use gsm0808_enc_speech_codec_list2() instead");
> same
See above.
File src/gsm/gsm0808_utils.c:
https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/f271ce71_c6ea4ad5
PS1, Line 267: OSMO_ASSERT(sc->type < 0x0f);
> to confirm this, this assert can be dropped because the switch() above does not leave any sc->type > […]
Ack, but I believe it's better doing this change separately:
https://gerrit.osmocom.org/q/Iafb45ed66378f2c9c2480f81371e92c6d1da71a7https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/8155a96c_52d8d1ab
PS1, Line 216: Helper
> (I detest comments saying "helper function" SCNR)
Not directly related to the changes I am making, so marking as resolved.
https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/0a51598e_1cc32974
PS1, Line 224: = fals
> (we could also drop this init)
https://gerrit.osmocom.org/q/Ifc6d109e27cdada0d08d2a8fc1c354f3de04f15chttps://gerrit.osmocom.org/c/libosmocore/+/30574/comment/1bd63c61_c073f26d
PS1, Line 299: \a
> (using "\a" is wrong)
This is not directly related to this patch, but could you explain why?
https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/c548d10b_90dfdf0f
PS1, Line 308: return -EINVAL;
> These asserts would be fine, or can even be dropped without substitute. […]
https://gerrit.osmocom.org/q/If9b4c92ace68191f5ddcc0a8a340fccbfe0f3dc0https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/cf83275d_305dfb56
PS1, Line 315: return rc;
I thought about this too, but IMO trying to recover the given msgb would unnecessary complicate things here. And simply shifting the tail is not enough. This recovery behavior may be acceptable for decoding API, because there can be new values and/or IEs added by 3GPP in recent revisions. But for the encoding API I see no need to tolerate any errors. If we fail to encode any of the IEs correctly, does it make sense to keep going and send the resulting PDU without a problematic IE? IMO, it does not. The usual approach for functions using this API would be simply free()ing the msgb and returning NULL. And as I said, this API should have been not made public at all...
> Actually actually, why do we even return the nr of bytes added at all, amount of data is tracked in the msgb anyway. How does it look in the rest of the gsm0808 API, can we just return 0 for success, negative on error?
The rest of the gsm0808 API does not even check values returned by these functions, only the unit tests do. I will introduce some checks in the upcoming patch.
https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/7a40d056_575fc6bf
PS1, Line 439: return rc;
> here the tiresome aspect, what if rc == 0. it will never happen, but still is an error. […]
Ah, indeed I need to convert rc from uint to int. Thanks for noticing this!
https://gerrit.osmocom.org/c/libosmocore/+/30574/comment/dbdadb9b_05bbe43d
PS1, Line 446: return *tlv_len + 2;
> same as above, only return 0 or negative?
I am afraid we don't have time for even more API changes...
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30574
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I199ffa0ba4a64813238519178155dfc767aa3975
Gerrit-Change-Number: 30574
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Attention: neels <nhofmeyr(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 13 Dec 2022 20:30:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: neels <nhofmeyr(a)sysmocom.de>
Gerrit-MessageType: comment
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/30576 )
Change subject: gsm0808: cosmetic: switch is not a function
......................................................................
gsm0808: cosmetic: switch is not a function
Change-Id: I2f58711675c5c9511c4f4fe4bf0d6e6f7dd093b1
---
M src/gsm/gsm0808_utils.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/30576/1
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index f1569c9..80d469e 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -227,7 +227,7 @@
* of 4 bit to fully specify the selected codec. In the following,
* we check if we work with an extended type or not. We also check
* if the codec type is valid at all. */
- switch(sc->type) {
+ switch (sc->type) {
case GSM0808_SCT_FR1:
case GSM0808_SCT_FR2:
case GSM0808_SCT_FR3:
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/30576
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2f58711675c5c9511c4f4fe4bf0d6e6f7dd093b1
Gerrit-Change-Number: 30576
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange