summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2014-05-01 11:15:02 -0500
committerMark Salyzyn2014-05-07 18:56:22 -0500
commit8116c8c37aadd83033ffea9e4f5fc86240428e43 (patch)
treef7542f2184f2f0f889ecd0a380d77be4e9174fd1 /libsparse
parent86e3f22b6ae048ba8c9284b4900258c3ccd17cdf (diff)
downloadplatform-system-core-8116c8c37aadd83033ffea9e4f5fc86240428e43.tar.gz
platform-system-core-8116c8c37aadd83033ffea9e4f5fc86240428e43.tar.xz
platform-system-core-8116c8c37aadd83033ffea9e4f5fc86240428e43.zip
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 9025cc025..02ab412bc 100644
--- a/libsparse/Android.mk
+++ b/libsparse/Android.mk
@@ -17,6 +17,7 @@ LOCAL_SRC_FILES := $(libsparse_src_files)
17LOCAL_MODULE := libsparse_host 17LOCAL_MODULE := libsparse_host
18LOCAL_STATIC_LIBRARIES := libz 18LOCAL_STATIC_LIBRARIES := libz
19LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib 19LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib
20LOCAL_CFLAGS := -Werror
20include $(BUILD_HOST_STATIC_LIBRARY) 21include $(BUILD_HOST_STATIC_LIBRARY)
21 22
22 23
@@ -27,6 +28,7 @@ LOCAL_MODULE := libsparse
27LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib 28LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib
28LOCAL_SHARED_LIBRARIES := \ 29LOCAL_SHARED_LIBRARIES := \
29 libz 30 libz
31LOCAL_CFLAGS := -Werror
30include $(BUILD_SHARED_LIBRARY) 32include $(BUILD_SHARED_LIBRARY)
31 33
32 34
@@ -36,6 +38,7 @@ LOCAL_SRC_FILES := $(libsparse_src_files)
36LOCAL_MODULE := libsparse_static 38LOCAL_MODULE := libsparse_static
37LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib 39LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib
38LOCAL_STATIC_LIBRARIES := libz 40LOCAL_STATIC_LIBRARIES := libz
41LOCAL_CFLAGS := -Werror
39include $(BUILD_STATIC_LIBRARY) 42include $(BUILD_STATIC_LIBRARY)
40 43
41 44
@@ -48,6 +51,7 @@ LOCAL_MODULE_STEM := simg2img
48LOCAL_STATIC_LIBRARIES := \ 51LOCAL_STATIC_LIBRARIES := \
49 libsparse_host \ 52 libsparse_host \
50 libz 53 libz
54LOCAL_CFLAGS := -Werror
51include $(BUILD_HOST_EXECUTABLE) 55include $(BUILD_HOST_EXECUTABLE)
52 56
53 57
@@ -58,6 +62,7 @@ LOCAL_MODULE := simg2img
58LOCAL_STATIC_LIBRARIES := \ 62LOCAL_STATIC_LIBRARIES := \
59 libsparse_static \ 63 libsparse_static \
60 libz 64 libz
65LOCAL_CFLAGS := -Werror
61include $(BUILD_EXECUTABLE) 66include $(BUILD_EXECUTABLE)
62 67
63 68
@@ -69,6 +74,7 @@ LOCAL_MODULE_STEM := img2simg
69LOCAL_STATIC_LIBRARIES := \ 74LOCAL_STATIC_LIBRARIES := \
70 libsparse_host \ 75 libsparse_host \
71 libz 76 libz
77LOCAL_CFLAGS := -Werror
72include $(BUILD_HOST_EXECUTABLE) 78include $(BUILD_HOST_EXECUTABLE)
73 79
74 80
@@ -78,6 +84,7 @@ LOCAL_MODULE := img2simg
78LOCAL_STATIC_LIBRARIES := \ 84LOCAL_STATIC_LIBRARIES := \
79 libsparse_static \ 85 libsparse_static \
80 libz 86 libz
87LOCAL_CFLAGS := -Werror
81include $(BUILD_EXECUTABLE) 88include $(BUILD_EXECUTABLE)
82 89
83 90
@@ -87,6 +94,7 @@ LOCAL_MODULE := simg2simg
87LOCAL_STATIC_LIBRARIES := \ 94LOCAL_STATIC_LIBRARIES := \
88 libsparse_host \ 95 libsparse_host \
89 libz 96 libz
97LOCAL_CFLAGS := -Werror
90include $(BUILD_HOST_EXECUTABLE) 98include $(BUILD_HOST_EXECUTABLE)
91 99
92 100
@@ -95,5 +103,5 @@ LOCAL_MODULE := simg_dump.py
95LOCAL_SRC_FILES := simg_dump.py 103LOCAL_SRC_FILES := simg_dump.py
96LOCAL_MODULE_CLASS := EXECUTABLES 104LOCAL_MODULE_CLASS := EXECUTABLES
97LOCAL_IS_HOST_MODULE := true 105LOCAL_IS_HOST_MODULE := true
106LOCAL_CFLAGS := -Werror
98include $(BUILD_PREBUILT) 107include $(BUILD_PREBUILT)
99
diff --git a/libsparse/img2simg.c b/libsparse/img2simg.c
index 6b1caa506..a0db36f45 100644
--- a/libsparse/img2simg.c
+++ b/libsparse/img2simg.c
@@ -47,7 +47,6 @@ int main(int argc, char *argv[])
47{ 47{
48 int in; 48 int in;
49 int out; 49 int out;
50 unsigned int i;
51 int ret; 50 int ret;
52 struct sparse_file *s; 51 struct sparse_file *s;
53 unsigned int block_size = 4096; 52 unsigned int block_size = 4096;
diff --git a/libsparse/output_file.c b/libsparse/output_file.c
index 1cf8d8dcf..cd3080038 100644
--- a/libsparse/output_file.c
+++ b/libsparse/output_file.c
@@ -31,8 +31,8 @@
31 31
32#include "defs.h" 32#include "defs.h"
33#include "output_file.h" 33#include "output_file.h"
34#include "sparse_format.h"
35#include "sparse_crc32.h" 34#include "sparse_crc32.h"
35#include "sparse_format.h"
36 36
37#ifndef USE_MINGW 37#ifndef USE_MINGW
38#include <sys/mman.h> 38#include <sys/mman.h>
@@ -295,7 +295,6 @@ static int callback_file_pad(struct output_file *out __unused, int64_t len __unu
295 295
296static int callback_file_write(struct output_file *out, void *data, int len) 296static int callback_file_write(struct output_file *out, void *data, int len)
297{ 297{
298 int ret;
299 struct output_file_callback *outc = to_output_file_callback(out); 298 struct output_file_callback *outc = to_output_file_callback(out);
300 299
301 return outc->write(outc->priv, data, len); 300 return outc->write(outc->priv, data, len);
@@ -341,7 +340,7 @@ int read_all(int fd, void *buf, size_t len)
341static int write_sparse_skip_chunk(struct output_file *out, int64_t skip_len) 340static int write_sparse_skip_chunk(struct output_file *out, int64_t skip_len)
342{ 341{
343 chunk_header_t chunk_header; 342 chunk_header_t chunk_header;
344 int ret, chunk; 343 int ret;
345 344
346 if (skip_len % out->block_size) { 345 if (skip_len % out->block_size) {
347 error("don't care size %"PRIi64" 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",
@@ -368,9 +367,8 @@ static int write_sparse_fill_chunk(struct output_file *out, unsigned int len,
368 uint32_t fill_val) 367 uint32_t fill_val)
369{ 368{
370 chunk_header_t chunk_header; 369 chunk_header_t chunk_header;
371 int rnd_up_len, zero_len, count; 370 int rnd_up_len, count;
372 int ret; 371 int ret;
373 unsigned int i;
374 372
375 /* Round up the fill length to a multiple of the block size */ 373 /* Round up the fill length to a multiple of the block size */
376 rnd_up_len = ALIGN(len, out->block_size); 374 rnd_up_len = ALIGN(len, out->block_size);
@@ -536,8 +534,6 @@ static struct sparse_file_ops normal_file_ops = {
536 534
537void output_file_close(struct output_file *out) 535void output_file_close(struct output_file *out)
538{ 536{
539 int ret;
540
541 out->sparse_ops->write_end_chunk(out); 537 out->sparse_ops->write_end_chunk(out);
542 out->ops->close(out); 538 out->ops->close(out);
543} 539}
diff --git a/libsparse/sparse.c b/libsparse/sparse.c
index 0f107b00f..baa30cdc1 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,
279 struct sparse_file **out_s, int out_s_count) 279 struct sparse_file **out_s, int out_s_count)
280{ 280{
281 struct backed_block *bb; 281 struct backed_block *bb;
282 unsigned int overhead;
283 struct sparse_file *s; 282 struct sparse_file *s;
284 struct sparse_file *tmp; 283 struct sparse_file *tmp;
285 int c = 0; 284 int c = 0;
diff --git a/libsparse/sparse_read.c b/libsparse/sparse_read.c
index 873c87c7a..8e188e9a4 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,
180 int fd __unused, unsigned int blocks, 180 int fd __unused, unsigned int blocks,
181 unsigned int block __unused, uint32_t *crc32) 181 unsigned int block __unused, uint32_t *crc32)
182{ 182{
183 int ret;
184 int chunk;
185 int64_t len = (int64_t)blocks * s->block_size;
186 uint32_t fill_val;
187 uint32_t *fillbuf;
188 unsigned int i;
189
190 if (chunk_size != 0) { 183 if (chunk_size != 0) {
191 return -EINVAL; 184 return -EINVAL;
192 } 185 }
193 186
194 if (crc32) { 187 if (crc32) {
188 int64_t len = (int64_t)blocks * s->block_size;
195 memset(copybuf, 0, COPY_BUF_SIZE); 189 memset(copybuf, 0, COPY_BUF_SIZE);
196 190
197 while (len) { 191 while (len) {
198 chunk = min(len, COPY_BUF_SIZE); 192 int chunk = min(len, COPY_BUF_SIZE);
199 *crc32 = sparse_crc32(*crc32, copybuf, chunk); 193 *crc32 = sparse_crc32(*crc32, copybuf, chunk);
200 len -= chunk; 194 len -= chunk;
201 } 195 }
@@ -367,7 +361,6 @@ static int sparse_file_read_normal(struct sparse_file *s, int fd)
367 int64_t remain = s->len; 361 int64_t remain = s->len;
368 int64_t offset = 0; 362 int64_t offset = 0;
369 unsigned int to_read; 363 unsigned int to_read;
370 char *ptr;
371 unsigned int i; 364 unsigned int i;
372 bool sparse_block; 365 bool sparse_block;
373 366