diff options
author | Russell Belfer <rb@github.com> | 2012-04-27 00:04:54 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-04-27 00:04:54 +0400 |
commit | 821f6bc7404122260a46796422c011105a33638f (patch) | |
tree | 13a7c69cae57a5804363bc72fc3d10abd7d520d4 /src | |
parent | 631ba94e0e489d4baf4e289539a9acf084953c32 (diff) |
Fix Win32 warnings
Diffstat (limited to 'src')
-rw-r--r-- | src/attr_file.c | 3 | ||||
-rw-r--r-- | src/diff.c | 3 | ||||
-rw-r--r-- | src/indexer.c | 2 | ||||
-rw-r--r-- | src/khash.h | 16 | ||||
-rw-r--r-- | src/pool.c | 12 | ||||
-rw-r--r-- | src/revwalk.c | 2 |
6 files changed, 20 insertions, 18 deletions
diff --git a/src/attr_file.c b/src/attr_file.c index 650b58fcc..25c21b1fd 100644 --- a/src/attr_file.c +++ b/src/attr_file.c @@ -403,7 +403,8 @@ int git_attr_fnmatch__parse( /* given an unrooted fullpath match from a file inside a repo, * prefix the pattern with the relative directory of the source file */ - spec->pattern = git_pool_malloc(pool, sourcelen + spec->length + 1); + spec->pattern = git_pool_malloc( + pool, (uint32_t)(sourcelen + spec->length + 1)); if (spec->pattern) { memcpy(spec->pattern, source, sourcelen); memcpy(spec->pattern + sourcelen, pattern, spec->length); diff --git a/src/diff.c b/src/diff.c index b239031a2..5d70b822b 100644 --- a/src/diff.c +++ b/src/diff.c @@ -313,7 +313,8 @@ static git_diff_list *git_diff_list_alloc( if (!diff_pathspec_is_interesting(&opts->pathspec)) return diff; - if (git_vector_init(&diff->pathspec, opts->pathspec.count, NULL) < 0) + if (git_vector_init( + &diff->pathspec, (unsigned int)opts->pathspec.count, NULL) < 0) goto fail; for (i = 0; i < opts->pathspec.count; ++i) { diff --git a/src/indexer.c b/src/indexer.c index 1f8b512c2..22a510a3a 100644 --- a/src/indexer.c +++ b/src/indexer.c @@ -376,7 +376,7 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz git__free(obj.data); - stats->processed = ++processed; + stats->processed = (unsigned int)++processed; } return 0; diff --git a/src/khash.h b/src/khash.h index f9d239336..bd67fe1f7 100644 --- a/src/khash.h +++ b/src/khash.h @@ -196,8 +196,8 @@ static const double __ac_HASH_UPPER = 0.77; SCOPE void kh_destroy_##name(kh_##name##_t *h) \ { \ if (h) { \ - kfree(h->keys); kfree(h->flags); \ - kfree(h->vals); \ + kfree((void *)h->keys); kfree(h->flags); \ + kfree((void *)h->vals); \ kfree(h); \ } \ } \ @@ -235,11 +235,11 @@ static const double __ac_HASH_UPPER = 0.77; if (!new_flags) return -1; \ memset(new_flags, 0xaa, __ac_fsize(new_n_buckets) * sizeof(khint32_t)); \ if (h->n_buckets < new_n_buckets) { /* expand */ \ - khkey_t *new_keys = (khkey_t*)krealloc(h->keys, new_n_buckets * sizeof(khkey_t)); \ + khkey_t *new_keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ if (!new_keys) return -1; \ h->keys = new_keys; \ if (kh_is_map) { \ - khval_t *new_vals = (khval_t*)krealloc(h->vals, new_n_buckets * sizeof(khval_t)); \ + khval_t *new_vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ if (!new_vals) return -1; \ h->vals = new_vals; \ } \ @@ -275,8 +275,8 @@ static const double __ac_HASH_UPPER = 0.77; } \ } \ if (h->n_buckets > new_n_buckets) { /* shrink the hash table */ \ - h->keys = (khkey_t*)krealloc(h->keys, new_n_buckets * sizeof(khkey_t)); \ - if (kh_is_map) h->vals = (khval_t*)krealloc(h->vals, new_n_buckets * sizeof(khval_t)); \ + h->keys = (khkey_t*)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \ + if (kh_is_map) h->vals = (khval_t*)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \ } \ kfree(h->flags); /* free the working space */ \ h->flags = new_flags; \ @@ -376,8 +376,8 @@ static const double __ac_HASH_UPPER = 0.77; */ static inline khint_t __ac_X31_hash_string(const char *s) { - khint_t h = *s; - if (h) for (++s ; *s; ++s) h = (h << 5) - h + *s; + khint_t h = (khint_t)*s; + if (h) for (++s ; *s; ++s) h = (h << 5) - h + (khint_t)*s; return h; } /*! @function diff --git a/src/pool.c b/src/pool.c index 8f5c7e75a..641292d06 100644 --- a/src/pool.c +++ b/src/pool.c @@ -190,7 +190,7 @@ char *git_pool_strndup(git_pool *pool, const char *str, size_t n) assert(pool && str && pool->item_size == sizeof(char)); - if ((ptr = git_pool_malloc(pool, n + 1)) != NULL) { + if ((ptr = git_pool_malloc(pool, (uint32_t)(n + 1))) != NULL) { memcpy(ptr, str, n); *(((char *)ptr) + n) = '\0'; } @@ -216,7 +216,7 @@ char *git_pool_strcat(git_pool *pool, const char *a, const char *b) len_a = a ? strlen(a) : 0; len_b = b ? strlen(b) : 0; - if ((ptr = git_pool_malloc(pool, len_a + len_b + 1)) != NULL) { + if ((ptr = git_pool_malloc(pool, (uint32_t)(len_a + len_b + 1))) != NULL) { if (len_a) memcpy(ptr, a, len_a); if (len_b) @@ -256,12 +256,12 @@ bool git_pool__ptr_in_pool(git_pool *pool, void *ptr) { git_pool_page *scan; for (scan = pool->open; scan != NULL; scan = scan->next) - if ( ((void *)scan->data) <= ptr && - (((void *)scan->data) + scan->size) > ptr) + if ((void *)scan->data <= ptr && + (void *)(((char *)scan->data) + scan->size) > ptr) return true; for (scan = pool->full; scan != NULL; scan = scan->next) - if ( ((void *)scan->data) <= ptr && - (((void *)scan->data) + scan->size) > ptr) + if ((void *)scan->data <= ptr && + (void *)(((char *)scan->data) + scan->size) > ptr) return true; return false; } diff --git a/src/revwalk.c b/src/revwalk.c index 4f2f82798..c62bb4e0e 100644 --- a/src/revwalk.c +++ b/src/revwalk.c @@ -141,7 +141,7 @@ static commit_object **alloc_parents( return (commit_object **)((char *)commit + sizeof(commit_object)); return (commit_object **)git_pool_malloc( - &walk->commit_pool, n_parents * sizeof(commit_object *)); + &walk->commit_pool, (uint32_t)(n_parents * sizeof(commit_object *))); } |