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

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

commit fc863b6cd043e1f47dca272ecd74961363c6533e
Author: raiden00pl <raide...@railab.me>
AuthorDate: Sat Sep 28 10:38:02 2024 +0200

    examples/foc: fix snprintf warning
    
    fix snprintf warning:
    
        foc_thr.c:110:39: warning: '%d' directive output may be truncated 
writing between 1 and 11 bytes into a region of size 7 [-Wformat-truncation=]
          110 |   snprintf(mqname, sizeof(mqname), "%s%d", CONTROL_MQ_MQNAME, 
envp->id);
              |                                       ^~
        foc_thr.c:110:36: note: directive argument in the range [-2147483648, 0]
          110 |   snprintf(mqname, sizeof(mqname), "%s%d", CONTROL_MQ_MQNAME, 
envp->id);
              |                                    ^~~~~~
        foc_thr.c:110:3: note: 'snprintf' output between 5 and 15 bytes into a 
destination of size 10
          110 |   snprintf(mqname, sizeof(mqname), "%s%d", CONTROL_MQ_MQNAME, 
envp->id);
              |   
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 examples/foc/foc_thr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/foc/foc_thr.h b/examples/foc/foc_thr.h
index 53fe854a4..93f6832ab 100644
--- a/examples/foc/foc_thr.h
+++ b/examples/foc/foc_thr.h
@@ -112,7 +112,7 @@ enum foc_controller_state_e
 struct foc_ctrl_env_s
 {
   mqd_t                     mqd;   /* Control msg queue */
-  int                       id;    /* FOC device id */
+  uint8_t                   id;    /* FOC device id */
   int                       inst;  /* Type specific instance counter */
   int                       type;  /* Controller type */
   FAR struct foc_thr_cfg_s *cfg;   /* Control thread configuration */

Reply via email to