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

Fix two incompatible types warnings in example code #405

Merged
merged 2 commits into from
Apr 11, 2024

Commits on Mar 30, 2024

  1. client: fix incompatible types warning

    The `rustls_verify_server_cert_callback` type is defined as returning
    uint32_t. This uint32_t return is translated by the calling code in
    rustls-ffi to a `rustls_result`.
    
    In client.c we were mistakenly typing the `verify` callback as returnign
    `enum rustls_result` when it should be `uint32_t`. This commit makes the
    required adjustment, silencing the warning.
    cpu committed Mar 30, 2024
    Configuration menu
    Copy the full SHA
    2f91c4b View commit details
    Browse the repository at this point in the history
  2. server: fix incompatible types warning

    On Linux, `man 2 setsockopt` shows the `optval` argument as being `const
    void *`. On Windows, `setsockopt`'s `optval` argument is `const char*`.
    This mismatch produces an incompatible types warning when building the
    `server.c` example on Windows.
    
    The solution is straight-forward. Explicitly cast `optval` to `const
    char*`. On Windows this is the correct type. On Linux it will be
    implicitly converted to `const void *` and everyone is happy.
    cpu committed Mar 30, 2024
    Configuration menu
    Copy the full SHA
    6fd8fae View commit details
    Browse the repository at this point in the history