Skip to content

ldap: adapt to conn->port now being an 'int' - #9281

Closed
bagder wants to merge 1 commit into
masterfrom
bagder/ldap-conn-port
Closed

bagder wants to merge 1 commit into
masterfrom
bagder/ldap-conn-port

Conversation

@bagder

@bagder bagder commented Aug 8, 2022

Copy link
Copy Markdown
Member

Remove typecasts. Fix printf() formats.

Follow-up from 764c6bd.
Pointed out by Coverity CID 1507858.

Remove typecasts. Fix printf() formats.

Follow-up from 764c6bd.
Pointed out by Coverity CID 1507858.
@bagder bagder closed this in ca528d1 Aug 8, 2022
@bagder
bagder deleted the bagder/ldap-conn-port branch August 8, 2022 17:56

@cvengler cvengler left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't %d more natural for an int?

@bagder

bagder commented Aug 8, 2022

Copy link
Copy Markdown
Member Author

since the output is always unsigned I figured %u makes it more obvious

@cvengler

cvengler commented Aug 8, 2022

Copy link
Copy Markdown

since the output is always unsigned I figured %u makes it more obvious

But, at that point, wouldn't it mane more sense to change conn->port to an unsigned int anyway? Although not the scope of this PR, obviously.

@bagder

bagder commented Aug 8, 2022

Copy link
Copy Markdown
Member Author

I don't think it does, as that will just cause some more typecasts or require conversions elsewhere. The printf format string is for how it outputs the number, %d and %u both work on the same int input. It's not an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants