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 some compiler warnings in tests code #84

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

SeverinLeonhardt
Copy link

These are just some warnings I came across when building the driver for which I could implement a fix.

Compiling with MSVC produces the following warning:

	warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings

Instead of just ignoring the deprecation warnings replacing `inet_addr`
is straight-forward here.

`inet_pton` works well as a cross-platform alternative. The difference
in parsing[^1] are acceptable since this is only used in test code where
it won't lead to a chance in behavior since the only used value is a
fixed string of "127.0.0.1" in `bridge.cpp`.

[^1]: https://man7.org/linux/man-pages/man3/inet_pton.3.html#NOTES
Compiling the code with a higher warning level than the default gives
the following warning from MSVC:

	warning C4245: 'argument': conversion from 'long' to 'uint64_t', signed/unsigned mismatch

Indeed `long` is signed while `uint64_t` is unsigned. Casting to the
right data type gives the same result but fixes the warning.
In the tests `cass_retry_policy_downgrading_consistency_new` is called
intentionally, even though it's marked as deprecated. Ignore that
warning on MSVC.
@mykaul mykaul requested a review from avelanarius June 28, 2023 10:16
@mykaul mykaul changed the title Fix some warnings Fix some compiler warnings in tests code Jun 28, 2023
@mykaul
Copy link

mykaul commented Jun 13, 2024

With which compiler?

@SeverinLeonhardt
Copy link
Author

With which compiler?

This was with the Microsoft Visual C++ compiler. Details can be found in the individual commit messages.

It seems c77df6c isn't necessary. The code compiles without it for version 19.29 and 19.40 of the compiler.

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.

2 participants