diff options
author | Dan Bornstein <danfuzz@android.com> | 2011-05-25 16:58:39 -0700 |
---|---|---|
committer | Dan Bornstein <danfuzz@android.com> | 2011-05-25 17:01:28 -0700 |
commit | 614dca3bb487f17ef8ea37a82a22dd6c4abc027e (patch) | |
tree | 31925320f524c67fddfcc7c3144fe1e9afd3883d /libdex | |
parent | 48a2061356d1269fbd04420d9095ca7dd5e54901 (diff) | |
download | android_dalvik-614dca3bb487f17ef8ea37a82a22dd6c4abc027e.tar.gz android_dalvik-614dca3bb487f17ef8ea37a82a22dd6c4abc027e.tar.bz2 android_dalvik-614dca3bb487f17ef8ea37a82a22dd6c4abc027e.zip |
Conservation of newlines in libdex.
The log facility adds newlines automatically, and the prevailing
convention is now to omit them.
Change-Id: I14762ea4a7c24eea333f778724a0e4b6b65bae2b
Diffstat (limited to 'libdex')
-rw-r--r-- | libdex/DexDataMap.cpp | 6 | ||||
-rw-r--r-- | libdex/DexFile.cpp | 28 | ||||
-rw-r--r-- | libdex/DexOptData.cpp | 14 | ||||
-rw-r--r-- | libdex/DexSwapVerify.cpp | 256 | ||||
-rw-r--r-- | libdex/InstrUtils.cpp | 6 | ||||
-rw-r--r-- | libdex/OptInvocation.cpp | 4 | ||||
-rw-r--r-- | libdex/SysUtil.cpp | 44 | ||||
-rw-r--r-- | libdex/ZipArchive.cpp | 68 |
8 files changed, 213 insertions, 213 deletions
diff --git a/libdex/DexDataMap.cpp b/libdex/DexDataMap.cpp index 33135ed1c..d2f675fb2 100644 --- a/libdex/DexDataMap.cpp +++ b/libdex/DexDataMap.cpp @@ -77,7 +77,7 @@ void dexDataMapAdd(DexDataMap* map, u4 offset, u2 type) { if ((map->count != 0) && (map->offsets[map->count - 1] >= offset)) { - LOGE("Out-of-order data map offset: 0x%x then 0x%x\n", + LOGE("Out-of-order data map offset: 0x%x then 0x%x", map->offsets[map->count - 1], offset); return; } @@ -130,10 +130,10 @@ bool dexDataMapVerify(DexDataMap* map, u4 offset, u2 type) { } if (found < 0) { - LOGE("No data map entry found @ 0x%x; expected %x\n", + LOGE("No data map entry found @ 0x%x; expected %x", offset, type); } else { - LOGE("Unexpected data map entry @ 0x%x: expected %x, found %x\n", + LOGE("Unexpected data map entry @ 0x%x: expected %x, found %x", offset, type, found); } diff --git a/libdex/DexFile.cpp b/libdex/DexFile.cpp index da9affc29..b38bfca87 100644 --- a/libdex/DexFile.cpp +++ b/libdex/DexFile.cpp @@ -195,7 +195,7 @@ static void classLookupAdd(DexFile* pDexFile, DexClassLookup* pLookup, probes++; } //if (probes > 1) - // LOGW("classLookupAdd: probes=%d\n", probes); + // LOGW("classLookupAdd: probes=%d", probes); pLookup->table[idx].classDescriptorHash = hash; pLookup->table[idx].classDescriptorOffset = stringOff; @@ -294,7 +294,7 @@ DexFile* dexFileParse(const u1* data, size_t length, int flags) int result = -1; if (length < sizeof(DexHeader)) { - LOGE("too short to be a valid .dex\n"); + LOGE("too short to be a valid .dex"); goto bail; /* bad file format */ } @@ -309,13 +309,13 @@ DexFile* dexFileParse(const u1* data, size_t length, int flags) if (memcmp(data, DEX_OPT_MAGIC, 4) == 0) { magic = data; if (memcmp(magic+4, DEX_OPT_MAGIC_VERS, 4) != 0) { - LOGE("bad opt version (0x%02x %02x %02x %02x)\n", + LOGE("bad opt version (0x%02x %02x %02x %02x)", magic[4], magic[5], magic[6], magic[7]); goto bail; } pDexFile->pOptHeader = (const DexOptHeader*) data; - LOGV("Good opt header, DEX offset is %d, flags=0x%02x\n", + LOGV("Good opt header, DEX offset is %d, flags=0x%02x", pDexFile->pOptHeader->dexOffset, pDexFile->pOptHeader->flags); /* parse the optimized dex file tables */ @@ -326,7 +326,7 @@ DexFile* dexFileParse(const u1* data, size_t length, int flags) data += pDexFile->pOptHeader->dexOffset; length -= pDexFile->pOptHeader->dexOffset; if (pDexFile->pOptHeader->dexLength > length) { - LOGE("File truncated? stored len=%d, rem len=%d\n", + LOGE("File truncated? stored len=%d, rem len=%d", pDexFile->pOptHeader->dexLength, (int) length); goto bail; } @@ -348,24 +348,24 @@ DexFile* dexFileParse(const u1* data, size_t length, int flags) if (flags & kDexParseVerifyChecksum) { u4 adler = dexComputeChecksum(pHeader); if (adler != pHeader->checksum) { - LOGE("ERROR: bad checksum (%08x vs %08x)\n", + LOGE("ERROR: bad checksum (%08x vs %08x)", adler, pHeader->checksum); if (!(flags & kDexParseContinueOnError)) goto bail; } else { - LOGV("+++ adler32 checksum (%08x) verified\n", adler); + LOGV("+++ adler32 checksum (%08x) verified", adler); } const DexOptHeader* pOptHeader = pDexFile->pOptHeader; if (pOptHeader != NULL) { adler = dexComputeOptChecksum(pOptHeader); if (adler != pOptHeader->checksum) { - LOGE("ERROR: bad opt checksum (%08x vs %08x)\n", + LOGE("ERROR: bad opt checksum (%08x vs %08x)", adler, pOptHeader->checksum); if (!(flags & kDexParseContinueOnError)) goto bail; } else { - LOGV("+++ adler32 opt checksum (%08x) verified\n", adler); + LOGV("+++ adler32 opt checksum (%08x) verified", adler); } } } @@ -385,25 +385,25 @@ DexFile* dexFileParse(const u1* data, size_t length, int flags) if (memcmp(sha1Digest, pHeader->signature, kSHA1DigestLen) != 0) { char tmpBuf1[kSHA1DigestOutputLen]; char tmpBuf2[kSHA1DigestOutputLen]; - LOGE("ERROR: bad SHA1 digest (%s vs %s)\n", + LOGE("ERROR: bad SHA1 digest (%s vs %s)", dexSHA1DigestToStr(sha1Digest, tmpBuf1), dexSHA1DigestToStr(pHeader->signature, tmpBuf2)); if (!(flags & kDexParseContinueOnError)) goto bail; } else { - LOGV("+++ sha1 digest verified\n"); + LOGV("+++ sha1 digest verified"); } } if (pHeader->fileSize != length) { - LOGE("ERROR: stored file size (%d) != expected (%d)\n", + LOGE("ERROR: stored file size (%d) != expected (%d)", (int) pHeader->fileSize, (int) length); if (!(flags & kDexParseContinueOnError)) goto bail; } if (pHeader->classDefsSize == 0) { - LOGE("ERROR: DEX file has no classes in it, failing\n"); + LOGE("ERROR: DEX file has no classes in it, failing"); goto bail; } @@ -516,7 +516,7 @@ size_t dexGetDexCodeSize(const DexCode* pCode) const u1* handlerData = dexGetCatchHandlerData(pCode); - //LOGD("+++ pCode=%p handlerData=%p last offset=%d\n", + //LOGD("+++ pCode=%p handlerData=%p last offset=%d", // pCode, handlerData, offset); /* return the size of the catch handler + everything before it */ diff --git a/libdex/DexOptData.cpp b/libdex/DexOptData.cpp index 131b6566f..b224d6d79 100644 --- a/libdex/DexOptData.cpp +++ b/libdex/DexOptData.cpp @@ -61,13 +61,13 @@ bool dexParseOptData(const u1* data, size_t length, DexFile* pDexFile) * properly aligned. This test will catch both of these cases. */ if (!isValidPointer(pOpt, pOptStart, pOptEnd)) { - LOGE("Bogus opt data start pointer\n"); + LOGE("Bogus opt data start pointer"); return false; } /* Make sure that the opt data length is a whole number of words. */ if ((optLength & 3) != 0) { - LOGE("Unaligned opt data area end\n"); + LOGE("Unaligned opt data area end"); return false; } @@ -76,14 +76,14 @@ bool dexParseOptData(const u1* data, size_t length, DexFile* pDexFile) * one chunk header. */ if (optLength < 8) { - LOGE("Undersized opt data area (%u)\n", optLength); + LOGE("Undersized opt data area (%u)", optLength); return false; } /* Process chunks until we see the end marker. */ while (*pOpt != kDexChunkEnd) { if (!isValidPointer(pOpt + 2, pOptStart, pOptEnd)) { - LOGE("Bogus opt data content pointer at offset %u\n", + LOGE("Bogus opt data content pointer at offset %u", ((const u1*) pOpt) - data); return false; } @@ -99,7 +99,7 @@ bool dexParseOptData(const u1* data, size_t length, DexFile* pDexFile) const u4* pNextOpt = pOpt + (roundedSize / sizeof(u4)); if (!isValidPointer(pNextOpt, pOptStart, pOptEnd)) { - LOGE("Opt data area problem for chunk of size %u at offset %u\n", + LOGE("Opt data area problem for chunk of size %u at offset %u", size, ((const u1*) pOpt) - data); return false; } @@ -109,11 +109,11 @@ bool dexParseOptData(const u1* data, size_t length, DexFile* pDexFile) pDexFile->pClassLookup = (const DexClassLookup*) pOptData; break; case kDexChunkRegisterMaps: - LOGV("+++ found register maps, size=%u\n", size); + LOGV("+++ found register maps, size=%u", size); pDexFile->pRegisterMapPool = pOptData; break; default: - LOGI("Unknown chunk 0x%08x (%c%c%c%c), size=%d in opt data area\n", + LOGI("Unknown chunk 0x%08x (%c%c%c%c), size=%d in opt data area", *pOpt, (char) ((*pOpt) >> 24), (char) ((*pOpt) >> 16), (char) ((*pOpt) >> 8), (char) (*pOpt), diff --git a/libdex/DexSwapVerify.cpp b/libdex/DexSwapVerify.cpp index 9a465dd4d..64f231341 100644 --- a/libdex/DexSwapVerify.cpp +++ b/libdex/DexSwapVerify.cpp @@ -114,7 +114,7 @@ static inline bool checkPtrRange(const CheckState* state, const void* fileEnd = state->fileEnd; if ((start < fileStart) || (start > fileEnd) || (end < start) || (end > fileEnd)) { - LOGW("Bad offset range for %s: 0x%x..0x%x\n", label, + LOGW("Bad offset range for %s: 0x%x..0x%x", label, fileOffset(state, start), fileOffset(state, end)); return false; } @@ -187,7 +187,7 @@ static inline bool checkPtrRange(const CheckState* state, */ #define CHECK_INDEX(_field, _limit) { \ if ((_field) >= (_limit)) { \ - LOGW("Bad index: %s(%u) > %s(%u)\n", \ + LOGW("Bad index: %s(%u) > %s(%u)", \ #_field, (u4)(_field), #_limit, (u4)(_limit)); \ return 0; \ } \ @@ -206,7 +206,7 @@ static inline bool checkPtrRange(const CheckState* state, */ #define CHECK_INDEX_OR_NOINDEX(_field, _limit) { \ if ((_field) != kDexNoIndex && (_field) >= (_limit)) { \ - LOGW("Bad index: %s(%u) > %s(%u)\n", \ + LOGW("Bad index: %s(%u) > %s(%u)", \ #_field, (u4)(_field), #_limit, (u4)(_limit)); \ return 0; \ } \ @@ -299,7 +299,7 @@ static bool swapDexHeader(const CheckState* state, DexHeader* pHeader) SWAP_OFFSET4(pHeader->dataOff); if (pHeader->endianTag != kDexEndianConstant) { - LOGE("Unexpected endian_tag: 0x%x\n", pHeader->endianTag); + LOGE("Unexpected endian_tag: 0x%x", pHeader->endianTag); return false; } @@ -323,12 +323,12 @@ static bool swapDexHeader(const CheckState* state, DexHeader* pHeader) static bool checkHeaderSection(const CheckState* state, u4 sectionOffset, u4 sectionCount, u4* endOffset) { if (sectionCount != 1) { - LOGE("Multiple header items\n"); + LOGE("Multiple header items"); return false; } if (sectionOffset != 0) { - LOGE("Header at 0x%x; not at start of file\n", sectionOffset); + LOGE("Header at 0x%x; not at start of file", sectionOffset); return false; } @@ -362,7 +362,7 @@ static u4 mapTypeToBitMask(int mapType) { case kDexTypeEncodedArrayItem: return 1 << 16; case kDexTypeAnnotationsDirectoryItem: return 1 << 17; default: { - LOGE("Unknown map item type %04x\n", mapType); + LOGE("Unknown map item type %04x", mapType); return 0; } } @@ -416,13 +416,13 @@ static bool swapMap(CheckState* state, DexMapList* pMap) if (first) { first = false; } else if (lastOffset >= item->offset) { - LOGE("Out-of-order map item: 0x%x then 0x%x\n", + LOGE("Out-of-order map item: 0x%x then 0x%x", lastOffset, item->offset); return false; } if (item->offset >= state->pHeader->fileSize) { - LOGE("Map item after end of file: %x, size 0x%x\n", + LOGE("Map item after end of file: %x, size 0x%x", item->offset, state->pHeader->fileSize); return false; } @@ -452,7 +452,7 @@ static bool swapMap(CheckState* state, DexMapList* pMap) } if ((usedBits & bit) != 0) { - LOGE("Duplicate map section of type 0x%x\n", item->type); + LOGE("Duplicate map section of type 0x%x", item->type); return false; } @@ -462,60 +462,60 @@ static bool swapMap(CheckState* state, DexMapList* pMap) } if ((usedBits & mapTypeToBitMask(kDexTypeHeaderItem)) == 0) { - LOGE("Map is missing header entry\n"); + LOGE("Map is missing header entry"); return false; } if ((usedBits & mapTypeToBitMask(kDexTypeMapList)) == 0) { - LOGE("Map is missing map_list entry\n"); + LOGE("Map is missing map_list entry"); return false; } if (((usedBits & mapTypeToBitMask(kDexTypeStringIdItem)) == 0) && ((state->pHeader->stringIdsOff != 0) || (state->pHeader->stringIdsSize != 0))) { - LOGE("Map is missing string_ids entry\n"); + LOGE("Map is missing string_ids entry"); return false; } if (((usedBits & mapTypeToBitMask(kDexTypeTypeIdItem)) == 0) && ((state->pHeader->typeIdsOff != 0) || (state->pHeader->typeIdsSize != 0))) { - LOGE("Map is missing type_ids entry\n"); + LOGE("Map is missing type_ids entry"); return false; } if (((usedBits & mapTypeToBitMask(kDexTypeProtoIdItem)) == 0) && ((state->pHeader->protoIdsOff != 0) || (state->pHeader->protoIdsSize != 0))) { - LOGE("Map is missing proto_ids entry\n"); + LOGE("Map is missing proto_ids entry"); return false; } if (((usedBits & mapTypeToBitMask(kDexTypeFieldIdItem)) == 0) && ((state->pHeader->fieldIdsOff != 0) || (state->pHeader->fieldIdsSize != 0))) { - LOGE("Map is missing field_ids entry\n"); + LOGE("Map is missing field_ids entry"); return false; } if (((usedBits & mapTypeToBitMask(kDexTypeMethodIdItem)) == 0) && ((state->pHeader->methodIdsOff != 0) || (state->pHeader->methodIdsSize != 0))) { - LOGE("Map is missing method_ids entry\n"); + LOGE("Map is missing method_ids entry"); return false; } if (((usedBits & mapTypeToBitMask(kDexTypeClassDefItem)) == 0) && ((state->pHeader->classDefsOff != 0) || (state->pHeader->classDefsSize != 0))) { - LOGE("Map is missing class_defs entry\n"); + LOGE("Map is missing class_defs entry"); return false; } state->pDataMap = dexDataMapAlloc(dataItemCount); if (state->pDataMap == NULL) { - LOGE("Unable to allocate data map (size 0x%x)\n", dataItemCount); + LOGE("Unable to allocate data map (size 0x%x)", dataItemCount); return false; } @@ -531,7 +531,7 @@ static bool checkMapSection(const CheckState* state, u4 sectionOffset, } if (sectionOffset != state->pHeader->mapOff) { - LOGE("Map not at header-defined offset: 0x%x, expected 0x%x\n", + LOGE("Map not at header-defined offset: 0x%x, expected 0x%x", sectionOffset, state->pHeader->mapOff); return false; } @@ -568,7 +568,7 @@ static void* crossVerifyStringIdItem(const CheckState* state, void* ptr) { const char* s0 = dexGetStringData(state->pDexFile, item0); const char* s1 = dexGetStringData(state->pDexFile, item); if (dexUtf8Cmp(s0, s1) >= 0) { - LOGE("Out-of-order string_ids: '%s' then '%s'\n", s0, s1); + LOGE("Out-of-order string_ids: '%s' then '%s'", s0, s1); return NULL; } } @@ -593,7 +593,7 @@ static void* crossVerifyTypeIdItem(const CheckState* state, void* ptr) { dexStringById(state->pDexFile, item->descriptorIdx); if (!dexIsValidTypeDescriptor(descriptor)) { - LOGE("Invalid type descriptor: '%s'\n", descriptor); + LOGE("Invalid type descriptor: '%s'", descriptor); return NULL; } @@ -601,7 +601,7 @@ static void* crossVerifyTypeIdItem(const CheckState* state, void* ptr) { if (item0 != NULL) { // Check ordering. This relies on string_ids being in order. if (item0->descriptorIdx >= item->descriptorIdx) { - LOGE("Out-of-order type_ids: 0x%x then 0x%x\n", + LOGE("Out-of-order type_ids: 0x%x then 0x%x", item0->descriptorIdx, item->descriptorIdx); return NULL; } @@ -630,7 +630,7 @@ static bool shortyDescMatch(char shorty, const char* descriptor, bool switch (shorty) { case 'V': { if (!isReturnType) { - LOGE("Invalid use of void\n"); + LOGE("Invalid use of void"); return false; } // Fall through. @@ -644,7 +644,7 @@ static bool shortyDescMatch(char shorty, const char* descriptor, bool case 'S': case 'Z': { if ((descriptor[0] != shorty) || (descriptor[1] != '\0')) { - LOGE("Shorty vs. primitive type mismatch: '%c', '%s'\n", + LOGE("Shorty vs. primitive type mismatch: '%c', '%s'", shorty, descriptor); return false; } @@ -652,14 +652,14 @@ static bool shortyDescMatch(char shorty, const char* descriptor, bool } case 'L': { if ((descriptor[0] != 'L') && (descriptor[0] != '[')) { - LOGE("Shorty vs. type mismatch: '%c', '%s'\n", + LOGE("Shorty vs. type mismatch: '%c', '%s'", shorty, descriptor); return false; } break; } default: { - LOGE("Bogus shorty: '%c'\n", shorty); + LOGE("Bogus shorty: '%c'", shorty); return false; } } @@ -699,7 +699,7 @@ static void* crossVerifyProtoIdItem(const CheckState* state, void* ptr) { } if (*shorty == '\0') { - LOGE("Shorty is too short\n"); + LOGE("Shorty is too short"); return NULL; } @@ -711,7 +711,7 @@ static void* crossVerifyProtoIdItem(const CheckState* state, void* ptr) { } if (*shorty != '\0') { - LOGE("Shorty is too long\n"); + LOGE("Shorty is too long"); return NULL; } @@ -719,7 +719,7 @@ static void* crossVerifyProtoIdItem(const CheckState* state, void* ptr) { if (item0 != NULL) { // Check ordering. This relies on type_ids being in order. if (item0->returnTypeIdx > item->returnTypeIdx) { - LOGE("Out-of-order proto_id return types\n"); + LOGE("Out-of-order proto_id return types"); return NULL; } else if (item0->returnTypeIdx == item->returnTypeIdx) { bool badOrder = false; @@ -751,7 +751,7 @@ static void* crossVerifyProtoIdItem(const CheckState* state, void* ptr) { } if (badOrder) { - LOGE("Out-of-order proto_id arguments\n"); + LOGE("Out-of-order proto_id arguments"); return NULL; } } @@ -779,19 +779,19 @@ static void* crossVerifyFieldIdItem(const CheckState* state, void* ptr) { s = dexStringByTypeIdx(state->pDexFile, item->classIdx); if (!dexIsClassDescriptor(s)) { - LOGE("Invalid descriptor for class_idx: '%s'\n", s); + LOGE("Invalid descriptor for class_idx: '%s'", s); return NULL; } s = dexStringByTypeIdx(state->pDexFile, item->typeIdx); if (!dexIsFieldDescriptor(s)) { - LOGE("Invalid descriptor for type_idx: '%s'\n", s); + LOGE("Invalid descriptor for type_idx: '%s'", s); return NULL; } s = dexStringById(state->pDexFile, item->nameIdx); if (!dexIsValidMemberName(s)) { - LOGE("Invalid name: '%s'\n", s); + LOGE("Invalid name: '%s'", s); return NULL; } @@ -824,7 +824,7 @@ static void* crossVerifyFieldIdItem(const CheckState* state, void* ptr) { } if (bogus) { - LOGE("Out-of-order field_ids\n"); + LOGE("Out-of-order field_ids"); return NULL; } } @@ -851,13 +851,13 @@ static void* crossVerifyMethodIdItem(const CheckState* state, void* ptr) { s = dexStringByTypeIdx(state->pDexFile, item->classIdx); if (!dexIsReferenceDescriptor(s)) { - LOGE("Invalid descriptor for class_idx: '%s'\n", s); + LOGE("Invalid descriptor for class_idx: '%s'", s); return NULL; } s = dexStringById(state->pDexFile, item->nameIdx); if (!dexIsValidMemberName(s)) { - LOGE("Invalid name: '%s'\n", s); + LOGE("Invalid name: '%s'", s); return NULL; } @@ -890,7 +890,7 @@ static void* crossVerifyMethodIdItem(const CheckState* state, void* ptr) { } if (bogus) { - LOGE("Out-of-order method_ids\n"); + LOGE("Out-of-order method_ids"); return NULL; } } @@ -971,12 +971,12 @@ static void* crossVerifyClassDefItem(const CheckState* state, void* ptr) { const char* descriptor = dexStringByTypeIdx(state->pDexFile, classIdx); if (!dexIsClassDescriptor(descriptor)) { - LOGE("Invalid class: '%s'\n", descriptor); + LOGE("Invalid class: '%s'", descriptor); return NULL; } if (setDefinedClassBit(state, classIdx)) { - LOGE("Duplicate class definition: '%s'\n", descriptor); + LOGE("Duplicate class definition: '%s'", descriptor); return NULL; } @@ -997,7 +997,7 @@ static void* crossVerifyClassDefItem(const CheckState* state, void* ptr) { if (item->superclassIdx != kDexNoIndex) { descriptor = dexStringByTypeIdx(state->pDexFile, item->superclassIdx); if (!dexIsClassDescriptor(descriptor)) { - LOGE("Invalid superclass: '%s'\n", descriptor); + LOGE("Invalid superclass: '%s'", descriptor); return NULL; } } @@ -1016,7 +1016,7 @@ static void* crossVerifyClassDefItem(const CheckState* state, void* ptr) { descriptor = dexStringByTypeIdx(state->pDexFile, dexTypeListGetIdx(interfaces, i)); if (!dexIsClassDescriptor(descriptor)) { - LOGE("Invalid interface: '%s'\n", descriptor); + LOGE("Invalid interface: '%s'", descriptor); return NULL; } } @@ -1034,7 +1034,7 @@ static void* crossVerifyClassDefItem(const CheckState* state, void* ptr) { for (j = 0; j < i; j++) { u4 idx2 = dexTypeListGetIdx(interfaces, j); if (idx1 == idx2) { - LOGE("Duplicate interface: '%s'\n", + LOGE("Duplicate interface: '%s'", dexStringByTypeIdx(state->pDexFile, idx1)); return NULL; } @@ -1043,13 +1043,13 @@ static void* crossVerifyClassDefItem(const CheckState* state, void* ptr) { } if (!verifyClassDataIsForDef(state, item->classDataOff, item->classIdx)) { - LOGE("Invalid class_data_item\n"); + LOGE("Invalid class_data_item"); return NULL; } if (!verifyAnnotationsDirectoryIsForDef(state, item->annotationsOff, item->classIdx)) { - LOGE("Invalid annotations_directory_item\n"); + LOGE("Invalid annotations_directory_item"); return NULL; } @@ -1073,7 +1073,7 @@ static u1* swapFieldAnnotations(const CheckState* state, u4 count, u1* addr) { if (first) { first = false; } else if (lastIdx >= item->fieldIdx) { - LOGE("Out-of-order field_idx: 0x%x then 0x%x\n", lastIdx, + LOGE("Out-of-order field_idx: 0x%x then 0x%x", lastIdx, item->fieldIdx); return NULL; } @@ -1102,7 +1102,7 @@ static u1* swapMethodAnnotations(const CheckState* state, u4 count, u1* addr) { if (first) { first = false; } else if (lastIdx >= item->methodIdx) { - LOGE("Out-of-order method_idx: 0x%x then 0x%x\n", lastIdx, + LOGE("Out-of-order method_idx: 0x%x then 0x%x", lastIdx, item->methodIdx); return NULL; } @@ -1132,7 +1132,7 @@ static u1* swapParameterAnnotations(const CheckState* state, u4 count, if (first) { first = false; } else if (lastIdx >= item->methodIdx) { - LOGE("Out-of-order method_idx: 0x%x then 0x%x\n", lastIdx, + LOGE("Out-of-order method_idx: 0x%x then 0x%x", lastIdx, item->methodIdx); return NULL; } @@ -1423,7 +1423,7 @@ static void* crossVerifyAnnotationSetItem(const CheckState* state, void* ptr) { if (first) { first = false; } else if (lastIdx >= idx) { - LOGE("Out-of-order entry types: 0x%x then 0x%x\n", + LOGE("Out-of-order entry types: 0x%x then 0x%x", lastIdx, idx); return NULL; } @@ -1447,12 +1447,12 @@ static bool verifyFields(const CheckState* state, u4 size, CHECK_INDEX(field->fieldIdx, state->pHeader->fieldIdsSize); if (isStatic != expectStatic) { - LOGE("Field in wrong list @ %d\n", i); + LOGE("Field in wrong list @ %d", i); return false; } if ((accessFlags & ~ACC_FIELD_MASK) != 0) { - LOGE("Bogus field access flags %x @ %d\n", accessFlags, i); + LOGE("Bogus field access flags %x @ %d", accessFlags, i); return false; } } @@ -1478,24 +1478,24 @@ static bool verifyMethods(const CheckState* state, u4 size, bool allowSynchronized = (accessFlags & ACC_NATIVE) != 0; if (isDirect != expectDirect) { - LOGE("Method in wrong list @ %d\n", i); + LOGE("Method in wrong list @ %d", i); return false; } if (((accessFlags & ~ACC_METHOD_MASK) != 0) || (isSynchronized && !allowSynchronized)) { - LOGE("Bogus method access flags %x @ %d\n", accessFlags, i); + LOGE("Bogus method access flags %x @ %d", accessFlags, i); return false; } if (expectCode) { if (method->codeOff == 0) { - LOGE("Unexpected zero code_off for access_flags %x\n", + LOGE("Unexpected zero code_off for access_flags %x", accessFlags); return false; } } else if (method->codeOff != 0) { - LOGE("Unexpected non-zero code_off 0x%x for access_flags %x\n", + LOGE("Unexpected non-zero code_off 0x%x for access_flags %x", method->codeOff, accessFlags); return false; } @@ -1513,7 +1513,7 @@ static bool verifyClassDataItem0(const CheckState* state, classData->staticFields, true); if (!okay) { - LOGE("Trouble with static fields\n"); + LOGE("Trouble with static fields"); return false; } @@ -1521,7 +1521,7 @@ static bool verifyClassDataItem0(const CheckState* state, classData->instanceFields, false); if (!okay) { - LOGE("Trouble with instance fields\n"); + LOGE("Trouble with instance fields"); return false; } @@ -1529,7 +1529,7 @@ static bool verifyClassDataItem0(const CheckState* state, classData->directMethods, true); if (!okay) { - LOGE("Trouble with direct methods\n"); + LOGE("Trouble with direct methods"); return false; } @@ -1537,7 +1537,7 @@ static bool verifyClassDataItem0(const CheckState* state, classData->virtualMethods, false); if (!okay) { - LOGE("Trouble with virtual methods\n"); + LOGE("Trouble with virtual methods"); return false; } @@ -1550,7 +1550,7 @@ static void* intraVerifyClassDataItem(const CheckState* state, void* ptr) { DexClassData* classData = dexReadAndVerifyClassData(&data, state->fileEnd); if (classData == NULL) { - LOGE("Unable to parse class_data_item\n"); + LOGE("Unable to parse class_data_item"); return NULL; } @@ -1659,12 +1659,12 @@ static u4 setHandlerOffsAndVerify(const CheckState* state, bool catchAll; if (!okay) { - LOGE("Bogus size\n"); + LOGE("Bogus size"); return 0; } if ((size < -65536) || (size > 65536)) { - LOGE("Invalid size: %d\n", size); + LOGE("Invalid size: %d", size); return 0; } @@ -1731,12 +1731,12 @@ static void* swapTriesAndCatches(const CheckState* state, DexCode* code) { readAndVerifyUnsignedLeb128(&encodedPtr, state->fileEnd, &okay); if (!okay) { - LOGE("Bogus handlers_size\n"); + LOGE("Bogus handlers_size"); return NULL; } if ((handlersSize == 0) || (handlersSize >= 65536)) { - LOGE("Invalid handlers_size: %d\n", handlersSize); + LOGE("Invalid handlers_size: %d", handlersSize); return NULL; } @@ -1763,12 +1763,12 @@ static void* swapTriesAndCatches(const CheckState* state, DexCode* code) { SWAP_FIELD2(tries->handlerOff); if (tries->startAddr < lastEnd) { - LOGE("Out-of-order try\n"); + LOGE("Out-of-order try"); return NULL; } if (tries->startAddr >= code->insnsSize) { - LOGE("Invalid start_addr: 0x%x\n", tries->startAddr); + LOGE("Invalid start_addr: 0x%x", tries->startAddr); return NULL; } @@ -1779,14 +1779,14 @@ static void* swapTriesAndCatches(const CheckState* state, DexCode* code) { } if (i == handlersSize) { - LOGE("Bogus handler offset: 0x%x\n", tries->handlerOff); + LOGE("Bogus handler offset: 0x%x", tries->handlerOff); return NULL; } lastEnd = tries->startAddr + tries->insnCount; if (lastEnd > code->insnsSize) { - LOGE("Invalid insn_count: 0x%x (end addr 0x%x)\n", + LOGE("Invalid insn_count: 0x%x (end addr 0x%x)", tries->insnCount, lastEnd); return NULL; } @@ -1812,7 +1812,7 @@ static void* swapCodeItem(const CheckState* state, void* ptr) { SWAP_FIELD4(item->insnsSize); if (item->insSize > item->registersSize) { - LOGE("insSize (%u) > registersSize (%u)\n", item->insSize, + LOGE("insSize (%u) > registersSize (%u)", item->insSize, item->registersSize); return NULL; } @@ -1825,7 +1825,7 @@ static void* swapCodeItem(const CheckState* state, void* ptr) { * list. Longer parameter lists, though, need to be represented * in-order in the register file. */ - LOGE("outsSize (%u) > registersSize (%u)\n", item->outsSize, + LOGE("outsSize (%u) > registersSize (%u)", item->outsSize, item->registersSize); return NULL; } @@ -1845,7 +1845,7 @@ static void* swapCodeItem(const CheckState* state, void* ptr) { if ((((u4) insns) & 3) != 0) { // Four-byte alignment for the tries. Verify the spacer is a 0. if (*insns != 0) { - LOGE("Non-zero padding: 0x%x\n", (u4) *insns); + LOGE("Non-zero padding: 0x%x", (u4) *insns); return NULL; } } @@ -1865,13 +1865,13 @@ static void* intraVerifyStringDataItem(const CheckState* state, void* ptr) { u4 i; if (!okay) { - LOGE("Bogus utf16_size\n"); + LOGE("Bogus utf16_size"); return NULL; } for (i = 0; i < utf16Size; i++) { if (data >= fileEnd) { - LOGE("String data would go beyond end-of-file\n"); + LOGE("String data would go beyond end-of-file"); return NULL; } @@ -1882,7 +1882,7 @@ static void* intraVerifyStringDataItem(const CheckState* state, void* ptr) { case 0x00: { // Special case of bit pattern 0xxx. if (byte1 == 0) { - LOGE("String shorter than indicated utf16_size 0x%x\n", + LOGE("String shorter than indicated utf16_size 0x%x", utf16Size); return NULL; } @@ -1908,25 +1908,25 @@ static void* intraVerifyStringDataItem(const CheckState* state, void* ptr) { * Note: 1111 is valid for normal UTF-8, but not the * modified UTF-8 used here. */ - LOGE("Illegal start byte 0x%x\n", byte1); + LOGE("Illegal start byte 0x%x", byte1); return NULL; } case 0x0e: { // Bit pattern 1110, so there are two additional bytes. u1 byte2 = *(data++); if ((byte2 & 0xc0) != 0x80) { - LOGE("Illegal continuation byte 0x%x\n", byte2); + LOGE("Illegal continuation byte 0x%x", byte2); return NULL; } u1 byte3 = *(data++); if ((byte3 & 0xc0) != 0x80) { - LOGE("Illegal continuation byte 0x%x\n", byte3); + LOGE("Illegal continuation byte 0x%x", byte3); return NULL; } u2 value = ((byte1 & 0x0f) << 12) | ((byte2 & 0x3f) << 6) | (byte3 & 0x3f); if (value < 0x800) { - LOGE("Illegal representation for value %x\n", value); + LOGE("Illegal representation for value %x", value); return NULL; } break; @@ -1936,12 +1936,12 @@ static void* intraVerifyStringDataItem(const CheckState* state, void* ptr) { // Bit pattern 110x, so there is one additional byte. u1 byte2 = *(data++); if ((byte2 & 0xc0) != 0x80) { - LOGE("Illegal continuation byte 0x%x\n", byte2); + LOGE("Illegal continuation byte 0x%x", byte2); return NULL; } u2 value = ((byte1 & 0x1f) << 6) | (byte2 & 0x3f); if ((value != 0) && (value < 0x80)) { - LOGE("Illegal representation for value %x\n", value); + LOGE("Illegal representation for value %x", value); return NULL; } break; @@ -1950,7 +1950,7 @@ static void* intraVerifyStringDataItem(const CheckState* state, void* ptr) { } if (*(data++) != '\0') { - LOGE("String longer than indicated utf16_size 0x%x\n", utf16Size); + LOGE("String longer than indicated utf16_size 0x%x", utf16Size); return NULL; } @@ -1967,7 +1967,7 @@ static void* intraVerifyDebugInfoItem(const CheckState* state, void* ptr) { readAndVerifyUnsignedLeb128(&data, fileEnd, &okay); if (!okay) { - LOGE("Bogus line_start\n"); + LOGE("Bogus line_start"); return NULL; } @@ -1975,12 +1975,12 @@ static void* intraVerifyDebugInfoItem(const CheckState* state, void* ptr) { readAndVerifyUnsignedLeb128(&data, fileEnd, &okay); if (!okay) { - LOGE("Bogus parameters_size\n"); + LOGE("Bogus parameters_size"); return NULL; } if (parametersSize > 65536) { - LOGE("Invalid parameters_size: 0x%x\n", parametersSize); + LOGE("Invalid parameters_size: 0x%x", parametersSize); return NULL; } @@ -1989,7 +1989,7 @@ static void* intraVerifyDebugInfoItem(const CheckState* state, void* ptr) { readAndVerifyUnsignedLeb128(&data, fileEnd, &okay); if (!okay) { - LOGE("Bogus parameter_name\n"); + LOGE("Bogus parameter_name"); return NULL; } @@ -2091,7 +2091,7 @@ static void* intraVerifyDebugInfoItem(const CheckState* state, void* ptr) { } if (!okay) { - LOGE("Bogus syntax for opcode %02x\n", opcode); + LOGE("Bogus syntax for opcode %02x", opcode); return NULL; } } @@ -2131,14 +2131,14 @@ static const u1* verifyEncodedArray(const CheckState* state, u4 size = readAndVerifyUnsignedLeb128(&data, state->fileEnd, &okay); if (!okay) { - LOGE("Bogus encoded_array size\n"); + LOGE("Bogus encoded_array size"); return NULL; } while (size--) { data = verifyEncodedValue(state, data, crossVerify); if (data == NULL) { - LOGE("Bogus encoded_array value\n"); + LOGE("Bogus encoded_array value"); return NULL; } } @@ -2159,7 +2159,7 @@ static const u1* verifyEncodedValue(const CheckState* state, switch (valueType) { case kDexAnnotationByte: { if (valueArg != 0) { - LOGE("Bogus byte size 0x%x\n", valueArg); + LOGE("Bogus byte size 0x%x", valueArg); return NULL; } data++; @@ -2168,7 +2168,7 @@ static const u1* verifyEncodedValue(const CheckState* state, case kDexAnnotationShort: case kDexAnnotationChar: { if (valueArg > 1) { - LOGE("Bogus char/short size 0x%x\n", valueArg); + LOGE("Bogus char/short size 0x%x", valueArg); return NULL; } data += valueArg + 1; @@ -2177,7 +2177,7 @@ static const u1* verifyEncodedValue(const CheckState* state, case kDexAnnotationInt: case kDexAnnotationFloat: { if (valueArg > 3) { - LOGE("Bogus int/float size 0x%x\n", valueArg); + LOGE("Bogus int/float size 0x%x", valueArg); return NULL; } data += valueArg + 1; @@ -2190,7 +2190,7 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationString: { if (valueArg > 3) { - LOGE("Bogus string size 0x%x\n", valueArg); + LOGE("Bogus string size 0x%x", valueArg); return NULL; } u4 idx = readUnsignedLittleEndian(state, &data, valueArg + 1); @@ -2199,7 +2199,7 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationType: { if (valueArg > 3) { - LOGE("Bogus type size 0x%x\n", valueArg); + LOGE("Bogus type size 0x%x", valueArg); return NULL; } u4 idx = readUnsignedLittleEndian(state, &data, valueArg + 1); @@ -2209,7 +2209,7 @@ static const u1* verifyEncodedValue(const CheckState* state, case kDexAnnotationField: case kDexAnnotationEnum: { if (valueArg > 3) { - LOGE("Bogus field/enum size 0x%x\n", valueArg); + LOGE("Bogus field/enum size 0x%x", valueArg); return NULL; } u4 idx = readUnsignedLittleEndian(state, &data, valueArg + 1); @@ -2218,7 +2218,7 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationMethod: { if (valueArg > 3) { - LOGE("Bogus method size 0x%x\n", valueArg); + LOGE("Bogus method size 0x%x", valueArg); return NULL; } u4 idx = readUnsignedLittleEndian(state, &data, valueArg + 1); @@ -2227,7 +2227,7 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationArray: { if (valueArg != 0) { - LOGE("Bogus array value_arg 0x%x\n", valueArg); + LOGE("Bogus array value_arg 0x%x", valueArg); return NULL; } data = verifyEncodedArray(state, data, crossVerify); @@ -2235,7 +2235,7 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationAnnotation: { if (valueArg != 0) { - LOGE("Bogus annotation value_arg 0x%x\n", valueArg); + LOGE("Bogus annotation value_arg 0x%x", valueArg); return NULL; } data = verifyEncodedAnnotation(state, data, crossVerify); @@ -2243,7 +2243,7 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationNull: { if (valueArg != 0) { - LOGE("Bogus null value_arg 0x%x\n", valueArg); + LOGE("Bogus null value_arg 0x%x", valueArg); return NULL; } // Nothing else to do for this type. @@ -2251,14 +2251,14 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationBoolean: { if (valueArg > 1) { - LOGE("Bogus boolean value_arg 0x%x\n", valueArg); + LOGE("Bogus boolean value_arg 0x%x", valueArg); return NULL; } // Nothing else to do for this type. break; } default: { - LOGE("Bogus value_type 0x%x\n", valueType); + LOGE("Bogus value_type 0x%x", valueType); return NULL; } } @@ -2275,7 +2275,7 @@ static const u1* verifyEncodedAnnotation(const CheckState* state, u4 idx = readAndVerifyUnsignedLeb128(&data, fileEnd, &okay); if (!okay) { - LOGE("Bogus encoded_annotation type_idx\n"); + LOGE("Bogus encoded_annotation type_idx"); return NULL; } @@ -2284,7 +2284,7 @@ static const u1* verifyEncodedAnnotation(const CheckState* state, if (crossVerify) { const char* descriptor = dexStringByTypeIdx(state->pDexFile, idx); if (!dexIsClassDescriptor(descriptor)) { - LOGE("Bogus annotation type: '%s'\n", descriptor); + LOGE("Bogus annotation type: '%s'", descriptor); return NULL; } } @@ -2294,7 +2294,7 @@ static const u1* verifyEncodedAnnotation(const CheckState* state, bool first = true; if (!okay) { - LOGE("Bogus encoded_annotation size\n"); + LOGE("Bogus encoded_annotation size"); return NULL; } @@ -2302,7 +2302,7 @@ static const u1* verifyEncodedAnnotation(const CheckState* state, idx = readAndVerifyUnsignedLeb128(&data, fileEnd, &okay); if (!okay) { - LOGE("Bogus encoded_annotation name_idx\n"); + LOGE("Bogus encoded_annotation name_idx"); return NULL; } @@ -2311,7 +2311,7 @@ static const u1* verifyEncodedAnnotation(const CheckState* state, if (crossVerify) { const char* name = dexStringById(state->pDexFile, idx); if (!dexIsValidMemberName(name)) { - LOGE("Bogus annotation member name: '%s'\n", name); + LOGE("Bogus annotation member name: '%s'", name); return NULL; } } @@ -2319,7 +2319,7 @@ static const u1* verifyEncodedAnnotation(const CheckState* state, if (first) { first = false; } else if (lastIdx >= idx) { - LOGE("Out-of-order encoded_annotation name_idx: 0x%x then 0x%x\n", + LOGE("Out-of-order encoded_annotation name_idx: 0x%x then 0x%x", lastIdx, idx); return NULL; } @@ -2353,7 +2353,7 @@ static void* intraVerifyAnnotationItem(const CheckState* state, void* ptr) { break; } default: { - LOGE("Bogus annotation visibility: 0x%x\n", *data); + LOGE("Bogus annotation visibility: 0x%x", *data); return NULL; } } @@ -2402,7 +2402,7 @@ static bool iterateSectionWithOptionalUpdate(CheckState* state, CHECK_OFFSET_RANGE(offset, newOffset); while (offset < newOffset) { if (*ptr != '\0') { - LOGE("Non-zero padding 0x%02x @ %x\n", *ptr, offset); + LOGE("Non-zero padding 0x%02x @ %x", *ptr, offset); return false; } ptr++; @@ -2415,12 +2415,12 @@ static bool iterateSectionWithOptionalUpdate(CheckState* state, newOffset = fileOffset(state, newPtr); if (newPtr == NULL) { - LOGE("Trouble with item %d @ offset 0x%x\n", i, offset); + LOGE("Trouble with item %d @ offset 0x%x", i, offset); return false; } if (newOffset > state->fileLen) { - LOGE("Item %d @ offset 0x%x ends out of bounds\n", i, offset); + LOGE("Item %d @ offset 0x%x ends out of bounds", i, offset); return false; } @@ -2458,13 +2458,13 @@ static bool checkBoundsAndIterateSection(CheckState* state, u4 offset, u4 count, u4 expectedOffset, u4 expectedCount, ItemVisitorFunction* func, u4 alignment, u4* nextOffset) { if (offset != expectedOffset) { - LOGE("Bogus offset for section: got 0x%x; expected 0x%x\n", + LOGE("Bogus offset for section: got 0x%x; expected 0x%x", offset, expectedOffset); return false; } if (count != expectedCount) { - LOGE("Bogus size for section: got 0x%x; expected 0x%x\n", + LOGE("Bogus size for section: got 0x%x; expected 0x%x", count, expectedCount); return false; } @@ -2484,7 +2484,7 @@ static bool iterateDataSection(CheckState* state, u4 offset, u4 count, assert(nextOffset != NULL); if ((offset < dataStart) || (offset >= dataEnd)) { - LOGE("Bogus offset for data subsection: 0x%x\n", offset); + LOGE("Bogus offset for data subsection: 0x%x", offset); return false; } @@ -2494,7 +2494,7 @@ static bool iterateDataSection(CheckState* state, u4 offset, u4 count, } if (*nextOffset > dataEnd) { - LOGE("Out-of-bounds end of data subsection: 0x%x\n", *nextOffset); + LOGE("Out-of-bounds end of data subsection: 0x%x", *nextOffset); return false; } @@ -2527,7 +2527,7 @@ static bool swapEverythingButHeaderAndMap(CheckState* state, const u1* ptr = (const u1*) filePointer(state, lastOffset); while (lastOffset < sectionOffset) { if (*ptr != '\0') { - LOGE("Non-zero padding 0x%02x before section start @ %x\n", + LOGE("Non-zero padding 0x%02x before section start @ %x", *ptr, lastOffset); okay = false; break; @@ -2536,7 +2536,7 @@ static bool swapEverythingButHeaderAndMap(CheckState* state, lastOffset++; } } else if (lastOffset > sectionOffset) { - LOGE("Section overlap or out-of-order map: %x, %x\n", + LOGE("Section overlap or out-of-order map: %x, %x", lastOffset, sectionOffset); okay = false; } @@ -2664,13 +2664,13 @@ static bool swapEverythingButHeaderAndMap(CheckState* state, break; } default: { - LOGE("Unknown map item type %04x\n", type); + LOGE("Unknown map item type %04x", type); return false; } } if (!okay) { - LOGE("Swap of section type %04x failed\n", type); + LOGE("Swap of section type %04x failed", type); } item++; @@ -2765,13 +2765,13 @@ static bool crossVerifyEverything(CheckState* state, DexMapList* pMap) break; } default: { - LOGE("Unknown map item type %04x\n", item->type); + LOGE("Unknown map item type %04x", item->type); return false; } } if (!okay) { - LOGE("Cross-item verify of section type %04x failed\n", + LOGE("Cross-item verify of section type %04x failed", item->type); } @@ -2821,7 +2821,7 @@ int dexSwapAndVerify(u1* addr, int len) bool okay = true; memset(&state, 0, sizeof(state)); - LOGV("+++ swapping and verifying\n"); + LOGV("+++ swapping and verifying"); /* * Note: The caller must have verified that "len" is at least as @@ -2836,10 +2836,10 @@ int dexSwapAndVerify(u1* addr, int len) if (okay) { int expectedLen = (int) SWAP4(pHeader->fileSize); if (len < expectedLen) { - LOGE("ERROR: Bad length: expected %d, got %d\n", expectedLen, len); + LOGE("ERROR: Bad length: expected %d, got %d", expectedLen, len); okay = false; } else if (len != expectedLen) { - LOGW("WARNING: Odd length: expected %d, got %d\n", expectedLen, + LOGW("WARNING: Odd length: expected %d, got %d", expectedLen, len); // keep going } @@ -2864,7 +2864,7 @@ int dexSwapAndVerify(u1* addr, int len) storedFileSize - nonSum); if (adler != expectedChecksum) { - LOGE("ERROR: bad checksum (%08lx, expected %08x)\n", + LOGE("ERROR: bad checksum (%08lx, expected %08x)", adler, expectedChecksum); okay = false; } @@ -2889,11 +2889,11 @@ int dexSwapAndVerify(u1* addr, int len) state.pHeader = pHeader; if (pHeader->headerSize < sizeof(DexHeader)) { - LOGE("ERROR: Small header size %d, struct %d\n", + LOGE("ERROR: Small header size %d, struct %d", pHeader->headerSize, (int) sizeof(DexHeader)); okay = false; } else if (pHeader->headerSize > sizeof(DexHeader)) { - LOGW("WARNING: Large header size %d, struct %d\n", + LOGW("WARNING: Large header size %d, struct %d", pHeader->headerSize, (int) sizeof(DexHeader)); // keep going? } @@ -2922,7 +2922,7 @@ int dexSwapAndVerify(u1* addr, int len) } if (!okay) { - LOGE("ERROR: Byte swap + verify failed\n"); + LOGE("ERROR: Byte swap + verify failed"); } if (state.pDataMap != NULL) { @@ -2952,7 +2952,7 @@ int dexSwapAndVerifyIfNecessary(u1* addr, int len) return dexSwapAndVerify(addr, len); } - LOGE("ERROR: Bad magic number (0x%02x %02x %02x %02x)\n", + LOGE("ERROR: Bad magic number (0x%02x %02x %02x %02x)", addr[0], addr[1], addr[2], addr[3]); return 1; diff --git a/libdex/InstrUtils.cpp b/libdex/InstrUtils.cpp index 3770c6da0..59c22c772 100644 --- a/libdex/InstrUtils.cpp +++ b/libdex/InstrUtils.cpp @@ -1004,7 +1004,7 @@ void dexDecodeInstruction(const u2* insns, DecodedInstruction* pDec) case 5: { if (format == kFmt35mi) { /* A fifth arg is verboten for inline invokes. */ - LOGW("Invalid arg count in 35mi (5)\n"); + LOGW("Invalid arg count in 35mi (5)"); goto bail; } /* @@ -1020,7 +1020,7 @@ void dexDecodeInstruction(const u2* insns, DecodedInstruction* pDec) case 1: pDec->vC = pDec->arg[0] = regList & 0x0f; break; case 0: break; // Valid, but no need to do anything. default: - LOGW("Invalid arg count in 35c/35ms/35mi (%d)\n", count); + LOGW("Invalid arg count in 35c/35ms/35mi (%d)", count); goto bail; } } @@ -1074,7 +1074,7 @@ void dexDecodeInstruction(const u2* insns, DecodedInstruction* pDec) pDec->vC = FETCH(4); break; default: - LOGW("Can't decode unexpected format %d (op=%d)\n", format, opcode); + LOGW("Can't decode unexpected format %d (op=%d)", format, opcode); assert(false); break; } diff --git a/libdex/OptInvocation.cpp b/libdex/OptInvocation.cpp index df5f8d99f..911e9d5a0 100644 --- a/libdex/OptInvocation.cpp +++ b/libdex/OptInvocation.cpp @@ -62,7 +62,7 @@ char* dexOptGenerateCacheFileName(const char* fileName, const char* subFileName) * the leading "./" out, but it'll do. */ if (getcwd(absoluteFile, kBufLen) == NULL) { - LOGE("Can't get CWD while opening jar file\n"); + LOGE("Can't get CWD while opening jar file"); return NULL; } strncat(absoluteFile, "/", kBufLen); @@ -101,7 +101,7 @@ char* dexOptGenerateCacheFileName(const char* fileName, const char* subFileName) */ strncat(nameBuf, absoluteFile, kBufLen); - LOGV("Cache file for '%s' '%s' is '%s'\n", fileName, subFileName, nameBuf); + LOGV("Cache file for '%s' '%s' is '%s'", fileName, subFileName, nameBuf); return strdup(nameBuf); } diff --git a/libdex/SysUtil.cpp b/libdex/SysUtil.cpp index 951ca1d8a..da5eb97a2 100644 --- a/libdex/SysUtil.cpp +++ b/libdex/SysUtil.cpp @@ -46,14 +46,14 @@ static void* sysCreateAnonShmem(size_t length) ptr = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); if (ptr == MAP_FAILED) { - LOGW("mmap(%d, RW, SHARED|ANON) failed: %s\n", (int) length, + LOGW("mmap(%d, RW, SHARED|ANON) failed: %s", (int) length, strerror(errno)); return NULL; } return ptr; #else - LOGE("sysCreateAnonShmem not implemented.\n"); + LOGE("sysCreateAnonShmem not implemented."); return NULL; #endif } @@ -90,13 +90,13 @@ static int getFileStartAndLength(int fd, off_t *start_, size_t *length_) (void) lseek(fd, start, SEEK_SET); if (start == (off_t) -1 || end == (off_t) -1) { - LOGE("could not determine length of file\n"); + LOGE("could not determine length of file"); return -1; } length = end - start; if (length == 0) { - LOGE("file is empty\n"); + LOGE("file is empty"); return -1; } @@ -131,7 +131,7 @@ int sysLoadFileInShmem(int fd, MemMapping* pMap) actual = read(fd, memPtr, length); if (actual != length) { - LOGE("only read %d of %d bytes\n", (int) actual, (int) length); + LOGE("only read %d of %d bytes", (int) actual, (int) length); sysReleaseShmem(pMap); return -1; } @@ -141,7 +141,7 @@ int sysLoadFileInShmem(int fd, MemMapping* pMap) return 0; #else - LOGE("sysLoadFileInShmem not implemented.\n"); + LOGE("sysLoadFileInShmem not implemented."); return -1; #endif } @@ -164,7 +164,7 @@ int sysFakeMapFile(int fd, MemMapping* pMap) memPtr = malloc(length); if (read(fd, memPtr, length) < 0) { - LOGW("read(fd=%d, start=%d, length=%d) failed: %s\n", (int) length, + LOGW("read(fd=%d, start=%d, length=%d) failed: %s", (int) length, fd, (int) start, strerror(errno)); return -1; } @@ -197,7 +197,7 @@ int sysMapFileInShmemReadOnly(int fd, MemMapping* pMap) memPtr = mmap(NULL, length, PROT_READ, MAP_FILE | MAP_SHARED, fd, start); if (memPtr == MAP_FAILED) { - LOGW("mmap(%d, RO, FILE|SHARED, %d, %d) failed: %s\n", (int) length, + LOGW("mmap(%d, RO, FILE|SHARED, %d, %d) failed: %s", (int) length, fd, (int) start, strerror(errno)); return -1; } @@ -237,16 +237,16 @@ int sysMapFileInShmemWritableReadOnly(int fd, MemMapping* pMap) memPtr = mmap(NULL, length, PROT_READ | PROT_WRITE, MAP_FILE | MAP_PRIVATE, fd, start); if (memPtr == MAP_FAILED) { - LOGW("mmap(%d, R/W, FILE|PRIVATE, %d, %d) failed: %s\n", (int) length, + LOGW("mmap(%d, R/W, FILE|PRIVATE, %d, %d) failed: %s", (int) length, fd, (int) start, strerror(errno)); return -1; } if (mprotect(memPtr, length, PROT_READ) < 0) { /* this fails with EACCESS on FAT filesystems, e.g. /sdcard */ int err = errno; - LOGV("mprotect(%p, %d, PROT_READ) failed: %s\n", + LOGV("mprotect(%p, %d, PROT_READ) failed: %s", memPtr, length, strerror(err)); - LOGD("mprotect(RO) failed (%d), file will remain read-write\n", err); + LOGD("mprotect(RO) failed (%d), file will remain read-write", err); } pMap->baseAddr = pMap->addr = memPtr; @@ -284,7 +284,7 @@ int sysMapFileSegmentInShmem(int fd, off_t start, size_t length, memPtr = mmap(NULL, actualLength, PROT_READ, MAP_FILE | MAP_SHARED, fd, actualStart); if (memPtr == MAP_FAILED) { - LOGW("mmap(%d, R, FILE|SHARED, %d, %d) failed: %s\n", + LOGW("mmap(%d, R, FILE|SHARED, %d, %d) failed: %s", (int) actualLength, fd, (int) actualStart, strerror(errno)); return -1; } @@ -294,14 +294,14 @@ int sysMapFileSegmentInShmem(int fd, off_t start, size_t length, pMap->addr = (char*)memPtr + adjust; pMap->length = length; - LOGVV("mmap seg (st=%d ln=%d): bp=%p bl=%d ad=%p ln=%d\n", + LOGVV("mmap seg (st=%d ln=%d): bp=%p bl=%d ad=%p ln=%d", (int) start, (int) length, pMap->baseAddr, (int) pMap->baseLength, pMap->addr, (int) pMap->length); return 0; #else - LOGE("sysMapFileSegmentInShmem not implemented.\n"); + LOGE("sysMapFileSegmentInShmem not implemented."); return -1; #endif } @@ -321,7 +321,7 @@ int sysChangeMapAccess(void* addr, size_t length, int wantReadWrite, if (addr < pMap->baseAddr || (u1*)addr >= (u1*)pMap->baseAddr + pMap->baseLength) { - LOGE("Attempted to change %p; map is %p - %p\n", + LOGE("Attempted to change %p; map is %p - %p", addr, pMap->baseAddr, (u1*)pMap->baseAddr + pMap->baseLength); return -1; } @@ -334,11 +334,11 @@ int sysChangeMapAccess(void* addr, size_t length, int wantReadWrite, u1* alignAddr = (u1*) ((int) addr & ~(SYSTEM_PAGE_SIZE-1)); size_t alignLength = length + ((u1*) addr - alignAddr); - //LOGI("%p/%zd --> %p/%zd\n", addr, length, alignAddr, alignLength); + //LOGI("%p/%zd --> %p/%zd", addr, length, alignAddr, alignLength); int prot = wantReadWrite ? (PROT_READ|PROT_WRITE) : (PROT_READ); if (mprotect(alignAddr, alignLength, prot) != 0) { int err = errno; - LOGV("mprotect (%p,%zd,%d) failed: %s\n", + LOGV("mprotect (%p,%zd,%d) failed: %s", alignAddr, alignLength, prot, strerror(errno)); return (errno != 0) ? errno : -1; } @@ -358,10 +358,10 @@ void sysReleaseShmem(MemMapping* pMap) return; if (munmap(pMap->baseAddr, pMap->baseLength) < 0) { - LOGW("munmap(%p, %d) failed: %s\n", + LOGW("munmap(%p, %d) failed: %s", pMap->baseAddr, (int)pMap->baseLength, strerror(errno)); } else { - LOGV("munmap(%p, %d) succeeded\n", pMap->baseAddr, pMap->baseLength); + LOGV("munmap(%p, %d) succeeded", pMap->baseAddr, pMap->baseLength); pMap->baseAddr = NULL; pMap->baseLength = 0; } @@ -394,10 +394,10 @@ int sysWriteFully(int fd, const void* buf, size_t count, const char* logMsg) ssize_t actual = TEMP_FAILURE_RETRY(write(fd, buf, count)); if (actual < 0) { int err = errno; - LOGE("%s: write failed: %s\n", logMsg, strerror(err)); + LOGE("%s: write failed: %s", logMsg, strerror(err)); return err; } else if (actual != (ssize_t) count) { - LOGD("%s: partial write (will retry): (%d of %zd)\n", + LOGD("%s: partial write (will retry): (%d of %zd)", logMsg, (int) actual, count); buf = (const void*) (((const u1*) buf) + actual); } @@ -418,7 +418,7 @@ int sysCopyFileToFile(int outFd, int inFd, size_t count) ssize_t actual = TEMP_FAILURE_RETRY(read(inFd, buf, getSize)); if (actual != (ssize_t) getSize) { - LOGW("sysCopyFileToFile: copy read failed (%d vs %zd)\n", + LOGW("sysCopyFileToFile: copy read failed (%d vs %zd)", (int) actual, getSize); return -1; } diff --git a/libdex/ZipArchive.cpp b/libdex/ZipArchive.cpp index 29b665ed7..4c9e1206c 100644 --- a/libdex/ZipArchive.cpp +++ b/libdex/ZipArchive.cpp @@ -80,7 +80,7 @@ static int entryToIndex(const ZipArchive* pArchive, const ZipEntry entry) if (ent < 0 || ent >= pArchive->mHashTableSize || pArchive->mHashTable[ent].name == NULL) { - LOGW("Zip: invalid ZipEntry %p (%ld)\n", entry, ent); + LOGW("Zip: invalid ZipEntry %p (%ld)", entry, ent); return -1; } return ent; @@ -149,7 +149,7 @@ static int mapCentralDirectory0(int fd, const char* debugFileName, */ off_t fileLength = lseek(fd, 0, SEEK_END); if (fileLength < kEOCDLen) { - LOGV("Zip: length %ld is too small to be zip\n", (long) fileLength); + LOGV("Zip: length %ld is too small to be zip", (long) fileLength); return -1; } @@ -172,12 +172,12 @@ static int mapCentralDirectory0(int fd, const char* debugFileName, scanBuf = (u1*) malloc(readAmount); if (lseek(fd, searchStart, SEEK_SET) != searchStart) { - LOGW("Zip: seek %ld failed: %s\n", (long) searchStart, strerror(errno)); + LOGW("Zip: seek %ld failed: %s", (long) searchStart, strerror(errno)); return -1; } ssize_t actual = TEMP_FAILURE_RETRY(read(fd, scanBuf, readAmount)); if (actual != (ssize_t) readAmount) { - LOGW("Zip: read %zd failed: %s\n", readAmount, strerror(errno)); + LOGW("Zip: read %zd failed: %s", readAmount, strerror(errno)); return -1; } @@ -190,12 +190,12 @@ static int mapCentralDirectory0(int fd, const char* debugFileName, int i; for (i = readAmount - kEOCDLen; i >= 0; i--) { if (scanBuf[i] == 0x50 && get4LE(&scanBuf[i]) == kEOCDSignature) { - LOGV("+++ Found EOCD at buf+%d\n", i); + LOGV("+++ Found EOCD at buf+%d", i); break; } } if (i < 0) { - LOGD("Zip: EOCD not found, %s is not zip\n", debugFileName); + LOGD("Zip: EOCD not found, %s is not zip", debugFileName); return -1; } @@ -213,16 +213,16 @@ static int mapCentralDirectory0(int fd, const char* debugFileName, u4 dirOffset = get4LE(eocdPtr + kEOCDFileOffset); if ((long long) dirOffset + (long long) dirSize > (long long) eocdOffset) { - LOGW("Zip: bad offsets (dir %ld, size %u, eocd %ld)\n", + LOGW("Zip: bad offsets (dir %ld, size %u, eocd %ld)", (long) dirOffset, dirSize, (long) eocdOffset); return -1; } if (numEntries == 0) { - LOGW("Zip: empty archive?\n"); + LOGW("Zip: empty archive?"); return -1; } - LOGV("+++ numEntries=%d dirSize=%d dirOffset=%d\n", + LOGV("+++ numEntries=%d dirSize=%d dirOffset=%d", numEntries, dirSize, dirOffset); /* @@ -232,7 +232,7 @@ static int mapCentralDirectory0(int fd, const char* debugFileName, if (sysMapFileSegmentInShmem(fd, dirOffset, dirSize, &pArchive->mDirectoryMap) != 0) { - LOGW("Zip: cd map failed\n"); + LOGW("Zip: cd map failed"); return -1; } @@ -295,17 +295,17 @@ static int parseZipArchive(ZipArchive* pArchive) int i; for (i = 0; i < numEntries; i++) { if (get4LE(ptr) != kCDESignature) { - LOGW("Zip: missed a central dir sig (at %d)\n", i); + LOGW("Zip: missed a central dir sig (at %d)", i); goto bail; } if (ptr + kCDELen > cdPtr + cdLength) { - LOGW("Zip: ran off the end (at %d)\n", i); + LOGW("Zip: ran off the end (at %d)", i); goto bail; } long localHdrOffset = (long) get4LE(ptr + kCDELocalOffset); if (localHdrOffset >= pArchive->mDirectoryOffset) { - LOGW("Zip: bad LFH offset %ld at entry %d\n", localHdrOffset, i); + LOGW("Zip: bad LFH offset %ld at entry %d", localHdrOffset, i); goto bail; } @@ -320,12 +320,12 @@ static int parseZipArchive(ZipArchive* pArchive) ptr += kCDELen + fileNameLen + extraLen + commentLen; if ((size_t)(ptr - cdPtr) > cdLength) { - LOGW("Zip: bad CD advance (%d vs %zd) at entry %d\n", + LOGW("Zip: bad CD advance (%d vs %zd) at entry %d", (int) (ptr - cdPtr), cdLength, i); goto bail; } } - LOGV("+++ zip good scan %d entries\n", numEntries); + LOGV("+++ zip good scan %d entries", numEntries); result = 0; @@ -348,14 +348,14 @@ int dexZipOpenArchive(const char* fileName, ZipArchive* pArchive) { int fd, err; - LOGV("Opening as zip '%s' %p\n", fileName, pArchive); + LOGV("Opening as zip '%s' %p", fileName, pArchive); memset(pArchive, 0, sizeof(ZipArchive)); fd = open(fileName, O_RDONLY | O_BINARY, 0); if (fd < 0) { err = errno ? errno : -1; - LOGV("Unable to open '%s': %s\n", fileName, strerror(err)); + LOGV("Unable to open '%s': %s", fileName, strerror(err)); return err; } @@ -378,7 +378,7 @@ int dexZipPrepArchive(int fd, const char* debugFileName, ZipArchive* pArchive) goto bail; if (parseZipArchive(pArchive) != 0) { - LOGV("Zip: parsing '%s' failed\n", debugFileName); + LOGV("Zip: parsing '%s' failed", debugFileName); goto bail; } @@ -399,7 +399,7 @@ bail: */ void dexZipCloseArchive(ZipArchive* pArchive) { - LOGV("Closing archive %p\n", pArchive); + LOGV("Closing archive %p", pArchive); if (pArchive->mFd >= 0) close(pArchive->mFd); @@ -454,7 +454,7 @@ ZipEntry dexZipFindEntry(const ZipArchive* pArchive, const char* entryName) ZipEntry findEntryByIndex(ZipArchive* pArchive, int idx) { if (idx < 0 || idx >= pArchive->mNumEntries) { - LOGW("Invalid index %d\n", idx); + LOGW("Invalid index %d", idx); return NULL; } @@ -531,24 +531,24 @@ int dexZipGetEntryInfo(const ZipArchive* pArchive, ZipEntry entry, if (pOffset != NULL) { long localHdrOffset = (long) get4LE(ptr + kCDELocalOffset); if (localHdrOffset + kLFHLen >= cdOffset) { - LOGW("Zip: bad local hdr offset in zip\n"); + LOGW("Zip: bad local hdr offset in zip"); return -1; } u1 lfhBuf[kLFHLen]; if (lseek(pArchive->mFd, localHdrOffset, SEEK_SET) != localHdrOffset) { - LOGW("Zip: failed seeking to lfh at offset %ld\n", localHdrOffset); + LOGW("Zip: failed seeking to lfh at offset %ld", localHdrOffset); return -1; } ssize_t actual = TEMP_FAILURE_RETRY(read(pArchive->mFd, lfhBuf, sizeof(lfhBuf))); if (actual != sizeof(lfhBuf)) { - LOGW("Zip: failed reading lfh from offset %ld\n", localHdrOffset); + LOGW("Zip: failed reading lfh from offset %ld", localHdrOffset); return -1; } if (get4LE(lfhBuf) != kLFHSignature) { - LOGW("Zip: didn't find signature at start of lfh, offset=%ld\n", + LOGW("Zip: didn't find signature at start of lfh, offset=%ld", localHdrOffset); return -1; } @@ -556,13 +556,13 @@ int dexZipGetEntryInfo(const ZipArchive* pArchive, ZipEntry entry, off_t dataOffset = localHdrOffset + kLFHLen + get2LE(lfhBuf + kLFHNameLen) + get2LE(lfhBuf + kLFHExtraLen); if (dataOffset >= cdOffset) { - LOGW("Zip: bad data offset %ld in zip\n", (long) dataOffset); + LOGW("Zip: bad data offset %ld in zip", (long) dataOffset); return -1; } /* check lengths */ if ((off_t)(dataOffset + compLen) > cdOffset) { - LOGW("Zip: bad compressed length in zip (%ld + %zd > %ld)\n", + LOGW("Zip: bad compressed length in zip (%ld + %zd > %ld)", (long) dataOffset, compLen, (long) cdOffset); return -1; } @@ -570,7 +570,7 @@ int dexZipGetEntryInfo(const ZipArchive* pArchive, ZipEntry entry, if (method == kCompressStored && (off_t)(dataOffset + uncompLen) > cdOffset) { - LOGW("Zip: bad uncompressed length in zip (%ld + %zd > %ld)\n", + LOGW("Zip: bad uncompressed length in zip (%ld + %zd > %ld)", (long) dataOffset, uncompLen, (long) cdOffset); return -1; } @@ -616,10 +616,10 @@ static int inflateToFile(int outFd, int inFd, size_t uncompLen, size_t compLen) zerr = inflateInit2(&zstream, -MAX_WBITS); if (zerr != Z_OK) { if (zerr == Z_VERSION_ERROR) { - LOGE("Installed zlib is not compatible with linked version (%s)\n", + LOGE("Installed zlib is not compatible with linked version (%s)", ZLIB_VERSION); } else { - LOGW("Call to inflateInit2 failed (zerr=%d)\n", zerr); + LOGW("Call to inflateInit2 failed (zerr=%d)", zerr); } goto bail; } @@ -634,7 +634,7 @@ static int inflateToFile(int outFd, int inFd, size_t uncompLen, size_t compLen) ssize_t actual = TEMP_FAILURE_RETRY(read(inFd, readBuf, getSize)); if (actual != (ssize_t) getSize) { - LOGW("Zip: inflate read failed (%d vs %zd)\n", + LOGW("Zip: inflate read failed (%d vs %zd)", (int)actual, getSize); goto z_bail; } @@ -648,7 +648,7 @@ static int inflateToFile(int outFd, int inFd, size_t uncompLen, size_t compLen) /* uncompress the data */ zerr = inflate(&zstream, Z_NO_FLUSH); if (zerr != Z_OK && zerr != Z_STREAM_END) { - LOGW("Zip: inflate zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n", + LOGW("Zip: inflate zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)", zerr, zstream.next_in, zstream.avail_in, zstream.next_out, zstream.avail_out); goto z_bail; @@ -671,7 +671,7 @@ static int inflateToFile(int outFd, int inFd, size_t uncompLen, size_t compLen) /* paranoia */ if (zstream.total_out != uncompLen) { - LOGW("Zip: size mismatch on inflated file (%ld vs %zd)\n", + LOGW("Zip: size mismatch on inflated file (%ld vs %zd)", zstream.total_out, uncompLen); goto z_bail; } @@ -699,7 +699,7 @@ int dexZipExtractEntryToFile(const ZipArchive* pArchive, int result = -1; int ent = entryToIndex(pArchive, entry); if (ent < 0) { - LOGW("Zip: extract can't find entry %p\n", entry); + LOGW("Zip: extract can't find entry %p", entry); goto bail; } @@ -713,7 +713,7 @@ int dexZipExtractEntryToFile(const ZipArchive* pArchive, goto bail; } if (lseek(pArchive->mFd, dataOffset, SEEK_SET) != dataOffset) { - LOGW("Zip: lseek to data at %ld failed\n", (long) dataOffset); + LOGW("Zip: lseek to data at %ld failed", (long) dataOffset); goto bail; } |