Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove most of the silly warnings #3613

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

Merged
merged 11 commits into from
Feb 18, 2016
Merged

Remove most of the silly warnings #3613

merged 11 commits into from
Feb 18, 2016

Conversation

ethomson
Copy link
Member

Fix up some of the silly warning: correct casts, constness, etc. This doesn't get us to zero warnings on all platforms, but it gets us closer.

Edward Thomson added 3 commits February 11, 2016 11:26
Windows defines `timeval` with `long`, which we cannot
sanely cope with.  Instead, use a custom timeval struct.
@@ -135,7 +135,7 @@ static git_tree_entry *alloc_entry(const char *filename)

struct tree_key_search {
const char *filename;
uint16_t filename_len;
size_t filename_len;
Copy link
Member

Choose a reason for hiding this comment

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

This makes the filename_len field a different size for the field in the git_tree_entry which I'd rather avoid.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, yes that's true. A quick perusal of the git source shows that they use an unsigned int here for the tree entry length.

There's an obvious compatibility issue here, then. And although I'm not surprised that we haven't run into it yet, one can certainly imagine a world where somebody is using git as a general data exchange mechanism (perhaps not directly related to filesystem or filename sizes) and a uint16_t is too small to hold the tree entries. So we should probably increase git_tree_entry's size as well.

Copy link
Member

Choose a reason for hiding this comment

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

We only just moved to 16 bits. This is in part to reduce the size and improve the alignment of the tree entries, and partly to make sure we can allocate the entries in the pool. We figured that 16 bits is more than actual OSs allow you to use for file names, and we're not going to go out of our way to support people who should be using actual databases.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated to use uint16_t.

carlosmn added a commit that referenced this pull request Feb 18, 2016
Remove most of the silly warnings
@carlosmn carlosmn merged commit 5663d4f into libgit2:master Feb 18, 2016
@ethomson ethomson deleted the fixups branch February 29, 2016 21:01
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