You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ag...@apache.org on 2020/04/12 18:17:59 UTC

[incubator-nuttx-apps] branch master updated (3e73991 -> 58085e5)

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

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


    from 3e73991  nxstyle fixes for PR 170
     new f95d753  Fix warnings noted in PR build checks.
     new 58085e5  Run nxstyle against files modified in previous commit.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 examples/dsptest/test_motor.c      |  1 -
 examples/pf_ieee802154/pf_server.c | 27 ++++++++++++++---------
 examples/userfs/userfs_main.c      | 45 ++++++++++++++------------------------
 3 files changed, 33 insertions(+), 40 deletions(-)


[incubator-nuttx-apps] 01/02: Fix warnings noted in PR build checks.

Posted by ag...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f95d753759ddbd821cefebc6b938103ec4e60551
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sun Apr 12 09:31:34 2020 -0600

    Fix warnings noted in PR build checks.
    
        userfs_main.c:547:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
          if (*relpath == '\0')
              ^~~~~~~~~~~~~~~~
        userfs_main.c:564:10: note: uninitialized use occurs here
          return ret;
                 ^~~
        userfs_main.c:547:3: note: remove the 'if' if its condition is always false
          if (*relpath == '\0')
          ^~~~~~~~~~~~~~~~~~~~~
        userfs_main.c:543:10: note: initialize the variable 'ret' to silence this warning
          int ret;
                 ^
                  = 0
    
        test_motor.c:1068:14: warning: explicitly assigning value of variable of type 'float' to itself [-Wself-assign]
          expected_e = expected_e;
          ~~~~~~~~~~ ^ ~~~~~~~~~~
---
 examples/dsptest/test_motor.c      |  1 -
 examples/pf_ieee802154/pf_server.c | 10 +++++-----
 examples/userfs/userfs_main.c      | 41 +++++++++++++-------------------------
 3 files changed, 19 insertions(+), 33 deletions(-)

diff --git a/examples/dsptest/test_motor.c b/examples/dsptest/test_motor.c
index 3dde2ae..15f9f7f 100644
--- a/examples/dsptest/test_motor.c
+++ b/examples/dsptest/test_motor.c
@@ -1065,7 +1065,6 @@ static void test_angle_m_el_mixed(void)
 
   angle_step = 2 * MOTOR_ANGLE_E_MAX;
   expected_i = expected_i - 2;
-  expected_e = expected_e;
   expected_m = expected_m - 2 * MOTOR_ANGLE_M_MAX / p;
   s = sin(expected_e);
   c = cos(expected_e);
diff --git a/examples/pf_ieee802154/pf_server.c b/examples/pf_ieee802154/pf_server.c
index f476b66..f2afa67 100644
--- a/examples/pf_ieee802154/pf_server.c
+++ b/examples/pf_ieee802154/pf_server.c
@@ -145,15 +145,15 @@ int main(int argc, FAR char *argv[])
                  offset, nbytes,
                  client.sa_addr.s_saddr[0], client.sa_addr.s_saddr[1]);
         }
-      else if (client.sa_addr.s_mode == IEEE802154_ADDRMODE_SHORT)
+      else if (client.sa_addr.s_mode == IEEE802154_ADDRMODE_EXTENDED)
         {
           printf("server: %d. Received %d bytes from "
                  "%02x:%02x:%02x:%02x:%02x:%02x:%02x: %02x\n",
                  offset, nbytes,
-                 client.sa_addr.s_saddr[0], client.sa_addr.s_saddr[1],
-                 client.sa_addr.s_saddr[2], client.sa_addr.s_saddr[3],
-                 client.sa_addr.s_saddr[4], client.sa_addr.s_saddr[5],
-                 client.sa_addr.s_saddr[6], client.sa_addr.s_saddr[7]);
+                 client.sa_addr.s_eaddr[0], client.sa_addr.s_eaddr[1],
+                 client.sa_addr.s_eaddr[2], client.sa_addr.s_eaddr[3],
+                 client.sa_addr.s_eaddr[4], client.sa_addr.s_eaddr[5],
+                 client.sa_addr.s_eaddr[6], client.sa_addr.s_eaddr[7]);
         }
       else
         {
diff --git a/examples/userfs/userfs_main.c b/examples/userfs/userfs_main.c
index e231ae0..83478cd 100644
--- a/examples/userfs/userfs_main.c
+++ b/examples/userfs/userfs_main.c
@@ -1,35 +1,20 @@
 /****************************************************************************
  * examples/userfs/userfs_main.c
  *
- *   Copyright (C) 2017 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ *   http://www.apache.org/licenses/LICENSE-2.0
  *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
  *
  ****************************************************************************/
 
@@ -550,6 +535,8 @@ static int ufstest_stat(FAR void *volinfo, FAR const char *relpath,
       buf->st_mode    = (S_IFDIR | S_IRWXU | S_IRUSR | S_IRGRP | S_IRWXG |
                          S_IROTH | S_IRWXO);
       buf->st_blksize = UFSTEST_FS_BLOCKSIZE;
+
+      ret = OK;
     }
   else
     {


[incubator-nuttx-apps] 02/02: Run nxstyle against files modified in previous commit.

Posted by ag...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 58085e5983ee9e672ee14a20fbae374d4a567222
Author: Gregory Nutt <gn...@nuttx.org>
AuthorDate: Sun Apr 12 11:22:34 2020 -0600

    Run nxstyle against files modified in previous commit.
---
 examples/pf_ieee802154/pf_server.c | 17 ++++++++++++-----
 examples/userfs/userfs_main.c      |  4 ++--
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/examples/pf_ieee802154/pf_server.c b/examples/pf_ieee802154/pf_server.c
index f2afa67..941e938 100644
--- a/examples/pf_ieee802154/pf_server.c
+++ b/examples/pf_ieee802154/pf_server.c
@@ -70,9 +70,11 @@ static inline int check_buffer(unsigned char *buf)
         {
           j = 1;
         }
+
       if (buf[j] != ch)
         {
-          printf("server: Buffer content error for offset=%d, index=%d\n", offset, j);
+          printf("server: Buffer content error for offset=%d, index=%d\n",
+                 offset, j);
           ret = 0;
         }
     }
@@ -95,6 +97,7 @@ int main(int argc, FAR char *argv[])
   int nbytes;
   int optval;
   int offset;
+  int ret;
 
   /* Parse any command line options */
 
@@ -112,7 +115,9 @@ int main(int argc, FAR char *argv[])
   /* Set socket to reuse address */
 
   optval = 1;
-  if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0)
+  ret = setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (FAR void *)&optval,
+                   sizeof(int));
+  if (ret < 0)
     {
       printf("server: setsockopt SO_REUSEADDR failure: %d\n", errno);
       exit(1);
@@ -124,7 +129,7 @@ int main(int argc, FAR char *argv[])
   memcpy(&server.sa_addr, &g_server_addr, sizeof(struct ieee802154_saddr_s));
   addrlen = sizeof(struct sockaddr_ieee802154_s);
 
-  if (bind(sockfd, (struct sockaddr*)&server, addrlen) < 0)
+  if (bind(sockfd, (FAR struct sockaddr *)&server, addrlen) < 0)
     {
       printf("server: bind failure: %d\n", errno);
       exit(1);
@@ -170,14 +175,16 @@ int main(int argc, FAR char *argv[])
 
       if (nbytes != SENDSIZE)
         {
-          printf("server: %d. recv size incorrect: %d vs %d\n", offset, nbytes, SENDSIZE);
+          printf("server: %d. recv size incorrect: %d vs %d\n",
+                 offset, nbytes, SENDSIZE);
           close(sockfd);
           exit(1);
         }
 
       if (offset < inbuf[0])
         {
-          printf("server: %d. %d packets lost, resetting offset\n", offset, inbuf[0] - offset);
+          printf("server: %d. %d packets lost, resetting offset\n",
+                 offset, inbuf[0] - offset);
           offset = inbuf[0];
         }
       else if (offset > inbuf[0])
diff --git a/examples/userfs/userfs_main.c b/examples/userfs/userfs_main.c
index 83478cd..1907352 100644
--- a/examples/userfs/userfs_main.c
+++ b/examples/userfs/userfs_main.c
@@ -215,7 +215,7 @@ static int ufstest_open(FAR void *volinfo, FAR const char *relpath,
   if (file != NULL)
     {
       opriv = (FAR struct ufstest_openfile_s *)
-         malloc(sizeof(struct ufstest_openfile_s ));
+         malloc(sizeof(struct ufstest_openfile_s));
       if (opriv == NULL)
         {
           return -ENOMEM;
@@ -420,7 +420,7 @@ static int ufstest_opendir(FAR void *volinfo, FAR const char *relpath,
       /* The path refers to the top level directory. */
 
       odir = (FAR struct ufstest_opendir_s *)
-         malloc(sizeof(struct ufstest_opendir_s ));
+         malloc(sizeof(struct ufstest_opendir_s));
       if (odir == NULL)
         {
           return -ENOMEM;