Skip to content
Permalink
Browse files

Merge pull request #1788 from gitster/bb/pedantic

Merge bb/pedantic to fix MSVC compile warnings
  • Loading branch information...
jamill committed Aug 9, 2018
2 parents ede0edb + 2b647a0 commit 070e699af98973499e05acfb739fb76ff7dfda64
Showing with 26 additions and 12 deletions.
  1. +2 −0 connect.h
  2. +1 −1 convert.c
  3. +1 −1 path.h
  4. +2 −0 refs/refs-internal.h
  5. +2 −2 sequencer.c
  6. +14 −4 string-list.c
  7. +4 −4 utf8.c
@@ -1,6 +1,8 @@
#ifndef CONNECT_H
#define CONNECT_H

#include "protocol.h"

#define CONNECT_VERBOSE (1u << 0)
#define CONNECT_DIAG_URL (1u << 1)
#define CONNECT_IPV4 (1u << 2)
@@ -334,7 +334,7 @@ static void trace_encoding(const char *context, const char *path,
strbuf_addf(&trace, "%s (%s, considered %s):\n", context, path, encoding);
for (i = 0; i < len && buf; ++i) {
strbuf_addf(
&trace,"| \e[2m%2i:\e[0m %2x \e[2m%c\e[0m%c",
&trace, "| \033[2m%2i:\033[0m %2x \033[2m%c\033[0m%c",
i,
(unsigned char) buf[i],
(buf[i] > 32 && buf[i] < 127 ? buf[i] : ' '),
2 path.h
@@ -147,7 +147,7 @@ extern void report_linked_checkout_garbage(void);
/*
* You can define a static memoized git path like:
*
* static GIT_PATH_FUNC(git_path_foo, "FOO");
* static GIT_PATH_FUNC(git_path_foo, "FOO")
*
* or use one of the global ones below.
*/
@@ -1,6 +1,8 @@
#ifndef REFS_REFS_INTERNAL_H
#define REFS_REFS_INTERNAL_H

#include "iterator.h"

/*
* Data structures and functions for the internal use of the refs
* module. Code outside of the refs module should use only the public
@@ -61,12 +61,12 @@ static GIT_PATH_FUNC(rebase_path_done, "rebase-merge/done")
* The file to keep track of how many commands were already processed (e.g.
* for the prompt).
*/
static GIT_PATH_FUNC(rebase_path_msgnum, "rebase-merge/msgnum");
static GIT_PATH_FUNC(rebase_path_msgnum, "rebase-merge/msgnum")
/*
* The file to keep track of how many commands are to be processed in total
* (e.g. for the prompt).
*/
static GIT_PATH_FUNC(rebase_path_msgtotal, "rebase-merge/end");
static GIT_PATH_FUNC(rebase_path_msgtotal, "rebase-merge/end")
/*
* The commit message that is planned to be used for any changes that
* need to be committed following a user interaction.
@@ -224,18 +224,28 @@ struct string_list_item *string_list_append(struct string_list *list,
list->strdup_strings ? xstrdup(string) : (char *)string);
}

/*
* Encapsulate the compare function pointer because ISO C99 forbids
* casting from void * to a function pointer and vice versa.
*/
struct string_list_sort_ctx
{
compare_strings_fn cmp;
};

static int cmp_items(const void *a, const void *b, void *ctx)
{
compare_strings_fn cmp = ctx;
struct string_list_sort_ctx *sort_ctx = ctx;
const struct string_list_item *one = a;
const struct string_list_item *two = b;
return cmp(one->string, two->string);
return sort_ctx->cmp(one->string, two->string);
}

void string_list_sort(struct string_list *list)
{
QSORT_S(list->items, list->nr, cmp_items,
list->cmp ? list->cmp : strcmp);
struct string_list_sort_ctx sort_ctx = {list->cmp ? list->cmp : strcmp};

QSORT_S(list->items, list->nr, cmp_items, &sort_ctx);
}

struct string_list_item *unsorted_string_list_lookup(struct string_list *list,
8 utf8.c
@@ -566,10 +566,10 @@ static int has_bom_prefix(const char *data, size_t len,
return data && bom && (len >= bom_len) && !memcmp(data, bom, bom_len);
}

static const char utf16_be_bom[] = {0xFE, 0xFF};
static const char utf16_le_bom[] = {0xFF, 0xFE};
static const char utf32_be_bom[] = {0x00, 0x00, 0xFE, 0xFF};
static const char utf32_le_bom[] = {0xFF, 0xFE, 0x00, 0x00};
static const char utf16_be_bom[] = {'\xFE', '\xFF'};
static const char utf16_le_bom[] = {'\xFF', '\xFE'};
static const char utf32_be_bom[] = {'\0', '\0', '\xFE', '\xFF'};
static const char utf32_le_bom[] = {'\xFF', '\xFE', '\0', '\0'};

int has_prohibited_utf_bom(const char *enc, const char *data, size_t len)
{

0 comments on commit 070e699

Please sign in to comment.
You can’t perform that action at this time.