Skip to content

Commit

Permalink
Fix MSVC warnings and add /Wx to appveyor.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Feb 26, 2017
1 parent 8eb46db commit 93b6b06
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ build_script:
- if "%BUILD_TYPE%" == "cmake" if "%platform%" == "x64" SET VS_FULL=%VS_VERSION% Win64
- if "%BUILD_TYPE%" == "cmake" if "%platform%" == "x86" SET VS_FULL=%VS_VERSION%
- if "%BUILD_TYPE%" == "cmake" echo "%VS_FULL%"
- if "%BUILD_TYPE%" == "cmake" cmake -G "%VS_FULL%" . -DSELFTEST=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=../bin -DBUILD_LIBPROJ_SHARED=ON
- if "%BUILD_TYPE%" == "cmake" cmake -G "%VS_FULL%" . -DSELFTEST=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=../bin -DBUILD_LIBPROJ_SHARED=ON -D_CRT_SECURE_NO_WARNINGS -DCMAKE_C_FLAGS="/W3 /WX"
- if "%BUILD_TYPE%" == "cmake" cmake --build . --config Release

test_script:
Expand Down
6 changes: 3 additions & 3 deletions src/PJ_horner.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,16 @@ static void horner_free (HORNER *h) {

static HORNER *horner_alloc (size_t order, int complex_polynomia) {
/* size_t is unsigned, so we need not check for order > 0 */
int n = horner_number_of_coefficients(order);
int n = (int)horner_number_of_coefficients(order);
int polynomia_ok = 0;
HORNER *h = horner_calloc (1, sizeof (HORNER));

if (0==h)
return 0;

if (complex_polynomia)
n = 2*order + 2;
h->order = order;
n = 2*(int)order + 2;
h->order = (int)order;
h->coefs = n;

if (complex_polynomia) {
Expand Down
4 changes: 2 additions & 2 deletions src/PJ_pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ static PJ *pj_create_pipeline (PJ *P, size_t steps) {
if (0==P->opaque->pipeline)
return 0;

P->opaque->steps = steps;
P->opaque->steps = (int)steps;

P->opaque->reverse_step = pj_calloc (steps + 2, sizeof(int));
if (0==P->opaque->reverse_step)
Expand Down Expand Up @@ -369,7 +369,7 @@ PJ *PROJECTION(pipeline) {
if (0==P->opaque)
return 0;

argc = argc_params (P->params);
argc = (int)argc_params (P->params);
P->opaque->argv = argv = argv_params (P->params, argc);
if (0==argv)
return pipeline_freeup (P, ENOMEM);
Expand Down
6 changes: 3 additions & 3 deletions src/nad_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ struct CTABLE *nad_ctable_init( projCtx ctx, PAFile fid )
}

/* trim white space and newlines off id */
for( id_end = strlen(ct->id)-1; id_end > 0; id_end-- )
for( id_end = (int)strlen(ct->id)-1; id_end > 0; id_end-- )
{
if( ct->id[id_end] == '\n' || ct->id[id_end] == ' ' )
ct->id[id_end] = '\0';
Expand Down Expand Up @@ -181,7 +181,7 @@ int nad_ctable2_load( projCtx ctx, struct CTABLE *ct, PAFile fid )

if( !IS_LSB )
{
swap_words( ct->cvs, 4, a_size * 2 );
swap_words( ct->cvs, 4, (int)a_size * 2 );
}

return 1;
Expand Down Expand Up @@ -243,7 +243,7 @@ struct CTABLE *nad_ctable2_init( projCtx ctx, PAFile fid )
}

/* trim white space and newlines off id */
for( id_end = strlen(ct->id)-1; id_end > 0; id_end-- )
for( id_end = (int)strlen(ct->id)-1; id_end > 0; id_end-- )
{
if( ct->id[id_end] == '\n' || ct->id[id_end] == ' ' )
ct->id[id_end] = '\0';
Expand Down
6 changes: 3 additions & 3 deletions src/pj_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static const char *fill_buffer(pj_read_state *state, const char *last_char)
/* Move the existing data to the start of the buffer. */
/* -------------------------------------------------------------------- */
memmove(state->buffer, last_char, char_remaining);
state->buffer_filled = char_remaining;
state->buffer_filled = (int)char_remaining;
last_char = state->buffer;

/* -------------------------------------------------------------------- */
Expand Down Expand Up @@ -116,7 +116,7 @@ static const char *fill_buffer(pj_read_state *state, const char *last_char)
*w++ = *r++;
}
*w = 0;
state->buffer_filled += (bytes_read - (r-w));
state->buffer_filled += (int)(bytes_read - (r-w));

return last_char;
}
Expand All @@ -139,7 +139,7 @@ get_opt(projCtx ctx, paralist **start, PAFile fid, char *name, paralist *next,
if(found_def)
*found_def = 0;

len = strlen(name);
len = (int)strlen(name);
*sword = 't';

if (0==next_char)
Expand Down
4 changes: 2 additions & 2 deletions src/pj_open_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pj_open_lib(projCtx ctx, const char *name, const char *mode) {
if (*name == '~' && strchr(dir_chars,name[1]) )
if ((sysname = getenv("HOME")) != NULL) {
(void)strcpy(fname, sysname);
fname[n = strlen(fname)] = DIR_CHAR;
fname[n = (int)strlen(fname)] = DIR_CHAR;
fname[++n] = '\0';
(void)strcpy(fname+n, name + 1);
sysname = fname;
Expand All @@ -134,7 +134,7 @@ pj_open_lib(projCtx ctx, const char *name, const char *mode) {
/* or is environment PROJ_LIB defined */
else if ((sysname = getenv("PROJ_LIB")) || (sysname = proj_lib_name)) {
(void)strcpy(fname, sysname);
fname[n = strlen(fname)] = DIR_CHAR;
fname[n = (int)strlen(fname)] = DIR_CHAR;
fname[++n] = '\0';
(void)strcpy(fname+n, name);
sysname = fname;
Expand Down
2 changes: 1 addition & 1 deletion src/pj_param.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pj_param(projCtx ctx, paralist *pl, const char *opt) {

type = *opt++;
/* simple linear lookup */
l = strlen(opt);
l = (int)strlen(opt);
while (pl && !(!strncmp(pl->param, opt, l) &&
(!pl->param[l] || pl->param[l] == '=')))
pl = pl->next;
Expand Down
4 changes: 2 additions & 2 deletions src/pj_pr_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pr_list(PJ *P, int not_used) {
(void)putchar('#');
for (t = P->params; t; t = t->next)
if ((!not_used && t->used) || (not_used && !t->used)) {
l = strlen(t->param) + 1;
l = (int)strlen(t->param) + 1;
if (n + l > LINE_LEN) {
(void)fputs("\n#", stdout);
n = 2;
Expand Down Expand Up @@ -71,7 +71,7 @@ char *pj_get_def( PJ *P, int options )
continue;

/* grow the resulting string if needed */
l = strlen(t->param) + 1;
l = (int)strlen(t->param) + 1;
if( strlen(definition) + l + 5 > def_max )
{
char *def2;
Expand Down

0 comments on commit 93b6b06

Please sign in to comment.