diff options
author | Mark Salyzyn | 2014-05-08 15:36:34 -0500 |
---|---|---|
committer | Android Git Automerger | 2014-05-08 15:36:34 -0500 |
commit | d4d096370154492433f02df56a7508eb99f564e2 (patch) | |
tree | 4b4e2f86cf3e340c8c5fa8ee557a123a2f9aaffb /libsparse | |
parent | af0df46d74368bb98edaadb3c09ddbc7252d3110 (diff) | |
parent | db32e7889049150c965fe9103400299c9256acf1 (diff) | |
download | platform-system-core-d4d096370154492433f02df56a7508eb99f564e2.tar.gz platform-system-core-d4d096370154492433f02df56a7508eb99f564e2.tar.xz platform-system-core-d4d096370154492433f02df56a7508eb99f564e2.zip |
am db32e788: am a2b03c4a: Merge "libsparse: turn on -Werror"
* commit 'db32e7889049150c965fe9103400299c9256acf1':
libsparse: turn on -Werror
Diffstat (limited to 'libsparse')
-rw-r--r-- | libsparse/Android.mk | 10 | ||||
-rw-r--r-- | libsparse/img2simg.c | 1 | ||||
-rw-r--r-- | libsparse/output_file.c | 10 | ||||
-rw-r--r-- | libsparse/sparse.c | 1 | ||||
-rw-r--r-- | libsparse/sparse_read.c | 11 |
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) | |||
17 | LOCAL_MODULE := libsparse_host | 17 | LOCAL_MODULE := libsparse_host |
18 | LOCAL_STATIC_LIBRARIES := libz | 18 | LOCAL_STATIC_LIBRARIES := libz |
19 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib | 19 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib |
20 | LOCAL_CFLAGS := -Werror | ||
20 | include $(BUILD_HOST_STATIC_LIBRARY) | 21 | include $(BUILD_HOST_STATIC_LIBRARY) |
21 | 22 | ||
22 | 23 | ||
@@ -27,6 +28,7 @@ LOCAL_MODULE := libsparse | |||
27 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib | 28 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib |
28 | LOCAL_SHARED_LIBRARIES := \ | 29 | LOCAL_SHARED_LIBRARIES := \ |
29 | libz | 30 | libz |
31 | LOCAL_CFLAGS := -Werror | ||
30 | include $(BUILD_SHARED_LIBRARY) | 32 | include $(BUILD_SHARED_LIBRARY) |
31 | 33 | ||
32 | 34 | ||
@@ -36,6 +38,7 @@ LOCAL_SRC_FILES := $(libsparse_src_files) | |||
36 | LOCAL_MODULE := libsparse_static | 38 | LOCAL_MODULE := libsparse_static |
37 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib | 39 | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib |
38 | LOCAL_STATIC_LIBRARIES := libz | 40 | LOCAL_STATIC_LIBRARIES := libz |
41 | LOCAL_CFLAGS := -Werror | ||
39 | include $(BUILD_STATIC_LIBRARY) | 42 | include $(BUILD_STATIC_LIBRARY) |
40 | 43 | ||
41 | 44 | ||
@@ -48,6 +51,7 @@ LOCAL_MODULE_STEM := simg2img | |||
48 | LOCAL_STATIC_LIBRARIES := \ | 51 | LOCAL_STATIC_LIBRARIES := \ |
49 | libsparse_host \ | 52 | libsparse_host \ |
50 | libz | 53 | libz |
54 | LOCAL_CFLAGS := -Werror | ||
51 | include $(BUILD_HOST_EXECUTABLE) | 55 | include $(BUILD_HOST_EXECUTABLE) |
52 | 56 | ||
53 | 57 | ||
@@ -58,6 +62,7 @@ LOCAL_MODULE := simg2img | |||
58 | LOCAL_STATIC_LIBRARIES := \ | 62 | LOCAL_STATIC_LIBRARIES := \ |
59 | libsparse_static \ | 63 | libsparse_static \ |
60 | libz | 64 | libz |
65 | LOCAL_CFLAGS := -Werror | ||
61 | include $(BUILD_EXECUTABLE) | 66 | include $(BUILD_EXECUTABLE) |
62 | 67 | ||
63 | 68 | ||
@@ -69,6 +74,7 @@ LOCAL_MODULE_STEM := img2simg | |||
69 | LOCAL_STATIC_LIBRARIES := \ | 74 | LOCAL_STATIC_LIBRARIES := \ |
70 | libsparse_host \ | 75 | libsparse_host \ |
71 | libz | 76 | libz |
77 | LOCAL_CFLAGS := -Werror | ||
72 | include $(BUILD_HOST_EXECUTABLE) | 78 | include $(BUILD_HOST_EXECUTABLE) |
73 | 79 | ||
74 | 80 | ||
@@ -78,6 +84,7 @@ LOCAL_MODULE := img2simg | |||
78 | LOCAL_STATIC_LIBRARIES := \ | 84 | LOCAL_STATIC_LIBRARIES := \ |
79 | libsparse_static \ | 85 | libsparse_static \ |
80 | libz | 86 | libz |
87 | LOCAL_CFLAGS := -Werror | ||
81 | include $(BUILD_EXECUTABLE) | 88 | include $(BUILD_EXECUTABLE) |
82 | 89 | ||
83 | 90 | ||
@@ -87,6 +94,7 @@ LOCAL_MODULE := simg2simg | |||
87 | LOCAL_STATIC_LIBRARIES := \ | 94 | LOCAL_STATIC_LIBRARIES := \ |
88 | libsparse_host \ | 95 | libsparse_host \ |
89 | libz | 96 | libz |
97 | LOCAL_CFLAGS := -Werror | ||
90 | include $(BUILD_HOST_EXECUTABLE) | 98 | include $(BUILD_HOST_EXECUTABLE) |
91 | 99 | ||
92 | 100 | ||
@@ -95,5 +103,5 @@ LOCAL_MODULE := simg_dump.py | |||
95 | LOCAL_SRC_FILES := simg_dump.py | 103 | LOCAL_SRC_FILES := simg_dump.py |
96 | LOCAL_MODULE_CLASS := EXECUTABLES | 104 | LOCAL_MODULE_CLASS := EXECUTABLES |
97 | LOCAL_IS_HOST_MODULE := true | 105 | LOCAL_IS_HOST_MODULE := true |
106 | LOCAL_CFLAGS := -Werror | ||
98 | include $(BUILD_PREBUILT) | 107 | include $(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 | ||
296 | static int callback_file_write(struct output_file *out, void *data, int len) | 296 | static 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) | |||
341 | static int write_sparse_skip_chunk(struct output_file *out, int64_t skip_len) | 340 | static 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 | ||
537 | void output_file_close(struct output_file *out) | 535 | void 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 | ||