summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fastboot/Android.mk3
-rw-r--r--fastboot/engine.c13
-rw-r--r--fastboot/fastboot.c36
-rw-r--r--fastboot/protocol.c3
-rw-r--r--fastboot/usb_linux.c3
-rw-r--r--fastboot/usb_windows.c2
-rw-r--r--fastboot/usbtest.c14
7 files changed, 32 insertions, 42 deletions
diff --git a/fastboot/Android.mk b/fastboot/Android.mk
index 05ddf2a..73794a0 100644
--- a/fastboot/Android.mk
+++ b/fastboot/Android.mk
@@ -21,7 +21,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../mkbootimg \
LOCAL_SRC_FILES := protocol.c engine.c bootimg.c fastboot.c util.c fs.c
LOCAL_MODULE := fastboot
LOCAL_MODULE_TAGS := debug
-LOCAL_CFLAGS += -std=gnu99
+LOCAL_CFLAGS += -std=gnu99 -Werror
ifeq ($(HOST_OS),linux)
LOCAL_SRC_FILES += usb_linux.c util_linux.c
@@ -72,6 +72,7 @@ ifeq ($(HOST_OS),linux)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := usbtest.c usb_linux.c util.c
LOCAL_MODULE := usbtest
+LOCAL_CFLAGS := -Werror
include $(BUILD_HOST_EXECUTABLE)
endif
diff --git a/fastboot/engine.c b/fastboot/engine.c
index 5a6709b..2f90e41 100644
--- a/fastboot/engine.c
+++ b/fastboot/engine.c
@@ -30,10 +30,10 @@
#include "fs.h"
#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <stdarg.h>
#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -45,6 +45,10 @@
#include <sys/mman.h>
#endif
+#ifndef __unused
+#define __unused __attribute__((__unused__))
+#endif
+
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#define OP_DOWNLOAD 1
@@ -106,7 +110,6 @@ int fb_format_supported(usb_handle *usb, const char *partition, const char *type
{
char fs_type[FB_RESPONSE_SZ + 1] = {0,};
int status;
- unsigned int i;
if (type_override) {
return !!fs_get_generator(type_override);
@@ -197,9 +200,7 @@ void fb_queue_flash_sparse(const char *ptn, struct sparse_file *s, unsigned sz)
static int match(char *str, const char **value, unsigned count)
{
- const char *val;
unsigned n;
- int len;
for (n = 0; n < count; n++) {
const char *val = value[n];
@@ -325,7 +326,7 @@ void fb_queue_query_save(const char *var, char *dest, unsigned dest_size)
a->func = cb_save;
}
-static int cb_do_nothing(Action *a, int status, char *resp)
+static int cb_do_nothing(Action *a __unused, int status __unused, char *resp __unused)
{
fprintf(stderr,"\n");
return 0;
diff --git a/fastboot/fastboot.c b/fastboot/fastboot.c
index 4d3e0af..3a140ab 100644
--- a/fastboot/fastboot.c
+++ b/fastboot/fastboot.c
@@ -28,22 +28,20 @@
#define _LARGEFILE64_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <string.h>
-
+#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
-#include <unistd.h>
-#include <limits.h>
-#include <ctype.h>
#include <getopt.h>
-
+#include <limits.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
-#include <sys/stat.h>
+#include <unistd.h>
#include <bootimg.h>
#include <sparse/sparse.h>
@@ -72,7 +70,6 @@ static usb_handle *usb = 0;
static const char *serial = 0;
static const char *product = 0;
static const char *cmdline = 0;
-static int wipe_data = 0;
static unsigned short vendor_id = 0;
static int long_listing = 0;
static int64_t sparse_limit = -1;
@@ -270,7 +267,7 @@ usb_handle *open_device(void)
announce = 0;
fprintf(stderr,"< waiting for device >\n");
}
- sleep(1);
+ usleep(1000);
}
}
@@ -428,7 +425,7 @@ static int unzip_to_file(zipfile_t zip, char *name)
return -1;
}
- if (write(fd, data, sz) != sz) {
+ if (write(fd, data, sz) != (ssize_t)sz) {
fd = -1;
}
@@ -722,7 +719,7 @@ void do_update(usb_handle *usb, char *fn, int erase_first)
int fd;
int rc;
struct fastboot_buffer buf;
- int i;
+ size_t i;
queue_info_dump();
@@ -796,7 +793,7 @@ void do_flashall(usb_handle *usb, int erase_first)
void *data;
unsigned sz;
struct fastboot_buffer buf;
- int i;
+ size_t i;
queue_info_dump();
@@ -828,7 +825,6 @@ void do_flashall(usb_handle *usb, int erase_first)
int do_oem_command(int argc, char **argv)
{
- int i;
char command[256];
if (argc <= 1) return 0;
@@ -915,7 +911,7 @@ void fb_perform_format(const char *partition, int skip_if_not_supported,
"Warning: %s type is %s, but %s was requested for formating.\n",
partition, pType, type_override);
}
- pType = type_override;
+ pType = (char *)type_override;
}
status = fb_getvar(usb, pSize, "partition-size:%s", partition);
@@ -929,7 +925,7 @@ void fb_perform_format(const char *partition, int skip_if_not_supported,
"Warning: %s size is %s, but %s was requested for formating.\n",
partition, pSize, size_override);
}
- pSize = size_override;
+ pSize = (char *)size_override;
}
gen = fs_get_generator(pType);
@@ -981,7 +977,6 @@ int main(int argc, char **argv)
unsigned sz;
int status;
int c;
- int r;
const struct option longopts[] = {
{"base", required_argument, 0, 'b'},
@@ -996,7 +991,6 @@ int main(int argc, char **argv)
serial = getenv("ANDROID_SERIAL");
while (1) {
- int option_index = 0;
c = getopt_long(argc, argv, "wub:k:n:r:t:s:S:lp:c:i:m:h", longopts, NULL);
if (c < 0) {
break;
diff --git a/fastboot/protocol.c b/fastboot/protocol.c
index a0e0fd4..84e9837 100644
--- a/fastboot/protocol.c
+++ b/fastboot/protocol.c
@@ -110,7 +110,6 @@ static int _command_start(usb_handle *usb, const char *cmd, unsigned size,
char *response)
{
int cmdsize = strlen(cmd);
- int r;
if(response) {
response[0] = 0;
@@ -189,8 +188,6 @@ static int _command_send(usb_handle *usb, const char *cmd,
static int _command_send_no_data(usb_handle *usb, const char *cmd,
char *response)
{
- int r;
-
return _command_start(usb, cmd, 0, response);
}
diff --git a/fastboot/usb_linux.c b/fastboot/usb_linux.c
index f2ce226..a45f9f8 100644
--- a/fastboot/usb_linux.c
+++ b/fastboot/usb_linux.c
@@ -125,9 +125,6 @@ static int filter_usb_device(char* sysfs_name,
unsigned i;
unsigned e;
- struct stat st;
- int result;
-
if(check(ptr, len, USB_DT_DEVICE, USB_DT_DEVICE_SIZE))
return -1;
dev = (void*) ptr;
diff --git a/fastboot/usb_windows.c b/fastboot/usb_windows.c
index f666015..0d13863 100644
--- a/fastboot/usb_windows.c
+++ b/fastboot/usb_windows.c
@@ -178,7 +178,7 @@ int usb_write(usb_handle* handle, const void* data, int len) {
count += written;
len -= written;
- data += written;
+ data = (const char *)data + written;
if (len == 0)
return count;
diff --git a/fastboot/usbtest.c b/fastboot/usbtest.c
index b8fb9e2..e6e2b37 100644
--- a/fastboot/usbtest.c
+++ b/fastboot/usbtest.c
@@ -88,14 +88,14 @@ int match_loop(usb_ifc_info *info)
int test_null(usb_handle *usb)
{
- int i;
+ unsigned i;
unsigned char buf[4096];
memset(buf, 0xee, 4096);
long long t0, t1;
t0 = NOW();
for(i = 0; i < arg_count; i++) {
- if(usb_write(usb, buf, arg_size) != arg_size) {
+ if(usb_write(usb, buf, arg_size) != (int)arg_size) {
fprintf(stderr,"write failed (%s)\n", strerror(errno));
return -1;
}
@@ -107,13 +107,13 @@ int test_null(usb_handle *usb)
int test_zero(usb_handle *usb)
{
- int i;
+ unsigned i;
unsigned char buf[4096];
long long t0, t1;
t0 = NOW();
for(i = 0; i < arg_count; i++) {
- if(usb_read(usb, buf, arg_size) != arg_size) {
+ if(usb_read(usb, buf, arg_size) != (int)arg_size) {
fprintf(stderr,"read failed (%s)\n", strerror(errno));
return -1;
}
@@ -130,11 +130,11 @@ struct
int (*test)(usb_handle *usb);
const char *help;
} tests[] = {
- { "list", printifc, 0, "list interfaces" },
+ { "list", printifc, NULL, "list interfaces" },
{ "send", match_null, test_null, "send to null interface" },
{ "recv", match_zero, test_zero, "recv from zero interface" },
- { "loop", match_loop, 0, "exercise loopback interface" },
- {},
+ { "loop", match_loop, NULL, "exercise loopback interface" },
+ { NULL, NULL, NULL, NULL },
};
int usage(void)