Fix the ability to compile coturn using C++ compiler#1546
Fix the ability to compile coturn using C++ compiler#1546ggarber merged 1 commit intocoturn:masterfrom
Conversation
|
My proposal to switch to building coturn as a C++ codebase is here, for reference: #1416 It depends on this change. |
e469a15 to
f3382f7
Compare
f3382f7 to
12afb61
Compare
|
@eakraly is this change thematically acceptable? My work is planning to integrate with opentelemetry-sdk, which is a C++ (cmake build) package, and that's going to depend on this change to be able to function. We'd rather not carry patches if upstream considers them acceptable. |
|
Hi @jonesmz ! Sorry I was unresponsive |
de9cb9c to
06efbee
Compare
06efbee to
c6e6954
Compare
|
@eakraly merge conflict resolved, CI is passing. |
|
@eakraly sorry to be a nag... is there anything else you're looking for on this? |
|
@ggarber are you open to taking a look at this PR? This PR is a dependency for the work my employer is doing with opentelemetry-sdk, it would be nice to reduce the difference between our fork of coturn and upstream. |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes compilation issues when using a C++ compiler by adding necessary type casts and const qualifiers while preserving the original C functionality. The changes include:
- Applying explicit casts to constants in min() calls in ns_turn_msg.c.
- Refactoring header includes and C linkage blocks in prom_server.h.
- Updating function signatures and header includes for const correctness and C++ compatibility in ns_turn_utils.h and ns_turn_utils.c.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/client/ns_turn_msg.c | Added explicit casts in min() calls to resolve C++ type issues. |
| src/apps/relay/prom_server.h | Cleaned up duplicated includes and adjusted C linkage blocks. |
| src/apps/common/ns_turn_utils.h | Improved C++ compatibility with const correctness and modern min usage. |
| src/apps/common/ns_turn_utils.c | Updated function signature for consistency with the header changes. |
|
Thank you for the contribution @jonesmz . it looks reasonable to me. In the future try to avoid changes unrelated to the goal of the PR (like indentation changes) in the same PR 🙏 But it is ok for this one. |
|
Thanks for merging the change. Can you help me understand what indentation changes you are referring to? I originally opened this PR 11 months ago and don't recall any intentional indentation changes, neither do I see any on my mobile webbrowser when looking at the diff Keep in mind that the linter rules of the project enforce the code style, so its possible any changes you are referring to are necessitated by that. |
This adjusts the code to allow compilation with a C++ compiler, but doesn't change the build to use a C++ compiler. Everything should continue working as-is with existing c-compilers. This is just a "let it work" change, not a "change how it works" change.