summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-02-18 10:16:15 +0000
committerGitHub <noreply@github.com>2018-02-18 10:16:15 +0000
commit574671ba8e0ca487dead726a4addd9841fa4e6fa (patch)
treef7129297c67e1c7df12b32a149a50750b7b21f55
parentb8cb75361d48f16f41dfa99b5b988a914e53040b (diff)
parent92324d84921721035458ba8d128dea48436525ec (diff)
downloadlibgit2-574671ba8e0ca487dead726a4addd9841fa4e6fa.tar.gz
Merge pull request #4534 from pks-t/pks/build-warnings
Fix build warnings
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/index.c2
-rw-r--r--src/patch_parse.c1
-rw-r--r--src/revparse.c5
-rw-r--r--src/streams/openssl.c6
-rw-r--r--src/tree.c2
-rw-r--r--src/util.c9
-rw-r--r--src/util.h8
8 files changed, 18 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53f10ba94..2e98bbc76 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -218,7 +218,7 @@ ELSE ()
ENABLE_WARNINGS(documentation)
DISABLE_WARNINGS(missing-field-initializers)
- ENABLE_WARNINGS(strict-aliasing=2)
+ ENABLE_WARNINGS(strict-aliasing)
ENABLE_WARNINGS(strict-prototypes)
ENABLE_WARNINGS(declaration-after-statement)
DISABLE_WARNINGS(unused-const-variable)
diff --git a/src/index.c b/src/index.c
index b7602fb44..d782a0803 100644
--- a/src/index.c
+++ b/src/index.c
@@ -2494,7 +2494,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
/* Parse all the entries */
for (i = 0; i < header.entry_count && buffer_size > INDEX_FOOTER_SIZE; ++i) {
- git_index_entry *entry;
+ git_index_entry *entry = NULL;
size_t entry_size = read_entry(&entry, index, buffer, buffer_size, last);
/* 0 bytes read means an object corruption */
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 27c01e96f..acdd45e82 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -575,6 +575,7 @@ static int parse_hunk_body(
switch (c) {
case '\n':
prefix = 0;
+ /* fall through */
case ' ':
origin = GIT_DIFF_LINE_CONTEXT;
diff --git a/src/revparse.c b/src/revparse.c
index 4ab4fb96d..7cb22f476 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -770,7 +770,6 @@ int revparse__ext(
}
case '@':
- {
if (spec[pos+1] == '{') {
git_object *temp_object = NULL;
@@ -786,10 +785,8 @@ int revparse__ext(
if (temp_object != NULL)
base_rev = temp_object;
break;
- } else {
- /* Fall through */
}
- }
+ /* fall through */
default:
if ((error = ensure_left_hand_identifier_is_not_known_yet(base_rev, reference)) < 0)
diff --git a/src/streams/openssl.c b/src/streams/openssl.c
index d00e98e02..9cbb2746f 100644
--- a/src/streams/openssl.c
+++ b/src/streams/openssl.c
@@ -344,7 +344,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
GENERAL_NAMES *alts;
struct in6_addr addr6;
struct in_addr addr4;
- void *addr;
+ void *addr = NULL;
int i = -1, j, error = 0;
if (SSL_get_verify_result(ssl) != X509_V_OK) {
@@ -357,7 +357,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
type = GEN_IPADD;
addr = &addr4;
} else {
- if(p_inet_pton(AF_INET6, host, &addr6)) {
+ if (p_inet_pton(AF_INET6, host, &addr6)) {
type = GEN_IPADD;
addr = &addr6;
}
@@ -397,7 +397,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
matched = 1;
} else if (type == GEN_IPADD) {
/* Here name isn't so much a name but a binary representation of the IP */
- matched = !!memcmp(name, addr, namelen);
+ matched = addr && !!memcmp(name, addr, namelen);
}
}
}
diff --git a/src/tree.c b/src/tree.c
index 6a136a6b7..fdf36f850 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -957,7 +957,7 @@ int git_tree_entry_bypath(
* walking down the path */
if (path[filename_len + 1] != '\0')
break;
-
+ /* fall through */
case '\0':
/* If there are no more components in the path, return
* this entry */
diff --git a/src/util.c b/src/util.c
index 1760a315e..34841df4f 100644
--- a/src/util.c
+++ b/src/util.c
@@ -7,10 +7,7 @@
#include "util.h"
-#include "git2.h"
-#include <stdio.h>
-#include <ctype.h>
-#include "posix.h"
+#include "common.h"
#ifdef GIT_WIN32
# include "win32/w32_buffer.h"
@@ -478,9 +475,11 @@ uint32_t git__hash(const void *key, int len, uint32_t seed)
switch(len & 3) {
case 3: k1 ^= tail[2] << 16;
+ /* fall through */
case 2: k1 ^= tail[1] << 8;
+ /* fall through */
case 1: k1 ^= tail[0];
- MURMUR_BLOCK();
+ MURMUR_BLOCK();
}
h1 ^= len;
diff --git a/src/util.h b/src/util.h
index 63ffa134e..f6d19cfde 100644
--- a/src/util.h
+++ b/src/util.h
@@ -9,12 +9,16 @@
#include "common.h"
+#ifndef GIT_WIN32
+# include <ctype.h>
+#endif
+
#include "git2/buffer.h"
-#include "buffer.h"
-#include "thread-utils.h"
+#include "buffer.h"
#include "common.h"
#include "strnlen.h"
+#include "thread-utils.h"
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#define bitsizeof(x) (CHAR_BIT * sizeof(x))