[PATCH 3/5] Misc: Fix various warnings

Joel Sherrill joel at rtems.org
Fri May 21 19:16:00 UTC 2021


---
 dnstest/init.c        |  2 +-
 http/init.c           |  2 +-
 mcast/init.c          |  7 ++++++-
 mcast/mcast.c         |  1 +
 mcast/mcast_route.c   |  1 +
 netdemo/init.c        |  3 ++-
 netdemo/test.c        |  2 +-
 nfsClientTest/init.c  |  2 +-
 ntp/init.c            |  2 +-
 rpc_demo/init.c       |  2 +-
 select/init.c         |  2 +-
 select/test.c         |  2 +-
 telnetd/init.c        |  4 ++--
 tftpTest/init.c       |  2 +-
 ttcp/init.c           |  2 +-
 ttcp/rtems_ttcp.c     |  4 ++--
 ttcp/ttcp_orig/ttcp.c | 12 ++++++------
 17 files changed, 30 insertions(+), 22 deletions(-)

diff --git a/dnstest/init.c b/dnstest/init.c
index 42a81d2..2f245ac 100644
--- a/dnstest/init.c
+++ b/dnstest/init.c
@@ -36,7 +36,7 @@ Init (rtems_task_argument ignored)
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 20
 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
 
 #define CONFIGURE_EXECUTIVE_RAM_SIZE	(512*1024)
diff --git a/http/init.c b/http/init.c
index ff2d847..7ddf49c 100644
--- a/http/init.c
+++ b/http/init.c
@@ -173,7 +173,7 @@ rtems_task Init(
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS	20
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS	20
 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
 
 #define CONFIGURE_EXECUTIVE_RAM_SIZE	(512*1024)
diff --git a/mcast/init.c b/mcast/init.c
index fc6f29d..29073a9 100644
--- a/mcast/init.c
+++ b/mcast/init.c
@@ -17,6 +17,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <rtems/bspIo.h>
 #include <rtems/rtems_bsdnet.h>
 #include "../networkconfig.h"
 
@@ -46,6 +47,10 @@ Init (rtems_task_argument ignored)
 
   printf("Loading filesystem image\n");
   status = Untar_FromMemory( (char *)FilesystemImage, FilesystemImage_size );
+  if (status != RTEMS_SUCCESSFUL) {
+    printk("Untar failed!\n");
+    exit(1);
+  }
    
   printk( "Initializing network\n" );
   rtems_bsdnet_initialize_network ();
@@ -64,7 +69,7 @@ Init (rtems_task_argument ignored)
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 20
 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
 
 #define CONFIGURE_EXECUTIVE_RAM_SIZE (512*1024)
diff --git a/mcast/mcast.c b/mcast/mcast.c
index 87c0517..01f162f 100644
--- a/mcast/mcast.c
+++ b/mcast/mcast.c
@@ -15,6 +15,7 @@
 #include <stdlib.h>
 #include <inttypes.h>
 #include <string.h>
+#include <unistd.h>
 
 
 #include "mcast_params.h"
diff --git a/mcast/mcast_route.c b/mcast/mcast_route.c
index 4d1df7a..eae5827 100644
--- a/mcast/mcast_route.c
+++ b/mcast/mcast_route.c
@@ -36,6 +36,7 @@ addresses outside this range.
 #include <arpa/inet.h>
 
 #include <stdio.h>
+#include <string.h>
 #include <sys/errno.h>
 
 
diff --git a/netdemo/init.c b/netdemo/init.c
index c49e1f7..c5d9963 100644
--- a/netdemo/init.c
+++ b/netdemo/init.c
@@ -17,6 +17,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <rtems/bspIo.h>
 #include <rtems/rtems_bsdnet.h>
 #include "../networkconfig.h"
 
@@ -40,7 +41,7 @@ Init (rtems_task_argument ignored)
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 20
 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
 
 #define CONFIGURE_EXECUTIVE_RAM_SIZE (512*1024)
diff --git a/netdemo/test.c b/netdemo/test.c
index 90d9b9c..894411c 100644
--- a/netdemo/test.c
+++ b/netdemo/test.c
@@ -228,7 +228,7 @@ echoServer (unsigned short port)
 		if (s1 < 0)
 			rtems_panic ("Can't accept connection: %s", strerror (errno));
 		else
-			printf ("ACCEPTED:%lX\n", ntohl (farAddr.sin_addr.s_addr));
+			printf ("ACCEPTED:%X\n", ntohl (farAddr.sin_addr.s_addr));
 
 		/*
 		 * Start an echo task
diff --git a/nfsClientTest/init.c b/nfsClientTest/init.c
index 5483400..a75a4e8 100644
--- a/nfsClientTest/init.c
+++ b/nfsClientTest/init.c
@@ -103,7 +103,7 @@ rtems_task Init(
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS	20
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS	20
 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
 
 #define CONFIGURE_MEMORY_OVERHEAD       256
diff --git a/ntp/init.c b/ntp/init.c
index b680c18..a2705ef 100644
--- a/ntp/init.c
+++ b/ntp/init.c
@@ -60,7 +60,7 @@ Init (rtems_task_argument ignored)
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 20
 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
 
 #define CONFIGURE_EXECUTIVE_RAM_SIZE	(512*1024)
diff --git a/rpc_demo/init.c b/rpc_demo/init.c
index c3b167e..faca00a 100644
--- a/rpc_demo/init.c
+++ b/rpc_demo/init.c
@@ -50,7 +50,7 @@ void pmap_set () { ; }
 void pmap_unset () { ; }
 
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 20
 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
 
 #define CONFIGURE_STACK_CHECKER_ENABLED
diff --git a/select/init.c b/select/init.c
index 829c567..e56dc8b 100644
--- a/select/init.c
+++ b/select/init.c
@@ -36,7 +36,7 @@ Init (rtems_task_argument ignored)
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 20
 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
 
 #define CONFIGURE_EXECUTIVE_RAM_SIZE	(512*1024)
diff --git a/select/test.c b/select/test.c
index 1dbe284..63f1986 100644
--- a/select/test.c
+++ b/select/test.c
@@ -63,7 +63,7 @@ getClients (unsigned short port)
 		if (s1 < 0)
 			rtems_panic ("Can't accept connection: %s", strerror (errno));
 		else
-			printf ("ACCEPTED:%lX\n", ntohl (farAddr.sin_addr.s_addr));
+			printf ("ACCEPTED:%X\n", ntohl (farAddr.sin_addr.s_addr));
 		clientfd[clientCount] = s1;
 	}
 
diff --git a/telnetd/init.c b/telnetd/init.c
index a4597b0..5c2d8b0 100644
--- a/telnetd/init.c
+++ b/telnetd/init.c
@@ -8,6 +8,7 @@
 #define USE_RTEMS_SHELL
 
 #include <bsp.h>
+#include <rtems/bspIo.h>
 
 #include <errno.h>
 #include <time.h>
@@ -199,8 +200,7 @@ rtems_task Init(
 
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
 
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS	20
-#define CONFIGURE_MAXIMUM_PTYS                          8
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS	20
 
 #if defined(USE_RTEMS_SHELL)
   #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
diff --git a/tftpTest/init.c b/tftpTest/init.c
index 6aa8e9b..66723ad 100644
--- a/tftpTest/init.c
+++ b/tftpTest/init.c
@@ -52,7 +52,7 @@ Init (rtems_task_argument ignored)
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 20
 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
 #define CONFIGURE_FILESYSTEM_IMFS
 #define CONFIGURE_FILESYSTEM_TFTPFS
diff --git a/ttcp/init.c b/ttcp/init.c
index 385825c..39749c9 100644
--- a/ttcp/init.c
+++ b/ttcp/init.c
@@ -36,7 +36,7 @@ Init (rtems_task_argument ignored)
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
+#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 20
 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
 
 #define CONFIGURE_EXECUTIVE_RAM_SIZE	(512*1024)
diff --git a/ttcp/rtems_ttcp.c b/ttcp/rtems_ttcp.c
index 75b10ff..112e45a 100644
--- a/ttcp/rtems_ttcp.c
+++ b/ttcp/rtems_ttcp.c
@@ -135,7 +135,7 @@ ttcpTask (rtems_task_argument arg)
 		 */
 		cp = linebuf;
 		for (;;) {
-			while (isspace (*cp))
+			while (isspace ((int) *cp))
 				*cp++ = '\0';
 			if (*cp == '\0')
 				break;
@@ -145,7 +145,7 @@ ttcpTask (rtems_task_argument arg)
 				break;
 			}
 			argv[argc++] = cp;
-			while (!isspace (*cp)) {
+			while (!isspace ((int) *cp)) {
 				if (*cp == '\0')
 					break;
 				cp++;
diff --git a/ttcp/ttcp_orig/ttcp.c b/ttcp/ttcp_orig/ttcp.c
index dc62c64..30b228b 100644
--- a/ttcp/ttcp_orig/ttcp.c
+++ b/ttcp/ttcp_orig/ttcp.c
@@ -295,7 +295,7 @@ char **argv;
 	if ( (buf = (char *)malloc(buflen+bufalign)) == (char *)NULL)
 		err("malloc");
 	if (bufalign != 0)
-		buf +=(bufalign - ((int)buf % bufalign) + bufoffset) % bufalign;
+		buf += (bufalign - ((uintptr_t)buf % bufalign) + bufoffset) % bufalign;
 
 	if (trans) {
 	    fprintf(stdout,
@@ -652,13 +652,13 @@ prusage(r0, r1, e, b, outp)
 
 		case 'U':
 			tvsub(&tdiff, &r1->ru_utime, &r0->ru_utime);
-			sprintf(outp,"%ld.%01ld", tdiff.tv_sec, tdiff.tv_usec/100000);
+			sprintf(outp,"%jd.%01ld", tdiff.tv_sec, tdiff.tv_usec/100000);
 			END(outp);
 			break;
 
 		case 'S':
 			tvsub(&tdiff, &r1->ru_stime, &r0->ru_stime);
-			sprintf(outp,"%ld.%01ld", tdiff.tv_sec, tdiff.tv_usec/100000);
+			sprintf(outp,"%jd.%01ld", tdiff.tv_sec, tdiff.tv_usec/100000);
 			END(outp);
 			break;
 
@@ -680,18 +680,18 @@ prusage(r0, r1, e, b, outp)
 			break;
 
 		case 'X':
-			sprintf(outp,"%ld", t == 0 ? 0 : (r1->ru_ixrss-r0->ru_ixrss)/t);
+			sprintf(outp,"%jd", t == 0 ? 0 : (r1->ru_ixrss-r0->ru_ixrss)/t);
 			END(outp);
 			break;
 
 		case 'D':
-			sprintf(outp,"%ld", t == 0 ? 0 :
+			sprintf(outp,"%jd", t == 0 ? 0 :
 			    (r1->ru_idrss+r1->ru_isrss-(r0->ru_idrss+r0->ru_isrss))/t);
 			END(outp);
 			break;
 
 		case 'K':
-			sprintf(outp,"%ld", t == 0 ? 0 :
+			sprintf(outp,"%jd", t == 0 ? 0 :
 			    ((r1->ru_ixrss+r1->ru_isrss+r1->ru_idrss) -
 			    (r0->ru_ixrss+r0->ru_idrss+r0->ru_isrss))/t);
 			END(outp);
-- 
1.8.3.1



More information about the devel mailing list