You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/12/27 17:05:53 UTC
[incubator-nuttx] branch master updated: driver/rwbuffer: Fix the compiler warning
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/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 8f72c76 driver/rwbuffer: Fix the compiler warning
8f72c76 is described below
commit 8f72c7626c25449a3579b9c59ca86d5457c53c9f
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Dec 26 23:55:43 2021 +0800
driver/rwbuffer: Fix the compiler warning
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
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
drivers/rwbuffer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rwbuffer.c b/drivers/rwbuffer.c
index 2a033c4..60e6306 100644
--- a/drivers/rwbuffer.c
+++ b/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(%" PRIu32 ") failed\n", allocsize);
return -ENOMEM;
}
- finfo("Write buffer size: %d bytes\n", allocsize);
+ finfo("Write buffer size: %" PRIu32 " bytes\n", allocsize);
}
#endif /* CONFIG_DRVR_WRITEBUFFER */