From fe9bff3b0df5fd5e6da4fad8d9ea96058d2fdd91 Mon Sep 17 00:00:00 2001 From: Zbigniew Bodek Date: Thu, 26 Nov 2020 13:02:55 -0500 Subject: [PATCH] Fix type warning in offset macros On 64bit systems the address and hence the offset will not be unsigned int. To fix that issue, use generic pointer size type uintptr_t. Signed-off-by: Zbigniew Bodek Change-Id: I69298b48c4676c5935fa2170e23c32586c18de06 --- include/utils_list.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/utils_list.h b/include/utils_list.h index a318859..5b8c8b9 100755 --- a/include/utils_list.h +++ b/include/utils_list.h @@ -26,6 +26,7 @@ #define _UTILS_LIST_H #include +#include #include "ohos_types.h" #ifdef __cplusplus @@ -377,7 +378,7 @@ static inline void UtilsListHeadInsertList(UTILS_DL_LIST *oldList, UTILS_DL_LIST *
  • utils_list.h: the header file that contains the API declaration.
* @see */ -#define OFFSET_OF_FIELD(type, field) ((unsigned int)&((type *)0)->field) +#define OFFSET_OF_FIELD(type, field) ((uintptr_t)&((type *)0)->field) /* * @ingroup utils_list @@ -398,7 +399,7 @@ static inline void UtilsListHeadInsertList(UTILS_DL_LIST *oldList, UTILS_DL_LIST *
  • utils_list.h: the header file that contains the API declaration.
* @see */ -#define UTILS_OFF_SET_OF(type, member) ((unsigned int)&((type *)0)->member) +#define UTILS_OFF_SET_OF(type, member) ((uintptr_t)&((type *)0)->member) /* * @ingroup utils_list -- Gitee