Browse files

Fix warning: cast from pointer to integer of different size.

  • Loading branch information...
1 parent d0c626a commit 81b065fa1ed113f5859819827043019776bbb432 @bnoordhuis committed Nov 8, 2010
Showing with 6 additions and 3 deletions.
  1. +4 −2 aas_cfg.c
  2. +2 −1 deps/botlib/l_struct.h
View
6 aas_cfg.c
@@ -29,9 +29,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "botlib/l_struct.h"
#include "botlib/l_libvar.h"
+#include <stddef.h>
+
//structure field offsets
-#define BBOX_OFS(x) (int)&(((aas_bbox_t *)0)->x)
-#define CFG_OFS(x) (int)&(((cfg_t *)0)->x)
+#define BBOX_OFS(x) offsetof(aas_bbox_t, x)
+#define CFG_OFS(x) offsetof(cfg_t, x)
//bounding box definition
fielddef_t bbox_fields[] =
View
3 deps/botlib/l_struct.h
@@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*****************************************************************************/
+#include <stddef.h>
#define MAX_STRINGFIELD 80
//field types
@@ -48,7 +49,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
typedef struct fielddef_s
{
char *name; //name of the field
- int offset; //offset in the structure
+ size_t offset; //offset in the structure
int type; //type of the field
//type specific fields
int maxarray; //maximum array size

0 comments on commit 81b065f

Please sign in to comment.