summaryrefslogtreecommitdiffstats
path: root/libsparse
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2014-05-01 09:15:02 -0700
committerMark Salyzyn <salyzyn@google.com>2014-05-07 16:56:22 -0700
commit8116c8c37aadd83033ffea9e4f5fc86240428e43 (patch)
treef7542f2184f2f0f889ecd0a380d77be4e9174fd1 /libsparse
parent86e3f22b6ae048ba8c9284b4900258c3ccd17cdf (diff)
downloadsystem_core-8116c8c37aadd83033ffea9e4f5fc86240428e43.zip
system_core-8116c8c37aadd83033ffea9e4f5fc86240428e43.tar.gz
system_core-8116c8c37aadd83033ffea9e4f5fc86240428e43.tar.bz2
libsparse: turn on -Werror
- Deal with some -Wunused issues Change-Id: I9667d74c0dfbe55c625e65b9d44d7c6f861c455d
Diffstat (limited to 'libsparse')
-rw-r--r--libsparse/Android.mk10
-rw-r--r--libsparse/img2simg.c1
-rw-r--r--libsparse/output_file.c10
-rw-r--r--libsparse/sparse.c1
-rw-r--r--libsparse/sparse_read.c11
5 files changed, 14 insertions, 19 deletions
diff --git a/libsparse/Android.mk b/libsparse/Android.mk
index 9025cc0..02ab412 100644
--- a/libsparse/Android.mk
+++ b/libsparse/Android.mk
@@ -17,6 +17,7 @@ LOCAL_SRC_FILES := $(libsparse_src_files)
LOCAL_MODULE := libsparse_host
LOCAL_STATIC_LIBRARIES := libz
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib
+LOCAL_CFLAGS := -Werror
include $(BUILD_HOST_STATIC_LIBRARY)
@@ -27,6 +28,7 @@ LOCAL_MODULE := libsparse
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib
LOCAL_SHARED_LIBRARIES := \
libz
+LOCAL_CFLAGS := -Werror
include $(BUILD_SHARED_LIBRARY)
@@ -36,6 +38,7 @@ LOCAL_SRC_FILES := $(libsparse_src_files)
LOCAL_MODULE := libsparse_static
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib
LOCAL_STATIC_LIBRARIES := libz
+LOCAL_CFLAGS := -Werror
include $(BUILD_STATIC_LIBRARY)
@@ -48,6 +51,7 @@ LOCAL_MODULE_STEM := simg2img
LOCAL_STATIC_LIBRARIES := \
libsparse_host \
libz
+LOCAL_CFLAGS := -Werror
include $(BUILD_HOST_EXECUTABLE)
@@ -58,6 +62,7 @@ LOCAL_MODULE := simg2img
LOCAL_STATIC_LIBRARIES := \
libsparse_static \
libz
+LOCAL_CFLAGS := -Werror
include $(BUILD_EXECUTABLE)
@@ -69,6 +74,7 @@ LOCAL_MODULE_STEM := img2simg
LOCAL_STATIC_LIBRARIES := \
libsparse_host \
libz
+LOCAL_CFLAGS := -Werror
include $(BUILD_HOST_EXECUTABLE)
@@ -78,6 +84,7 @@ LOCAL_MODULE := img2simg
LOCAL_STATIC_LIBRARIES := \
libsparse_static \
libz
+LOCAL_CFLAGS := -Werror
include $(BUILD_EXECUTABLE)
@@ -87,6 +94,7 @@ LOCAL_MODULE := simg2simg
LOCAL_STATIC_LIBRARIES := \
libsparse_host \
libz
+LOCAL_CFLAGS := -Werror
include $(BUILD_HOST_EXECUTABLE)
@@ -95,5 +103,5 @@ LOCAL_MODULE := simg_dump.py
LOCAL_SRC_FILES := simg_dump.py
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_IS_HOST_MODULE := true
+LOCAL_CFLAGS := -Werror
include $(BUILD_PREBUILT)
-
diff --git a/libsparse/img2simg.c b/libsparse/img2simg.c
index 6b1caa5..a0db36f 100644
--- a/libsparse/img2simg.c
+++ b/libsparse/img2simg.c
@@ -47,7 +47,6 @@ int main(int argc, char *argv[])
{
int in;
int out;
- unsigned int i;
int ret;
struct sparse_file *s;
unsigned int block_size = 4096;
diff --git a/libsparse/output_file.c b/libsparse/output_file.c
index 1cf8d8d..cd30800 100644
--- a/libsparse/output_file.c
+++ b/libsparse/output_file.c
@@ -31,8 +31,8 @@
#include "defs.h"
#include "output_file.h"
-#include "sparse_format.h"
#include "sparse_crc32.h"
+#include "sparse_format.h"
#ifndef USE_MINGW
#include <sys/mman.h>
@@ -295,7 +295,6 @@ static int callback_file_pad(struct output_file *out __unused, int64_t len __unu
static int callback_file_write(struct output_file *out, void *data, int len)
{
- int ret;
struct output_file_callback *outc = to_output_file_callback(out);
return outc->write(outc->priv, data, len);
@@ -341,7 +340,7 @@ int read_all(int fd, void *buf, size_t len)
static int write_sparse_skip_chunk(struct output_file *out, int64_t skip_len)
{
chunk_header_t chunk_header;
- int ret, chunk;
+ int ret;
if (skip_len % out->block_size) {
error("don't care size %"PRIi64" is not a multiple of the block size %u",
@@ -368,9 +367,8 @@ static int write_sparse_fill_chunk(struct output_file *out, unsigned int len,
uint32_t fill_val)
{
chunk_header_t chunk_header;
- int rnd_up_len, zero_len, count;
+ int rnd_up_len, count;
int ret;
- unsigned int i;
/* Round up the fill length to a multiple of the block size */
rnd_up_len = ALIGN(len, out->block_size);
@@ -536,8 +534,6 @@ static struct sparse_file_ops normal_file_ops = {
void output_file_close(struct output_file *out)
{
- int ret;
-
out->sparse_ops->write_end_chunk(out);
out->ops->close(out);
}
diff --git a/libsparse/sparse.c b/libsparse/sparse.c
index 0f107b0..baa30cd 100644
--- a/libsparse/sparse.c
+++ b/libsparse/sparse.c
@@ -279,7 +279,6 @@ int sparse_file_resparse(struct sparse_file *in_s, unsigned int max_len,
struct sparse_file **out_s, int out_s_count)
{
struct backed_block *bb;
- unsigned int overhead;
struct sparse_file *s;
struct sparse_file *tmp;
int c = 0;
diff --git a/libsparse/sparse_read.c b/libsparse/sparse_read.c
index 873c87c..8e188e9 100644
--- a/libsparse/sparse_read.c
+++ b/libsparse/sparse_read.c
@@ -180,22 +180,16 @@ static int process_skip_chunk(struct sparse_file *s, unsigned int chunk_size,
int fd __unused, unsigned int blocks,
unsigned int block __unused, uint32_t *crc32)
{
- int ret;
- int chunk;
- int64_t len = (int64_t)blocks * s->block_size;
- uint32_t fill_val;
- uint32_t *fillbuf;
- unsigned int i;
-
if (chunk_size != 0) {
return -EINVAL;
}
if (crc32) {
+ int64_t len = (int64_t)blocks * s->block_size;
memset(copybuf, 0, COPY_BUF_SIZE);
while (len) {
- chunk = min(len, COPY_BUF_SIZE);
+ int chunk = min(len, COPY_BUF_SIZE);
*crc32 = sparse_crc32(*crc32, copybuf, chunk);
len -= chunk;
}
@@ -367,7 +361,6 @@ static int sparse_file_read_normal(struct sparse_file *s, int fd)
int64_t remain = s->len;
int64_t offset = 0;
unsigned int to_read;
- char *ptr;
unsigned int i;
bool sparse_block;