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 2021/12/26 16:36:32 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 opened a new pull request #5077: driver/rwbuffer: Fix the compiler warning

xiaoxiang781216 opened a new pull request #5077:
URL: https://github.com/apache/incubator-nuttx/pull/5077


   ## Summary
   ```
   rwbuffer.c: In function 'rwb_initialize':
   rwbuffer.c:842:16: warning: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
     842 |           ferr("Write buffer kmm_malloc(%d) failed\n", allocsize);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~
         |                                                        |
         |                                                        uint32_t {aka long unsigned int}
   rwbuffer.c:842:42: note: format string is defined here
     842 |           ferr("Write buffer kmm_malloc(%d) failed\n", allocsize);
         |                                         ~^
         |                                          |
         |                                          int
         |                                         %ld
   In file included from rwbuffer.c:36:
   rwbuffer.c:846:13: warning: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
     846 |       finfo("Write buffer size: %d bytes\n", allocsize);
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~
         |                                              |
         |                                              uint32_t {aka long unsigned int}
   rwbuffer.c:846:34: note: format string is defined here
     846 |       finfo("Write buffer size: %d bytes\n", allocsize);
         |                                 ~^
         |                                  |
         |                                  int
         |                                 %ld
   ```
   
   ## Impact
   Minor
   
   ## Testing
   Pass CI
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5077: driver/rwbuffer: Fix the compiler warning

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5077:
URL: https://github.com/apache/incubator-nuttx/pull/5077#discussion_r775273000



##########
File path: drivers/rwbuffer.c
##########
@@ -839,11 +839,11 @@ int rwb_initialize(FAR struct rwbuffer_s *rwb)
       rwb->wrbuffer = kmm_malloc(allocsize);
       if (!rwb->wrbuffer)
         {
-          ferr("Write buffer kmm_malloc(%d) failed\n", allocsize);
+          ferr("Write buffer kmm_malloc(%"PRId32") failed\n", allocsize);

Review comment:
       ```suggestion
             ferr("Write buffer kmm_malloc(%" PRIu32 ") failed\n", allocsize);
   ```
   `allocsize` is unsigned.
   nit: the string operands of the concatenation are usually separated by whitespaces. 




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #5077: driver/rwbuffer: Fix the compiler warning

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


   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5077: driver/rwbuffer: Fix the compiler warning

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5077:
URL: https://github.com/apache/incubator-nuttx/pull/5077#discussion_r775273000



##########
File path: drivers/rwbuffer.c
##########
@@ -839,11 +839,11 @@ int rwb_initialize(FAR struct rwbuffer_s *rwb)
       rwb->wrbuffer = kmm_malloc(allocsize);
       if (!rwb->wrbuffer)
         {
-          ferr("Write buffer kmm_malloc(%d) failed\n", allocsize);
+          ferr("Write buffer kmm_malloc(%"PRId32") failed\n", allocsize);

Review comment:
       ```suggestion
             ferr("Write buffer kmm_malloc(%" PRId32 ") failed\n", allocsize);
   ```
   nit: the string operands of the concatenation are usually separated by whitespaces. 




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5077: driver/rwbuffer: Fix the compiler warning

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



##########
File path: drivers/rwbuffer.c
##########
@@ -839,11 +839,11 @@ int rwb_initialize(FAR struct rwbuffer_s *rwb)
       rwb->wrbuffer = kmm_malloc(allocsize);
       if (!rwb->wrbuffer)
         {
-          ferr("Write buffer kmm_malloc(%d) failed\n", allocsize);
+          ferr("Write buffer kmm_malloc(%"PRId32") failed\n", allocsize);
           return -ENOMEM;
         }
 
-      finfo("Write buffer size: %d bytes\n", allocsize);
+      finfo("Write buffer size: %"PRId32" bytes\n", allocsize);

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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5077: driver/rwbuffer: Fix the compiler warning

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5077:
URL: https://github.com/apache/incubator-nuttx/pull/5077#discussion_r775273040



##########
File path: drivers/rwbuffer.c
##########
@@ -839,11 +839,11 @@ int rwb_initialize(FAR struct rwbuffer_s *rwb)
       rwb->wrbuffer = kmm_malloc(allocsize);
       if (!rwb->wrbuffer)
         {
-          ferr("Write buffer kmm_malloc(%d) failed\n", allocsize);
+          ferr("Write buffer kmm_malloc(%"PRId32") failed\n", allocsize);
           return -ENOMEM;
         }
 
-      finfo("Write buffer size: %d bytes\n", allocsize);
+      finfo("Write buffer size: %"PRId32" bytes\n", allocsize);

Review comment:
       ```suggestion
         finfo("Write buffer size: %" PRIu32 " bytes\n", allocsize);
   ```
   `allocsize` is unsigned.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5077: driver/rwbuffer: Fix the compiler warning

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5077:
URL: https://github.com/apache/incubator-nuttx/pull/5077#discussion_r775273040



##########
File path: drivers/rwbuffer.c
##########
@@ -839,11 +839,11 @@ int rwb_initialize(FAR struct rwbuffer_s *rwb)
       rwb->wrbuffer = kmm_malloc(allocsize);
       if (!rwb->wrbuffer)
         {
-          ferr("Write buffer kmm_malloc(%d) failed\n", allocsize);
+          ferr("Write buffer kmm_malloc(%"PRId32") failed\n", allocsize);
           return -ENOMEM;
         }
 
-      finfo("Write buffer size: %d bytes\n", allocsize);
+      finfo("Write buffer size: %"PRId32" bytes\n", allocsize);

Review comment:
       ```suggestion
         finfo("Write buffer size: %" PRId32 " bytes\n", allocsize);
   ```




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5077: driver/rwbuffer: Fix the compiler warning

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



##########
File path: drivers/rwbuffer.c
##########
@@ -839,11 +839,11 @@ int rwb_initialize(FAR struct rwbuffer_s *rwb)
       rwb->wrbuffer = kmm_malloc(allocsize);
       if (!rwb->wrbuffer)
         {
-          ferr("Write buffer kmm_malloc(%d) failed\n", allocsize);
+          ferr("Write buffer kmm_malloc(%"PRId32") failed\n", allocsize);

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.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

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