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

base64: fix assignment to wrong type #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mmilata
Copy link
Contributor

@mmilata mmilata commented May 11, 2017

Found by gcc:

base64.c:196:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (more == -1) {
           ^

@dgibson
Copy link
Collaborator

dgibson commented May 12, 2017 via email

@peterbarker
Copy link

From program flow maximum size of the parameter is 3, so overflow is unlikely.

Changing it to return ssize_t would seem to be reasonable, 'though.

@mmilata Do you think changing the return type to ssize_t is reasonable? If so, would you like to do a PR for that?

Functions that returned int have been modified to return ssize_t
instead.

Found by gcc:

base64.c:196:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (more == -1) {
           ^

Signed-off-by: Martin Milata <[email protected]>
@mmilata
Copy link
Contributor Author

mmilata commented May 15, 2017

@peterbarker Updated the PR to use ssize_t. I've also changed the return type of base64_decode_quartet_using_maps for the sake of consistency. Please take a look?

@jsarenik
Copy link
Contributor

👍 @rustyrussell please merge, then ElementsProject/libwally-core@bf81e8b will need a ccan-update
(noticed today while compiling current ElementsProject/lightning@9470ea303)

@jsarenik
Copy link
Contributor

Just that it would be nicer without the warning… =)

../../../libwally-core/src/ccan/ccan/base64/base64.c: In function 'base64_decode_using_maps':
../../../libwally-core/src/ccan/ccan/base64/base64.c:196:11: warning: comparison
 of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'}
 and 'int' [-Wsign-compare]
  196 |  if (more == -1) {
      |           ^~

@rustyrussell
Copy link
Owner

Thanks, applied!

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.

5 participants