Merge pull request #2307 from edwardhartnett/ejh_warn

fixed all code warnings
This commit is contained in:
Ward Fisher 2022-04-26 11:05:11 -06:00 committed by GitHub
commit 885e2cc4ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 3 deletions

View File

@ -211,10 +211,11 @@ NC_mktmp(const char* base)
int fd = -1; int fd = -1;
char* tmp = NULL; char* tmp = NULL;
size_t len; size_t len;
int tries;
#define MAXTRIES 4 #define MAXTRIES 4
#ifdef HAVE_MKSTEMP #ifdef HAVE_MKSTEMP
mode_t mask; mode_t mask;
#else
int tries;
#endif #endif
len = strlen(base)+6+1; len = strlen(base)+6+1;

View File

@ -49,7 +49,9 @@ extern int ffio_open(const char*,int,off_t,size_t,size_t*,void*,ncio**,void** co
extern int memio_open(const char*,int,off_t,size_t,size_t*,void*,ncio**,void** const); extern int memio_open(const char*,int,off_t,size_t,size_t*,void*,ncio**,void** const);
/* Forward */ /* Forward */
#ifdef ENABLE_BYTERANGE
static int urlmodetest(const char* path); static int urlmodetest(const char* path);
#endif
int int
ncio_create(const char *path, int ioflags, size_t initialsz, ncio_create(const char *path, int ioflags, size_t initialsz,
@ -179,6 +181,7 @@ NC_HTTP => byterange
NC_S3SDK => s3 NC_S3SDK => s3
0 => Not URL 0 => Not URL
*/ */
#ifdef ENABLE_BYTERANGE
static int static int
urlmodetest(const char* path) urlmodetest(const char* path)
{ {
@ -195,3 +198,4 @@ urlmodetest(const char* path)
ncurifree(uri); ncurifree(uri);
return kind; return kind;
} }
#endif

View File

@ -132,7 +132,6 @@ fail(int ret)
void void
exists(const char* file) exists(const char* file)
{ {
int stat = 0;
FILE* f = NCfopen(file, "r"); FILE* f = NCfopen(file, "r");
if(f == NULL) fail(NC_EPERM); if(f == NULL) fail(NC_EPERM);
fclose(f); fclose(f);

View File

@ -550,7 +550,7 @@ main(int argc, char **argv)
/* union FU fout; */ /* union FU fout; */
union FU xpect[DIM_LEN_5]; union FU xpect[DIM_LEN_5];
union DU dfin; union DU dfin;
union DU dfout; /* union DU dfout; */
union DU double_xpect[DIM_LEN_5]; union DU double_xpect[DIM_LEN_5];
xpect[0].u = 0x3f8e3000; xpect[0].u = 0x3f8e3000;
xpect[1].u = 0x3f800fff; xpect[1].u = 0x3f800fff;

View File

@ -108,7 +108,9 @@ static Test PATHTESTS[] = {
char* macros[128]; char* macros[128];
/*Forward */ /*Forward */
#ifdef DEBUG
static const char* kind2string(int kind); static const char* kind2string(int kind);
#endif
static char* expand(const char* s); static char* expand(const char* s);
static void setmacros(void); static void setmacros(void);
static void reclaimmacros(void); static void reclaimmacros(void);
@ -130,7 +132,9 @@ main(int argc, char** argv)
/* Test localkind X path-kind */ /* Test localkind X path-kind */
for(test=PATHTESTS;test->test;test++) { for(test=PATHTESTS;test->test;test++) {
#ifdef DEBUG
int inputkind = NCgetinputpathkind(test->test); int inputkind = NCgetinputpathkind(test->test);
#endif
/* Iterate over the test paths */ /* Iterate over the test paths */
for(k=0;k<NKINDS;k++) { for(k=0;k<NKINDS;k++) {
int kind = kinds[k]; int kind = kinds[k];
@ -188,6 +192,7 @@ main(int argc, char** argv)
return (failcount > 0 ? 1 : 0); return (failcount > 0 ? 1 : 0);
} }
#ifdef DEBUG
static const char* static const char*
kind2string(int kind) kind2string(int kind)
{ {
@ -206,6 +211,7 @@ kind2string(int kind)
} }
return "Unknown"; return "Unknown";
} }
#endif
static char* static char*
expand(const char* s) expand(const char* s)