Merge pull request #4018 from pks-t/pks/various-fixes
Various fixes
diff --git a/src/graph.c b/src/graph.c
index 8accd80..948f7d3 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -59,7 +59,7 @@
/* as long as there are non-STALE commits */
while (interesting(&list, roots)) {
git_commit_list_node *commit = git_pqueue_pop(&list);
- int flags;
+ unsigned int flags;
if (commit == NULL)
break;
diff --git a/src/odb_mempack.c b/src/odb_mempack.c
index 594a278..68db3bc 100644
--- a/src/odb_mempack.c
+++ b/src/odb_mempack.c
@@ -24,7 +24,7 @@
git_oid oid;
size_t len;
git_otype type;
- char data[];
+ char data[GIT_FLEX_ARRAY];
};
struct memory_packer_db {
diff --git a/src/pack.c b/src/pack.c
index 2ee0c60..56de64d 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -509,8 +509,10 @@
git_packfile_stream_free(&stream);
if (error < 0)
return error;
- } else
+ } else {
*size_p = size;
+ base_offset = 0;
+ }
while (type == GIT_OBJ_OFS_DELTA || type == GIT_OBJ_REF_DELTA) {
curpos = base_offset;
diff --git a/src/patch_generate.c b/src/patch_generate.c
index a13f2ff..0e5d1db 100644
--- a/src/patch_generate.c
+++ b/src/patch_generate.c
@@ -284,7 +284,7 @@
size_t b_datalen)
{
git_buf deflate = GIT_BUF_INIT, delta = GIT_BUF_INIT;
- size_t delta_data_len;
+ size_t delta_data_len = 0;
int error;
/* The git_delta function accepts unsigned long only */
diff --git a/src/path.c b/src/path.c
index 2b1a962..7675527 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1145,7 +1145,6 @@
unsigned int flags)
{
git_win32_path path_filter;
- git_buf hack = {0};
static int is_win7_or_later = -1;
if (is_win7_or_later < 0)
diff --git a/src/revwalk.c b/src/revwalk.c
index 0ada587..f5502a7 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -290,7 +290,7 @@
while (parents) {
- git_commit_list_node *commit = git_commit_list_pop(&parents);
+ commit = git_commit_list_pop(&parents);
while (commit) {
if (commit->uninteresting)
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index c1e4124..53c0b08 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -412,12 +412,12 @@
if (i % 20 == 0 && t->rpc) {
git_pkt_ack *pkt;
- unsigned int i;
+ unsigned int j;
if ((error = git_pkt_buffer_wants(wants, count, &t->caps, &data)) < 0)
goto on_error;
- git_vector_foreach(&t->common, i, pkt) {
+ git_vector_foreach(&t->common, j, pkt) {
if ((error = git_pkt_buffer_have(&pkt->oid, &data)) < 0)
goto on_error;
}
@@ -432,12 +432,12 @@
/* Tell the other end that we're done negotiating */
if (t->rpc && t->common.length > 0) {
git_pkt_ack *pkt;
- unsigned int i;
+ unsigned int j;
if ((error = git_pkt_buffer_wants(wants, count, &t->caps, &data)) < 0)
goto on_error;
- git_vector_foreach(&t->common, i, pkt) {
+ git_vector_foreach(&t->common, j, pkt) {
if ((error = git_pkt_buffer_have(&pkt->oid, &data)) < 0)
goto on_error;
}
@@ -728,7 +728,7 @@
static int add_push_report_sideband_pkt(git_push *push, git_pkt_data *data_pkt, git_buf *data_pkt_buf)
{
git_pkt *pkt;
- const char *line, *line_end;
+ const char *line, *line_end = NULL;
size_t line_len;
int error;
int reading_from_buf = data_pkt_buf->size > 0;
diff --git a/tests/clar_libgit2.h b/tests/clar_libgit2.h
index 663d136..fc08bbf 100644
--- a/tests/clar_libgit2.h
+++ b/tests/clar_libgit2.h
@@ -79,7 +79,7 @@
} \
} while (0)
-static void cl_git_thread_check(void *data)
+GIT_INLINE(void) cl_git_thread_check(void *data)
{
cl_git_thread_err *threaderr = (cl_git_thread_err *)data;
if (threaderr->error != 0)