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 <zbigniew.bodek@huawei.com>
Change-Id: I69298b48c4676c5935fa2170e23c32586c18de06
This commit is contained in:
Zbigniew Bodek
2020-11-26 13:02:55 -05:00
parent f599e73a99
commit fe9bff3b0d
+3 -2
View File
@@ -26,6 +26,7 @@
#define _UTILS_LIST_H
#include <stdbool.h>
#include <stdint.h>
#include "ohos_types.h"
#ifdef __cplusplus
@@ -377,7 +378,7 @@ static inline void UtilsListHeadInsertList(UTILS_DL_LIST *oldList, UTILS_DL_LIST
* <ul><li>utils_list.h: the header file that contains the API declaration.</li></ul>
* @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
* <ul><li>utils_list.h: the header file that contains the API declaration.</li></ul>
* @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