From 2204f0bf56af53b588a01701b8cf9cd05b1b3ff9 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Tue, 21 Oct 2014 23:04:54 -0700 Subject: Frameworks/base: Wall Werror in libs/androidfw Turn on -Wall -Werror in libs/androidfw. Fix warnings. Refactor some code. Change-Id: I66fe54ace433c15dee5de328b149ca142f74b2dd --- libs/androidfw/BackupHelpers.cpp | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) (limited to 'libs/androidfw/BackupHelpers.cpp') diff --git a/libs/androidfw/BackupHelpers.cpp b/libs/androidfw/BackupHelpers.cpp index 52dce9f7f5c5..36a4cfef5243 100644 --- a/libs/androidfw/BackupHelpers.cpp +++ b/libs/androidfw/BackupHelpers.cpp @@ -68,14 +68,11 @@ struct file_metadata_v1 { const static int CURRENT_METADATA_VERSION = 1; -#if 1 -#define LOGP(f, x...) -#else +static const bool kIsDebug = false; #if TEST_BACKUP_HELPERS -#define LOGP(f, x...) printf(f "\n", x) +#define LOGP(f, x...) if (kIsDebug) printf(f "\n", x) #else -#define LOGP(x...) ALOGD(x) -#endif +#define LOGP(x...) if (kIsDebug) ALOGD(x) #endif const static int ROUND_UP[4] = { 0, 3, 2, 1 }; @@ -204,13 +201,6 @@ write_snapshot_file(int fd, const KeyedVector& snapshot) return 0; } -static int -write_delete_file(BackupDataWriter* dataStream, const String8& key) -{ - LOGP("write_delete_file %s\n", key.string()); - return dataStream->WriteEntityHeader(key, -1); -} - static int write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8& key, char const* realFilename) @@ -225,8 +215,6 @@ write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8& file_metadata_v1 metadata; char* buf = (char*)malloc(bufsize); - int crc = crc32(0L, Z_NULL, 0); - fileSize = lseek(fd, 0, SEEK_END); lseek(fd, 0, SEEK_SET); @@ -442,18 +430,6 @@ back_up_files(int oldSnapshotFD, BackupDataWriter* dataStream, int newSnapshotFD return 0; } -// Utility function, equivalent to stpcpy(): perform a strcpy, but instead of -// returning the initial dest, return a pointer to the trailing NUL. -static char* strcpy_ptr(char* dest, const char* str) { - if (dest && str) { - while ((*dest = *str) != 0) { - dest++; - str++; - } - } - return dest; -} - static void calc_tar_checksum(char* buf) { // [ 148 : 8 ] checksum -- to be calculated with this field as space chars memset(buf + 148, ' ', 8); @@ -635,7 +611,6 @@ int write_tarfile(const String8& packageName, const String8& domain, // construct the pax extended header data block memset(paxData, 0, BUFSIZE - (paxData - buf)); - int len; // size header -- calc len in digits by actually rendering the number // to a string - brute force but simple @@ -1200,7 +1175,6 @@ test_read_header_and_entity(BackupDataReader& reader, const char* str) size_t bufSize = strlen(str)+1; char* buf = (char*)malloc(bufSize); String8 string; - int cookie = 0x11111111; size_t actualSize; bool done; int type; @@ -1490,7 +1464,6 @@ int backup_helper_test_null_base() { int err; - int oldSnapshotFD; int dataStreamFD; int newSnapshotFD; @@ -1539,7 +1512,6 @@ int backup_helper_test_missing_file() { int err; - int oldSnapshotFD; int dataStreamFD; int newSnapshotFD; -- cgit v1.2.3-59-g8ed1b