cisco / libsrtp

Library for SRTP (Secure Realtime Transport Protocol)
Other
1.19k stars 470 forks source link

Build fails on macOS -Wshorten-64-to-32 #647

Closed jacobsologub closed 5 months ago

jacobsologub commented 1 year ago

Compiler and Version used Apple clang version 14.0.0 (clang-1400.0.29.202) Target: arm64-apple-darwin21.6.0 Thread model: posix

Operating System and version macOS 12.6.3

❌  libsrtp/srtp/srtp.c:368:35: implicit conversion loses integer precision: 'const unsigned long' to 'unsigned int' [-Werror,-Wshorten-64-to-32]

        str->num_master_keys = p->num_master_keys;
                             ~ ~~~^~~~~~~~~~~~~~~

❌  libsrtp/srtp/srtp.c:1366:47: implicit conversion loses integer precision: 'const unsigned long' to 'unsigned int' [-Werror,-Wshorten-64-to-32]

                                           p->num_master_keys);
                                           ~~~^~~~~~~~~~~~~~~

❌  libsrtp/crypto/math/datatypes.c:206:17: implicit conversion loses integer precision: 'unsigned long' to 'uint32_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32]

    v->length = length;
              ~ ^~~~~~
pabuhler commented 11 months ago

Hi @jacobsologub, thanks for reporting this. For now I am going to mark this as todo for version 3. We could just cast to remove warning but I would prefer to fix it by being more consistent in the types used in libsrtp.

pabuhler commented 5 months ago

This should be fixed now in main.