summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/imports.c
diff options
context:
space:
mode:
authorKarl Schultz <[email protected]>2005-05-05 21:08:07 +0000
committerKarl Schultz <[email protected]>2005-05-05 21:08:07 +0000
commit6258b76c49f49a56a7c713914b798e80c6553b06 (patch)
tree2cc86a17fdda506fc9c86daba7ff3900d2d64996 /src/mesa/main/imports.c
parent203dcb733d36cc91107554b0d323ed8ccef6e105 (diff)
Port Mesa to build on a P64 platform (e.g., Win64). P64 platforms
use 64-bit pointers and 32-bit longs. So, operations like casting pointers to unsigned long and back to pointer won't work. glheader.h now includes files to define uintptr_t, which should instead be used for this sort of operation. It is an integer type that is the same size as a pointer.
Diffstat (limited to 'src/mesa/main/imports.c')
-rw-r--r--src/mesa/main/imports.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
index 50bc1510b1c..767cef59e2e 100644
--- a/src/mesa/main/imports.c
+++ b/src/mesa/main/imports.c
@@ -124,16 +124,16 @@ _mesa_free(void *ptr)
void *
_mesa_align_malloc(size_t bytes, unsigned long alignment)
{
- unsigned long ptr, buf;
+ uintptr_t ptr, buf;
ASSERT( alignment > 0 );
- ptr = (unsigned long) _mesa_malloc(bytes + alignment + sizeof(void *));
+ ptr = (uintptr_t) _mesa_malloc(bytes + alignment + sizeof(void *));
if (!ptr)
return NULL;
- buf = (ptr + alignment + sizeof(void *)) & ~(unsigned long)(alignment - 1);
- *(unsigned long *)(buf - sizeof(void *)) = ptr;
+ buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1);
+ *(uintptr_t *)(buf - sizeof(void *)) = ptr;
#ifdef DEBUG
/* mark the non-aligned area */
@@ -151,16 +151,16 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
void *
_mesa_align_calloc(size_t bytes, unsigned long alignment)
{
- unsigned long ptr, buf;
+ uintptr_t ptr, buf;
ASSERT( alignment > 0 );
- ptr = (unsigned long) _mesa_calloc(bytes + alignment + sizeof(void *));
+ ptr = (uintptr_t) _mesa_calloc(bytes + alignment + sizeof(void *));
if (!ptr)
return NULL;
- buf = (ptr + alignment + sizeof(void *)) & ~(unsigned long)(alignment - 1);
- *(unsigned long *)(buf - sizeof(void *)) = ptr;
+ buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1);
+ *(uintptr_t *)(buf - sizeof(void *)) = ptr;
#ifdef DEBUG
/* mark the non-aligned area */
@@ -777,7 +777,7 @@ _mesa_strncmp( const char *s1, const char *s2, size_t n )
char *
_mesa_strdup( const char *s )
{
- int l = _mesa_strlen(s);
+ size_t l = _mesa_strlen(s);
char *s2 = (char *) _mesa_malloc(l + 1);
if (s2)
_mesa_strcpy(s2, s);