From f994b1f31bb64f0fb56a778c350b6ff05c93501f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 1 Jun 2004 16:17:32 +0000 Subject: Replace size_t with an ugly, ugly hack. This was done so that code in the core X-server would compile. Hopefully, this will soon be replaced with explicitly sized types (i.e., uint32_t) and everyone will be happy. --- shared-core/drm.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'shared-core/drm.h') diff --git a/shared-core/drm.h b/shared-core/drm.h index ceba2424..f7508b16 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -148,6 +148,22 @@ typedef struct drm_hw_lock { } drm_hw_lock_t; +/* This is beyond ugly, and only works on GCC. However, it allows me to use + * drm.h in places (i.e., in the X-server) where I can't use size_t. The real + * fix is to use uint32_t instead of size_t, but that fix will break existing + * LP64 (i.e., PowerPC64, SPARC64, IA-64, Alpha, etc.) systems. That *will* + * eventually happen, though. I chose 'unsigned long' to be the fallback type + * because that works on all the platforms I know about. Hopefully, the + * real fix will happen before that bites us. + */ + +#ifdef __SIZE_TYPE__ +# define DRM_SIZE_T __SIZE_TYPE__ +#else +# warning "__SIZE_TYPE__ not defined. Assuming sizeof(size_t) == sizeof(unsigned long)!" +# define DRM_SIZE_T unsigned long +#endif + /** * DRM_IOCTL_VERSION ioctl argument type. * @@ -157,11 +173,11 @@ typedef struct drm_version { int version_major; /**< Major version */ int version_minor; /**< Minor version */ int version_patchlevel;/**< Patch level */ - size_t name_len; /**< Length of name buffer */ + DRM_SIZE_T name_len; /**< Length of name buffer */ char *name; /**< Name of driver */ - size_t date_len; /**< Length of date buffer */ + DRM_SIZE_T date_len; /**< Length of date buffer */ char *date; /**< User-space buffer to hold date */ - size_t desc_len; /**< Length of desc buffer */ + DRM_SIZE_T desc_len; /**< Length of desc buffer */ char *desc; /**< User-space buffer to hold desc */ } drm_version_t; @@ -172,10 +188,11 @@ typedef struct drm_version { * \sa drmGetBusid() and drmSetBusId(). */ typedef struct drm_unique { - size_t unique_len; /**< Length of unique */ + DRM_SIZE_T unique_len; /**< Length of unique */ char *unique; /**< Unique name for driver instantiation */ } drm_unique_t; +#undef DRM_SIZE_T typedef struct drm_list { int count; /**< Length of user-space structures */ -- cgit v1.2.3