summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adb/services.c8
-rw-r--r--adb/sockets.c2
-rw-r--r--adb/transport.c6
-rw-r--r--adb/transport_local.c6
-rw-r--r--adb/usb_linux.c2
-rw-r--r--adb/usb_linux_client.c2
-rw-r--r--fastbootd/commands.c3
-rw-r--r--fastbootd/commands/flash.c5
-rw-r--r--fastbootd/secure.c2
-rw-r--r--fastbootd/transport.c4
-rw-r--r--fastbootd/transport_socket.c4
-rw-r--r--fastbootd/usb_linux_client.c4
-rw-r--r--fs_mgr/fs_mgr_verity.c3
-rw-r--r--init/init.c2
-rw-r--r--init/property_service.c6
-rw-r--r--libdiskconfig/diskconfig.c7
-rw-r--r--libion/ion_test.c2
-rw-r--r--libmemtrack/memtrack_test.c2
-rw-r--r--libsparse/output_file.c3
-rw-r--r--logwrapper/logwrapper.c3
-rw-r--r--toolbox/Android.mk2
-rw-r--r--toolbox/dd.c3
-rw-r--r--toolbox/getevent.c2
-rw-r--r--toolbox/insmod.c4
-rw-r--r--toolbox/ls.c4
-rw-r--r--toolbox/nandread.c2
-rw-r--r--toolbox/newfs_msdos.c7
-rw-r--r--toolbox/schedtop.c2
-rw-r--r--toolbox/setconsole.c17
29 files changed, 56 insertions, 63 deletions
diff --git a/adb/services.c b/adb/services.c
index be0cc729c..dcaf276b8 100644
--- a/adb/services.c
+++ b/adb/services.c
@@ -86,7 +86,7 @@ void restart_tcp_service(int fd, void *cookie)
86{ 86{
87 char buf[100]; 87 char buf[100];
88 char value[PROPERTY_VALUE_MAX]; 88 char value[PROPERTY_VALUE_MAX];
89 int port = (int)cookie; 89 int port = (int) (uintptr_t) cookie;
90 90
91 if (port <= 0) { 91 if (port <= 0) {
92 snprintf(buf, sizeof(buf), "invalid port\n"); 92 snprintf(buf, sizeof(buf), "invalid port\n");
@@ -256,7 +256,7 @@ static int create_subprocess(const char *cmd, const char *arg0, const char *arg1
256#if !ADB_HOST 256#if !ADB_HOST
257static void subproc_waiter_service(int fd, void *cookie) 257static void subproc_waiter_service(int fd, void *cookie)
258{ 258{
259 pid_t pid = (pid_t)cookie; 259 pid_t pid = (pid_t) (uintptr_t) cookie;
260 260
261 D("entered. fd=%d of pid=%d\n", fd, pid); 261 D("entered. fd=%d of pid=%d\n", fd, pid);
262 for (;;) { 262 for (;;) {
@@ -301,7 +301,7 @@ static int create_subproc_thread(const char *name)
301 sti = malloc(sizeof(stinfo)); 301 sti = malloc(sizeof(stinfo));
302 if(sti == 0) fatal("cannot allocate stinfo"); 302 if(sti == 0) fatal("cannot allocate stinfo");
303 sti->func = subproc_waiter_service; 303 sti->func = subproc_waiter_service;
304 sti->cookie = (void*)pid; 304 sti->cookie = (void*) (uintptr_t) pid;
305 sti->fd = ret_fd; 305 sti->fd = ret_fd;
306 306
307 if(adb_thread_create( &t, service_bootstrap_func, sti)){ 307 if(adb_thread_create( &t, service_bootstrap_func, sti)){
@@ -382,7 +382,7 @@ int service_to_fd(const char *name)
382 if (sscanf(name + 6, "%d", &port) == 0) { 382 if (sscanf(name + 6, "%d", &port) == 0) {
383 port = 0; 383 port = 0;
384 } 384 }
385 ret = create_service_thread(restart_tcp_service, (void *)port); 385 ret = create_service_thread(restart_tcp_service, (void *) (uintptr_t) port);
386 } else if(!strncmp(name, "usb:", 4)) { 386 } else if(!strncmp(name, "usb:", 4)) {
387 ret = create_service_thread(restart_usb_service, NULL); 387 ret = create_service_thread(restart_usb_service, NULL);
388#endif 388#endif
diff --git a/adb/sockets.c b/adb/sockets.c
index 7f54ad9ff..de14a2254 100644
--- a/adb/sockets.c
+++ b/adb/sockets.c
@@ -342,7 +342,7 @@ static void local_socket_event_func(int fd, unsigned ev, void *_s)
342 342
343 while(avail > 0) { 343 while(avail > 0) {
344 r = adb_read(fd, x, avail); 344 r = adb_read(fd, x, avail);
345 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); 345 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);
346 if(r > 0) { 346 if(r > 0) {
347 avail -= r; 347 avail -= r;
348 x += r; 348 x += r;
diff --git a/adb/transport.c b/adb/transport.c
index 224fe556b..60025308e 100644
--- a/adb/transport.c
+++ b/adb/transport.c
@@ -1142,9 +1142,9 @@ int readx(int fd, void *ptr, size_t len)
1142 char *p = ptr; 1142 char *p = ptr;
1143 int r; 1143 int r;
1144#if ADB_TRACE 1144#if ADB_TRACE
1145 int len0 = len; 1145 size_t len0 = len;
1146#endif 1146#endif
1147 D("readx: fd=%d wanted=%d\n", fd, (int)len); 1147 D("readx: fd=%d wanted=%zu\n", fd, len);
1148 while(len > 0) { 1148 while(len > 0) {
1149 r = adb_read(fd, p, len); 1149 r = adb_read(fd, p, len);
1150 if(r > 0) { 1150 if(r > 0) {
@@ -1163,7 +1163,7 @@ int readx(int fd, void *ptr, size_t len)
1163 } 1163 }
1164 1164
1165#if ADB_TRACE 1165#if ADB_TRACE
1166 D("readx: fd=%d wanted=%d got=%d\n", fd, len0, len0 - len); 1166 D("readx: fd=%d wanted=%zu got=%zu\n", fd, len0, len0 - len);
1167 dump_hex( ptr, len0 ); 1167 dump_hex( ptr, len0 );
1168#endif 1168#endif
1169 return 0; 1169 return 0;
diff --git a/adb/transport_local.c b/adb/transport_local.c
index 1cfa24d7f..d2dbca6f6 100644
--- a/adb/transport_local.c
+++ b/adb/transport_local.c
@@ -159,7 +159,7 @@ static void *server_socket_thread(void * arg)
159 int serverfd, fd; 159 int serverfd, fd;
160 struct sockaddr addr; 160 struct sockaddr addr;
161 socklen_t alen; 161 socklen_t alen;
162 int port = (int)arg; 162 int port = (int) (uintptr_t) arg;
163 163
164 D("transport: server_socket_thread() starting\n"); 164 D("transport: server_socket_thread() starting\n");
165 serverfd = -1; 165 serverfd = -1;
@@ -241,7 +241,7 @@ static const char _start_req[] = "start";
241/* 'ok' reply from the adb QEMUD service. */ 241/* 'ok' reply from the adb QEMUD service. */
242static const char _ok_resp[] = "ok"; 242static const char _ok_resp[] = "ok";
243 243
244 const int port = (int)arg; 244 const int port = (int) (uintptr_t) arg;
245 int res, fd; 245 int res, fd;
246 char tmp[256]; 246 char tmp[256];
247 char con_name[32]; 247 char con_name[32];
@@ -326,7 +326,7 @@ void local_init(int port)
326 326
327 D("transport: local %s init\n", HOST ? "client" : "server"); 327 D("transport: local %s init\n", HOST ? "client" : "server");
328 328
329 if(adb_thread_create(&thr, func, (void *)port)) { 329 if(adb_thread_create(&thr, func, (void *) (uintptr_t) port)) {
330 fatal_errno("cannot create local socket %s thread", 330 fatal_errno("cannot create local socket %s thread",
331 HOST ? "client" : "server"); 331 HOST ? "client" : "server");
332 } 332 }
diff --git a/adb/usb_linux.c b/adb/usb_linux.c
index 7bf205753..8ff753e43 100644
--- a/adb/usb_linux.c
+++ b/adb/usb_linux.c
@@ -179,7 +179,7 @@ static void find_usb_device(const char *base,
179 179
180 // should have device and configuration descriptors, and atleast two endpoints 180 // should have device and configuration descriptors, and atleast two endpoints
181 if (desclength < USB_DT_DEVICE_SIZE + USB_DT_CONFIG_SIZE) { 181 if (desclength < USB_DT_DEVICE_SIZE + USB_DT_CONFIG_SIZE) {
182 D("desclength %d is too small\n", desclength); 182 D("desclength %zu is too small\n", desclength);
183 adb_close(fd); 183 adb_close(fd);
184 continue; 184 continue;
185 } 185 }
diff --git a/adb/usb_linux_client.c b/adb/usb_linux_client.c
index fb1dad05f..69d806277 100644
--- a/adb/usb_linux_client.c
+++ b/adb/usb_linux_client.c
@@ -384,7 +384,7 @@ static int bulk_read(int bulk_out, char *buf, size_t length)
384 ret = adb_read(bulk_out, buf + count, length - count); 384 ret = adb_read(bulk_out, buf + count, length - count);
385 if (ret < 0) { 385 if (ret < 0) {
386 if (errno != EINTR) { 386 if (errno != EINTR) {
387 D("[ bulk_read failed fd=%d length=%d count=%d ]\n", 387 D("[ bulk_read failed fd=%d length=%zu count=%zu ]\n",
388 bulk_out, length, count); 388 bulk_out, length, count);
389 return ret; 389 return ret;
390 } 390 }
diff --git a/fastbootd/commands.c b/fastbootd/commands.c
index d8a601f52..063e1a600 100644
--- a/fastbootd/commands.c
+++ b/fastbootd/commands.c
@@ -29,6 +29,7 @@
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <inttypes.h>
32#include <stdlib.h> 33#include <stdlib.h>
33#include <unistd.h> 34#include <unistd.h>
34#include <sys/types.h> 35#include <sys/types.h>
@@ -319,7 +320,7 @@ static void cmd_flash(struct protocol_handle *phandle, const char *arg)
319 return; 320 return;
320 } 321 }
321 322
322 D(INFO, "writing %lld bytes to '%s'\n", sz, arg); 323 D(INFO, "writing %"PRId64" bytes to '%s'\n", sz, arg);
323 324
324 if (flash_write(partition, phandle->download_fd, sz, header_sz)) { 325 if (flash_write(partition, phandle->download_fd, sz, header_sz)) {
325 fastboot_fail(phandle, "flash write failure"); 326 fastboot_fail(phandle, "flash write failure");
diff --git a/fastbootd/commands/flash.c b/fastbootd/commands/flash.c
index 0954217b5..1eb4d1b33 100644
--- a/fastbootd/commands/flash.c
+++ b/fastbootd/commands/flash.c
@@ -31,6 +31,7 @@
31 31
32#include <sys/stat.h> 32#include <sys/stat.h>
33#include <fcntl.h> 33#include <fcntl.h>
34#include <inttypes.h>
34#include <sys/mman.h> 35#include <sys/mman.h>
35 36
36#include "flash.h" 37#include "flash.h"
@@ -82,7 +83,7 @@ int flash_erase(int fd)
82{ 83{
83 int64_t size; 84 int64_t size;
84 size = get_block_device_size(fd); 85 size = get_block_device_size(fd);
85 D(DEBUG, "erase %llu data from %d\n", size, fd); 86 D(DEBUG, "erase %"PRId64" data from %d\n", size, fd);
86 87
87 return wipe_block_device(fd, size); 88 return wipe_block_device(fd, size);
88} 89}
@@ -97,7 +98,7 @@ int flash_write(int partition_fd, int data_fd, ssize_t size, ssize_t skip)
97 int current_size = MIN(size - written, BUFFER_SIZE); 98 int current_size = MIN(size - written, BUFFER_SIZE);
98 99
99 if (gpt_mmap(&input, written + skip, current_size, data_fd)) { 100 if (gpt_mmap(&input, written + skip, current_size, data_fd)) {
100 D(ERR, "Error in writing data, unable to map data file %d at %d size %d", size, skip, current_size); 101 D(ERR, "Error in writing data, unable to map data file %zd at %zd size %d", size, skip, current_size);
101 return -1; 102 return -1;
102 } 103 }
103 if (gpt_mmap(&output, written, current_size, partition_fd)) { 104 if (gpt_mmap(&output, written, current_size, partition_fd)) {
diff --git a/fastbootd/secure.c b/fastbootd/secure.c
index a657ad4da..186e0268d 100644
--- a/fastbootd/secure.c
+++ b/fastbootd/secure.c
@@ -151,7 +151,7 @@ int cert_verify(BIO *content, CMS_ContentInfo *content_info, X509_STORE *store,
151 char buf[256]; 151 char buf[256];
152 unsigned long err = ERR_peek_last_error(); 152 unsigned long err = ERR_peek_last_error();
153 D(ERR, "Verification failed with reason: %s, %s", ERR_lib_error_string(err), ERR_error_string(err, buf)); 153 D(ERR, "Verification failed with reason: %s, %s", ERR_lib_error_string(err), ERR_error_string(err, buf));
154 D(ERR, "Data used: content %d", (int) content); 154 D(ERR, "Data used: content %p", content);
155 } 155 }
156 156
157 ERR_clear_error(); 157 ERR_clear_error();
diff --git a/fastbootd/transport.c b/fastbootd/transport.c
index 19a705c6e..ce8f9d096 100644
--- a/fastbootd/transport.c
+++ b/fastbootd/transport.c
@@ -56,14 +56,14 @@ int transport_handle_download(struct transport_handle *thandle, size_t len)
56 56
57 buffer = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); 57 buffer = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
58 if (buffer == NULL) { 58 if (buffer == NULL) {
59 D(ERR, "mmap(%u) failed: %d %s", len, errno, strerror(errno)); 59 D(ERR, "mmap(%zu) failed: %d %s", len, errno, strerror(errno));
60 goto err; 60 goto err;
61 } 61 }
62 62
63 while (n < len) { 63 while (n < len) {
64 ret = thandle->transport->read(thandle, buffer + n, len - n); 64 ret = thandle->transport->read(thandle, buffer + n, len - n);
65 if (ret <= 0) { 65 if (ret <= 0) {
66 D(WARN, "transport read failed, ret=%d %s", ret, strerror(-ret)); 66 D(WARN, "transport read failed, ret=%zd %s", ret, strerror(-ret));
67 break; 67 break;
68 } 68 }
69 n += ret; 69 n += ret;
diff --git a/fastbootd/transport_socket.c b/fastbootd/transport_socket.c
index ff0f3bdc8..664d4737f 100644
--- a/fastbootd/transport_socket.c
+++ b/fastbootd/transport_socket.c
@@ -88,7 +88,7 @@ ssize_t socket_write(struct transport_handle *thandle, const void *data, size_t
88 ssize_t ret; 88 ssize_t ret;
89 struct socket_handle *handle = container_of(thandle, struct socket_handle, handle); 89 struct socket_handle *handle = container_of(thandle, struct socket_handle, handle);
90 90
91 D(DEBUG, "about to write (fd=%d, len=%d)", handle->fd, len); 91 D(DEBUG, "about to write (fd=%d, len=%zu)", handle->fd, len);
92 ret = bulk_write(handle->fd, data, len); 92 ret = bulk_write(handle->fd, data, len);
93 if (ret < 0) { 93 if (ret < 0) {
94 D(ERR, "ERROR: fd = %d, ret = %zd", handle->fd, ret); 94 D(ERR, "ERROR: fd = %d, ret = %zd", handle->fd, ret);
@@ -103,7 +103,7 @@ ssize_t socket_read(struct transport_handle *thandle, void *data, size_t len)
103 ssize_t ret; 103 ssize_t ret;
104 struct socket_handle *handle = container_of(thandle, struct socket_handle, handle); 104 struct socket_handle *handle = container_of(thandle, struct socket_handle, handle);
105 105
106 D(DEBUG, "about to read (fd=%d, len=%d)", handle->fd, len); 106 D(DEBUG, "about to read (fd=%d, len=%zu)", handle->fd, len);
107 ret = bulk_read(handle->fd, data, len); 107 ret = bulk_read(handle->fd, data, len);
108 if (ret < 0) { 108 if (ret < 0) {
109 D(ERR, "ERROR: fd = %d, ret = %zd", handle->fd, ret); 109 D(ERR, "ERROR: fd = %d, ret = %zd", handle->fd, ret);
diff --git a/fastbootd/usb_linux_client.c b/fastbootd/usb_linux_client.c
index 7a8e46f3e..64420e986 100644
--- a/fastbootd/usb_linux_client.c
+++ b/fastbootd/usb_linux_client.c
@@ -217,7 +217,7 @@ static ssize_t usb_write(struct transport_handle *thandle, const void *data, siz
217 struct transport *t = thandle->transport; 217 struct transport *t = thandle->transport;
218 struct usb_transport *usb_transport = container_of(t, struct usb_transport, transport); 218 struct usb_transport *usb_transport = container_of(t, struct usb_transport, transport);
219 219
220 D(DEBUG, "about to write (fd=%d, len=%d)", usb_transport->bulk_in, len); 220 D(DEBUG, "about to write (fd=%d, len=%zu)", usb_transport->bulk_in, len);
221 ret = bulk_write(usb_transport->bulk_in, data, len); 221 ret = bulk_write(usb_transport->bulk_in, data, len);
222 if (ret < 0) { 222 if (ret < 0) {
223 D(ERR, "ERROR: fd = %d, ret = %zd", usb_transport->bulk_in, ret); 223 D(ERR, "ERROR: fd = %d, ret = %zd", usb_transport->bulk_in, ret);
@@ -233,7 +233,7 @@ ssize_t usb_read(struct transport_handle *thandle, void *data, size_t len)
233 struct transport *t = thandle->transport; 233 struct transport *t = thandle->transport;
234 struct usb_transport *usb_transport = container_of(t, struct usb_transport, transport); 234 struct usb_transport *usb_transport = container_of(t, struct usb_transport, transport);
235 235
236 D(DEBUG, "about to read (fd=%d, len=%d)", usb_transport->bulk_out, len); 236 D(DEBUG, "about to read (fd=%d, len=%zu)", usb_transport->bulk_out, len);
237 ret = bulk_read(usb_transport->bulk_out, data, len); 237 ret = bulk_read(usb_transport->bulk_out, data, len);
238 if (ret < 0) { 238 if (ret < 0) {
239 D(ERR, "ERROR: fd = %d, ret = %zd", usb_transport->bulk_out, ret); 239 D(ERR, "ERROR: fd = %d, ret = %zd", usb_transport->bulk_out, ret);
diff --git a/fs_mgr/fs_mgr_verity.c b/fs_mgr/fs_mgr_verity.c
index 969eab2a0..154931684 100644
--- a/fs_mgr/fs_mgr_verity.c
+++ b/fs_mgr/fs_mgr_verity.c
@@ -14,6 +14,7 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17#include <inttypes.h>
17#include <stdio.h> 18#include <stdio.h>
18#include <stdlib.h> 19#include <stdlib.h>
19#include <string.h> 20#include <string.h>
@@ -178,7 +179,7 @@ static int read_verity_metadata(char *block_device, char **signature, char **tab
178 goto out; 179 goto out;
179 } 180 }
180 if (magic_number != VERITY_METADATA_MAGIC_NUMBER) { 181 if (magic_number != VERITY_METADATA_MAGIC_NUMBER) {
181 ERROR("Couldn't find verity metadata at offset %llu!\n", device_length); 182 ERROR("Couldn't find verity metadata at offset %"PRIu64"!\n", device_length);
182 goto out; 183 goto out;
183 } 184 }
184 185
diff --git a/init/init.c b/init/init.c
index ab52749fd..4266a73c4 100644
--- a/init/init.c
+++ b/init/init.c
@@ -623,7 +623,7 @@ static int mix_hwrng_into_linux_rng_action(int nargs, char **args)
623 total_bytes_written += chunk_size; 623 total_bytes_written += chunk_size;
624 } 624 }
625 625
626 INFO("Mixed %d bytes from /dev/hw_random into /dev/urandom", 626 INFO("Mixed %zu bytes from /dev/hw_random into /dev/urandom",
627 total_bytes_written); 627 total_bytes_written);
628 result = 0; 628 result = 0;
629 629
diff --git a/init/property_service.c b/init/property_service.c
index 1b9327ce3..a9bf9b4ca 100644
--- a/init/property_service.c
+++ b/init/property_service.c
@@ -168,7 +168,7 @@ static int check_mac_perms(const char *name, char *sctx)
168 if (selabel_lookup(sehandle_prop, &tctx, name, 1) != 0) 168 if (selabel_lookup(sehandle_prop, &tctx, name, 1) != 0)
169 goto err; 169 goto err;
170 170
171 if (selinux_check_access(sctx, tctx, class, perm, name) == 0) 171 if (selinux_check_access(sctx, tctx, class, perm, (void*) name) == 0)
172 result = 1; 172 result = 1;
173 173
174 freecon(tctx); 174 freecon(tctx);
@@ -380,7 +380,7 @@ void handle_property_set_fd()
380 380
381 r = TEMP_FAILURE_RETRY(recv(s, &msg, sizeof(msg), 0)); 381 r = TEMP_FAILURE_RETRY(recv(s, &msg, sizeof(msg), 0));
382 if(r != sizeof(prop_msg)) { 382 if(r != sizeof(prop_msg)) {
383 ERROR("sys_prop: mis-match msg size received: %d expected: %d errno: %d\n", 383 ERROR("sys_prop: mis-match msg size received: %d expected: %zu errno: %d\n",
384 r, sizeof(prop_msg), errno); 384 r, sizeof(prop_msg), errno);
385 close(s); 385 close(s);
386 return; 386 return;
@@ -520,7 +520,7 @@ static void load_persistent_properties()
520 || (sb.st_uid != 0) 520 || (sb.st_uid != 0)
521 || (sb.st_gid != 0) 521 || (sb.st_gid != 0)
522 || (sb.st_nlink != 1)) { 522 || (sb.st_nlink != 1)) {
523 ERROR("skipping insecure property file %s (uid=%lu gid=%lu nlink=%d mode=%o)\n", 523 ERROR("skipping insecure property file %s (uid=%u gid=%u nlink=%d mode=%o)\n",
524 entry->d_name, sb.st_uid, sb.st_gid, sb.st_nlink, sb.st_mode); 524 entry->d_name, sb.st_uid, sb.st_gid, sb.st_nlink, sb.st_mode);
525 close(fd); 525 close(fd);
526 continue; 526 continue;
diff --git a/libdiskconfig/diskconfig.c b/libdiskconfig/diskconfig.c
index d5425de03..6fd81b714 100644
--- a/libdiskconfig/diskconfig.c
+++ b/libdiskconfig/diskconfig.c
@@ -19,6 +19,7 @@
19 19
20#include <errno.h> 20#include <errno.h>
21#include <fcntl.h> 21#include <fcntl.h>
22#include <inttypes.h>
22#include <stdio.h> 23#include <stdio.h>
23#include <stdlib.h> 24#include <stdlib.h>
24#include <string.h> 25#include <string.h>
@@ -80,7 +81,7 @@ parse_len(const char *str, uint64_t *plen)
80 *plen *= multiple; 81 *plen *= multiple;
81 82
82 if (*plen > 0xffffffffULL) { 83 if (*plen > 0xffffffffULL) {
83 ALOGE("Length specified is too large!: %llu KB", *plen); 84 ALOGE("Length specified is too large!: %"PRIu64" KB", *plen);
84 return 1; 85 return 1;
85 } 86 }
86 } 87 }
@@ -371,8 +372,8 @@ validate(struct disk_info *dinfo)
371 372
372 /* only matters for disks, not files */ 373 /* only matters for disks, not files */
373 if (S_ISBLK(stat.st_mode) && total_size > disk_size) { 374 if (S_ISBLK(stat.st_mode) && total_size > disk_size) {
374 ALOGE("Total requested size of partitions (%llu) is greater than disk " 375 ALOGE("Total requested size of partitions (%"PRIu64") is greater than disk "
375 "size (%llu).", total_size, disk_size); 376 "size (%"PRIu64").", total_size, disk_size);
376 goto fail; 377 goto fail;
377 } 378 }
378 379
diff --git a/libion/ion_test.c b/libion/ion_test.c
index 12163e936..887228283 100644
--- a/libion/ion_test.c
+++ b/libion/ion_test.c
@@ -63,7 +63,7 @@ void ion_alloc_test()
63 63
64 ret = ion_free(fd, handle); 64 ret = ion_free(fd, handle);
65 if (ret) { 65 if (ret) {
66 printf("%s failed: %s %p\n", __func__, strerror(ret), handle); 66 printf("%s failed: %s %d\n", __func__, strerror(ret), handle);
67 return; 67 return;
68 } 68 }
69 ion_close(fd); 69 ion_close(fd);
diff --git a/libmemtrack/memtrack_test.c b/libmemtrack/memtrack_test.c
index cd94bc5e1..eaadfa705 100644
--- a/libmemtrack/memtrack_test.c
+++ b/libmemtrack/memtrack_test.c
@@ -35,7 +35,7 @@ static int getprocname(pid_t pid, char *buf, int len) {
35 return -1; 35 return -1;
36 } 36 }
37 37
38 if (asprintf(&filename, "/proc/%zd/cmdline", pid) < 0) { 38 if (asprintf(&filename, "/proc/%d/cmdline", pid) < 0) {
39 rc = 1; 39 rc = 1;
40 goto exit; 40 goto exit;
41 } 41 }
diff --git a/libsparse/output_file.c b/libsparse/output_file.c
index a28b0a5ad..e63c4a929 100644
--- a/libsparse/output_file.c
+++ b/libsparse/output_file.c
@@ -18,6 +18,7 @@
18#define _LARGEFILE64_SOURCE 1 18#define _LARGEFILE64_SOURCE 1
19 19
20#include <fcntl.h> 20#include <fcntl.h>
21#include <inttypes.h>
21#include <limits.h> 22#include <limits.h>
22#include <stdbool.h> 23#include <stdbool.h>
23#include <stddef.h> 24#include <stddef.h>
@@ -342,7 +343,7 @@ static int write_sparse_skip_chunk(struct output_file *out, int64_t skip_len)
342 int ret, chunk; 343 int ret, chunk;
343 344
344 if (skip_len % out->block_size) { 345 if (skip_len % out->block_size) {
345 error("don't care size %llu is not a multiple of the block size %u", 346 error("don't care size %"PRIi64" is not a multiple of the block size %u",
346 skip_len, out->block_size); 347 skip_len, out->block_size);
347 return -1; 348 return -1;
348 } 349 }
diff --git a/logwrapper/logwrapper.c b/logwrapper/logwrapper.c
index db6cb4c3b..9e0385db2 100644
--- a/logwrapper/logwrapper.c
+++ b/logwrapper/logwrapper.c
@@ -90,7 +90,8 @@ int main(int argc, char* argv[]) {
90 } 90 }
91 91
92 if (seg_fault_on_exit) { 92 if (seg_fault_on_exit) {
93 *(int *)status = 0; // causes SIGSEGV with fault_address = status 93 uintptr_t fault_address = (uintptr_t) status;
94 *(int *) fault_address = 0; // causes SIGSEGV with fault_address = status
94 } 95 }
95 96
96 return rc; 97 return rc;
diff --git a/toolbox/Android.mk b/toolbox/Android.mk
index c5890b2c8..138f45574 100644
--- a/toolbox/Android.mk
+++ b/toolbox/Android.mk
@@ -90,6 +90,8 @@ LOCAL_SRC_FILES := \
90 90
91LOCAL_C_INCLUDES := bionic/libc/bionic 91LOCAL_C_INCLUDES := bionic/libc/bionic
92 92
93LOCAL_CFLAGS += -Wno-unused-parameter
94
93LOCAL_SHARED_LIBRARIES := \ 95LOCAL_SHARED_LIBRARIES := \
94 libcutils \ 96 libcutils \
95 liblog \ 97 liblog \
diff --git a/toolbox/dd.c b/toolbox/dd.c
index a8c12d285..6b61ffb12 100644
--- a/toolbox/dd.c
+++ b/toolbox/dd.c
@@ -92,9 +92,6 @@ extern u_int files_cnt;
92extern int progress; 92extern int progress;
93extern const u_char *ctab; 93extern const u_char *ctab;
94 94
95
96#define MIN(a, b) ((a) < (b) ? (a) : (b))
97#define MAX(a, b) ((a) > (b) ? (a) : (b))
98#define DEFFILEMODE (S_IRUSR | S_IWUSR) 95#define DEFFILEMODE (S_IRUSR | S_IWUSR)
99 96
100static void dd_close(void); 97static void dd_close(void);
diff --git a/toolbox/getevent.c b/toolbox/getevent.c
index f435a1ca0..c979c99da 100644
--- a/toolbox/getevent.c
+++ b/toolbox/getevent.c
@@ -166,7 +166,7 @@ static int print_possible_events(int fd, int print_flags)
166 if(bit_labels && (print_flags & PRINT_LABELS)) { 166 if(bit_labels && (print_flags & PRINT_LABELS)) {
167 bit_label = get_label(bit_labels, j * 8 + k); 167 bit_label = get_label(bit_labels, j * 8 + k);
168 if(bit_label) 168 if(bit_label)
169 printf(" %.20s%c%*s", bit_label, down, 20 - strlen(bit_label), ""); 169 printf(" %.20s%c%*s", bit_label, down, (int) (20 - strlen(bit_label)), "");
170 else 170 else
171 printf(" %04x%c ", j * 8 + k, down); 171 printf(" %04x%c ", j * 8 + k, down);
172 } else { 172 } else {
diff --git a/toolbox/insmod.c b/toolbox/insmod.c
index 756a64b94..fb1448ba5 100644
--- a/toolbox/insmod.c
+++ b/toolbox/insmod.c
@@ -4,6 +4,7 @@
4#include <unistd.h> 4#include <unistd.h>
5#include <malloc.h> 5#include <malloc.h>
6#include <errno.h> 6#include <errno.h>
7#include <sys/param.h>
7#include <sys/types.h> 8#include <sys/types.h>
8#include <sys/stat.h> 9#include <sys/stat.h>
9#include <unistd.h> 10#include <unistd.h>
@@ -45,7 +46,6 @@ bail:
45 return buffer; 46 return buffer;
46} 47}
47 48
48#define min(x,y) ((x) < (y) ? (x) : (y))
49int insmod_main(int argc, char **argv) 49int insmod_main(int argc, char **argv)
50{ 50{
51 void *file; 51 void *file;
@@ -73,7 +73,7 @@ int insmod_main(int argc, char **argv)
73 char *ptr = opts; 73 char *ptr = opts;
74 74
75 for (i = 2; (i < argc) && (ptr < end); i++) { 75 for (i = 2; (i < argc) && (ptr < end); i++) {
76 len = min(strlen(argv[i]), end - ptr); 76 len = MIN(strlen(argv[i]), end - ptr);
77 memcpy(ptr, argv[i], len); 77 memcpy(ptr, argv[i], len);
78 ptr += len; 78 ptr += len;
79 *ptr++ = ' '; 79 *ptr++ = ' ';
diff --git a/toolbox/ls.c b/toolbox/ls.c
index c740f847e..3cc5bb2c0 100644
--- a/toolbox/ls.c
+++ b/toolbox/ls.c
@@ -182,8 +182,8 @@ static int listfile_long(const char *path, struct stat *s, int flags)
182 182
183 mode2str(s->st_mode, mode); 183 mode2str(s->st_mode, mode);
184 if (flags & LIST_LONG_NUMERIC) { 184 if (flags & LIST_LONG_NUMERIC) {
185 snprintf(user, sizeof(user), "%ld", s->st_uid); 185 snprintf(user, sizeof(user), "%u", s->st_uid);
186 snprintf(group, sizeof(group), "%ld", s->st_gid); 186 snprintf(group, sizeof(group), "%u", s->st_gid);
187 } else { 187 } else {
188 user2str(s->st_uid, user, sizeof(user)); 188 user2str(s->st_uid, user, sizeof(user));
189 group2str(s->st_gid, group, sizeof(group)); 189 group2str(s->st_gid, group, sizeof(group));
diff --git a/toolbox/nandread.c b/toolbox/nandread.c
index 4666f2656..d43b2febe 100644
--- a/toolbox/nandread.c
+++ b/toolbox/nandread.c
@@ -158,7 +158,7 @@ int nandread_main(int argc, char **argv)
158 printf("oobavail: %u\n", ecclayout.oobavail); 158 printf("oobavail: %u\n", ecclayout.oobavail);
159 } 159 }
160 if (ecclayout.oobavail > spare_size) 160 if (ecclayout.oobavail > spare_size)
161 printf("oobavail, %d > image spare size, %d\n", ecclayout.oobavail, spare_size); 161 printf("oobavail, %d > image spare size, %zu\n", ecclayout.oobavail, spare_size);
162 162
163 ret = ioctl(fd, ECCGETSTATS, &initial_ecc); 163 ret = ioctl(fd, ECCGETSTATS, &initial_ecc);
164 if (ret) { 164 if (ret) {
diff --git a/toolbox/newfs_msdos.c b/toolbox/newfs_msdos.c
index 6d78eb695..27dca420b 100644
--- a/toolbox/newfs_msdos.c
+++ b/toolbox/newfs_msdos.c
@@ -234,13 +234,6 @@ static void mklabel(u_int8_t *, const char *);
234static void setstr(u_int8_t *, const char *, size_t); 234static void setstr(u_int8_t *, const char *, size_t);
235static void usage(void); 235static void usage(void);
236 236
237#ifdef ANDROID
238#define powerof2(x) ((((x) - 1) & (x)) == 0)
239#define howmany(x, y) (((x) + ((y) - 1)) / (y))
240#define MAX(x,y) ((x) > (y) ? (x) : (y))
241#define MIN(a, b) ((a) < (b) ? (a) : (b))
242
243#endif
244/* 237/*
245 * Construct a FAT12, FAT16, or FAT32 file system. 238 * Construct a FAT12, FAT16, or FAT32 file system.
246 */ 239 */
diff --git a/toolbox/schedtop.c b/toolbox/schedtop.c
index 6859b50bc..a76f968f3 100644
--- a/toolbox/schedtop.c
+++ b/toolbox/schedtop.c
@@ -212,7 +212,7 @@ static void update_table(DIR *d, uint32_t flags)
212 } 212 }
213 if (!(flags & FLAG_BATCH)) 213 if (!(flags & FLAG_BATCH))
214 printf("\e[H\e[0J"); 214 printf("\e[H\e[0J");
215 printf("Processes: %d, Threads %d\n", processes.active, threads.active); 215 printf("Processes: %zu, Threads %zu\n", processes.active, threads.active);
216 switch (time_dp) { 216 switch (time_dp) {
217 case 3: 217 case 3:
218 printf(" TID --- SINCE LAST ---- ---------- TOTAL ----------\n"); 218 printf(" TID --- SINCE LAST ---- ---------- TOTAL ----------\n");
diff --git a/toolbox/setconsole.c b/toolbox/setconsole.c
index 0159c07ee..85ea7c2f5 100644
--- a/toolbox/setconsole.c
+++ b/toolbox/setconsole.c
@@ -12,12 +12,9 @@
12static int activate_thread_switch_vc; 12static int activate_thread_switch_vc;
13static void *activate_thread(void *arg) 13static void *activate_thread(void *arg)
14{ 14{
15 int res; 15 int fd = (int) (uintptr_t) arg;
16 int fd = (int)arg;
17 while(activate_thread_switch_vc >= 0) { 16 while(activate_thread_switch_vc >= 0) {
18 do { 17 int res = TEMP_FAILURE_RETRY(ioctl(fd, VT_ACTIVATE, activate_thread_switch_vc));
19 res = ioctl(fd, VT_ACTIVATE, (void*)activate_thread_switch_vc);
20 } while(res < 0 && errno == EINTR);
21 if (res < 0) { 18 if (res < 0) {
22 fprintf(stderr, "ioctl( vcfd, VT_ACTIVATE, vtnum) failed, %d %d %s for %d\n", res, errno, strerror(errno), activate_thread_switch_vc); 19 fprintf(stderr, "ioctl( vcfd, VT_ACTIVATE, vtnum) failed, %d %d %s for %d\n", res, errno, strerror(errno), activate_thread_switch_vc);
23 } 20 }
@@ -131,11 +128,9 @@ int setconsole_main(int argc, char *argv[])
131 activate_thread_switch_vc = switch_vc; 128 activate_thread_switch_vc = switch_vc;
132 pthread_attr_init(&attr); 129 pthread_attr_init(&attr);
133 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); 130 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
134 pthread_create(&thread, &attr, activate_thread, (void*)fd); 131 pthread_create(&thread, &attr, activate_thread, (void*) (uintptr_t) fd);
135 132
136 do { 133 res = TEMP_FAILURE_RETRY(ioctl(fd, VT_WAITACTIVE, switch_vc));
137 res = ioctl(fd, VT_WAITACTIVE, (void*)switch_vc);
138 } while(res < 0 && errno == EINTR);
139 activate_thread_switch_vc = -1; 134 activate_thread_switch_vc = -1;
140 if (res < 0) { 135 if (res < 0) {
141 fprintf(stderr, "ioctl( vcfd, VT_WAITACTIVE, vtnum) failed, %d %d %s for %d\n", res, errno, strerror(errno), switch_vc); 136 fprintf(stderr, "ioctl( vcfd, VT_WAITACTIVE, vtnum) failed, %d %d %s for %d\n", res, errno, strerror(errno), switch_vc);
@@ -157,7 +152,7 @@ int setconsole_main(int argc, char *argv[])
157 } 152 }
158 } 153 }
159 if (mode != -1) { 154 if (mode != -1) {
160 if (ioctl(fd, KDSETMODE, (void*)mode) < 0) { 155 if (ioctl(fd, KDSETMODE, mode) < 0) {
161 fprintf(stderr, "KDSETMODE %d failed\n", mode); 156 fprintf(stderr, "KDSETMODE %d failed\n", mode);
162 return -1; 157 return -1;
163 } 158 }