nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gn...@apache.org
Subject [incubator-nuttx-apps] branch master updated: Fix nxstyle issue
Date Sat, 02 May 2020 15:45:55 GMT
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/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new e72608e  Fix nxstyle issue
e72608e is described below

commit e72608e0d8bb8e21172dec6536c9413c582bf753
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
AuthorDate: Sat May 2 21:30:54 2020 +0800

    Fix nxstyle issue
    
    Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
---
 builtin/exec_builtin.c                      |  6 +-
 fsutils/mkfatfs/mkfatfs.c                   | 32 ++++++-----
 fsutils/mksmartfs/mksmartfs.c               |  7 ++-
 netutils/ftpc/ftpc_connect.c                | 23 +++++---
 netutils/ftpc/ftpc_login.c                  | 27 +++++----
 netutils/tftpc/tftpc_get.c                  | 24 ++++----
 netutils/tftpc/tftpc_put.c                  | 85 +++++++++++++++--------------
 nshlib/nsh_fileapps.c                       | 30 +++++-----
 platform/mikroe-stm32f4/mikroe_configdata.c | 20 ++++---
 9 files changed, 137 insertions(+), 117 deletions(-)

diff --git a/builtin/exec_builtin.c b/builtin/exec_builtin.c
index 03a9e9f..40c28a3 100644
--- a/builtin/exec_builtin.c
+++ b/builtin/exec_builtin.c
@@ -138,9 +138,9 @@ int exec_builtin(FAR const char *appname, FAR char * const *argv,
       goto errout_with_actions;
     }
 
-   /* If robin robin scheduling is enabled, then set the scheduling policy
-    * of the new task to SCHED_RR before it has a chance to run.
-    */
+  /* If robin robin scheduling is enabled, then set the scheduling policy
+   * of the new task to SCHED_RR before it has a chance to run.
+   */
 
 #if CONFIG_RR_INTERVAL > 0
   ret = posix_spawnattr_setschedpolicy(&attr, SCHED_RR);
diff --git a/fsutils/mkfatfs/mkfatfs.c b/fsutils/mkfatfs/mkfatfs.c
index 028234c..b3f8972 100644
--- a/fsutils/mkfatfs/mkfatfs.c
+++ b/fsutils/mkfatfs/mkfatfs.c
@@ -104,13 +104,13 @@ static uint32_t fat_systime2fattime(void)
               uint16_t fattime;
               uint16_t fatdate;
 
-              fattime  = (tm.tm_sec       >>  1) & 0x001f; /* Bits 0-4: 2 second
count (0-29) */
-              fattime |= (tm.tm_min       <<  5) & 0x07e0; /* Bits 5-10: minutes
(0-59) */
-              fattime |= (tm.tm_hour      << 11) & 0xf800; /* Bits 11-15: hours
(0-23) */
+              fattime  = (tm.tm_sec         >>  1) & 0x001f; /* Bits 0-4: 2 second
count (0-29) */
+              fattime |= (tm.tm_min         <<  5) & 0x07e0; /* Bits 5-10: minutes
(0-59) */
+              fattime |= (tm.tm_hour        << 11) & 0xf800; /* Bits 11-15: hours
(0-23) */
 
-              fatdate  =  tm.tm_mday             & 0x001f; /* Bits 0-4: Day of month
(1-31) */
-              fatdate |= ((tm.tm_mon+1)   <<  5) & 0x01e0; /* Bits 5-8: Month of
year (1-12) */
-              fatdate |= ((tm.tm_year-80) <<  9) & 0xfe00; /* Bits 9-15: Year from
1980 */
+              fatdate  =  tm.tm_mday               & 0x001f; /* Bits 0-4: Day of month
(1-31) */
+              fatdate |= ((tm.tm_mon + 1)   <<  5) & 0x01e0; /* Bits 5-8: Month
of year (1-12) */
+              fatdate |= ((tm.tm_year - 80) <<  9) & 0xfe00; /* Bits 9-15: Year
from 1980 */
 
               return (uint32_t)fatdate << 16 | (uint32_t)fattime;
             }
@@ -160,8 +160,8 @@ static inline int mkfatfs_getgeometry(FAR struct fat_format_s *fmt,
       return -ENODEV;
     }
 
-  /* Check if the user provided maxblocks was provided and, if so, that is it less than
-   * the actual number of blocks on the device.
+  /* Check if the user provided maxblocks was provided and, if so, that is it
+   * less than the actual number of blocks on the device.
    */
 
   if (fmt->ff_nsectors != 0)
@@ -227,7 +227,7 @@ static inline int mkfatfs_getgeometry(FAR struct fat_format_s *fmt,
  *   fmt - Describes characteristics of the desired filesystem
  *
  * Return:
- *   Zero (OK) on success; -1 (ERROR) on failure with errno set appropriately:
+ *   Zero (OK) on success; -1 (ERROR) on failure with errno set:
  *
  *   EINVAL  - NULL block driver string, bad number of FATS in 'fmt', bad FAT
  *     size in 'fmt', bad cluster size in 'fmt'
@@ -301,8 +301,8 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt)
       goto errout;
     }
 
-   if (fmt->ff_rootdirentries != 0 &&
-       (fmt->ff_rootdirentries < 16 || fmt->ff_rootdirentries > 32767))
+  if (fmt->ff_rootdirentries != 0 &&
+      (fmt->ff_rootdirentries < 16 || fmt->ff_rootdirentries > 32767))
     {
       ferr("ERROR: Invalid number of root dir entries: %d\n",
            fmt->ff_rootdirentries);
@@ -311,8 +311,8 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt)
       goto errout;
     }
 
-   if (fmt->ff_rsvdseccount != 0 && (fmt->ff_rsvdseccount < 1 ||
-       fmt->ff_rsvdseccount > 32767))
+  if (fmt->ff_rsvdseccount != 0 && (fmt->ff_rsvdseccount < 1 ||
+      fmt->ff_rsvdseccount > 32767))
     {
       ferr("ERROR: Invalid number of reserved sectors: %d\n",
            fmt->ff_rsvdseccount);
@@ -332,8 +332,8 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt)
       goto errout;
     }
 
-  /* Determine the volume configuration based upon the input values and upon the
-   * reported device geometry.
+  /* Determine the volume configuration based upon the input values and upon
+   * the reported device geometry.
    */
 
   ret = mkfatfs_getgeometry(fmt, &var);
@@ -364,11 +364,13 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt)
   ret = mkfatfs_writefatfs(fmt, &var);
 
 errout_with_driver:
+
   /* Close the driver */
 
   close(var.fv_fd);
 
 errout:
+
   /* Release all allocated memory */
 
   if (var.fv_sect)
diff --git a/fsutils/mksmartfs/mksmartfs.c b/fsutils/mksmartfs/mksmartfs.c
index 5124d6a..5a0692a 100644
--- a/fsutils/mksmartfs/mksmartfs.c
+++ b/fsutils/mksmartfs/mksmartfs.c
@@ -83,7 +83,7 @@
  *   pathname - the full path to a registered block driver
  *
  * Return:
- *   Zero (OK) on success; -1 (ERROR) on failure with errno set appropriately:
+ *   Zero (OK) on success; -1 (ERROR) on failure with errno set:
  *
  *   EINVAL - NULL block driver string
  *   ENOENT - 'pathname' does not refer to anything in the filesystem.
@@ -143,7 +143,7 @@ out:
  *   nrootdirs  - Number of root directory entries to create.
  *
  * Return:
- *   Zero (OK) on success; -1 (ERROR) on failure with errno set appropriately:
+ *   Zero (OK) on success; -1 (ERROR) on failure with errno set:
  *
  *   EINVAL  - NULL block driver string, bad number of FATS in 'fmt', bad FAT
  *     size in 'fmt', bad cluster size in 'fmt'
@@ -198,7 +198,8 @@ int mksmartfs(FAR const char *pathname, uint16_t sectorsize)
   ret = ioctl(fd, BIOC_GETFORMAT, (unsigned long) &fmt);
 
   /* Now Write the filesystem to media.  Loop for each root dir entry and
-   * allocate the reserved Root Dir Entry, then write a blank root dir for it.
+   * allocate the reserved Root Dir Entry, then write a blank root dir for
+   * it.
    */
 
   type = SMARTFS_SECTOR_TYPE_DIR;
diff --git a/netutils/ftpc/ftpc_connect.c b/netutils/ftpc/ftpc_connect.c
index 07d0d15..88fb101 100644
--- a/netutils/ftpc/ftpc_connect.c
+++ b/netutils/ftpc/ftpc_connect.c
@@ -99,6 +99,7 @@ SESSION ftpc_connect(FAR union ftpc_sockaddr_u *server)
         }
     }
 #endif
+
 #ifdef CONFIG_NET_IPv4
   if (session->server.sa.sa_family == AF_INET)
     {
@@ -116,7 +117,6 @@ SESSION ftpc_connect(FAR union ftpc_sockaddr_u *server)
    */
 
   session->homeldir = strdup(ftpc_lpwd());
-/* session->curldir = strdup(session->homeldir); */
 
   /* Create up a timer to prevent hangs */
 
@@ -167,7 +167,8 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
 
   /* Set up a timer to prevent hangs */
 
-  ret = wd_start(session->wdog, session->conntimeo, ftpc_timeout, 1, session);
+  ret = wd_start(session->wdog,
+                 session->conntimeo, ftpc_timeout, 1, session);
   if (ret != OK)
     {
       nerr("ERROR: wd_start() failed\n");
@@ -189,17 +190,18 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
 #ifdef CONFIG_NET_IPv6
   if (session->server.sa.sa_family == AF_INET6)
     {
-      if (inet_ntop(AF_INET6, &session->server.in6.sin6_addr, buffer, 48) != NULL)
+      if (inet_ntop(AF_INET6, &session->server.in6.sin6_addr, buffer, 48))
         {
           ninfo("Connecting to server address %s:%d\n", buffer,
                 ntohs(session->server.in6.sin6_port));
         }
     }
 #endif /* CONFIG_NET_IPv6 */
+
 #ifdef CONFIG_NET_IPv4
   if (session->server.sa.sa_family == AF_INET)
     {
-      if (inet_ntop(AF_INET, &session->server.in4.sin_addr, buffer, 48) != NULL)
+      if (inet_ntop(AF_INET, &session->server.in4.sin_addr, buffer, 48))
         {
           ninfo("Connecting to server address %s:%d\n", buffer,
                 ntohs(session->server.in4.sin_port));
@@ -208,7 +210,8 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
 #endif /* CONFIG_NET_IPv4 */
 #endif /* CONFIG_DEBUG_NET_ERROR */
 
-  ret = ftpc_sockconnect(&session->cmd, (FAR struct sockaddr *)&session->server);
+  ret = ftpc_sockconnect(&session->cmd,
+                         (FAR struct sockaddr *)&session->server);
   if (ret != OK)
     {
       nerr("ERROR: ftpc_sockconnect() failed: %d\n", errno);
@@ -225,6 +228,7 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
     {
       fptc_getreply(session);
     }
+
   wd_cancel(session->wdog);
 
   if (!ftpc_sockconnected(&session->cmd))
@@ -250,29 +254,30 @@ int ftpc_reconnect(FAR struct ftpc_session_s *session)
 #ifdef CONFIG_NET_IPv6
   if (session->server.sa.sa_family == AF_INET6)
     {
-      if (inet_ntop(AF_INET6, &session->server.in6.sin6_addr, buffer, 48) != NULL)
+      if (inet_ntop(AF_INET6, &session->server.in6.sin6_addr, buffer, 48))
         {
           ninfo("  Remote address: %s:%d\n", buffer,
                 ntohs(session->server.in6.sin6_port));
         }
 
-     if (inet_ntop(AF_INET6, &session->cmd.laddr.in6.sin6_addr, buffer, 48) != NULL)
+      if (inet_ntop(AF_INET6, &session->cmd.laddr.in6.sin6_addr, buffer, 48))
         {
           ninfo("  Local address:  %s:%d\n", buffer,
                 ntohs(session->cmd.laddr.in6.sin6_port));
         }
     }
 #endif /* CONFIG_NET_IPv6 */
+
 #ifdef CONFIG_NET_IPv4
   if (session->server.sa.sa_family == AF_INET)
     {
-      if (inet_ntop(AF_INET, &session->server.in4.sin_addr, buffer, 48) != NULL)
+      if (inet_ntop(AF_INET, &session->server.in4.sin_addr, buffer, 48))
         {
           ninfo("  Remote address: %s:%d\n", buffer,
                 ntohs(session->server.in4.sin_port));
         }
 
-     if (inet_ntop(AF_INET, &session->cmd.laddr.in4.sin_addr, buffer, 48) != NULL)
+      if (inet_ntop(AF_INET, &session->cmd.laddr.in4.sin_addr, buffer, 48))
         {
           ninfo("  Local address:  %s:%d\n", buffer,
                 ntohs(session->cmd.laddr.in4.sin_port));
diff --git a/netutils/ftpc/ftpc_login.c b/netutils/ftpc/ftpc_login.c
index 3714c9a..9ccb707 100644
--- a/netutils/ftpc/ftpc_login.c
+++ b/netutils/ftpc/ftpc_login.c
@@ -147,10 +147,10 @@ int ftpc_relogin(FAR struct ftpc_session_s *session)
 {
   int ret;
 
-  /* Log into the server.  First send the USER command.  The server may accept
-   * USER with:
+  /* Log into the server.  First send the USER command.  The server may
+   * accept USER with:
    *
-   * - "230 User logged in, proceed" meaning that the client has permission to
+   * - "230 User logged in, proceed" meaning that the client has permission
    *    access files under that username
    * - "331 "User name okay, need password" or "332 Need account for login"
    *    meaning that permission might be granted after a PASS request.
@@ -170,19 +170,22 @@ int ftpc_relogin(FAR struct ftpc_session_s *session)
 
   if (session->code == 331)
     {
-      /* Send the PASS command with the passed. The server may accept PASS with:
+      /* Send the PASS command with the passed. The server may accept PASS
+       * with:
        *
-       * - "230 User logged in, proceed" meaning that the client has permission to
-       *    access files under that username
-       * - "202 Command not implemented, superfluous at this site" meaning that
-       *    permission was already granted in response to USER
-       * - "332 Need account for login" meaning that permission might be granted
-       *    after an ACCT request.
+       * - "230 User logged in, proceed" meaning that the client has
+       *    permission to access files under that username
+       * - "202 Command not implemented, superfluous at this site" meaning
+       *    that permission was already granted in response to USER
+       * - "332 Need account for login" meaning that permission might be
+       *    granted after an ACCT request.
        *
        * The server may reject PASS with:
        *
-       * - "503 Bad sequence of commands" if the previous request was not USER
-       * - "530 - Not logged in" if this username and password are unacceptable.
+       * - "503 Bad sequence of commands" if the previous request was not
+       *    USER.
+       * - "530 - Not logged in" if this username and password are
+       *    unacceptable.
        */
 
       ret = ftpc_cmd(session, "PASS %s", session->pwd);
diff --git a/netutils/tftpc/tftpc_get.c b/netutils/tftpc/tftpc_get.c
index e959717..639bb06 100644
--- a/netutils/tftpc/tftpc_get.c
+++ b/netutils/tftpc/tftpc_get.c
@@ -81,8 +81,8 @@ static inline int tftp_parsedatapacket(FAR const uint8_t *packet,
   *opcode = (uint16_t)packet[0] << 8 | (uint16_t)packet[1];
   if (*opcode == TFTP_DATA)
     {
-       *blockno = (uint16_t)packet[2] << 8 | (uint16_t)packet[3];
-       return OK;
+      *blockno = (uint16_t)packet[2] << 8 | (uint16_t)packet[3];
+      return OK;
     }
 #ifdef CONFIG_DEBUG_NET_WARN
   else if (*opcode == TFTP_ERR)
@@ -130,7 +130,7 @@ int tftpget_cb(FAR const char *remote, in_addr_t addr, bool binary,
 
   /* Allocate the buffer to used for socket/disk I/O */
 
-  packet = (FAR uint8_t*)zalloc(TFTP_IOBUFSIZE);
+  packet = (FAR uint8_t *)zalloc(TFTP_IOBUFSIZE);
   if (!packet)
     {
       nerr("ERROR: packet memory allocation failure\n");
@@ -179,10 +179,10 @@ int tftpget_cb(FAR const char *remote, in_addr_t addr, bool binary,
                   goto errout_with_sd;
                 }
 
-              /* Subsequent sendto will use the port number selected by the TFTP
-               * server in the DATA packet.  Setting the server port to zero
-               * here indicates that we have not yet received the server port
-               * number.
+              /* Subsequent sendto will use the port number selected by the
+               * TFTP server in the DATA packet.  Setting the server port to
+               * zero here indicates that we have not yet received the server
+               * port number.
                */
 
               server.sin_port = 0;
@@ -239,10 +239,11 @@ int tftpget_cb(FAR const char *remote, in_addr_t addr, bool binary,
                                              TFTP_ERRST_ILLEGALOP);
                       ret = tftp_sendto(sd, packet, len, &from);
                     }
+
                   continue;
                 }
 
-              /* Replace the server port to the one in the good data response */
+              /* Replace the server port to the one in the good response */
 
               if (!server.sin_port)
                 {
@@ -266,7 +267,8 @@ int tftpget_cb(FAR const char *remote, in_addr_t addr, bool binary,
       /* Write the received data chunk to the file */
 
       ndatabytes = nbytesrecvd - TFTP_DATAHEADERSIZE;
-      tftp_dumpbuffer("Recvd DATA", packet + TFTP_DATAHEADERSIZE, ndatabytes);
+      tftp_dumpbuffer("Recvd DATA",
+                      packet + TFTP_DATAHEADERSIZE, ndatabytes);
       if (tftp_cb(ctx, 0, packet + TFTP_DATAHEADERSIZE, ndatabytes) < 0)
         {
           goto errout_with_sd;
@@ -280,6 +282,7 @@ int tftpget_cb(FAR const char *remote, in_addr_t addr, bool binary,
         {
           goto errout_with_sd;
         }
+
       ninfo("ACK blockno %d\n", blockno);
     }
   while (ndatabytes >= TFTP_DATASIZE);
@@ -334,6 +337,7 @@ static ssize_t tftp_write(FAR void *ctx, uint32_t offset, FAR uint8_t
*buf,
       left -= nbyteswritten;
       buf  += nbyteswritten;
     }
+
   return len;
 }
 
@@ -358,7 +362,7 @@ int tftpget(FAR const char *remote, FAR const char *local, in_addr_t addr,
 
   /* Open the file for writing */
 
-  fd = open(local, O_WRONLY|O_CREAT|O_TRUNC, 0666);
+  fd = open(local, O_WRONLY | O_CREAT | O_TRUNC, 0666);
   if (fd < 0)
     {
       nerr("ERROR: open failed: %d\n", errno);
diff --git a/netutils/tftpc/tftpc_put.c b/netutils/tftpc/tftpc_put.c
index 2af9bc5..d2ddcf3 100644
--- a/netutils/tftpc/tftpc_put.c
+++ b/netutils/tftpc/tftpc_put.c
@@ -89,8 +89,8 @@
  *   blockno - The block number of the packet
  *
  * Return Value:
- *   Number of bytes read into the packet. <TFTP_PACKETSIZE means end of file;
- *   <1 if an error occurs.
+ *   Number of bytes read into the packet. <TFTP_PACKETSIZE means end of
+ *   file; <1 if an error occurs.
  *
  ****************************************************************************/
 
@@ -112,6 +112,7 @@ int tftp_mkdatapacket(off_t offset, FAR uint8_t *packet, uint16_t blockno,
     {
       return ERROR;
     }
+
   return nbytesread + TFTP_DATAHEADERSIZE;
 }
 
@@ -153,7 +154,7 @@ static int tftp_rcvack(int sd, FAR uint8_t *packet,
     {
       /* Try for until a valid ACK is received or some error occurs */
 
-      for (;;)
+      for (; ; )
         {
           /* Receive the next UDP packet from the server */
 
@@ -181,25 +182,25 @@ static int tftp_rcvack(int sd, FAR uint8_t *packet,
             }
           else
             {
-               /* Get the port being used by the server if that has not yet
-                * been established.
-                */
-
-               if (!*port)
-                 {
-                   *port            = from.sin_port;
-                   server->sin_port = from.sin_port;
-                 }
-
-               /* Verify that the packet was received from the correct host and
-                * port.
-                */
-
-               if (server->sin_addr.s_addr != from.sin_addr.s_addr)
-                 {
-                   ninfo("Invalid address in DATA\n");
-                   continue;
-                 }
+              /* Get the port being used by the server if that has not yet
+               * been established.
+               */
+
+              if (!*port)
+                {
+                  *port            = from.sin_port;
+                  server->sin_port = from.sin_port;
+                }
+
+              /* Verify that the packet was received from the correct host
+               * and port.
+               */
+
+              if (server->sin_addr.s_addr != from.sin_addr.s_addr)
+                {
+                  ninfo("Invalid address in DATA\n");
+                  continue;
+                }
 
               if (*port != server->sin_port)
                 {
@@ -212,16 +213,16 @@ static int tftp_rcvack(int sd, FAR uint8_t *packet,
 
               /* Parse the error message */
 
-               opcode   = (uint16_t)packet[0] << 8 | (uint16_t)packet[1];
-               rblockno = (uint16_t)packet[2] << 8 | (uint16_t)packet[3];
+              opcode   = (uint16_t)packet[0] << 8 | (uint16_t)packet[1];
+              rblockno = (uint16_t)packet[2] << 8 | (uint16_t)packet[3];
 
               /* Verify that the message that we received is an ACK for the
                * expected block number.
                */
 
-               if (opcode != TFTP_ACK)
-                 {
-                   nwarn("WARNING: Bad opcode\n");
+              if (opcode != TFTP_ACK)
+                {
+                  nwarn("WARNING: Bad opcode\n");
 
 #ifdef CONFIG_DEBUG_NET_WARN
                   if (opcode == TFTP_ERR)
@@ -232,7 +233,8 @@ static int tftp_rcvack(int sd, FAR uint8_t *packet,
 #endif
                   if (opcode > TFTP_MAXRFC1350)
                     {
-                      packetlen = tftp_mkerrpacket(packet, TFTP_ERR_ILLEGALOP,
+                      packetlen = tftp_mkerrpacket(packet,
+                                                   TFTP_ERR_ILLEGALOP,
                                                    TFTP_ERRST_ILLEGALOP);
                       tftp_sendto(sd, packet, packetlen, server);
                     }
@@ -291,7 +293,7 @@ int tftpput_cb(FAR const char *remote, in_addr_t addr, bool binary,
 
   /* Allocate the buffer to used for socket/disk I/O */
 
-  packet = (FAR uint8_t*)zalloc(TFTP_IOBUFSIZE);
+  packet = (FAR uint8_t *)zalloc(TFTP_IOBUFSIZE);
   if (!packet)
     {
       nerr("ERROR: packet memory allocation failure\n");
@@ -315,7 +317,7 @@ int tftpput_cb(FAR const char *remote, in_addr_t addr, bool binary,
 
   blockno = 1;
   retry   = 0;
-  for (;;)
+  for (; ; )
     {
       packetlen = tftp_mkreqpacket(packet, TFTP_WRQ, remote, binary);
       ret = tftp_sendto(sd, packet, packetlen, &server);
@@ -335,7 +337,7 @@ int tftpput_cb(FAR const char *remote, in_addr_t addr, bool binary,
 
       /* We are going to loop and re-send the request packet. Check the
        * retry count so that we do not loop forever.
-        */
+       */
 
       if (++retry > TFTP_RETRIES)
         {
@@ -350,7 +352,7 @@ int tftpput_cb(FAR const char *remote, in_addr_t addr, bool binary,
   offset     = 0;
   retry      = 0;
 
-  for (;;)
+  for (; ; )
     {
       /* Construct the next data packet */
 
@@ -379,24 +381,24 @@ int tftpput_cb(FAR const char *remote, in_addr_t addr, bool binary,
 
           if (rblockno == blockno)
             {
-               /* Yes.. If we are at the end of the file and if all of the
-                * packets have been ACKed, then we are done.
-                */
+              /* Yes.. If we are at the end of the file and if all of the
+               * packets have been ACKed, then we are done.
+               */
 
               if (packetlen < TFTP_PACKETSIZE)
                 {
                   break;
                 }
 
-               /* Not the last block.. set up for the next block */
+              /* Not the last block.. set up for the next block */
 
-               blockno += 1;
-               offset  += TFTP_DATASIZE;
-               retry    = 0;
+              blockno += 1;
+              offset  += TFTP_DATASIZE;
+              retry    = 0;
 
-               /* Skip the retry test */
+              /* Skip the retry test */
 
-               continue;
+              continue;
             }
         }
 
@@ -482,6 +484,7 @@ static ssize_t tftp_read(FAR void *ctx, uint32_t offset, FAR uint8_t *buf,
       totalread += nbytesread;
       buf       += nbytesread;
     }
+
   return totalread;
 }
 
diff --git a/nshlib/nsh_fileapps.c b/nshlib/nsh_fileapps.c
index ff97cc6..0f915d0 100644
--- a/nshlib/nsh_fileapps.c
+++ b/nshlib/nsh_fileapps.c
@@ -120,9 +120,9 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
                                              oflags, 0644);
       if (ret != 0)
         {
-           /* posix_spawn_file_actions_addopen returns a positive errno
-            * value on failure.
-            */
+          /* posix_spawn_file_actions_addopen returns a positive errno
+           * value on failure.
+           */
 
           nsh_error(vtbl, g_fmtcmdfailed, cmd,
                      "posix_spawn_file_actions_addopen",
@@ -146,8 +146,8 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
     {
       /* The application was successfully started with pre-emption disabled.
        * In the simplest cases, the application will not have run because the
-       * the scheduler is locked.  But in the case where I/O was redirected, a
-       * proxy task ran and broke our lock.  As result, the application may
+       * the scheduler is locked.  But in the case where I/O was redirected,
+       * a proxy task ran and broke our lock.  As result, the application may
        * have aso ran if its priority was higher than than the priority of
        * this thread.
        *
@@ -193,8 +193,8 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
           ret = waitpid(pid, &rc, WUNTRACED);
           if (ret < 0)
             {
-              /* If the child thread does not exist, waitpid() will return
-               * the error ECHLD.  Since we know that the task was successfully
+              /* If the child thread doesn't exist, waitpid() will return the
+               * error ECHLD.  Since we know that the task was successfully
                * started, this must be one of the cases described above; we
                * have to assume that the task already exit'ed.  In this case,
                * we have no idea if the application ran successfully or not
@@ -222,9 +222,9 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
 
               ret = OK;
 
-              /* TODO:  Set the environment variable '?' to a string corresponding
-               * to WEXITSTATUS(rc) so that $? will expand to the exit status of
-               * the most recently executed task.
+              /* TODO:  Set the environment variable '?' to a string
+               * corresponding to WEXITSTATUS(rc) so that $? will expand
+               * to the exit status of the most recently executed task.
                */
             }
 
@@ -239,13 +239,13 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
        *
        * - CONFIG_SCHED_WAITPID is not selected meaning that all commands
        *   have to be run in background, or
-       * - CONFIG_SCHED_WAITPID and CONFIG_NSH_DISABLEBG are both selected, but the
-       *   user requested to run the command in background.
+       * - CONFIG_SCHED_WAITPID and CONFIG_NSH_DISABLEBG are both selected,
+       *   but the user requested to run the command in background.
        *
        * NOTE that the case of a) CONFIG_SCHED_WAITPID is not selected and
-       * b) CONFIG_NSH_DISABLEBG selected cannot be supported.  In that event, all
-       * commands will have to run in background.  The waitpid() API must be
-       * available to support running the command in foreground.
+       * b) CONFIG_NSH_DISABLEBG selected cannot be supported. In that event,
+       * all commands will have to run in background.  The waitpid() API must
+       * be available to support running the command in foreground.
        */
 
 #if !defined(CONFIG_SCHED_WAITPID) || !defined(CONFIG_NSH_DISABLEBG)
diff --git a/platform/mikroe-stm32f4/mikroe_configdata.c b/platform/mikroe-stm32f4/mikroe_configdata.c
index de9fd7e..2948fa1 100644
--- a/platform/mikroe-stm32f4/mikroe_configdata.c
+++ b/platform/mikroe-stm32f4/mikroe_configdata.c
@@ -1,4 +1,4 @@
-/************************************************************************************
+/****************************************************************************
  * apps/platform/mikroe-stm32f4/mikroe_configdata.c
  *
  *   Copyright (C) 2013 Ken Pettit. All rights reserved.
@@ -31,11 +31,11 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- ************************************************************************************/
+ ****************************************************************************/
 
-/************************************************************************************
+/****************************************************************************
  * Included Files
- ************************************************************************************/
+ ****************************************************************************/
 
 #include <nuttx/config.h>
 
@@ -52,9 +52,9 @@
 
 #ifdef CONFIG_PLATFORM_CONFIGDATA
 
-/************************************************************************************
+/****************************************************************************
  * Public Functions
- ************************************************************************************/
+ ****************************************************************************/
 
 /****************************************************************************
  * Name: platform_setconfig
@@ -127,7 +127,8 @@ int platform_setconfig(enum config_data_e id, int instance,
          * the file.
          */
 
-        if ((fd = fopen(CONFIG_MIKROE_STM32F4_CONFIGDATA_FILENAME, "w+")) == NULL)
+        fd = fopen(CONFIG_MIKROE_STM32F4_CONFIGDATA_FILENAME, "w+");
+        if (fd == NULL)
           {
             /* Error opening the file */
 
@@ -161,7 +162,6 @@ int platform_setconfig(enum config_data_e id, int instance,
         break;
     }
 
-
   set_errno(ENOSYS);
   return -1;
 
@@ -213,6 +213,7 @@ int platform_getconfig(enum config_data_e id, int instance,
       0x00, 0xb8, 0x2d, 0xdb, 0xff
   };
 #endif
+
 #ifdef CONFIG_MIKROE_STM32F4_CONFIGDATA_PART
   struct config_data_s  config;
   int                   ret;
@@ -248,7 +249,8 @@ int platform_getconfig(enum config_data_e id, int instance,
          * the file.
          */
 
-        if ((fd = fopen(CONFIG_MIKROE_STM32F4_CONFIGDATA_FILENAME, "r")) == NULL)
+        fd = fopen(CONFIG_MIKROE_STM32F4_CONFIGDATA_FILENAME, "r");
+        if (fd == NULL)
           {
             /* Error opening the file */
 


Mime
View raw message