mt-st (1.1-4) 15fix_gcc_warnings

Summary

 mt.c     |   16 ++++++++++------
 stinit.c |    2 +-
 2 files changed, 11 insertions(+), 7 deletions(-)

    
download this patch

Patch contents

#! /bin/sh /usr/share/dpatch/dpatch-run
## 15fix_gcc_warnings.dpatch by  <hesso@pool.math.tu-berlin.de>
##
## DP: Get rid of all those gcc warnings.
## DP: (stinit.c hunk) buflen is positive in all cases.

@DPATCH@
--- mt-st-1.1.orig/mt.c	2008-04-27 18:49:00.000000000 +0200
+++ mt-st-1.1/mt.c	2008-05-24 19:25:04.000000000 +0200
@@ -164,7 +164,7 @@
     ET_ONLINE },
     { "stshowopt",	0,         do_show_options, 0,  FD_RDONLY, ONE_ARG,
     0 },
-    { NULL, 0, 0, 0 }
+    { NULL, 0, 0, 0, 0, 0, 0 }
 };
 
 
@@ -269,7 +269,8 @@
 #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 */
 
@@ -277,7 +278,8 @@
 	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;
 
@@ -474,7 +476,8 @@
 	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;
@@ -594,7 +597,8 @@
 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) {
@@ -753,7 +757,7 @@
 	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;
--- mt-st-1.1.orig/stinit.c	2008-04-27 13:24:16.000000000 +0200
+++ mt-st-1.1/stinit.c	2009-03-01 16:43:34.022415177 +0100
@@ -164,7 +164,7 @@
 		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);