Fix warnings trivial warnings.

Fix warnings about:
 . Unused variables
 . format mismatch in printf/scanf format string and arguments
 . Missing parenthesis around assignment as truth values
 . Clang warnings anout unknown GCC pragma
This commit is contained in:
2012-12-11 18:42:21 +01:00
parent 77399bd649
commit 0ac803292e
65 changed files with 297 additions and 284 deletions

View File

@@ -37,7 +37,7 @@ extern char *optarg;
int main(int argc, char **argv);
void descend(char *dirname);
void display_attrib(char *name, struct stat *st);
void display_attrib(const char *name, struct stat *st);
void usage(char *binname);
void open_outfile(void);
@@ -45,7 +45,7 @@ int main(argc, argv)
int argc;
char *argv[];
{
char *dir;
char *dir = __UNCONST("");
struct stat st;
int op;
@@ -54,7 +54,7 @@ char *argv[];
prot = DEF_PROT;
blocks = DEF_BLOCKS;
inodes = DEF_INODES;
indentstr = DEF_INDENTSTR;
indentstr = __UNCONST(DEF_INDENTSTR);
inode_given = 0;
block_given = 0;
top = 0;
@@ -170,7 +170,7 @@ char *dirname;
fprintf(outfile, "\n");
descend(temp);
for (i = 0; i < tabs; i++) {
fprintf(outfile, indentstr);
fprintf(outfile, "%s", indentstr);
}
fprintf(outfile, "$\n");
continue;
@@ -209,7 +209,7 @@ char *dirname;
void display_attrib(name, st)
char *name;
const char *name;
struct stat *st;
{
/* Output the specification for a single file */
@@ -220,7 +220,7 @@ struct stat *st;
if (same_gid) gid = st->st_gid;
if (same_prot)
prot = st->st_mode & 0777; /***** This one is a bit shady *****/
for (i = 0; i < tabs; i++) fprintf(outfile, indentstr);
for (i = 0; i < tabs; i++) fprintf(outfile, "%s", indentstr);
fprintf(outfile, "%s%s%c%c%c%3o %d %d",
name,
*name == '\0' ? "" : indentstr, /* stop the tab for a null name */

View File

@@ -141,7 +141,7 @@ lchown(const char *path, uid_t owner, gid_t group)
}
#endif
int
static int
utimes(const char *path, const struct timeval times[2])
{
return -1;
@@ -151,7 +151,11 @@ utimes(const char *path, const struct timeval times[2])
int
compare(NODE *s, FTSENT *p)
{
#if defined(__minix)
u_int32_t len, val;
#else
u_int32_t len, val, flags;
#endif /* defined(__minix) */
int fd, label;
const char *cp, *tab;
#if !defined(NO_MD5) || !defined(NO_RMD160) || !defined(NO_SHA1) || !defined(NO_SHA2)

View File

@@ -317,7 +317,9 @@ statd(FTS *t, FTSENT *parent, uid_t *puid, gid_t *pgid, mode_t *pmode,
gid_t sgid;
uid_t suid;
mode_t smode;
#if !defined(__minix)
u_long sflags = 0;
#endif /* !defined(__minix) */
const char *name = NULL;
gid_t savegid;
uid_t saveuid;

View File

@@ -168,7 +168,9 @@ miss(NODE *p, char *tail)
int create;
char *tp;
const char *type;
#if !defined(__minix)
u_int32_t flags;
#endif /* !defined(__minix) */
for (; p; p = p->next) {
if (p->flags & F_OPT && !(p->flags & F_VISIT))