You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/11/01 16:12:52 UTC
[incubator-nuttx] 04/07: Fix error: format specifies type 'unsigned short' but the argument has type 'int'
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 3b060bad34f443a9e0bda8695fc4e3af7f67d47a
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Oct 31 22:29:19 2022 +0800
Fix error: format specifies type 'unsigned short' but the argument has type 'int'
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
include/nuttx/usb/usb.h | 8 ++++----
net/sixlowpan/sixlowpan_internal.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/nuttx/usb/usb.h b/include/nuttx/usb/usb.h
index 8c4a23e4ce..2b70e1d796 100644
--- a/include/nuttx/usb/usb.h
+++ b/include/nuttx/usb/usb.h
@@ -65,10 +65,10 @@
#define MSBYTE(u16) ((u16) >> 8) /* Get MS byte from uint16_t */
#define LSBYTE(u16) ((u16) & 0xff) /* Get LS byte from uint16_t */
-#define GETUINT16(p) (((uint16_t)p[1] << 8) | (uint16_t)p[0])
-#define GETUINT32(p) (((uint32_t)p[3] << 24) | \
- ((uint32_t)p[2] << 16) | \
- ((uint32_t)p[1] << 8) | (uint32_t)p[0])
+#define GETUINT16(p) ((uint16_t)((uint16_t)(p[1] << 8) | (uint16_t)p[0]))
+#define GETUINT32(p) ((uint32_t)((uint32_t)p[3] << 24) | \
+ ((uint32_t)p[2] << 16) | \
+ ((uint32_t)p[1] << 8) | (uint32_t)p[0])
/* USB directions (in endpoint addresses) */
diff --git a/net/sixlowpan/sixlowpan_internal.h b/net/sixlowpan/sixlowpan_internal.h
index 29626af8f6..a7abf9416a 100644
--- a/net/sixlowpan/sixlowpan_internal.h
+++ b/net/sixlowpan/sixlowpan_internal.h
@@ -103,7 +103,7 @@
/* GET 16-bit data: source in network order */
#define GETUINT16(ptr,index) \
- ((((uint16_t)((ptr)[index])) << 8) | ((uint16_t)(((ptr)[(index) + 1]))))
+ ((uint16_t)((((uint16_t)((ptr)[index])) << 8) | ((uint16_t)(((ptr)[(index) + 1])))))
/* PUT 16-bit data: source in host order, result in network order */