Fix some more warnings found by clang.

This commit is contained in:
Rebecca Cran 2010-11-22 20:10:48 +00:00
parent 7dd052c1d9
commit 1161d4202c
11 changed files with 16 additions and 12 deletions

View File

@ -55,6 +55,7 @@ int yylex(void);
#define YY_INPUT(buf,result,max) \
result = (*buf = *arith_buf++) ? 1 : YY_NULL;
#define YY_NO_UNPUT
#define YY_NO_INPUT
%}
%%

View File

@ -515,7 +515,7 @@ readlabel(int flag)
f = open(specname, O_RDONLY);
if (f < 0)
err(1, specname);
err(1, "%s", specname);
if (is_file)
get_file_parms(f);
else {

View File

@ -374,7 +374,7 @@ eli_genkey_files(struct gctl_req *req, bool new, const char *type,
if (!gctl_has_param(req, argname))
return (i);
file = gctl_get_ascii(req, argname);
file = gctl_get_ascii(req, "%s", argname);
assert(file != NULL);
if (strcmp(file, "-") == 0)

View File

@ -614,7 +614,7 @@ static int
gpart_show_hasopt(struct gctl_req *req, const char *opt, const char *elt)
{
if (!gctl_get_int(req, opt))
if (!gctl_get_int(req, "%s", opt))
return (0);
if (elt != NULL)

View File

@ -276,7 +276,7 @@ virstor_label(struct gctl_req *req)
msize = secsize = 0;
for (i = 1; i < (unsigned)nargs; i++) {
snprintf(param, sizeof(param), "arg%u", i);
name = gctl_get_ascii(req, param);
name = gctl_get_ascii(req, "%s", param);
ssize = g_get_sectorsize(name);
if (ssize == 0)
fprintf(stderr, "%s for %s\n", strerror(errno), name);
@ -336,7 +336,7 @@ virstor_label(struct gctl_req *req)
for (i = 1; i < (unsigned)nargs; i++) {
snprintf(param, sizeof(param), "arg%u", i);
name = gctl_get_ascii(req, param);
name = gctl_get_ascii(req, "%s", param);
if (verbose)
printf(" %s", name);
@ -417,7 +417,7 @@ virstor_label(struct gctl_req *req)
/* Ok, store metadata. */
for (i = 1; i < (unsigned)nargs; i++) {
snprintf(param, sizeof(param), "arg%u", i);
name = gctl_get_ascii(req, param);
name = gctl_get_ascii(req, "%s", param);
msize = g_get_mediasize(name);
ssize = g_get_sectorsize(name);
@ -434,7 +434,7 @@ virstor_label(struct gctl_req *req)
if (verbose)
printf("(%u chunks) ", md.chunk_count);
/* Check to make sure last sector is unused */
if ((off_t)(md.chunk_count * md.md_chunk_size) > msize-ssize)
if ((off_t)(md.chunk_count * md.md_chunk_size) > (off_t)(msize-ssize))
md.chunk_count--;
md.chunk_next = 0;
if (i != 1) {
@ -499,7 +499,7 @@ virstor_clear(struct gctl_req *req)
}
for (i = 0; i < (unsigned)nargs; i++) {
snprintf(param, sizeof(param), "arg%u", i);
name = gctl_get_ascii(req, param);
name = gctl_get_ascii(req, "%s", param);
error = g_metadata_clear(name, G_VIRSTOR_MAGIC);
if (error != 0) {
@ -564,7 +564,7 @@ virstor_dump(struct gctl_req *req)
}
for (i = 0; i < nargs; i++) {
snprintf(param, sizeof(param), "arg%u", i);
name = gctl_get_ascii(req, param);
name = gctl_get_ascii(req, "%s", param);
error = g_metadata_read(name, (u_char *) & tmpmd, sizeof(tmpmd),
G_VIRSTOR_MAGIC);

View File

@ -281,7 +281,7 @@ dbg_dump_fs(struct fs *sb, const char *comment)
*/
fprintf(dbg_log, "maxbsize int32_t 0x%08x\n",
sb->fs_maxbsize);
fprintf(dbg_log, "unrefs int64_t 0x%08x\n",
fprintf(dbg_log, "unrefs int64_t 0x%08jx\n",
sb->fs_unrefs);
fprintf(dbg_log, "sblockloc int64_t 0x%08x%08x\n",
((unsigned int *)&(sb->fs_sblockloc))[1],

View File

@ -1427,5 +1427,5 @@ printconfig(FILE *of, char *comment)
if (*comment != '\0')
fprintf(of, "# Current configuration:\n");
fprintf(of, buf);
fprintf(of, "%s", buf);
}

View File

@ -24,6 +24,7 @@ CFLAGS+=-DINET6
.endif
# This is needed to have WARNS > 1.
CFLAGS+=-DYY_NO_UNPUT
CFLAGS+=-DYY_NO_INPUT
DPADD= ${LIBL}
LDADD= -ll

View File

@ -139,7 +139,7 @@ main(int argc, char **argv)
errx(1, "%s: non-numeric minor number", argv[4]);
range_error |= errno;
dev = makedev(mymajor, myminor);
if (range_error || major(dev) != (u_int) mymajor ||
if (range_error || major(dev) != mymajor ||
(long)(u_int)minor(dev) != myminor)
errx(1, "major or minor number too large");
} else {

View File

@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include "y.tab.h"
#define YY_NO_UNPUT
#define YY_NO_INPUT
int lineno = 1;
int yylex(void);

View File

@ -46,6 +46,7 @@ static void init_strbuf(void);
static void add_str(const char *);
static int bc_yyinput(char *, int);
#define YY_NO_INPUT
#undef YY_INPUT
#define YY_INPUT(buf,retval,max) \
(retval = bc_yyinput(buf, max))