-
-
Notifications
You must be signed in to change notification settings - Fork 326
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
lib/db: use integer port argument with mysql_real_connect in mysql driver #3325
Conversation
The port argument is not a string, but a plain integer. In the past, compilers ignore such type errors and produced a warning only, but this is changing, so this change also addresses a potential build failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix!
This is consistent with mysql_real_connect and db_get_login2 which creates the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @fweimer-rh !
mysql_real_connect()
does indeed use unsigned int
for the port (in comparison to PQsetdbLogin()
which uses char *
).
Anyone has a trick for quickly fixing clang-format issues without pulling the code locally? Unlike with Black, I'm not good at guessing what the right formatting is from the message. |
Its ugly. I wasn't able to create a good suggestion. |
(For the record for those not familiar with
Done in fc9803f |
#3255 ;-) |
I believe we have no CI test with MySQL driver, I’ll look into this. I suppose this should have been caught. |
I agree. We didn't necessarily choose the format. We used whatever was already there and what clang-format supported at the time hoping to get back to creating a nicer style with a more powerful version of clang-format. |
Attractive or not, the point of using formatters like ClangFormat and Black is to avoid non-productive discussions on formatting with potentially no end ...... :) |
Again, I deny ever taking a part in such discussion. |
The port argument is not a string, but a plain integer. In the past, compilers ignore such type errors and produced a warning only, but this is changing, so this change also addresses a potential build failure. Unlike PQsetdbLogin() which uses char *, mysql_real_connect() uses unsigned int for the port. Found as part of Porting To Modern C in the Fedora Project.
Problem is fixed in OSGeo/grass#3325 Closes NixOS#340475
The port argument is not a string, but a plain integer. In the past, compilers ignore such type errors and produced a warning only, but this is changing, so this change also addresses a potential build failure.
Note that I can't really test this, but at least the compiler error is gone. Found as part of: