diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/array.h | 4 | ||||
-rw-r--r-- | src/checkout.c | 1 | ||||
-rw-r--r-- | src/indexer.c | 2 | ||||
-rw-r--r-- | src/pack-objects.c | 4 | ||||
-rw-r--r-- | src/pack.c | 4 | ||||
-rw-r--r-- | src/pack.h | 2 | ||||
-rw-r--r-- | src/path.c | 30 | ||||
-rw-r--r-- | src/path.h | 10 | ||||
-rw-r--r-- | src/refs.c | 7 |
9 files changed, 43 insertions, 21 deletions
diff --git a/src/array.h b/src/array.h index d7272d78c..1d4e1c224 100644 --- a/src/array.h +++ b/src/array.h @@ -57,9 +57,9 @@ GIT_INLINE(void *) git_array_grow(void *_a, size_t item_size) } #define git_array_alloc(a) \ - ((a).size >= (a).asize) ? \ + (((a).size >= (a).asize) ? \ git_array_grow(&(a), sizeof(*(a).ptr)) : \ - ((a).ptr ? &(a).ptr[(a).size++] : NULL) + ((a).ptr ? &(a).ptr[(a).size++] : NULL)) #define git_array_last(a) ((a).size ? &(a).ptr[(a).size - 1] : NULL) diff --git a/src/checkout.c b/src/checkout.c index 662803725..76edc6a72 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -1694,7 +1694,6 @@ done: static int checkout_create_conflicts(checkout_data *data) { - git_vector conflicts = GIT_VECTOR_INIT; checkout_conflictdata *conflict; size_t i; int error = 0; diff --git a/src/indexer.c b/src/indexer.c index 07d0073c8..0873c8cf0 100644 --- a/src/indexer.c +++ b/src/indexer.c @@ -660,7 +660,7 @@ static int inject_object(git_indexer *idx, git_oid *id) /* And then the compressed object */ git_filebuf_write(&idx->pack_file, buf.ptr, buf.size); idx->pack->mwf.size += buf.size; - entry->crc = htonl(crc32(entry->crc, (unsigned char *)buf.ptr, buf.size)); + entry->crc = htonl(crc32(entry->crc, (unsigned char *)buf.ptr, (uInt)buf.size)); git_buf_free(&buf); /* Write a fake trailer so the pack functions play ball */ diff --git a/src/pack-objects.c b/src/pack-objects.c index 2d0f564d1..9ea7c659a 100644 --- a/src/pack-objects.c +++ b/src/pack-objects.c @@ -26,7 +26,7 @@ struct unpacked { git_pobject *object; void *data; struct git_delta_index *index; - unsigned int depth; + int depth; }; struct tree_walk_context { @@ -659,7 +659,7 @@ static int delta_cacheable(git_packbuilder *pb, unsigned long src_size, } static int try_delta(git_packbuilder *pb, struct unpacked *trg, - struct unpacked *src, unsigned int max_depth, + struct unpacked *src, int max_depth, unsigned long *mem_usage, int *ret) { git_pobject *trg_object = trg->object; diff --git a/src/pack.c b/src/pack.c index 5df0f50b9..644b2d465 100644 --- a/src/pack.c +++ b/src/pack.c @@ -372,7 +372,7 @@ static unsigned char *pack_window_open( * - each byte afterwards: low seven bits are size continuation, * with the high bit being "size continues" */ -int git_packfile__object_header(unsigned char *hdr, unsigned long size, git_otype type) +size_t git_packfile__object_header(unsigned char *hdr, size_t size, git_otype type) { unsigned char *hdr_base; unsigned char c; @@ -392,7 +392,7 @@ int git_packfile__object_header(unsigned char *hdr, unsigned long size, git_otyp } *hdr++ = c; - return (int)(hdr - hdr_base); + return (hdr - hdr_base); } diff --git a/src/pack.h b/src/pack.h index ddeefea1d..28146ab30 100644 --- a/src/pack.h +++ b/src/pack.h @@ -112,7 +112,7 @@ typedef struct git_packfile_stream { git_mwindow *mw; } git_packfile_stream; -int git_packfile__object_header(unsigned char *hdr, unsigned long size, git_otype type); +size_t git_packfile__object_header(unsigned char *hdr, size_t size, git_otype type); int git_packfile_unpack_header( size_t *size_p, diff --git a/src/path.c b/src/path.c index d45751cd1..750dd3ef7 100644 --- a/src/path.c +++ b/src/path.c @@ -834,7 +834,12 @@ int git_path_direach( DIR *dir; path_dirent_data de_data; struct dirent *de, *de_buf = (struct dirent *)&de_data; + + (void)flags; + +#ifdef GIT_USE_ICONV git_path_iconv_t ic = GIT_PATH_ICONV_INIT; +#endif if (git_path_to_dir(path) < 0) return -1; @@ -846,8 +851,10 @@ int git_path_direach( return -1; } +#ifdef GIT_USE_ICONV if ((flags & GIT_PATH_DIR_PRECOMPOSE_UNICODE) != 0) (void)git_path_iconv_init_precompose(&ic); +#endif while (p_readdir_r(dir, de_buf, &de) == 0 && de != NULL) { char *de_path = de->d_name; @@ -856,8 +863,12 @@ int git_path_direach( if (git_path_is_dot_or_dotdot(de_path)) continue; - if ((error = git_path_iconv(&ic, &de_path, &de_len)) < 0 || - (error = git_buf_put(path, de_path, de_len)) < 0) +#ifdef GIT_USE_ICONV + if ((error = git_path_iconv(&ic, &de_path, &de_len)) < 0) + break; +#endif + + if ((error = git_buf_put(path, de_path, de_len)) < 0) break; error = fn(arg, path); @@ -871,7 +882,10 @@ int git_path_direach( } closedir(dir); + +#ifdef GIT_USE_ICONV git_path_iconv_clear(&ic); +#endif return error; } @@ -888,7 +902,12 @@ int git_path_dirload( size_t path_len; path_dirent_data de_data; struct dirent *de, *de_buf = (struct dirent *)&de_data; + + (void)flags; + +#ifdef GIT_USE_ICONV git_path_iconv_t ic = GIT_PATH_ICONV_INIT; +#endif assert(path && contents); @@ -903,8 +922,10 @@ int git_path_dirload( return -1; } +#ifdef GIT_USE_ICONV if ((flags & GIT_PATH_DIR_PRECOMPOSE_UNICODE) != 0) (void)git_path_iconv_init_precompose(&ic); +#endif path += prefix_len; path_len -= prefix_len; @@ -917,8 +938,10 @@ int git_path_dirload( if (git_path_is_dot_or_dotdot(de_path)) continue; +#ifdef GIT_USE_ICONV if ((error = git_path_iconv(&ic, &de_path, &de_len)) < 0) break; +#endif alloc_size = path_len + need_slash + de_len + 1 + alloc_extra; if ((entry_path = git__calloc(alloc_size, 1)) == NULL) { @@ -937,7 +960,10 @@ int git_path_dirload( } closedir(dir); + +#ifdef GIT_USE_ICONV git_path_iconv_clear(&ic); +#endif if (error != 0) giterr_set(GITERR_OS, "Failed to process directory entry in '%s'", path); diff --git a/src/path.h b/src/path.h index 17f4f7726..3daafd265 100644 --- a/src/path.h +++ b/src/path.h @@ -425,16 +425,6 @@ extern void git_path_iconv_clear(git_path_iconv_t *ic); */ extern int git_path_iconv(git_path_iconv_t *ic, char **in, size_t *inlen); -#else - -typedef struct { - int unused; -} git_path_iconv_t; -#define GIT_PATH_ICONV_INIT { 0 } -#define git_path_iconv_init_precompose(X) 0 -#define git_path_iconv_clear(X) (void)(X) -#define git_path_iconv(X,Y,Z) 0 - #endif /* GIT_USE_ICONV */ #endif diff --git a/src/refs.c b/src/refs.c index 269c5f54e..472a79890 100644 --- a/src/refs.c +++ b/src/refs.c @@ -737,7 +737,10 @@ int git_reference__normalize_name( int segment_len, segments_count = 0, error = GIT_EINVALIDSPEC; unsigned int process_flags; bool normalize = (buf != NULL); + +#ifdef GIT_USE_ICONV git_path_iconv_t ic = GIT_PATH_ICONV_INIT; +#endif assert(name); @@ -750,6 +753,7 @@ int git_reference__normalize_name( if (normalize) git_buf_clear(buf); +#ifdef GIT_USE_ICONV if ((flags & GIT_REF_FORMAT__PRECOMPOSE_UNICODE) != 0) { size_t namelen = strlen(current); if ((error = git_path_iconv_init_precompose(&ic)) < 0 || @@ -757,6 +761,7 @@ int git_reference__normalize_name( goto cleanup; error = GIT_EINVALIDSPEC; } +#endif while (true) { segment_len = ensure_segment_validity(current); @@ -834,7 +839,9 @@ cleanup: if (error && normalize) git_buf_free(buf); +#ifdef GIT_USE_ICONV git_path_iconv_clear(&ic); +#endif return error; } |