aboutsummaryrefslogtreecommitdiffstats
path: root/android/utils
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2010-10-20 19:07:28 +0200
committerDavid 'Digit' Turner <digit@android.com>2010-10-21 17:03:05 +0200
commitd9b6cb97a8a9e93f1bbe5351874b03f7faa81783 (patch)
treeed29b83a936789ffcc40d1170f6ff5c0653831c6 /android/utils
parent7d98eae200f294f51ada36d9b01591fc4726dd94 (diff)
downloadexternal_qemu-d9b6cb97a8a9e93f1bbe5351874b03f7faa81783.zip
external_qemu-d9b6cb97a8a9e93f1bbe5351874b03f7faa81783.tar.gz
external_qemu-d9b6cb97a8a9e93f1bbe5351874b03f7faa81783.tar.bz2
Fix linux-x86_64 build.
Fix various 64-bitness issues in the source code to make the --try-64 option work again on Linux. Note that the generated binary is not faster than its 32-bit variant when it comes to benchmarking the boot sequence. Change-Id: Iad248e033757d4cd25524a438a5dbe1cf3aca6cf
Diffstat (limited to 'android/utils')
-rw-r--r--android/utils/mapfile.c10
-rw-r--r--android/utils/mapfile.h2
-rw-r--r--android/utils/system.c2
-rw-r--r--android/utils/timezone.c2
4 files changed, 8 insertions, 8 deletions
diff --git a/android/utils/mapfile.c b/android/utils/mapfile.c
index 102dfd8..61b57c4 100644
--- a/android/utils/mapfile.c
+++ b/android/utils/mapfile.c
@@ -88,7 +88,7 @@ mapfile_open(const char* path, int oflag, int share_mode)
int file_handle = open(path, oflag, share_mode);
#endif // WIN32
- return (MapFile*)file_handle;
+ return (MapFile*)(ptrdiff_t)file_handle;
}
int
@@ -102,7 +102,7 @@ mapfile_close(MapFile* handle)
return -1;
}
#else // WIN32
- return close((int)handle);
+ return close((int)(ptrdiff_t)handle);
#endif // WIN32
}
@@ -122,7 +122,7 @@ mapfile_read(MapFile* handle, void* buf, size_t nbyte)
#else // WIN32
ssize_t ret;
do {
- ret = read((int)handle, buf, nbyte);
+ ret = read((int)(ptrdiff_t)handle, buf, nbyte);
} while (ret < 0 && errno == EINTR);
return ret;
#endif // WIN32
@@ -142,7 +142,7 @@ mapfile_read_at(MapFile* handle, size_t offset, void* buf, size_t nbyte)
}
return mapfile_read(handle, buf, nbyte);
#else // WIN32
- ssize_t res = lseek((int)handle, offset, SEEK_SET);
+ ssize_t res = lseek((int)(ptrdiff_t)handle, offset, SEEK_SET);
return res >= 0 ? mapfile_read(handle, buf, nbyte) : res;
#endif // WIN32
}
@@ -223,7 +223,7 @@ mapfile_map(MapFile* handle,
}
#else // WIN32
mapped_at =
- mmap(0, map_size, PROT_READ, MAP_SHARED, (int)handle, map_offset);
+ mmap(0, map_size, PROT_READ, MAP_SHARED, (int)(ptrdiff_t)handle, map_offset);
if (mapped_at == MAP_FAILED) {
return NULL;
}
diff --git a/android/utils/mapfile.h b/android/utils/mapfile.h
index c125337..18f8845 100644
--- a/android/utils/mapfile.h
+++ b/android/utils/mapfile.h
@@ -39,7 +39,7 @@ typedef struct MapFile MapFile;
static inline int
mapfile_is_valid(MapFile* handle)
{
- return (int)handle != -1;
+ return handle != (void*)(ptrdiff_t)-1;
}
/* Opens file in selected mode.
diff --git a/android/utils/system.c b/android/utils/system.c
index 8443877..5b20b4b 100644
--- a/android/utils/system.c
+++ b/android/utils/system.c
@@ -66,7 +66,7 @@ android_realloc( void* block, size_t size )
if (block2 != NULL)
return block2;
- fprintf(stderr, "PANIC: not enough memory to reallocate %d bytes\n", size);
+ fprintf(stderr, "PANIC: not enough memory to reallocate %lld bytes\n", (uint64_t)size);
exit(1);
return NULL;
}
diff --git a/android/utils/timezone.c b/android/utils/timezone.c
index 2707e2e..1b99917 100644
--- a/android/utils/timezone.c
+++ b/android/utils/timezone.c
@@ -185,7 +185,7 @@ compare_timezone_to_localtime( ScanDataRec* scan,
}
if ( st.st_size != scan->localtime_st.st_size ) {
- D( " size mistmatch (%lld != %lld)\n", st.st_size, scan->localtime_st.st_size );
+ D( " size mistmatch (%zd != %zd)\n", (size_t)st.st_size, (size_t)scan->localtime_st.st_size );
return 0;
}