system/core 64-bit cleanup.
This cleans up most of the size-related problems in system/core.
There are still a few changes needed for a clean 64-bit build,
but they look like they might require changes to things like the
fastboot protocol.
Change-Id: I1560425a289fa158e13e2e3173cc3e71976f92c0
diff --git a/adb/services.c b/adb/services.c
index 951048e..1c9db0d 100644
--- a/adb/services.c
+++ b/adb/services.c
@@ -86,7 +86,7 @@
{
char buf[100];
char value[PROPERTY_VALUE_MAX];
- int port = (int)cookie;
+ int port = (int) (uintptr_t) cookie;
if (port <= 0) {
snprintf(buf, sizeof(buf), "invalid port\n");
@@ -269,7 +269,7 @@
#if !ADB_HOST
static void subproc_waiter_service(int fd, void *cookie)
{
- pid_t pid = (pid_t)cookie;
+ pid_t pid = (pid_t) (uintptr_t) cookie;
D("entered. fd=%d of pid=%d\n", fd, pid);
for (;;) {
@@ -314,7 +314,7 @@
sti = malloc(sizeof(stinfo));
if(sti == 0) fatal("cannot allocate stinfo");
sti->func = subproc_waiter_service;
- sti->cookie = (void*)pid;
+ sti->cookie = (void*) (uintptr_t) pid;
sti->fd = ret_fd;
if(adb_thread_create( &t, service_bootstrap_func, sti)){
@@ -397,7 +397,7 @@
if (sscanf(name + 6, "%d", &port) == 0) {
port = 0;
}
- ret = create_service_thread(restart_tcp_service, (void *)port);
+ ret = create_service_thread(restart_tcp_service, (void *) (uintptr_t) port);
} else if(!strncmp(name, "usb:", 4)) {
ret = create_service_thread(restart_usb_service, NULL);
#endif
diff --git a/adb/sockets.c b/adb/sockets.c
index 7f54ad9..de14a22 100644
--- a/adb/sockets.c
+++ b/adb/sockets.c
@@ -342,7 +342,7 @@
while(avail > 0) {
r = adb_read(fd, x, avail);
- D("LS(%d): post adb_read(fd=%d,...) r=%d (errno=%d) avail=%d\n", s->id, s->fd, r, r<0?errno:0, avail);
+ D("LS(%d): post adb_read(fd=%d,...) r=%d (errno=%d) avail=%zu\n", s->id, s->fd, r, r<0?errno:0, avail);
if(r > 0) {
avail -= r;
x += r;
diff --git a/adb/transport.c b/adb/transport.c
index 224fe55..6002530 100644
--- a/adb/transport.c
+++ b/adb/transport.c
@@ -1142,9 +1142,9 @@
char *p = ptr;
int r;
#if ADB_TRACE
- int len0 = len;
+ size_t len0 = len;
#endif
- D("readx: fd=%d wanted=%d\n", fd, (int)len);
+ D("readx: fd=%d wanted=%zu\n", fd, len);
while(len > 0) {
r = adb_read(fd, p, len);
if(r > 0) {
@@ -1163,7 +1163,7 @@
}
#if ADB_TRACE
- D("readx: fd=%d wanted=%d got=%d\n", fd, len0, len0 - len);
+ D("readx: fd=%d wanted=%zu got=%zu\n", fd, len0, len0 - len);
dump_hex( ptr, len0 );
#endif
return 0;
diff --git a/adb/transport_local.c b/adb/transport_local.c
index 1cfa24d..d2dbca6 100644
--- a/adb/transport_local.c
+++ b/adb/transport_local.c
@@ -159,7 +159,7 @@
int serverfd, fd;
struct sockaddr addr;
socklen_t alen;
- int port = (int)arg;
+ int port = (int) (uintptr_t) arg;
D("transport: server_socket_thread() starting\n");
serverfd = -1;
@@ -241,7 +241,7 @@
/* 'ok' reply from the adb QEMUD service. */
static const char _ok_resp[] = "ok";
- const int port = (int)arg;
+ const int port = (int) (uintptr_t) arg;
int res, fd;
char tmp[256];
char con_name[32];
@@ -326,7 +326,7 @@
D("transport: local %s init\n", HOST ? "client" : "server");
- if(adb_thread_create(&thr, func, (void *)port)) {
+ if(adb_thread_create(&thr, func, (void *) (uintptr_t) port)) {
fatal_errno("cannot create local socket %s thread",
HOST ? "client" : "server");
}
diff --git a/adb/usb_linux.c b/adb/usb_linux.c
index 7bf2057..8ff753e 100644
--- a/adb/usb_linux.c
+++ b/adb/usb_linux.c
@@ -179,7 +179,7 @@
// should have device and configuration descriptors, and atleast two endpoints
if (desclength < USB_DT_DEVICE_SIZE + USB_DT_CONFIG_SIZE) {
- D("desclength %d is too small\n", desclength);
+ D("desclength %zu is too small\n", desclength);
adb_close(fd);
continue;
}
diff --git a/adb/usb_linux_client.c b/adb/usb_linux_client.c
index fb1dad0..69d8062 100644
--- a/adb/usb_linux_client.c
+++ b/adb/usb_linux_client.c
@@ -384,7 +384,7 @@
ret = adb_read(bulk_out, buf + count, length - count);
if (ret < 0) {
if (errno != EINTR) {
- D("[ bulk_read failed fd=%d length=%d count=%d ]\n",
+ D("[ bulk_read failed fd=%d length=%zu count=%zu ]\n",
bulk_out, length, count);
return ret;
}