You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gu...@apache.org on 2021/07/10 10:45:51 UTC

[incubator-nuttx-apps] branch master updated: system/nxlooper: Fix the following compiler warning

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

gustavonihei 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 ca70e58  system/nxlooper: Fix the following compiler warning
ca70e58 is described below

commit ca70e585b105b94ae74b104b65975d2b58ae7b0b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Jul 10 02:59:06 2021 +0800

    system/nxlooper: Fix the following compiler warning
    
    nxlooper.c: In function 'nxlooper_opendevice':
    Error: nxlooper.c:126:15: error: unused variable 'x' [-Werror=unused-variable]
      126 |       uint8_t x;
          |               ^
    Error: nxlooper.c:125:15: error: unused variable 'supported' [-Werror=unused-variable]
      125 |       uint8_t supported = true;
          |               ^~~~~~~~~
    In file included from nxlooper.c:40:
    nxlooper.c: In function 'nxlooper_loopthread':
    Error: nxlooper.c:482:15: error: format '%d' expects argument of type 'int', but argument 3 has type 'ssize_t' {aka 'long int'} [-Werror=format=]
      482 |       audinfo("message received size %d id%d\n", size, msg.msg_id);
          |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~
          |                                                  |
          |                                                  ssize_t {aka long int}
    nxlooper.c:482:39: note: format string is defined here
      482 |       audinfo("message received size %d id%d\n", size, msg.msg_id);
          |                                      ~^
          |                                       |
          |                                       int
          |                                      %ld
    cc1: all warnings being treated as errors
    make[3]: *** [/github/workspace/sources/apps/Application.mk:133: nxlooper.c.github.workspace.sources.apps.system.nxlooper.o] Error 1
    nxlooper_main.c: In function 'nxlooper_cmd_loopback':
    Error: nxlooper_main.c:209:9: error: implicit declaration of function 'nxlooper_loopraw'; did you mean 'nxlooper_stop'? [-Werror=implicit-function-declaration]
      209 |   ret = nxlooper_loopraw(plooper, channels, bpsamp,
          |         ^~~~~~~~~~~~~~~~
          |         nxlooper_stop
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 include/system/nxlooper.h  | 27 +++++++++++++++++++++++++++
 system/nxlooper/nxlooper.c |  4 +---
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/include/system/nxlooper.h b/include/system/nxlooper.h
index f9a922c..51f45c7 100644
--- a/include/system/nxlooper.h
+++ b/include/system/nxlooper.h
@@ -162,6 +162,33 @@ int nxlooper_setdevice(FAR struct nxlooper_s *plooper,
                        FAR const char *device);
 
 /****************************************************************************
+ * Name: nxlooper_loopraw
+ *
+ *   nxlooper_loopraw() tries to record and then play the raw data using the
+ *   Audio system.  If a device is specified, it will try to use that
+ *   device.
+ *
+ * Input Parameters:
+ *   plooper    Pointer to the initialized Looper context
+ *   nchannels  channel num
+ *   bpsampe    bit width
+ *   samprate   sample rate
+ *   chmap      channel map
+ *
+ * Returned Value:
+ *   OK         File is being looped
+ *   -EBUSY     The media device is busy
+ *   -ENOSYS    The media file is an unsupported type
+ *   -ENODEV    No audio device suitable
+ *   -ENOENT    The media file was not found
+ *
+ ****************************************************************************/
+
+int nxlooper_loopraw(FAR struct nxlooper_s *plooper,
+                     uint8_t nchannels, uint8_t bpsamp,
+                     uint32_t samprate, uint8_t chmap);
+
+/****************************************************************************
  * Name: nxlooper_stop
  *
  *   Stops current loopback.
diff --git a/system/nxlooper/nxlooper.c b/system/nxlooper/nxlooper.c
index ae26dd6..a3fa219 100644
--- a/system/nxlooper/nxlooper.c
+++ b/system/nxlooper/nxlooper.c
@@ -122,8 +122,6 @@ static int nxlooper_opendevice(FAR struct nxlooper_s *plooper)
       FAR struct dirent *pdevice;
       FAR DIR *dirp;
       char path[64];
-      uint8_t supported = true;
-      uint8_t x;
 
       /* Search for a device in the audio device directory */
 
@@ -479,7 +477,7 @@ static void *nxlooper_loopthread(pthread_addr_t pvarg)
 
       /* Validate a message was received */
 
-      audinfo("message received size %d id%d\n", size, msg.msg_id);
+      audinfo("message received size %zd id%d\n", size, msg.msg_id);
       if (size != sizeof(msg))
         {
           /* Interrupted by a signal? What to do? */