Get rid of all those gcc warnings

For the stinit.c change, buflen is positive in all cases, so use a
cast. The other changes are straightforward.
This commit is contained in:
Jan Christoph Nordholz
2008-05-27 15:19:12 +02:00
committed by Iustin Pop
parent 6fd7c41012
commit 4d88fb7a01
2 changed files with 11 additions and 7 deletions

16
mt.c
View File

@@ -164,7 +164,7 @@ static cmdef_tr cmds[] = {
ET_ONLINE },
{ "stshowopt", 0, do_show_options, 0, FD_RDONLY, ONE_ARG,
0 },
{ NULL, 0, 0, 0 }
{ NULL, 0, 0, 0, 0, 0, 0 }
};
@@ -273,7 +273,8 @@ static struct booleans {
#endif
{"sili", MT_ST_SILI, "enable SILI for variable block mode"},
{"cleaning", MT_ST_SET_CLN, "set the cleaning bit location and mask"},
{NULL, 0}};
{NULL, 0, NULL}
};
static char *tape_name; /* The tape name for messages */
@@ -281,7 +282,8 @@ static char *tape_name; /* The tape name for messages */
int
main(int argc, char **argv)
{
int mtfd, cmd_code, i, argn, len, oflags;
int mtfd, cmd_code, i, argn, oflags;
unsigned int len;
char *cmdstr;
cmdef_tr *comp, *comp2;
@@ -487,7 +489,8 @@ do_drvbuffer(int mtfd, cmdef_tr *cmd, int argc, char **argv)
static int
do_options(int mtfd, cmdef_tr *cmd, int argc, char **argv)
{
int i, an, len;
int i, an;
unsigned int len;
struct mtop mt_com;
mt_com.mt_op = MTSETDRVBUFFER;
@@ -607,7 +610,8 @@ do_asf(int mtfd, cmdef_tr *cmd, int argc, char **argv)
do_status(int mtfd, cmdef_tr *cmd, int argc, char **argv)
{
struct mtget status;
int dens, i;
int dens;
unsigned int i;
char *type, *density;
if (ioctl(mtfd, MTIOCGET, (char *)&status) < 0) {
@@ -766,7 +770,7 @@ static int do_show_options(int mtfd, cmdef_tr *cmd, int argc, char **argv)
static int
print_densities(int fd, cmdef_tr *cmd, int argc, char **argv)
{
int i, offset;
unsigned int i, offset;
printf("Some SCSI tape density codes:\ncode explanation code explanation\n");
offset = (NBR_DENSITIES + 1) / 2;

View File

@@ -164,7 +164,7 @@ find_string(char *s, char *target, char *buf, int buflen)
if (buf == NULL)
buf = strdup(argp);
else {
if (strlen(argp) < buflen)
if (strlen(argp) < (unsigned int)buflen)
strcpy(buf, argp);
else {
strncpy(buf, argp, buflen);