diff options
| author | Russell Belfer <rb@github.com> | 2013-10-02 14:13:11 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2013-10-03 10:45:04 -0700 |
| commit | af302acaee95ff2ca3379b93cd886ebe96adff10 (patch) | |
| tree | 83be2a9f600c43a5b6c1aba17239bab56e83d934 /src/indexer.c | |
| parent | 618b7689e1cdd4ebd956949a95038fd49592a187 (diff) | |
| download | libgit2-af302acaee95ff2ca3379b93cd886ebe96adff10.tar.gz | |
Clean up annoying warnings
The indexer code was generating warnings on Windows 64-bit. I
looked closely at the logic and was able to simplify it a bit.
Also this fixes some other Windows and Linux warnings.
Diffstat (limited to 'src/indexer.c')
| -rw-r--r-- | src/indexer.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/indexer.c b/src/indexer.c index 4ce69fc8d..1270488f0 100644 --- a/src/indexer.c +++ b/src/indexer.c @@ -50,7 +50,7 @@ struct git_indexer_stream { /* Fields for calculating the packfile trailer (hash of everything before it) */ char inbuf[GIT_OID_RAWSZ]; - int inbuf_len; + size_t inbuf_len; git_hash_ctx trailer; }; @@ -378,13 +378,13 @@ static int do_progress_callback(git_indexer_stream *idx, git_transfer_progress * /* Hash everything but the last 20B of input */ static void hash_partially(git_indexer_stream *idx, const uint8_t *data, size_t size) { - int to_expell, to_keep; + size_t to_expell, to_keep; if (size == 0) return; /* Easy case, dump the buffer and the data minus the last 20 bytes */ - if (size >= 20) { + if (size >= GIT_OID_RAWSZ) { git_hash_update(&idx->trailer, idx->inbuf, idx->inbuf_len); git_hash_update(&idx->trailer, data, size - GIT_OID_RAWSZ); @@ -402,8 +402,8 @@ static void hash_partially(git_indexer_stream *idx, const uint8_t *data, size_t } /* We need to partially drain the buffer and then append */ - to_expell = abs(size - (GIT_OID_RAWSZ - idx->inbuf_len)); - to_keep = abs(idx->inbuf_len - to_expell); + to_keep = GIT_OID_RAWSZ - size; + to_expell = idx->inbuf_len - to_keep; git_hash_update(&idx->trailer, idx->inbuf, to_expell); |
