diff options
author | Andreas Gampe <agampe@google.com> | 2014-10-21 23:04:54 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2014-11-07 13:35:05 -0800 |
commit | 2204f0bf56af53b588a01701b8cf9cd05b1b3ff9 (patch) | |
tree | d163b59ccc8d10a3181bc77ea99f83c94e6748ce /libs/androidfw/BackupHelpers.cpp | |
parent | 59701b9ba5c453e327bc0e6873a9f6ff87a10391 (diff) | |
download | frameworks_base-2204f0bf56af53b588a01701b8cf9cd05b1b3ff9.zip frameworks_base-2204f0bf56af53b588a01701b8cf9cd05b1b3ff9.tar.gz frameworks_base-2204f0bf56af53b588a01701b8cf9cd05b1b3ff9.tar.bz2 |
Frameworks/base: Wall Werror in libs/androidfw
Turn on -Wall -Werror in libs/androidfw. Fix warnings. Refactor
some code.
Change-Id: I66fe54ace433c15dee5de328b149ca142f74b2dd
Diffstat (limited to 'libs/androidfw/BackupHelpers.cpp')
-rw-r--r-- | libs/androidfw/BackupHelpers.cpp | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/libs/androidfw/BackupHelpers.cpp b/libs/androidfw/BackupHelpers.cpp index 52dce9f..36a4cfe 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 }; @@ -205,13 +202,6 @@ write_snapshot_file(int fd, const KeyedVector<String8,FileRec>& snapshot) } 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; |