mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-14 00:19:50 +00:00
Fix Win32 warnings
This commit is contained in:
parent
631ba94e0e
commit
821f6bc740
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
16
src/khash.h
16
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
|
||||
|
12
src/pool.c
12
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;
|
||||
}
|
||||
|
@ -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 *)));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user