You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/20 20:28:53 UTC

[GitHub] [incubator-nuttx-apps] a-lunev opened a new pull request #972: netutils/netcat: fixed ISO C89/C90 related warnings

a-lunev opened a new pull request #972:
URL: https://github.com/apache/incubator-nuttx-apps/pull/972


   ## Summary
   
   Fixed the following types of warnings:
   warning: ISO C90 forbids variable length array ‘buf’ [-Wvla]
   warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   
   ## Impact
   
   netutils/netcat
   
   ## Testing


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] xiaoxiang781216 merged pull request #972: netutils/netcat: fixed ISO C89/C90 related warnings

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #972:
URL: https://github.com/apache/incubator-nuttx-apps/pull/972


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a change in pull request #972: netutils/netcat: fixed ISO C89/C90 related warnings

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on a change in pull request #972:
URL: https://github.com/apache/incubator-nuttx-apps/pull/972#discussion_r789402446



##########
File path: netutils/netcat/netcat_main.c
##########
@@ -44,18 +44,23 @@
 # define NETCAT_PORT 31337
 #endif
 
+#ifndef NETCAT_IOBUF_SIZE
+# define NETCAT_IOBUF_SIZE 256
+#endif
+
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
 int do_io(int infd, int outfd)
 {
-  size_t capacity = 256;
-  char buf[capacity];
+  ssize_t avail;
+  ssize_t written;
+  char buf[NETCAT_IOBUF_SIZE];
 
   while (true)
     {
-      ssize_t avail = read(infd, buf, capacity);

Review comment:
       Actually this is not a C89 issue. Standard allows this.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] a-lunev commented on a change in pull request #972: netutils/netcat: fixed ISO C89/C90 related warnings

Posted by GitBox <gi...@apache.org>.
a-lunev commented on a change in pull request #972:
URL: https://github.com/apache/incubator-nuttx-apps/pull/972#discussion_r789589963



##########
File path: netutils/netcat/netcat_main.c
##########
@@ -44,18 +44,23 @@
 # define NETCAT_PORT 31337
 #endif
 
+#ifndef NETCAT_IOBUF_SIZE
+# define NETCAT_IOBUF_SIZE 256
+#endif
+
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
 
 int do_io(int infd, int outfd)
 {
-  size_t capacity = 256;
-  char buf[capacity];
+  ssize_t avail;
+  ssize_t written;
+  char buf[NETCAT_IOBUF_SIZE];
 
   while (true)
     {
-      ssize_t avail = read(infd, buf, capacity);

Review comment:
       Yes, "ssize_t avail" was moved not because of C89. I moved it together with moving "ssize_t written" that was C89 related issue. So I moved "ssize_t avail" for uniformity reasons.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org