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


The following commit(s) were added to refs/heads/master by this push:
     new ffcee721c nshlib/ddcmd:Fixed NSH_CMDOPT_DD_STATS output format warning 
in 64-bit environment
ffcee721c is described below

commit ffcee721ce1ede5bc1159045691ebc80c8d2f50d
Author: chenrun1 <[email protected]>
AuthorDate: Sun Apr 7 19:50:59 2024 +0800

    nshlib/ddcmd:Fixed NSH_CMDOPT_DD_STATS output format warning in 64-bit 
environment
    
    In file included from nsh_ddcmd.c:44:
    nsh_ddcmd.c: In function 'cmd_dd':
    nsh_ddcmd.c:456:20: error: format '%llu' expects argument of type 'long 
long unsigned int', but argument 3 has type 'uint64_t' {aka 'long unsigned 
int'} [-Werror=format=]
      456 |   nsh_output(vtbl, "%llu bytes copied, %u usec, ",
          |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      457 |              total, (unsigned int)elapsed);
          |              ~~~~~
          |              |
          |              uint64_t {aka long unsigned int}
    nsh_console.h:55:49: note: in definition of macro 'nsh_output'
       55 | #  define nsh_output(v, ...)   (v)->output(v, ##__VA_ARGS__)
          |                                                 ^~~~~~~~~~~
    nsh_ddcmd.c:456:24: note: format string is defined here
      456 |   nsh_output(vtbl, "%llu bytes copied, %u usec, ",
          |                     ~~~^
          |                        |
          |                        long long unsigned int
          |                     %lu
    cc1: all warnings being treated as errors
    
    Signed-off-by: chenrun1 <[email protected]>
---
 nshlib/nsh_ddcmd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nshlib/nsh_ddcmd.c b/nshlib/nsh_ddcmd.c
index 470518fdb..0f829314d 100644
--- a/nshlib/nsh_ddcmd.c
+++ b/nshlib/nsh_ddcmd.c
@@ -443,8 +443,8 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char 
**argv)
 
   total = ((uint64_t)sector * (uint64_t)dd.sectsize);
 
-  nsh_output(vtbl, "%llu bytes copied, %u usec, ",
-             total, (unsigned int)elapsed);
+  nsh_output(vtbl, "%" PRIu64 "bytes copied, %" PRIu64 " usec, ",
+             total, elapsed);
   nsh_output(vtbl, "%u KB/s\n" ,
              (unsigned int)(((double)total / 1024)
              / ((double)elapsed / USEC_PER_SEC)));

Reply via email to