This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit f3c104b99a8405d3b20565ca74c00e2e1e93422c
Author: Xiang Xiao <[email protected]>
AuthorDate: Mon Mar 20 01:25:22 2023 +0800

    Fix nxstyle warning
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 examples/modbus/modbus_main.c | 29 +++++++++++++++++++----------
 interpreters/bas/bas_fs.h     | 16 ++++++++++------
 modbus/nuttx/portserial.c     | 23 ++++++++++++++---------
 modbus/nuttx/portserial_m.c   | 18 ++++++++++--------
 system/zmodem/rz_main.c       |  1 +
 system/zmodem/sz_main.c       |  1 +
 6 files changed, 55 insertions(+), 33 deletions(-)

diff --git a/examples/modbus/modbus_main.c b/examples/modbus/modbus_main.c
index 9ac8b76ae..14327766a 100644
--- a/examples/modbus/modbus_main.c
+++ b/examples/modbus/modbus_main.c
@@ -1,5 +1,5 @@
 /****************************************************************************
- * apps/examples/modbus/main.c
+ * apps/examples/modbus/modbus_main.c
  *
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -140,7 +140,10 @@ static void modbus_showusage(FAR const char *progname, int 
exitcode);
  ****************************************************************************/
 
 static struct modbus_state_s g_modbus;
-static const uint8_t g_slaveid[] = { 0xaa, 0xbb, 0xcc };
+static const uint8_t g_slaveid[] =
+{
+  0xaa, 0xbb, 0xcc
+};
 
 /****************************************************************************
  * Private Functions
@@ -191,7 +194,8 @@ static inline int modbus_initialize(void)
    */
 
   mberr = eMBInit(MB_RTU, 0x0a, CONFIG_EXAMPLES_MODBUS_PORT,
-                  CONFIG_EXAMPLES_MODBUS_BAUD, CONFIG_EXAMPLES_MODBUS_PARITY);
+                  CONFIG_EXAMPLES_MODBUS_BAUD,
+                  CONFIG_EXAMPLES_MODBUS_PARITY);
   if (mberr != MB_ENOERR)
     {
       fprintf(stderr, "modbus_main: "
@@ -231,6 +235,7 @@ static inline int modbus_initialize(void)
   return OK;
 
 errout_with_modbus:
+
   /* Release hardware resources. */
 
   eMBClose();
@@ -376,7 +381,8 @@ static inline int modbus_create_pollthread(void)
 
   if (g_modbus.threadstate == STOPPED)
     {
-      ret = pthread_create(&g_modbus.threadid, NULL, modbus_pollthread, NULL);
+      ret = pthread_create(&g_modbus.threadid, NULL,
+                           modbus_pollthread, NULL);
     }
     else
     {
@@ -444,7 +450,8 @@ int main(int argc, FAR char *argv[])
               if (ret != OK)
                 {
                   fprintf(stderr, "modbus_main: "
-                          "ERROR: modbus_create_pollthread failed: %d\n", ret);
+                          "ERROR: modbus_create_pollthread failed: %d\n",
+                          ret);
                   exit(EXIT_FAILURE);
                 }
             }
@@ -536,8 +543,8 @@ eMBErrorCode eMBRegInputCB(uint8_t *buffer, uint16_t 
address, uint16_t nregs)
  *
  ****************************************************************************/
 
-eMBErrorCode eMBRegHoldingCB(uint8_t *buffer, uint16_t address, uint16_t nregs,
-                             eMBRegisterMode mode)
+eMBErrorCode eMBRegHoldingCB(uint8_t *buffer, uint16_t address,
+                             uint16_t nregs, eMBRegisterMode mode)
 {
   eMBErrorCode    mberr = MB_ENOERR;
   int             index;
@@ -551,6 +558,7 @@ eMBErrorCode eMBRegHoldingCB(uint8_t *buffer, uint16_t 
address, uint16_t nregs,
       switch (mode)
         {
           /* Pass current register values to the protocol stack. */
+
           case MB_REG_READ:
             while (nregs > 0)
               {
@@ -592,8 +600,8 @@ eMBErrorCode eMBRegHoldingCB(uint8_t *buffer, uint16_t 
address, uint16_t nregs,
  *
  ****************************************************************************/
 
-eMBErrorCode eMBRegCoilsCB(uint8_t *buffer, uint16_t address, uint16_t ncoils,
-                           eMBRegisterMode mode)
+eMBErrorCode eMBRegCoilsCB(uint8_t *buffer, uint16_t address,
+                           uint16_t ncoils, eMBRegisterMode mode)
 {
   eMBErrorCode    mberr = MB_ENOERR;
   int             index;
@@ -649,7 +657,8 @@ eMBErrorCode eMBRegCoilsCB(uint8_t *buffer, uint16_t 
address, uint16_t ncoils,
  *
  ****************************************************************************/
 
-eMBErrorCode eMBRegDiscreteCB(uint8_t *buffer, uint16_t address, uint16_t 
ndiscrete)
+eMBErrorCode eMBRegDiscreteCB(uint8_t *buffer, uint16_t address,
+                              uint16_t ndiscrete)
 {
   return MB_ENOREG;
 }
diff --git a/interpreters/bas/bas_fs.h b/interpreters/bas/bas_fs.h
index 8b74ad5d9..54ffb22e5 100644
--- a/interpreters/bas/bas_fs.h
+++ b/interpreters/bas/bas_fs.h
@@ -13,8 +13,8 @@
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
@@ -69,20 +69,24 @@
 
 struct FileStream
 {
-  int dev,tty;
+  int dev;
+  int tty;
   int recLength;
 
   int infd;
   char inBuf[1024];
-  size_t inSize,inCapacity;
+  size_t inSize;
+  size_t inCapacity;
 
   int outfd;
   int outPos;
   int outLineWidth;
   int outColWidth;
   char outBuf[1024];
-  size_t outSize,outCapacity;
-  int outforeground,outbackground;
+  size_t outSize;
+  size_t outCapacity;
+  int outforeground;
+  int outbackground;
 
   int randomfd;
   int recPos;
diff --git a/modbus/nuttx/portserial.c b/modbus/nuttx/portserial.c
index d7071cc04..3bf887940 100644
--- a/modbus/nuttx/portserial.c
+++ b/modbus/nuttx/portserial.c
@@ -214,7 +214,8 @@ bool xMBPortSerialInit(uint8_t ucPort, speed_t ulBaudRate,
     }
   else if (tcgetattr(iSerialFd, &xOldTIO) != 0)
     {
-      vMBPortLog(MB_LOG_ERROR, "SER-INIT", "Can't get settings from port %s: 
%d\n",
+      vMBPortLog(MB_LOG_ERROR,
+                 "SER-INIT", "Can't get settings from port %s: %d\n",
                  szDevice, errno);
     }
   else
@@ -261,22 +262,24 @@ bool xMBPortSerialInit(uint8_t ucPort, speed_t ulBaudRate,
            *
            * (1) In NuttX, cfset[i|o]speed always return OK so failures will
            *     really only be reported when tcsetattr() is called.
-           * (2) NuttX does not support separate input and output speeds so it
-           *     is not necessary to call both cfsetispeed() and
+           * (2) NuttX does not support separate input and output speeds so
+           *     it is not necessary to call both cfsetispeed() and
            *     cfsetospeed(), and
            * (3) In NuttX, the input value to cfiset[i|o]speed is not
-           *     encoded, but is the absolute baud value.  The following might
-           *     not be
+           *     encoded, but is the absolute baud value.  The following
+           *     might not be
            */
 
           if (cfsetispeed(&xNewTIO, ulBaudRate) != 0 /* || 
cfsetospeed(&xNewTIO, ulBaudRate) != 0 */)
             {
-              vMBPortLog(MB_LOG_ERROR, "SER-INIT", "Can't set baud rate %ld 
for port %s: %d\n",
+              vMBPortLog(MB_LOG_ERROR, "SER-INIT",
+                         "Can't set baud rate %ld for port %s: %d\n",
                          ulBaudRate, szDevice, errno);
             }
           else if (tcsetattr(iSerialFd, TCSANOW, &xNewTIO) != 0)
             {
-              vMBPortLog(MB_LOG_ERROR, "SER-INIT", "Can't set settings for 
port %s: %d\n",
+              vMBPortLog(MB_LOG_ERROR,
+                         "SER-INIT", "Can't set settings for port %s: %d\n",
                          szDevice, errno);
             }
           else
@@ -344,7 +347,8 @@ bool xMBPortSerialPoll(void)
         }
       else
         {
-          vMBPortLog(MB_LOG_ERROR, "SER-POLL", "read failed on serial device: 
%d\n",
+          vMBPortLog(MB_LOG_ERROR,
+                     "SER-POLL", "read failed on serial device: %d\n",
                      errno);
           bStatus = false;
         }
@@ -361,7 +365,8 @@ bool xMBPortSerialPoll(void)
 
       if (!prvbMBPortSerialWrite(&ucBuffer[0], uiTxBufferPos))
         {
-          vMBPortLog(MB_LOG_ERROR, "SER-POLL", "write failed on serial device: 
%d\n",
+          vMBPortLog(MB_LOG_ERROR,
+                     "SER-POLL", "write failed on serial device: %d\n",
                      errno);
           bStatus = false;
         }
diff --git a/modbus/nuttx/portserial_m.c b/modbus/nuttx/portserial_m.c
index ee82e4492..ea3ad3174 100644
--- a/modbus/nuttx/portserial_m.c
+++ b/modbus/nuttx/portserial_m.c
@@ -87,7 +87,8 @@ static struct termios xOldTIO;
 
 static bool prvbMBMasterPortSerialRead(uint8_t *pucBuffer, uint16_t usNBytes,
                                        uint16_t *usNBytesRead);
-static bool prvbMBMasterPortSerialWrite(uint8_t *pucBuffer, uint16_t usNBytes);
+static bool prvbMBMasterPortSerialWrite(uint8_t *pucBuffer,
+                                        uint16_t usNBytes);
 
 /****************************************************************************
  * Private Functions
@@ -142,7 +143,8 @@ static bool prvbMBMasterPortSerialRead(uint8_t *pucBuffer, 
uint16_t usNBytes,
   return bResult;
 }
 
-static bool prvbMBMasterPortSerialWrite(uint8_t *pucBuffer, uint16_t usNBytes)
+static bool prvbMBMasterPortSerialWrite(uint8_t *pucBuffer,
+                                        uint16_t usNBytes)
 {
   ssize_t res;
   size_t  left = (size_t) usNBytes;
@@ -268,12 +270,12 @@ bool xMBMasterPortSerialInit(uint8_t ucPort, speed_t 
ulBaudRate,
            *
            * (1) In NuttX, cfset[i|o]speed always return OK so failures will
            *     really only be reported when tcsetattr() is called.
-           * (2) NuttX does not support separate input and output speeds so it
-           *     is not necessary to call both cfsetispeed() and
+           * (2) NuttX does not support separate input and output speeds so
+           *     it is not necessary to call both cfsetispeed() and
            *     cfsetospeed(), and
            * (3) In NuttX, the input value to cfiset[i|o]speed is not
-           *     encoded, but is the absolute baud value.  The following might
-           *     not be
+           *     encoded, but is the absolute baud value.  The following
+           *     might not be
            */
 
           if (cfsetispeed(&xNewTIO, ulBaudRate) != 0 /* || 
cfsetospeed(&xNewTIO, ulBaudRate) != 0 */)
@@ -313,7 +315,7 @@ bool xMBMasterPortSerialSetTimeout(uint32_t ulNewTimeoutMs)
   return true;
 }
 
-void vMBMasterPortClose( void )
+void vMBMasterPortClose(void)
 {
   if (iSerialFd != -1)
     {
@@ -323,7 +325,7 @@ void vMBMasterPortClose( void )
     }
 }
 
-bool xMBMasterPortSerialPoll( void )
+bool xMBMasterPortSerialPoll(void)
 {
   bool     bStatus = true;
   uint16_t usBytesRead;
diff --git a/system/zmodem/rz_main.c b/system/zmodem/rz_main.c
index dc7b3344d..16099411f 100644
--- a/system/zmodem/rz_main.c
+++ b/system/zmodem/rz_main.c
@@ -160,6 +160,7 @@ errout_with_zmodem:
   zmr_release(handle);
 
 errout_with_device:
+
   /* Flush the serial output to assure do not hang trying to drain it */
 
   tcflush(fd, TCIOFLUSH);
diff --git a/system/zmodem/sz_main.c b/system/zmodem/sz_main.c
index 82cfac700..ca9d25a1a 100644
--- a/system/zmodem/sz_main.c
+++ b/system/zmodem/sz_main.c
@@ -260,6 +260,7 @@ errout_with_zmodem:
   zms_release(handle);
 
 errout_with_device:
+
   /* Flush the serial output to assure do not hang trying to drain it */
 
   tcflush(fd, TCIOFLUSH);

Reply via email to