Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove use of pointers to 32bit values #667

Merged
merged 2 commits into from
Dec 20, 2023

Conversation

pabuhler
Copy link
Member

There is no reason to use pointers to 32bit values, all operations are based on bytes. So This removes alot of extra casting and potential pointer arithmetic errors.
Also provide some functions for calculating header values to reduce duplication and improve readability.

@pabuhler pabuhler requested a review from paulej December 19, 2023 10:23
There is no reason to use pointers to 32bit values, all operations are
based on bytes. So This removes alot of extra casting and potential
pointer arithmetic errors.
Also provide some functions for calculating header values to reduce
duplication and improve readability.
#define octets_in_rtp_extn_hdr 4
#define octets_in_rtp_xtn_hdr 4

static uint32_t srtp_get_rtp_hdr_len(const srtp_hdr_t *hdr)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's semantically right to use uint32_t for byte lengths? I'd suggest size_t. (Not that this matters practically.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally agree and plan to convert to size_t both in the public API and internally, at the moment the mix of size_t, uint32_t, int and unsigned int is just staggering in this project. But such a change in the public API needs a major version bump which is why I have been putting it off. I think it might be a goal for the Christmass break to start.

srtp/srtp.c Show resolved Hide resolved
srtp_get_rtp_xtn_hdr & srtp_get_rtp_xtn_hdr_len both
assume that the caller has verified that the input arguments
are valid, ie that there is an extension present by previously
checking the x bit of the RTP header.
@pabuhler pabuhler merged commit 9a139f5 into cisco:main Dec 20, 2023
33 checks passed
@pabuhler pabuhler deleted the remove-32bit-pointers branch December 20, 2023 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants