changeset 211:7eda95524e83 src

use uintptr_t for pointer arithmetics for AMD64 compatibility (patch suggested by Adrian Schroeter)
author mroi
date Mon, 25 Aug 2003 14:23:13 +0000
parents e8d264bda65e
children 6b67914ae021
files dvd_reader.c dvd_udf.c read_cache.c
diffstat 3 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/dvd_reader.c	Sun Aug 03 09:40:58 2003 +0000
+++ b/dvd_reader.c	Mon Aug 25 14:23:13 2003 +0000
@@ -1000,7 +1000,7 @@
       ( ( ( seek_byte + byte_size ) % DVD_VIDEO_LB_LEN ) ? 1 : 0 );
     
     secbuf_base = (unsigned char *) malloc( numsec * DVD_VIDEO_LB_LEN + 2048 );
-    secbuf = (unsigned char *)(((int)secbuf_base & ~2047) + 2048);
+    secbuf = (unsigned char *)(((uintptr_t)secbuf_base & ~2047) + 2048);
     if( !secbuf_base ) {
 	fprintf( stderr, "libdvdread: Can't allocate memory " 
 		 "for file read!\n" );
@@ -1054,7 +1054,7 @@
 	    ssize_t bytes_read;
 	    size_t file_size = dvd_file->filesize * DVD_VIDEO_LB_LEN;
 	    char *buffer_base = malloc( file_size + 2048 );
-	    char *buffer = (unsigned char *)(((int)buffer_base & ~2047) + 2048);
+	    char *buffer = (unsigned char *)(((uintptr_t)buffer_base & ~2047) + 2048);
 	    
 	    if( buffer_base == NULL ) {
 		fprintf( stderr, "libdvdread: DVDDiscId, failed to "
@@ -1099,7 +1099,7 @@
   }
   
   buffer_base = malloc( DVD_VIDEO_LB_LEN + 2048 );
-  buffer = (unsigned char *)(((int)buffer_base & ~2047) + 2048);
+  buffer = (unsigned char *)(((uintptr_t)buffer_base & ~2047) + 2048);
 
   if( buffer_base == NULL ) {
     fprintf( stderr, "libdvdread: DVDISOVolumeInfo, failed to "
--- a/dvd_udf.c	Sun Aug 03 09:40:58 2003 +0000
+++ b/dvd_udf.c	Mon Aug 25 14:23:13 2003 +0000
@@ -492,7 +492,7 @@
 		      struct Partition *partition, struct AD *File ) 
 {
     uint8_t LogBlock_base[DVD_VIDEO_LB_LEN + 2048];
-    uint8_t *LogBlock = (uint8_t *)(((int)LogBlock_base & ~2047) + 2048);
+    uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~2047) + 2048);
     uint32_t lbnum;
     uint16_t TagID;
     struct icbmap tmpmap;
@@ -537,7 +537,7 @@
 {
     char filename[ MAX_UDF_FILE_NAME_LEN ];
     uint8_t directory_base[ 2 * DVD_VIDEO_LB_LEN + 2048];
-    uint8_t *directory = (uint8_t *)(((int)directory_base & ~2047) + 2048);
+    uint8_t *directory = (uint8_t *)(((uintptr_t)directory_base & ~2047) + 2048);
     uint32_t lbnum;
     uint16_t TagID;
     uint8_t filechar;
@@ -559,7 +559,7 @@
 	if((cached_dir_base = malloc(dir_lba * DVD_VIDEO_LB_LEN + 2048)) == NULL) {
 	  return 0;
 	}
-	cached_dir = (uint8_t *)(((int)cached_dir_base & ~2047) + 2048);
+	cached_dir = (uint8_t *)(((uintptr_t)cached_dir_base & ~2047) + 2048);
 	if( DVDReadLBUDF( device, lbnum, dir_lba, cached_dir, 0) <= 0 ) {
 	  free(cached_dir_base);
 	  cached_dir = NULL;
@@ -650,7 +650,7 @@
 		       struct avdp_t *avdp)
 {
   uint8_t Anchor_base[ DVD_VIDEO_LB_LEN + 2048 ];
-  uint8_t *Anchor = (uint8_t *)(((int)Anchor_base & ~2047) + 2048);
+  uint8_t *Anchor = (uint8_t *)(((uintptr_t)Anchor_base & ~2047) + 2048);
   uint32_t lbnum, MVDS_location, MVDS_length;
   uint16_t TagID;
   uint32_t lastsector;
@@ -722,7 +722,7 @@
 			     struct Partition *part ) 
 {
     uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ];
-    uint8_t *LogBlock = (uint8_t *)(((int)LogBlock_base & ~2047) + 2048);
+    uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~2047) + 2048);
     uint32_t lbnum, MVDS_location, MVDS_length;
     uint16_t TagID;
     int i, volvalid;
@@ -785,7 +785,7 @@
 		      uint32_t *filesize )
 {
     uint8_t LogBlock_base[ DVD_VIDEO_LB_LEN + 2048 ];
-    uint8_t *LogBlock = (uint8_t *)(((int)LogBlock_base & ~2047) + 2048);
+    uint8_t *LogBlock = (uint8_t *)(((uintptr_t)LogBlock_base & ~2047) + 2048);
     uint32_t lbnum;
     uint16_t TagID;
     struct Partition partition;
@@ -930,7 +930,7 @@
 static int UDFGetPVD(dvd_reader_t *device, struct pvd_t *pvd)
 {
   uint8_t pvd_buf_base[DVD_VIDEO_LB_LEN + 2048];
-  uint8_t *pvd_buf = (uint8_t *)(((int)pvd_buf_base & ~2047) + 2048);
+  uint8_t *pvd_buf = (uint8_t *)(((uintptr_t)pvd_buf_base & ~2047) + 2048);
   
   if(GetUDFCache(device, PVDCache, 0, pvd)) {
     return 1;
--- a/read_cache.c	Sun Aug 03 09:40:58 2003 +0000
+++ b/read_cache.c	Mon Aug 25 14:23:13 2003 +0000
@@ -448,7 +448,7 @@
       self->chunk[use].cache_buffer_base = realloc(self->chunk[use].cache_buffer_base,
         block_count * DVD_VIDEO_LB_LEN + ALIGNMENT);
       self->chunk[use].cache_buffer =
-        (uint8_t *)(((int)self->chunk[use].cache_buffer_base & ~(ALIGNMENT - 1)) + ALIGNMENT);
+        (uint8_t *)(((uintptr_t)self->chunk[use].cache_buffer_base & ~(ALIGNMENT - 1)) + ALIGNMENT);
       dprintf("pre_cache DVD read realloc happened\n");
       self->chunk[use].cache_malloc_size = block_count;
     } else {
@@ -466,7 +466,7 @@
 	self->chunk[i].cache_buffer_base =
 	  malloc((block_count > 500 ? block_count : 500) * DVD_VIDEO_LB_LEN + ALIGNMENT);
 	self->chunk[i].cache_buffer =
-	  (uint8_t *)(((int)self->chunk[i].cache_buffer_base & ~(ALIGNMENT - 1)) + ALIGNMENT);
+	  (uint8_t *)(((uintptr_t)self->chunk[i].cache_buffer_base & ~(ALIGNMENT - 1)) + ALIGNMENT);
 	self->chunk[i].cache_malloc_size = block_count > 500 ? block_count : 500;
 	dprintf("pre_cache DVD read malloc %d blocks\n",
 	  (block_count > 500 ? block_count : 500 ));