You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/11/05 12:12:34 UTC

[GitHub] [incubator-nuttx-apps] yamt opened a new pull request #463: Fix printf format warnings

yamt opened a new pull request #463:
URL: https://github.com/apache/incubator-nuttx-apps/pull/463


   ## Summary
   fix some printf errors found by the compiler.
   ## Impact
   
   ## Testing
   https://github.com/apache/incubator-nuttx/pull/2222


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a change in pull request #463: Fix printf format warnings

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #463:
URL: https://github.com/apache/incubator-nuttx-apps/pull/463#discussion_r519680402



##########
File path: nshlib/nsh_dbgcmds.c
##########
@@ -445,7 +445,8 @@ int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
                       dumpbytes = count;
                     }
 
-                  snprintf(msg, sizeof(msg), "%s at %08x", argv[1], skip);
+                  snprintf(msg, sizeof(msg), "%s at %08zx", argv[1],
+                           (uintmax_t)skip);

Review comment:
       consistent with what?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] yamt commented on a change in pull request #463: Fix printf format warnings

Posted by GitBox <gi...@apache.org>.
yamt commented on a change in pull request #463:
URL: https://github.com/apache/incubator-nuttx-apps/pull/463#discussion_r519647443



##########
File path: nshlib/nsh_dbgcmds.c
##########
@@ -445,7 +445,8 @@ int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
                       dumpbytes = count;
                     }
 
-                  snprintf(msg, sizeof(msg), "%s at %08x", argv[1], skip);
+                  snprintf(msg, sizeof(msg), "%s at %08zx", argv[1],
+                           (uintmax_t)skip);

Review comment:
       i changed it to use uintmax_t consistently.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] yamt commented on a change in pull request #463: Fix printf format warnings

Posted by GitBox <gi...@apache.org>.
yamt commented on a change in pull request #463:
URL: https://github.com/apache/incubator-nuttx-apps/pull/463#discussion_r519647505



##########
File path: nshlib/nsh_dbgcmds.c
##########
@@ -473,7 +474,8 @@ int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
             }
 #endif
 
-          snprintf(msg, sizeof(msg), "%s at %08x", argv[1], position);
+          snprintf(msg, sizeof(msg), "%s at %08zx", argv[1],
+                   (uintmax_t)position);

Review comment:
       i changed it to use uintmax_t consistently.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] yamt commented on a change in pull request #463: Fix printf format warnings

Posted by GitBox <gi...@apache.org>.
yamt commented on a change in pull request #463:
URL: https://github.com/apache/incubator-nuttx-apps/pull/463#discussion_r519646685



##########
File path: system/ramtest/ramtest.c
##########
@@ -142,8 +142,8 @@ static void parse_commandline(int argc, char **argv,
   info->start = (uintptr_t)strtoul(argv[optind], &ptr, 16);
   if (*ptr != '\0')
     {
-      printf(RAMTEST_PREFIX "Invalid <hex-address>: %s->%lx [%02x]\n",
-             argv[optind], info->start, *ptr);
+      printf(RAMTEST_PREFIX "Invalid <hex-address>: %s->%p [%02x]\n",

Review comment:
       done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a change in pull request #463: Fix printf format warnings

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #463:
URL: https://github.com/apache/incubator-nuttx-apps/pull/463#discussion_r518014583



##########
File path: system/ramtest/ramtest.c
##########
@@ -142,8 +142,8 @@ static void parse_commandline(int argc, char **argv,
   info->start = (uintptr_t)strtoul(argv[optind], &ptr, 16);
   if (*ptr != '\0')
     {
-      printf(RAMTEST_PREFIX "Invalid <hex-address>: %s->%lx [%02x]\n",
-             argv[optind], info->start, *ptr);
+      printf(RAMTEST_PREFIX "Invalid <hex-address>: %s->%p [%02x]\n",

Review comment:
       should we change p to PRIxPTR?

##########
File path: nshlib/nsh_dbgcmds.c
##########
@@ -473,7 +474,8 @@ int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
             }
 #endif
 
-          snprintf(msg, sizeof(msg), "%s at %08x", argv[1], position);
+          snprintf(msg, sizeof(msg), "%s at %08zx", argv[1],
+                   (uintmax_t)position);

Review comment:
       should we use ssize_t?

##########
File path: nshlib/nsh_dbgcmds.c
##########
@@ -445,7 +445,8 @@ int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
                       dumpbytes = count;
                     }
 
-                  snprintf(msg, sizeof(msg), "%s at %08x", argv[1], skip);
+                  snprintf(msg, sizeof(msg), "%s at %08zx", argv[1],
+                           (uintmax_t)skip);

Review comment:
       should we use ssize_t?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] yamt commented on a change in pull request #463: Fix printf format warnings

Posted by GitBox <gi...@apache.org>.
yamt commented on a change in pull request #463:
URL: https://github.com/apache/incubator-nuttx-apps/pull/463#discussion_r519684905



##########
File path: nshlib/nsh_dbgcmds.c
##########
@@ -445,7 +445,8 @@ int cmd_hexdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
                       dumpbytes = count;
                     }
 
-                  snprintf(msg, sizeof(msg), "%s at %08x", argv[1], skip);
+                  snprintf(msg, sizeof(msg), "%s at %08zx", argv[1],
+                           (uintmax_t)skip);

Review comment:
       i made printf format (%jx) and cast (uintmax_t) consistent.
   
   ssize_t might or might not be wider than off_t.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx-apps] xiaoxiang781216 merged pull request #463: Fix printf format warnings

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #463:
URL: https://github.com/apache/incubator-nuttx-apps/pull/463


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org