Browse Source

misc/offset.h: in UPPER_OBJECT, cast to char * not to uint8_t *

ambrop7 13 năm trước cách đây
mục cha
commit
907aba2046
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      misc/offset.h

+ 1 - 1
misc/offset.h

@@ -40,7 +40,7 @@
 /**
  * Returns a pointer to a struct, given a pointer to its member.
  */
-#define UPPER_OBJECT(_ptr, _object_type, _field_name) ((_object_type *)((uint8_t *)(_ptr) - offsetof(_object_type, _field_name)))
+#define UPPER_OBJECT(_ptr, _object_type, _field_name) ((_object_type *)((char *)(_ptr) - offsetof(_object_type, _field_name)))
 
 /**
  * Returns the offset of one struct member from another.