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

[Unifex] Implicit cast warning in functions enif_get_int64() and enif_get_long() #728

Closed
maksstach opened this issue Sep 14, 2021 · 0 comments
Assignees
Labels

Comments

@maksstach
Copy link

When compiling membrane_h264_ffmpeg_plugin the unifex generated code raises a warning:

~/Projects/membrane_h264_ffmpeg_plugin master ❯ mix compile                                                                                                  13:30:46
Bundlex: Building natives: parser, decoder, encoder
/Users/maksstachowiak/Projects/membrane_h264_ffmpeg_plugin/c_src/membrane_h264_ffmpeg_plugin/_generated/nif/decoder.c:183:37: warning: incompatible pointer types passing 'int64_t *' (aka 'long long *') to parameter of type 'long *' [-Wincompatible-pointer-types]
  if (!enif_get_int64(env, argv[1], &dts)) {
                                    ^~~~
/Users/maksstachowiak/.asdf/installs/erlang/24.0.5/usr/include/erl_nif_api_funcs.h:104:79: note: passing argument to parameter 'ip' here
ERL_NIF_API_FUNC_DECL(int,enif_get_long,(ErlNifEnv*, ERL_NIF_TERM term, long* ip));
                                                                              ^
1 warning generated.
/Users/maksstachowiak/Projects/membrane_h264_ffmpeg_plugin/c_src/membrane_h264_ffmpeg_plugin/_generated/nif/encoder.c:258:37: warning: incompatible pointer types passing 'int64_t *' (aka 'long long *') to parameter of type 'long *' [-Wincompatible-pointer-types]
  if (!enif_get_int64(env, argv[1], &pts)) {
                                    ^~~~
/Users/maksstachowiak/.asdf/installs/erlang/24.0.5/usr/include/erl_nif_api_funcs.h:104:79: note: passing argument to parameter 'ip' here
ERL_NIF_API_FUNC_DECL(int,enif_get_long,(ErlNifEnv*, ERL_NIF_TERM term, long* ip));
                                                                              ^
1 warning generated.

The definition of long is platform dependent.
fix: explicitly cast the argument to functions enif_get_int64() and enif_get_long() to type ErlNifUInt64

@maksstach maksstach changed the title implicit cast warning in functions enif_get_int64() and enif_get_long() Implicit cast warning in functions enif_get_int64() and enif_get_long() Sep 14, 2021
@mat-hek mat-hek changed the title Implicit cast warning in functions enif_get_int64() and enif_get_long() [Unifex] Implicit cast warning in functions enif_get_int64() and enif_get_long() Jan 30, 2024
@mat-hek mat-hek transferred this issue from membraneframework/unifex Jan 30, 2024
@mat-hek mat-hek moved this to Backlog in Smackore Jan 30, 2024
@mat-hek mat-hek added the bug label Jan 30, 2024
@mat-hek mat-hek moved this from Backlog to Todo in Smackore Jan 30, 2024
@bartkrak bartkrak moved this from Todo to In Progress in Smackore Feb 8, 2024
@bartkrak bartkrak moved this from In Progress to In Review in Smackore Feb 15, 2024
@bartkrak bartkrak moved this from In Review to Done in Smackore Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

3 participants