Skip to content

Commit 398412c

Browse files
authored
Merge pull request libgit2#5143 from libgit2/ethomson/warnings
ci: build with ENABLE_WERROR on Windows
2 parents 5c87b5a + a3afda9 commit 398412c

File tree

14 files changed

+28
-28
lines changed

14 files changed

+28
-28
lines changed

ci/build.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Write-Host "####################################################################
1818
Write-Host "## Configuring build environment"
1919
Write-Host "##############################################################################"
2020

21-
Invoke-Expression "cmake ${SourceDirectory} -DBUILD_EXAMPLES=ON ${Env:CMAKE_OPTIONS}"
21+
Invoke-Expression "cmake ${SourceDirectory} -DBUILD_EXAMPLES=ON -DENABLE_WERROR=ON ${Env:CMAKE_OPTIONS}"
2222
if ($LastExitCode -ne 0) { [Environment]::Exit($LastExitCode) }
2323

2424
Write-Host ""

examples/blame.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static void parse_opts(struct opts *o, int argc, char *argv[]);
3333
int lg2_blame(git_repository *repo, int argc, char *argv[])
3434
{
3535
int line, break_on_null_hunk;
36-
size_t i, rawsize;
36+
git_off_t i, rawsize;
3737
char spec[1024] = {0};
3838
struct opts o = {0};
3939
const char *rawdata;
@@ -91,7 +91,7 @@ int lg2_blame(git_repository *repo, int argc, char *argv[])
9191
i = 0;
9292
break_on_null_hunk = 0;
9393
while (i < rawsize) {
94-
const char *eol = memchr(rawdata + i, '\n', rawsize - i);
94+
const char *eol = memchr(rawdata + i, '\n', (size_t)(rawsize - i));
9595
char oid[10] = {0};
9696
const git_blame_hunk *hunk = git_blame_get_hunk_byline(blame, line);
9797

examples/clone.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ static void print_progress(const progress_data *pd)
1717
0;
1818

1919
int checkout_percent = pd->total_steps > 0
20-
? (100 * pd->completed_steps) / pd->total_steps
20+
? (int)((100 * pd->completed_steps) / pd->total_steps)
2121
: 0;
22-
int kbytes = pd->fetch_progress.received_bytes / 1024;
22+
size_t kbytes = pd->fetch_progress.received_bytes / 1024;
2323

2424
if (pd->fetch_progress.total_objects &&
2525
pd->fetch_progress.received_objects == pd->fetch_progress.total_objects) {
2626
printf("Resolving deltas %d/%d\r",
2727
pd->fetch_progress.indexed_deltas,
2828
pd->fetch_progress.total_deltas);
2929
} else {
30-
printf("net %3d%% (%4d kb, %5d/%5d) / idx %3d%% (%5d/%5d) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ ") %s\n",
30+
printf("net %3d%% (%4"PRIuZ" kb, %5d/%5d) / idx %3d%% (%5d/%5d) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ ") %s\n",
3131
network_percent, kbytes,
3232
pd->fetch_progress.received_objects, pd->fetch_progress.total_objects,
3333
index_percent, pd->fetch_progress.indexed_objects, pd->fetch_progress.total_objects,

examples/describe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static void opts_add_commit(describe_options *opts, const char *commit)
5454
assert(opts != NULL);
5555

5656
sz = ++opts->commit_count * sizeof(opts->commits[0]);
57-
opts->commits = xrealloc(opts->commits, sz);
57+
opts->commits = xrealloc((void *) opts->commits, sz);
5858
opts->commits[opts->commit_count - 1] = commit;
5959
}
6060

examples/general.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ static void revwalking(git_repository *repo)
624624
static void index_walking(git_repository *repo)
625625
{
626626
git_index *index;
627-
unsigned int i, ecount;
627+
size_t i, ecount;
628628

629629
printf("\n*Index Walking*\n");
630630

examples/index-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# define read _read
1212
# define close _close
1313

14-
#define ssize_t unsigned int
14+
#define ssize_t int
1515
#else
1616
# include <unistd.h>
1717
#endif

examples/merge.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static void opts_add_refish(merge_options *opts, const char *refish)
5757
assert(opts != NULL);
5858

5959
sz = ++opts->heads_count * sizeof(opts->heads[0]);
60-
opts->heads = xrealloc(opts->heads, sz);
60+
opts->heads = xrealloc((void *) opts->heads, sz);
6161
opts->heads[opts->heads_count - 1] = refish;
6262
}
6363

@@ -355,7 +355,7 @@ int lg2_merge(git_repository *repo, int argc, char **argv)
355355
}
356356

357357
cleanup:
358-
free(opts.heads);
358+
free((char **)opts.heads);
359359
free(opts.annotated);
360360

361361
return 0;

examples/show-index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
int lg2_show_index(git_repository *repo, int argc, char** argv)
1818
{
1919
git_index *index;
20-
unsigned int i, ecount;
20+
size_t i, ecount;
2121
char *dir = ".";
2222
size_t dirlen;
2323
char out[GIT_OID_HEXSZ+1];

src/win32/w32_stack.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ int git_win32__stack_compare(
7676
}
7777

7878
int git_win32__stack_format(
79-
char *pbuf, int buf_len,
79+
char *pbuf, size_t buf_len,
8080
const git_win32__stack__raw_data *pdata,
8181
const char *prefix, const char *suffix)
8282
{
@@ -91,10 +91,10 @@ int git_win32__stack_format(
9191
} s;
9292

9393
IMAGEHLP_LINE64 line;
94-
int buf_used = 0;
94+
size_t buf_used = 0;
9595
unsigned int k;
9696
char detail[MY_MAX_FILENAME * 2]; /* filename plus space for function name and formatting */
97-
int detail_len;
97+
size_t detail_len;
9898

9999
if (!g_win32_stack_initialized) {
100100
git_error_set(GIT_ERROR_INVALID, "git_win32_stack not initialized.");
@@ -171,7 +171,7 @@ int git_win32__stack_format(
171171
}
172172

173173
int git_win32__stack(
174-
char * pbuf, int buf_len,
174+
char * pbuf, size_t buf_len,
175175
int skip,
176176
const char *prefix, const char *suffix)
177177
{

src/win32/w32_stack.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ typedef void (*git_win32__stack__aux_cb_alloc)(unsigned int *aux_id);
3838
* @param aux_msg A buffer where a formatted message should be written.
3939
* @param aux_msg_len The size of the buffer.
4040
*/
41-
typedef void (*git_win32__stack__aux_cb_lookup)(unsigned int aux_id, char *aux_msg, unsigned int aux_msg_len);
41+
typedef void (*git_win32__stack__aux_cb_lookup)(unsigned int aux_id, char *aux_msg, size_t aux_msg_len);
4242

4343
/**
4444
* Register an "aux" data provider to augment our C stacktrace data.
@@ -116,7 +116,7 @@ int git_win32__stack_compare(
116116
* @param suffix String written after each frame; defaults to "\n".
117117
*/
118118
int git_win32__stack_format(
119-
char *pbuf, int buf_len,
119+
char *pbuf, size_t buf_len,
120120
const git_win32__stack__raw_data *pdata,
121121
const char *prefix, const char *suffix);
122122

@@ -132,7 +132,7 @@ int git_win32__stack_format(
132132
* @param suffix String written after each frame; defaults to "\n".
133133
*/
134134
int git_win32__stack(
135-
char * pbuf, int buf_len,
135+
char * pbuf, size_t buf_len,
136136
int skip,
137137
const char *prefix, const char *suffix);
138138

0 commit comments

Comments
 (0)