am a2b03c4a: Merge "libsparse: turn on -Werror"

* commit 'a2b03c4a6a8d68b0991ed64c51df59b39370d8d4':
  libsparse: turn on -Werror
This commit is contained in:
Mark Salyzyn 2014-05-08 20:33:30 +00:00 committed by Android Git Automerger
commit db32e78890
5 changed files with 14 additions and 19 deletions

View file

@ -17,6 +17,7 @@ LOCAL_SRC_FILES := $(libsparse_src_files)
LOCAL_MODULE := libsparse_host LOCAL_MODULE := libsparse_host
LOCAL_STATIC_LIBRARIES := libz LOCAL_STATIC_LIBRARIES := libz
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib
LOCAL_CFLAGS := -Werror
include $(BUILD_HOST_STATIC_LIBRARY) include $(BUILD_HOST_STATIC_LIBRARY)
@ -27,6 +28,7 @@ LOCAL_MODULE := libsparse
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib
LOCAL_SHARED_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := \
libz libz
LOCAL_CFLAGS := -Werror
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)
@ -36,6 +38,7 @@ LOCAL_SRC_FILES := $(libsparse_src_files)
LOCAL_MODULE := libsparse_static LOCAL_MODULE := libsparse_static
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib LOCAL_C_INCLUDES += $(LOCAL_PATH)/include external/zlib
LOCAL_STATIC_LIBRARIES := libz LOCAL_STATIC_LIBRARIES := libz
LOCAL_CFLAGS := -Werror
include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY)
@ -48,6 +51,7 @@ LOCAL_MODULE_STEM := simg2img
LOCAL_STATIC_LIBRARIES := \ LOCAL_STATIC_LIBRARIES := \
libsparse_host \ libsparse_host \
libz libz
LOCAL_CFLAGS := -Werror
include $(BUILD_HOST_EXECUTABLE) include $(BUILD_HOST_EXECUTABLE)
@ -58,6 +62,7 @@ LOCAL_MODULE := simg2img
LOCAL_STATIC_LIBRARIES := \ LOCAL_STATIC_LIBRARIES := \
libsparse_static \ libsparse_static \
libz libz
LOCAL_CFLAGS := -Werror
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)
@ -69,6 +74,7 @@ LOCAL_MODULE_STEM := img2simg
LOCAL_STATIC_LIBRARIES := \ LOCAL_STATIC_LIBRARIES := \
libsparse_host \ libsparse_host \
libz libz
LOCAL_CFLAGS := -Werror
include $(BUILD_HOST_EXECUTABLE) include $(BUILD_HOST_EXECUTABLE)
@ -78,6 +84,7 @@ LOCAL_MODULE := img2simg
LOCAL_STATIC_LIBRARIES := \ LOCAL_STATIC_LIBRARIES := \
libsparse_static \ libsparse_static \
libz libz
LOCAL_CFLAGS := -Werror
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)
@ -87,6 +94,7 @@ LOCAL_MODULE := simg2simg
LOCAL_STATIC_LIBRARIES := \ LOCAL_STATIC_LIBRARIES := \
libsparse_host \ libsparse_host \
libz libz
LOCAL_CFLAGS := -Werror
include $(BUILD_HOST_EXECUTABLE) include $(BUILD_HOST_EXECUTABLE)
@ -95,5 +103,5 @@ LOCAL_MODULE := simg_dump.py
LOCAL_SRC_FILES := simg_dump.py LOCAL_SRC_FILES := simg_dump.py
LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_IS_HOST_MODULE := true LOCAL_IS_HOST_MODULE := true
LOCAL_CFLAGS := -Werror
include $(BUILD_PREBUILT) include $(BUILD_PREBUILT)

View file

@ -47,7 +47,6 @@ int main(int argc, char *argv[])
{ {
int in; int in;
int out; int out;
unsigned int i;
int ret; int ret;
struct sparse_file *s; struct sparse_file *s;
unsigned int block_size = 4096; unsigned int block_size = 4096;

View file

@ -31,8 +31,8 @@
#include "defs.h" #include "defs.h"
#include "output_file.h" #include "output_file.h"
#include "sparse_format.h"
#include "sparse_crc32.h" #include "sparse_crc32.h"
#include "sparse_format.h"
#ifndef USE_MINGW #ifndef USE_MINGW
#include <sys/mman.h> #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) 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); struct output_file_callback *outc = to_output_file_callback(out);
return outc->write(outc->priv, data, len); 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) static int write_sparse_skip_chunk(struct output_file *out, int64_t skip_len)
{ {
chunk_header_t chunk_header; chunk_header_t chunk_header;
int ret, chunk; int ret;
if (skip_len % out->block_size) { if (skip_len % out->block_size) {
error("don't care size %"PRIi64" is not a multiple of the block size %u", 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) uint32_t fill_val)
{ {
chunk_header_t chunk_header; chunk_header_t chunk_header;
int rnd_up_len, zero_len, count; int rnd_up_len, count;
int ret; int ret;
unsigned int i;
/* Round up the fill length to a multiple of the block size */ /* Round up the fill length to a multiple of the block size */
rnd_up_len = ALIGN(len, out->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) void output_file_close(struct output_file *out)
{ {
int ret;
out->sparse_ops->write_end_chunk(out); out->sparse_ops->write_end_chunk(out);
out->ops->close(out); out->ops->close(out);
} }

View file

@ -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 sparse_file **out_s, int out_s_count)
{ {
struct backed_block *bb; struct backed_block *bb;
unsigned int overhead;
struct sparse_file *s; struct sparse_file *s;
struct sparse_file *tmp; struct sparse_file *tmp;
int c = 0; int c = 0;

View file

@ -180,22 +180,16 @@ static int process_skip_chunk(struct sparse_file *s, unsigned int chunk_size,
int fd __unused, unsigned int blocks, int fd __unused, unsigned int blocks,
unsigned int block __unused, uint32_t *crc32) 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) { if (chunk_size != 0) {
return -EINVAL; return -EINVAL;
} }
if (crc32) { if (crc32) {
int64_t len = (int64_t)blocks * s->block_size;
memset(copybuf, 0, COPY_BUF_SIZE); memset(copybuf, 0, COPY_BUF_SIZE);
while (len) { while (len) {
chunk = min(len, COPY_BUF_SIZE); int chunk = min(len, COPY_BUF_SIZE);
*crc32 = sparse_crc32(*crc32, copybuf, chunk); *crc32 = sparse_crc32(*crc32, copybuf, chunk);
len -= 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 remain = s->len;
int64_t offset = 0; int64_t offset = 0;
unsigned int to_read; unsigned int to_read;
char *ptr;
unsigned int i; unsigned int i;
bool sparse_block; bool sparse_block;