Skip to content

Conversation

sourcejedi
Copy link

Two tiny fixes, please merge :).

hashindex: Fix printf size specifiers in error messages
gitignore: all cython generated files

Fixes warnings on 32-bit (x86).

1. Cast sizeof() to match printf specifier
2. Cast off_t to long long.  This is guaranteed 64-bit.
   No performance concern because it's an error message.

attic/_hashindex.c: In function ‘hashindex_read’:
attic/_hashindex.c:148:13: warning: format ‘%ld’ expects argument of type ‘long
int’, but argument 4 has type ‘unsigned int’ [-Wformat=]
             EPRINTF_MSG_PATH(path, "failed to read %ld bytes", sizeof(HashHeader));
             ^
attic/_hashindex.c:188:13: warning: format ‘%ld’ expects argument of type ‘long
int’, but argument 4 has type ‘off_t’ [-Wformat=]
             EPRINTF_MSG_PATH(path, "failed to read %ld bytes", length);
             ^
@ThomasWaldmann
Copy link
Contributor

isn't %ju format and casting all these values to (uintmax_t) a more general solution?

@sourcejedi
Copy link
Author

This' a bit less noisy and should work on Windows :).

I saw elsewhere Windows isn't supported. So"%j" (as in borg) is fine, and I agree uintmax is nice and explicit.

@ThomasWaldmann
Copy link
Contributor

@sourcejedi is there a problem with %j and Windows? Or Cygwin?

@sourcejedi
Copy link
Author

It's a problem with native Windows. http://stackoverflow.com/a/22537979/799204

Apparently Cygwin is a whole 'nother library, so if you're using that then I don't know. I'd like to think it supports a 15-year old standard which has no fully-portable alternative :).

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