Unverified Commit 574671ba by Edward Thomson Committed by GitHub

Merge pull request #4534 from pks-t/pks/build-warnings

Fix build warnings
parents b8cb7536 92324d84
...@@ -218,7 +218,7 @@ ELSE () ...@@ -218,7 +218,7 @@ ELSE ()
ENABLE_WARNINGS(documentation) ENABLE_WARNINGS(documentation)
DISABLE_WARNINGS(missing-field-initializers) DISABLE_WARNINGS(missing-field-initializers)
ENABLE_WARNINGS(strict-aliasing=2) ENABLE_WARNINGS(strict-aliasing)
ENABLE_WARNINGS(strict-prototypes) ENABLE_WARNINGS(strict-prototypes)
ENABLE_WARNINGS(declaration-after-statement) ENABLE_WARNINGS(declaration-after-statement)
DISABLE_WARNINGS(unused-const-variable) DISABLE_WARNINGS(unused-const-variable)
......
...@@ -2494,7 +2494,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size) ...@@ -2494,7 +2494,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
/* Parse all the entries */ /* Parse all the entries */
for (i = 0; i < header.entry_count && buffer_size > INDEX_FOOTER_SIZE; ++i) { 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); size_t entry_size = read_entry(&entry, index, buffer, buffer_size, last);
/* 0 bytes read means an object corruption */ /* 0 bytes read means an object corruption */
......
...@@ -575,6 +575,7 @@ static int parse_hunk_body( ...@@ -575,6 +575,7 @@ static int parse_hunk_body(
switch (c) { switch (c) {
case '\n': case '\n':
prefix = 0; prefix = 0;
/* fall through */
case ' ': case ' ':
origin = GIT_DIFF_LINE_CONTEXT; origin = GIT_DIFF_LINE_CONTEXT;
......
...@@ -770,7 +770,6 @@ int revparse__ext( ...@@ -770,7 +770,6 @@ int revparse__ext(
} }
case '@': case '@':
{
if (spec[pos+1] == '{') { if (spec[pos+1] == '{') {
git_object *temp_object = NULL; git_object *temp_object = NULL;
...@@ -786,10 +785,8 @@ int revparse__ext( ...@@ -786,10 +785,8 @@ int revparse__ext(
if (temp_object != NULL) if (temp_object != NULL)
base_rev = temp_object; base_rev = temp_object;
break; break;
} else {
/* Fall through */
} }
} /* fall through */
default: default:
if ((error = ensure_left_hand_identifier_is_not_known_yet(base_rev, reference)) < 0) if ((error = ensure_left_hand_identifier_is_not_known_yet(base_rev, reference)) < 0)
......
...@@ -344,7 +344,7 @@ static int verify_server_cert(SSL *ssl, const char *host) ...@@ -344,7 +344,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
GENERAL_NAMES *alts; GENERAL_NAMES *alts;
struct in6_addr addr6; struct in6_addr addr6;
struct in_addr addr4; struct in_addr addr4;
void *addr; void *addr = NULL;
int i = -1, j, error = 0; int i = -1, j, error = 0;
if (SSL_get_verify_result(ssl) != X509_V_OK) { if (SSL_get_verify_result(ssl) != X509_V_OK) {
...@@ -357,7 +357,7 @@ static int verify_server_cert(SSL *ssl, const char *host) ...@@ -357,7 +357,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
type = GEN_IPADD; type = GEN_IPADD;
addr = &addr4; addr = &addr4;
} else { } else {
if(p_inet_pton(AF_INET6, host, &addr6)) { if (p_inet_pton(AF_INET6, host, &addr6)) {
type = GEN_IPADD; type = GEN_IPADD;
addr = &addr6; addr = &addr6;
} }
...@@ -397,7 +397,7 @@ static int verify_server_cert(SSL *ssl, const char *host) ...@@ -397,7 +397,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
matched = 1; matched = 1;
} else if (type == GEN_IPADD) { } else if (type == GEN_IPADD) {
/* Here name isn't so much a name but a binary representation of the IP */ /* 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);
} }
} }
} }
......
...@@ -957,7 +957,7 @@ int git_tree_entry_bypath( ...@@ -957,7 +957,7 @@ int git_tree_entry_bypath(
* walking down the path */ * walking down the path */
if (path[filename_len + 1] != '\0') if (path[filename_len + 1] != '\0')
break; break;
/* fall through */
case '\0': case '\0':
/* If there are no more components in the path, return /* If there are no more components in the path, return
* this entry */ * this entry */
......
...@@ -7,10 +7,7 @@ ...@@ -7,10 +7,7 @@
#include "util.h" #include "util.h"
#include "git2.h" #include "common.h"
#include <stdio.h>
#include <ctype.h>
#include "posix.h"
#ifdef GIT_WIN32 #ifdef GIT_WIN32
# include "win32/w32_buffer.h" # include "win32/w32_buffer.h"
...@@ -478,9 +475,11 @@ uint32_t git__hash(const void *key, int len, uint32_t seed) ...@@ -478,9 +475,11 @@ uint32_t git__hash(const void *key, int len, uint32_t seed)
switch(len & 3) { switch(len & 3) {
case 3: k1 ^= tail[2] << 16; case 3: k1 ^= tail[2] << 16;
/* fall through */
case 2: k1 ^= tail[1] << 8; case 2: k1 ^= tail[1] << 8;
/* fall through */
case 1: k1 ^= tail[0]; case 1: k1 ^= tail[0];
MURMUR_BLOCK(); MURMUR_BLOCK();
} }
h1 ^= len; h1 ^= len;
......
...@@ -9,12 +9,16 @@ ...@@ -9,12 +9,16 @@
#include "common.h" #include "common.h"
#ifndef GIT_WIN32
# include <ctype.h>
#endif
#include "git2/buffer.h" #include "git2/buffer.h"
#include "buffer.h"
#include "thread-utils.h"
#include "buffer.h"
#include "common.h" #include "common.h"
#include "strnlen.h" #include "strnlen.h"
#include "thread-utils.h"
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#define bitsizeof(x) (CHAR_BIT * sizeof(x)) #define bitsizeof(x) (CHAR_BIT * sizeof(x))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment