diff options
Diffstat (limited to 'libs/utils')
-rw-r--r-- | libs/utils/Asset.cpp | 34 | ||||
-rw-r--r-- | libs/utils/AssetManager.cpp | 104 | ||||
-rw-r--r-- | libs/utils/BackupData.cpp | 28 | ||||
-rw-r--r-- | libs/utils/BackupHelpers.cpp | 46 | ||||
-rw-r--r-- | libs/utils/BlobCache.cpp | 44 | ||||
-rw-r--r-- | libs/utils/CallStack.cpp | 2 | ||||
-rw-r--r-- | libs/utils/FileMap.cpp | 16 | ||||
-rw-r--r-- | libs/utils/Looper.cpp | 58 | ||||
-rw-r--r-- | libs/utils/ObbFile.cpp | 54 | ||||
-rw-r--r-- | libs/utils/PropertyMap.cpp | 22 | ||||
-rw-r--r-- | libs/utils/RefBase.cpp | 48 | ||||
-rw-r--r-- | libs/utils/ResourceTypes.cpp | 242 | ||||
-rw-r--r-- | libs/utils/Static.cpp | 4 | ||||
-rw-r--r-- | libs/utils/StopWatch.cpp | 4 | ||||
-rw-r--r-- | libs/utils/StreamingZipInflater.cpp | 14 | ||||
-rw-r--r-- | libs/utils/String16.cpp | 4 | ||||
-rw-r--r-- | libs/utils/String8.cpp | 6 | ||||
-rw-r--r-- | libs/utils/SystemClock.cpp | 8 | ||||
-rw-r--r-- | libs/utils/Threads.cpp | 14 | ||||
-rw-r--r-- | libs/utils/Timers.cpp | 2 | ||||
-rw-r--r-- | libs/utils/Tokenizer.cpp | 12 | ||||
-rw-r--r-- | libs/utils/VectorImpl.cpp | 24 | ||||
-rw-r--r-- | libs/utils/ZipFileRO.cpp | 86 | ||||
-rw-r--r-- | libs/utils/ZipUtils.cpp | 24 |
24 files changed, 450 insertions, 450 deletions
diff --git a/libs/utils/Asset.cpp b/libs/utils/Asset.cpp index a18294b..50e701a 100644 --- a/libs/utils/Asset.cpp +++ b/libs/utils/Asset.cpp @@ -89,7 +89,7 @@ Asset::Asset(void) gTail->mNext = this; gTail = this; } - //LOGI("Creating Asset %p #%d\n", this, gCount); + //ALOGI("Creating Asset %p #%d\n", this, gCount); } Asset::~Asset(void) @@ -109,7 +109,7 @@ Asset::~Asset(void) mPrev->mNext = mNext; } mNext = mPrev = NULL; - //LOGI("Destroying Asset in %p #%d\n", this, gCount); + //ALOGI("Destroying Asset in %p #%d\n", this, gCount); } /* @@ -210,7 +210,7 @@ Asset::~Asset(void) offset = ftell(fp); fclose(fp); if (!scanResult) { - LOGD("File '%s' is not in gzip format\n", fileName); + ALOGD("File '%s' is not in gzip format\n", fileName); ::close(fd); return NULL; } @@ -327,14 +327,14 @@ off64_t Asset::handleSeek(off64_t offset, int whence, off64_t curPosn, off64_t m newOffset = maxPosn + offset; break; default: - LOGW("unexpected whence %d\n", whence); + ALOGW("unexpected whence %d\n", whence); // this was happening due to an off64_t size mismatch assert(false); return (off64_t) -1; } if (newOffset < 0 || newOffset > maxPosn) { - LOGW("seek out of range: want %ld, end=%ld\n", + ALOGW("seek out of range: want %ld, end=%ld\n", (long) newOffset, (long) maxPosn); return (off64_t) -1; } @@ -384,12 +384,12 @@ status_t _FileAsset::openChunk(const char* fileName, int fd, off64_t offset, siz fileLength = lseek64(fd, 0, SEEK_END); if (fileLength == (off64_t) -1) { // probably a bad file descriptor - LOGD("failed lseek (errno=%d)\n", errno); + ALOGD("failed lseek (errno=%d)\n", errno); return UNKNOWN_ERROR; } if ((off64_t) (offset + length) > fileLength) { - LOGD("start (%ld) + len (%ld) > end (%ld)\n", + ALOGD("start (%ld) + len (%ld) > end (%ld)\n", (long) offset, (long) length, (long) fileLength); return BAD_INDEX; } @@ -473,7 +473,7 @@ ssize_t _FileAsset::read(void* buf, size_t count) /* read from the file */ //printf("file read\n"); if (ftell(mFp) != mStart + mOffset) { - LOGE("Hosed: %ld != %ld+%ld\n", + ALOGE("Hosed: %ld != %ld+%ld\n", ftell(mFp), (long) mStart, (long) mOffset); assert(false); } @@ -581,23 +581,23 @@ const void* _FileAsset::getBuffer(bool wordAligned) buf = new unsigned char[allocLen]; if (buf == NULL) { - LOGE("alloc of %ld bytes failed\n", (long) allocLen); + ALOGE("alloc of %ld bytes failed\n", (long) allocLen); return NULL; } - LOGV("Asset %p allocating buffer size %d (smaller than threshold)", this, (int)allocLen); + ALOGV("Asset %p allocating buffer size %d (smaller than threshold)", this, (int)allocLen); if (mLength > 0) { long oldPosn = ftell(mFp); fseek(mFp, mStart, SEEK_SET); if (fread(buf, 1, mLength, mFp) != (size_t) mLength) { - LOGE("failed reading %ld bytes\n", (long) mLength); + ALOGE("failed reading %ld bytes\n", (long) mLength); delete[] buf; return NULL; } fseek(mFp, oldPosn, SEEK_SET); } - LOGV(" getBuffer: loaded into buffer\n"); + ALOGV(" getBuffer: loaded into buffer\n"); mBuf = buf; return mBuf; @@ -610,7 +610,7 @@ const void* _FileAsset::getBuffer(bool wordAligned) return NULL; } - LOGV(" getBuffer: mapped\n"); + ALOGV(" getBuffer: mapped\n"); mMap = map; if (!wordAligned) { @@ -648,17 +648,17 @@ const void* _FileAsset::ensureAlignment(FileMap* map) if ((((size_t)data)&0x3) == 0) { // We can return this directly if it is aligned on a word // boundary. - LOGV("Returning aligned FileAsset %p (%s).", this, + ALOGV("Returning aligned FileAsset %p (%s).", this, getAssetSource()); return data; } // If not aligned on a word boundary, then we need to copy it into // our own buffer. - LOGV("Copying FileAsset %p (%s) to buffer size %d to make it aligned.", this, + ALOGV("Copying FileAsset %p (%s) to buffer size %d to make it aligned.", this, getAssetSource(), (int)mLength); unsigned char* buf = new unsigned char[mLength]; if (buf == NULL) { - LOGE("alloc of %ld bytes failed\n", (long) mLength); + ALOGE("alloc of %ld bytes failed\n", (long) mLength); return NULL; } memcpy(buf, data, mLength); @@ -855,7 +855,7 @@ const void* _CompressedAsset::getBuffer(bool wordAligned) */ buf = new unsigned char[mUncompressedLen]; if (buf == NULL) { - LOGW("alloc %ld bytes failed\n", (long) mUncompressedLen); + ALOGW("alloc %ld bytes failed\n", (long) mUncompressedLen); goto bail; } diff --git a/libs/utils/AssetManager.cpp b/libs/utils/AssetManager.cpp index 22034c5..47a2b99 100644 --- a/libs/utils/AssetManager.cpp +++ b/libs/utils/AssetManager.cpp @@ -117,14 +117,14 @@ AssetManager::AssetManager(CacheMode cacheMode) mCacheMode(cacheMode), mCacheValid(false) { int count = android_atomic_inc(&gCount)+1; - //LOGI("Creating AssetManager %p #%d\n", this, count); + //ALOGI("Creating AssetManager %p #%d\n", this, count); memset(mConfig, 0, sizeof(ResTable_config)); } AssetManager::~AssetManager(void) { int count = android_atomic_dec(&gCount); - //LOGI("Destroying AssetManager in %p #%d\n", this, count); + //ALOGI("Destroying AssetManager in %p #%d\n", this, count); delete mConfig; delete mResources; @@ -151,7 +151,7 @@ bool AssetManager::addAssetPath(const String8& path, void** cookie) ap.path = path; ap.type = ::getFileType(path.string()); if (ap.type != kFileTypeDirectory && ap.type != kFileTypeRegular) { - LOGW("Asset path %s is neither a directory nor file (type=%d).", + ALOGW("Asset path %s is neither a directory nor file (type=%d).", path.string(), (int)ap.type); return false; } @@ -167,7 +167,7 @@ bool AssetManager::addAssetPath(const String8& path, void** cookie) } } - LOGV("In %p Asset %s path: %s", this, + ALOGV("In %p Asset %s path: %s", this, ap.type == kFileTypeDirectory ? "dir" : "zip", ap.path.string()); mAssetPaths.add(ap); @@ -200,7 +200,7 @@ bool AssetManager::addAssetPath(const String8& path, void** cookie) if (addOverlay) { mAssetPaths.add(oap); } else { - LOGW("failed to add overlay package %s\n", overlayPath.string()); + ALOGW("failed to add overlay package %s\n", overlayPath.string()); } } } @@ -216,17 +216,17 @@ bool AssetManager::isIdmapStaleLocked(const String8& originalPath, const String8 if (errno == ENOENT) { return true; // non-existing idmap is always stale } else { - LOGW("failed to stat file %s: %s\n", idmapPath.string(), strerror(errno)); + ALOGW("failed to stat file %s: %s\n", idmapPath.string(), strerror(errno)); return false; } } if (st.st_size < ResTable::IDMAP_HEADER_SIZE_BYTES) { - LOGW("file %s has unexpectedly small size=%zd\n", idmapPath.string(), (size_t)st.st_size); + ALOGW("file %s has unexpectedly small size=%zd\n", idmapPath.string(), (size_t)st.st_size); return false; } int fd = TEMP_FAILURE_RETRY(::open(idmapPath.string(), O_RDONLY)); if (fd == -1) { - LOGW("failed to open file %s: %s\n", idmapPath.string(), strerror(errno)); + ALOGW("failed to open file %s: %s\n", idmapPath.string(), strerror(errno)); return false; } char buf[ResTable::IDMAP_HEADER_SIZE_BYTES]; @@ -283,7 +283,7 @@ bool AssetManager::getZipEntryCrcLocked(const String8& zipPath, const char* entr bool AssetManager::createIdmapFileLocked(const String8& originalPath, const String8& overlayPath, const String8& idmapPath) { - LOGD("%s: originalPath=%s overlayPath=%s idmapPath=%s\n", + ALOGD("%s: originalPath=%s overlayPath=%s idmapPath=%s\n", __FUNCTION__, originalPath.string(), overlayPath.string(), idmapPath.string()); ResTable tables[2]; const String8* paths[2] = { &originalPath, &overlayPath }; @@ -300,24 +300,24 @@ bool AssetManager::createIdmapFileLocked(const String8& originalPath, const Stri ap.path = *paths[i]; Asset* ass = openNonAssetInPathLocked("resources.arsc", Asset::ACCESS_BUFFER, ap); if (ass == NULL) { - LOGW("failed to find resources.arsc in %s\n", ap.path.string()); + ALOGW("failed to find resources.arsc in %s\n", ap.path.string()); goto error; } tables[i].add(ass, (void*)1, false); } if (!getZipEntryCrcLocked(originalPath, "resources.arsc", &originalCrc)) { - LOGW("failed to retrieve crc for resources.arsc in %s\n", originalPath.string()); + ALOGW("failed to retrieve crc for resources.arsc in %s\n", originalPath.string()); goto error; } if (!getZipEntryCrcLocked(overlayPath, "resources.arsc", &overlayCrc)) { - LOGW("failed to retrieve crc for resources.arsc in %s\n", overlayPath.string()); + ALOGW("failed to retrieve crc for resources.arsc in %s\n", overlayPath.string()); goto error; } if (tables[0].createIdmap(tables[1], originalCrc, overlayCrc, (void**)&data, &size) != NO_ERROR) { - LOGW("failed to generate idmap data for file %s\n", idmapPath.string()); + ALOGW("failed to generate idmap data for file %s\n", idmapPath.string()); goto error; } @@ -326,13 +326,13 @@ bool AssetManager::createIdmapFileLocked(const String8& originalPath, const Stri // installd). fd = TEMP_FAILURE_RETRY(::open(idmapPath.string(), O_WRONLY | O_CREAT | O_TRUNC, 0644)); if (fd == -1) { - LOGW("failed to write idmap file %s (open: %s)\n", idmapPath.string(), strerror(errno)); + ALOGW("failed to write idmap file %s (open: %s)\n", idmapPath.string(), strerror(errno)); goto error_free; } for (;;) { ssize_t written = TEMP_FAILURE_RETRY(write(fd, data + offset, size)); if (written < 0) { - LOGW("failed to write idmap file %s (write: %s)\n", idmapPath.string(), + ALOGW("failed to write idmap file %s (write: %s)\n", idmapPath.string(), strerror(errno)); goto error_close; } @@ -498,7 +498,7 @@ Asset* AssetManager::open(const char* fileName, AccessMode mode) size_t i = mAssetPaths.size(); while (i > 0) { i--; - LOGV("Looking for asset '%s' in '%s'\n", + ALOGV("Looking for asset '%s' in '%s'\n", assetName.string(), mAssetPaths.itemAt(i).path.string()); Asset* pAsset = openNonAssetInPathLocked(assetName.string(), mode, mAssetPaths.itemAt(i)); if (pAsset != NULL) { @@ -532,7 +532,7 @@ Asset* AssetManager::openNonAsset(const char* fileName, AccessMode mode) size_t i = mAssetPaths.size(); while (i > 0) { i--; - LOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(i).path.string()); + ALOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(i).path.string()); Asset* pAsset = openNonAssetInPathLocked( fileName, mode, mAssetPaths.itemAt(i)); if (pAsset != NULL) { @@ -556,7 +556,7 @@ Asset* AssetManager::openNonAsset(void* cookie, const char* fileName, AccessMode loadFileNameCacheLocked(); if (which < mAssetPaths.size()) { - LOGV("Looking for non-asset '%s' in '%s'\n", fileName, + ALOGV("Looking for non-asset '%s' in '%s'\n", fileName, mAssetPaths.itemAt(which).path.string()); Asset* pAsset = openNonAssetInPathLocked( fileName, mode, mAssetPaths.itemAt(which)); @@ -621,7 +621,7 @@ const ResTable* AssetManager::getResTable(bool required) const bool shared = true; const asset_path& ap = mAssetPaths.itemAt(i); Asset* idmap = openIdmapLocked(ap); - LOGV("Looking for resource asset in '%s'\n", ap.path.string()); + ALOGV("Looking for resource asset in '%s'\n", ap.path.string()); if (ap.type != kFileTypeDirectory) { if (i == 0) { // The first item is typically the framework resources, @@ -633,7 +633,7 @@ const ResTable* AssetManager::getResTable(bool required) const ass = const_cast<AssetManager*>(this)-> mZipSet.getZipResourceTableAsset(ap.path); if (ass == NULL) { - LOGV("loading resource table %s\n", ap.path.string()); + ALOGV("loading resource table %s\n", ap.path.string()); ass = const_cast<AssetManager*>(this)-> openNonAssetInPathLocked("resources.arsc", Asset::ACCESS_BUFFER, @@ -648,7 +648,7 @@ const ResTable* AssetManager::getResTable(bool required) const // If this is the first resource table in the asset // manager, then we are going to cache it so that we // can quickly copy it out for others. - LOGV("Creating shared resources for %s", ap.path.string()); + ALOGV("Creating shared resources for %s", ap.path.string()); sharedRes = new ResTable(); sharedRes->add(ass, (void*)(i+1), false, idmap); sharedRes = const_cast<AssetManager*>(this)-> @@ -656,7 +656,7 @@ const ResTable* AssetManager::getResTable(bool required) const } } } else { - LOGV("loading resource table %s\n", ap.path.string()); + ALOGV("loading resource table %s\n", ap.path.string()); Asset* ass = const_cast<AssetManager*>(this)-> openNonAssetInPathLocked("resources.arsc", Asset::ACCESS_BUFFER, @@ -668,12 +668,12 @@ const ResTable* AssetManager::getResTable(bool required) const mResources = rt = new ResTable(); updateResourceParamsLocked(); } - LOGV("Installing resource asset %p in to table %p\n", ass, mResources); + ALOGV("Installing resource asset %p in to table %p\n", ass, mResources); if (sharedRes != NULL) { - LOGV("Copying existing resources for %s", ap.path.string()); + ALOGV("Copying existing resources for %s", ap.path.string()); rt->add(sharedRes); } else { - LOGV("Parsing resources for %s", ap.path.string()); + ALOGV("Parsing resources for %s", ap.path.string()); rt->add(ass, (void*)(i+1), !shared, idmap); } @@ -686,7 +686,7 @@ const ResTable* AssetManager::getResTable(bool required) const } } - if (required && !rt) LOGW("Unable to find resources file resources.arsc"); + if (required && !rt) ALOGW("Unable to find resources file resources.arsc"); if (!rt) { mResources = rt = new ResTable(); } @@ -725,9 +725,9 @@ Asset* AssetManager::openIdmapLocked(const struct asset_path& ap) const ass = const_cast<AssetManager*>(this)-> openAssetFromFileLocked(ap.idmap, Asset::ACCESS_BUFFER); if (ass) { - LOGV("loading idmap %s\n", ap.idmap.string()); + ALOGV("loading idmap %s\n", ap.idmap.string()); } else { - LOGW("failed to load idmap %s\n", ap.idmap.string()); + ALOGW("failed to load idmap %s\n", ap.idmap.string()); } } return ass; @@ -923,7 +923,7 @@ Asset* AssetManager::openInLocaleVendorLocked(const char* fileName, AccessMode m */ if (found) { if (pAsset == NULL) - LOGD("Expected file not found: '%s'\n", path.string()); + ALOGD("Expected file not found: '%s'\n", path.string()); return pAsset; } } @@ -1019,7 +1019,7 @@ String8 AssetManager::createPathNameLocked(const asset_path& ap, const char* roo */ ZipFileRO* AssetManager::getZipFileLocked(const asset_path& ap) { - LOGV("getZipFileLocked() in %p\n", this); + ALOGV("getZipFileLocked() in %p\n", this); return mZipSet.getZip(ap.path); } @@ -1074,29 +1074,29 @@ Asset* AssetManager::openAssetFromZipLocked(const ZipFileRO* pZipFile, if (!pZipFile->getEntryInfo(entry, &method, &uncompressedLen, NULL, NULL, NULL, NULL)) { - LOGW("getEntryInfo failed\n"); + ALOGW("getEntryInfo failed\n"); return NULL; } FileMap* dataMap = pZipFile->createEntryFileMap(entry); if (dataMap == NULL) { - LOGW("create map from entry failed\n"); + ALOGW("create map from entry failed\n"); return NULL; } if (method == ZipFileRO::kCompressStored) { pAsset = Asset::createFromUncompressedMap(dataMap, mode); - LOGV("Opened uncompressed entry %s in zip %s mode %d: %p", entryName.string(), + ALOGV("Opened uncompressed entry %s in zip %s mode %d: %p", entryName.string(), dataMap->getFileName(), mode, pAsset); } else { pAsset = Asset::createFromCompressedMap(dataMap, method, uncompressedLen, mode); - LOGV("Opened compressed entry %s in zip %s mode %d: %p", entryName.string(), + ALOGV("Opened compressed entry %s in zip %s mode %d: %p", entryName.string(), dataMap->getFileName(), mode, pAsset); } if (pAsset == NULL) { /* unexpected */ - LOGW("create from segment failed\n"); + ALOGW("create from segment failed\n"); } return pAsset; @@ -1146,10 +1146,10 @@ AssetDir* AssetManager::openDir(const char* dirName) i--; const asset_path& ap = mAssetPaths.itemAt(i); if (ap.type == kFileTypeRegular) { - LOGV("Adding directory %s from zip %s", dirName, ap.path.string()); + ALOGV("Adding directory %s from zip %s", dirName, ap.path.string()); scanAndMergeZipLocked(pMergedInfo, ap, kAssetsRoot, dirName); } else { - LOGV("Adding directory %s from dir %s", dirName, ap.path.string()); + ALOGV("Adding directory %s from dir %s", dirName, ap.path.string()); scanAndMergeDirLocked(pMergedInfo, ap, kAssetsRoot, dirName); } } @@ -1200,10 +1200,10 @@ AssetDir* AssetManager::openNonAssetDir(void* cookie, const char* dirName) if (which < mAssetPaths.size()) { const asset_path& ap = mAssetPaths.itemAt(which); if (ap.type == kFileTypeRegular) { - LOGV("Adding directory %s from zip %s", dirName, ap.path.string()); + ALOGV("Adding directory %s from zip %s", dirName, ap.path.string()); scanAndMergeZipLocked(pMergedInfo, ap, NULL, dirName); } else { - LOGV("Adding directory %s from dir %s", dirName, ap.path.string()); + ALOGV("Adding directory %s from dir %s", dirName, ap.path.string()); scanAndMergeDirLocked(pMergedInfo, ap, NULL, dirName); } } @@ -1325,7 +1325,7 @@ bool AssetManager::scanAndMergeDirLocked(SortedVector<AssetDir::FileInfo>* pMerg matchIdx = AssetDir::FileInfo::findEntry(pMergedInfo, match); if (matchIdx > 0) { - LOGV("Excluding '%s' [%s]\n", + ALOGV("Excluding '%s' [%s]\n", pMergedInfo->itemAt(matchIdx).getFileName().string(), pMergedInfo->itemAt(matchIdx).getSourceName().string()); pMergedInfo->removeAt(matchIdx); @@ -1333,7 +1333,7 @@ bool AssetManager::scanAndMergeDirLocked(SortedVector<AssetDir::FileInfo>* pMerg //printf("+++ no match on '%s'\n", (const char*) match); } - LOGD("HEY: size=%d removing %d\n", (int)pContents->size(), i); + ALOGD("HEY: size=%d removing %d\n", (int)pContents->size(), i); pContents->removeAt(i); i--; // adjust "for" loop count--; // and loop limit @@ -1365,7 +1365,7 @@ SortedVector<AssetDir::FileInfo>* AssetManager::scanDirLocked(const String8& pat struct dirent* entry; FileType fileType; - LOGV("Scanning dir '%s'\n", path.string()); + ALOGV("Scanning dir '%s'\n", path.string()); dir = opendir(path.string()); if (dir == NULL) @@ -1427,7 +1427,7 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector<AssetDir::FileInfo>* pMerg pZip = mZipSet.getZip(ap.path); if (pZip == NULL) { - LOGW("Failure opening zip %s\n", ap.path.string()); + ALOGW("Failure opening zip %s\n", ap.path.string()); return false; } @@ -1461,7 +1461,7 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector<AssetDir::FileInfo>* pMerg entry = pZip->findEntryByIndex(i); if (pZip->getEntryFileName(entry, nameBuf, sizeof(nameBuf)) != 0) { // TODO: fix this if we expect to have long names - LOGE("ARGH: name too long?\n"); + ALOGE("ARGH: name too long?\n"); continue; } //printf("Comparing %s in %s?\n", nameBuf, dirName.string()); @@ -1652,7 +1652,7 @@ void AssetManager::loadFileNameCacheLocked(void) #ifdef DO_TIMINGS timer.stop(); - LOGD("Cache scan took %.3fms\n", + ALOGD("Cache scan took %.3fms\n", timer.durationUsecs() / 1000.0); #endif @@ -1780,11 +1780,11 @@ AssetManager::SharedZip::SharedZip(const String8& path, time_t modWhen) : mPath(path), mZipFile(NULL), mModWhen(modWhen), mResourceTableAsset(NULL), mResourceTable(NULL) { - //LOGI("Creating SharedZip %p %s\n", this, (const char*)mPath); + //ALOGI("Creating SharedZip %p %s\n", this, (const char*)mPath); mZipFile = new ZipFileRO; - LOGV("+++ opening zip '%s'\n", mPath.string()); + ALOGV("+++ opening zip '%s'\n", mPath.string()); if (mZipFile->open(mPath.string()) != NO_ERROR) { - LOGD("failed to open Zip archive '%s'\n", mPath.string()); + ALOGD("failed to open Zip archive '%s'\n", mPath.string()); delete mZipFile; mZipFile = NULL; } @@ -1811,7 +1811,7 @@ ZipFileRO* AssetManager::SharedZip::getZip() Asset* AssetManager::SharedZip::getResourceTableAsset() { - LOGV("Getting from SharedZip %p resource asset %p\n", this, mResourceTableAsset); + ALOGV("Getting from SharedZip %p resource asset %p\n", this, mResourceTableAsset); return mResourceTableAsset; } @@ -1833,7 +1833,7 @@ Asset* AssetManager::SharedZip::setResourceTableAsset(Asset* asset) ResTable* AssetManager::SharedZip::getResourceTable() { - LOGV("Getting from SharedZip %p resource table %p\n", this, mResourceTable); + ALOGV("Getting from SharedZip %p resource table %p\n", this, mResourceTable); return mResourceTable; } @@ -1858,7 +1858,7 @@ bool AssetManager::SharedZip::isUpToDate() AssetManager::SharedZip::~SharedZip() { - //LOGI("Destroying SharedZip %p %s\n", this, (const char*)mPath); + //ALOGI("Destroying SharedZip %p %s\n", this, (const char*)mPath); if (mResourceTable != NULL) { delete mResourceTable; } @@ -1867,7 +1867,7 @@ AssetManager::SharedZip::~SharedZip() } if (mZipFile != NULL) { delete mZipFile; - LOGV("Closed '%s'\n", mPath.string()); + ALOGV("Closed '%s'\n", mPath.string()); } } diff --git a/libs/utils/BackupData.cpp b/libs/utils/BackupData.cpp index 87912639..f956306 100644 --- a/libs/utils/BackupData.cpp +++ b/libs/utils/BackupData.cpp @@ -78,7 +78,7 @@ BackupDataWriter::write_padding_for(int n) paddingSize = padding_extra(n); if (paddingSize > 0) { uint32_t padding = 0xbcbcbcbc; - if (DEBUG) LOGI("writing %d padding bytes for %d", paddingSize, n); + if (DEBUG) ALOGI("writing %d padding bytes for %d", paddingSize, n); amt = write(m_fd, &padding, paddingSize); if (amt != paddingSize) { m_status = errno; @@ -112,8 +112,8 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize) k = key; } if (DEBUG) { - LOGD("Writing header: prefix='%s' key='%s' dataSize=%d", m_keyPrefix.string(), key.string(), - dataSize); + ALOGD("Writing header: prefix='%s' key='%s' dataSize=%d", m_keyPrefix.string(), + key.string(), dataSize); } entity_header_v1 header; @@ -125,7 +125,7 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize) header.keyLen = tolel(keyLen); header.dataSize = tolel(dataSize); - if (DEBUG) LOGI("writing entity header, %d bytes", sizeof(entity_header_v1)); + if (DEBUG) ALOGI("writing entity header, %d bytes", sizeof(entity_header_v1)); amt = write(m_fd, &header, sizeof(entity_header_v1)); if (amt != sizeof(entity_header_v1)) { m_status = errno; @@ -133,7 +133,7 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize) } m_pos += amt; - if (DEBUG) LOGI("writing entity header key, %d bytes", keyLen+1); + if (DEBUG) ALOGI("writing entity header key, %d bytes", keyLen+1); amt = write(m_fd, k.string(), keyLen+1); if (amt != keyLen+1) { m_status = errno; @@ -151,11 +151,11 @@ BackupDataWriter::WriteEntityHeader(const String8& key, size_t dataSize) status_t BackupDataWriter::WriteEntityData(const void* data, size_t size) { - if (DEBUG) LOGD("Writing data: size=%lu", (unsigned long) size); + if (DEBUG) ALOGD("Writing data: size=%lu", (unsigned long) size); if (m_status != NO_ERROR) { if (DEBUG) { - LOGD("Not writing data - stream in error state %d (%s)", m_status, strerror(m_status)); + ALOGD("Not writing data - stream in error state %d (%s)", m_status, strerror(m_status)); } return m_status; } @@ -166,7 +166,7 @@ BackupDataWriter::WriteEntityData(const void* data, size_t size) ssize_t amt = write(m_fd, data, size); if (amt != (ssize_t)size) { m_status = errno; - if (DEBUG) LOGD("write returned error %d (%s)", m_status, strerror(m_status)); + if (DEBUG) ALOGD("write returned error %d (%s)", m_status, strerror(m_status)); return m_status; } m_pos += amt; @@ -208,7 +208,7 @@ BackupDataReader::Status() m_done = true; \ } else { \ m_status = errno; \ - LOGD("CHECK_SIZE(a=%ld e=%ld) failed at line %d m_status='%s'", \ + ALOGD("CHECK_SIZE(a=%ld e=%ld) failed at line %d m_status='%s'", \ long(actual), long(expected), __LINE__, strerror(m_status)); \ } \ return m_status; \ @@ -218,7 +218,7 @@ BackupDataReader::Status() do { \ status_t err = skip_padding(); \ if (err != NO_ERROR) { \ - LOGD("SKIP_PADDING FAILED at line %d", __LINE__); \ + ALOGD("SKIP_PADDING FAILED at line %d", __LINE__); \ m_status = err; \ return err; \ } \ @@ -261,7 +261,7 @@ BackupDataReader::ReadNextHeader(bool* done, int* type) { m_header.entity.keyLen = fromlel(m_header.entity.keyLen); if (m_header.entity.keyLen <= 0) { - LOGD("Entity header at %d has keyLen<=0: 0x%08x\n", (int)m_pos, + ALOGD("Entity header at %d has keyLen<=0: 0x%08x\n", (int)m_pos, (int)m_header.entity.keyLen); m_status = EINVAL; } @@ -285,7 +285,7 @@ BackupDataReader::ReadNextHeader(bool* done, int* type) break; } default: - LOGD("Chunk header at %d has invalid type: 0x%08x", + ALOGD("Chunk header at %d has invalid type: 0x%08x", (int)(m_pos - sizeof(m_header)), (int)m_header.type); m_status = EINVAL; } @@ -339,7 +339,7 @@ BackupDataReader::ReadEntityData(void* data, size_t size) return -1; } int remaining = m_dataEndPos - m_pos; - //LOGD("ReadEntityData size=%d m_pos=0x%x m_dataEndPos=0x%x remaining=%d\n", + //ALOGD("ReadEntityData size=%d m_pos=0x%x m_dataEndPos=0x%x remaining=%d\n", // size, m_pos, m_dataEndPos, remaining); if (remaining <= 0) { return 0; @@ -347,7 +347,7 @@ BackupDataReader::ReadEntityData(void* data, size_t size) if (((int)size) > remaining) { size = remaining; } - //LOGD(" reading %d bytes", size); + //ALOGD(" reading %d bytes", size); int amt = read(m_fd, data, size); if (amt < 0) { m_status = errno; diff --git a/libs/utils/BackupHelpers.cpp b/libs/utils/BackupHelpers.cpp index 7ef30f9..f77a891 100644 --- a/libs/utils/BackupHelpers.cpp +++ b/libs/utils/BackupHelpers.cpp @@ -74,7 +74,7 @@ const static int CURRENT_METADATA_VERSION = 1; #if TEST_BACKUP_HELPERS #define LOGP(f, x...) printf(f "\n", x) #else -#define LOGP(x...) LOGD(x) +#define LOGP(x...) ALOGD(x) #endif #endif @@ -100,7 +100,7 @@ read_snapshot_file(int fd, KeyedVector<String8,FileState>* snapshot) bytesRead += amt; if (header.magic0 != MAGIC0 || header.magic1 != MAGIC1) { - LOGW("read_snapshot_file header.magic0=0x%08x magic1=0x%08x", header.magic0, header.magic1); + ALOGW("read_snapshot_file header.magic0=0x%08x magic1=0x%08x", header.magic0, header.magic1); return 1; } @@ -110,7 +110,7 @@ read_snapshot_file(int fd, KeyedVector<String8,FileState>* snapshot) amt = read(fd, &file, sizeof(FileState)); if (amt != sizeof(FileState)) { - LOGW("read_snapshot_file FileState truncated/error with read at %d bytes\n", bytesRead); + ALOGW("read_snapshot_file FileState truncated/error with read at %d bytes\n", bytesRead); return 1; } bytesRead += amt; @@ -129,13 +129,13 @@ read_snapshot_file(int fd, KeyedVector<String8,FileState>* snapshot) free(filename); } if (amt != nameBufSize) { - LOGW("read_snapshot_file filename truncated/error with read at %d bytes\n", bytesRead); + ALOGW("read_snapshot_file filename truncated/error with read at %d bytes\n", bytesRead); return 1; } } if (header.totalSize != bytesRead) { - LOGW("read_snapshot_file length mismatch: header.totalSize=%d bytesRead=%d\n", + ALOGW("read_snapshot_file length mismatch: header.totalSize=%d bytesRead=%d\n", header.totalSize, bytesRead); return 1; } @@ -166,7 +166,7 @@ write_snapshot_file(int fd, const KeyedVector<String8,FileRec>& snapshot) amt = write(fd, &header, sizeof(header)); if (amt != sizeof(header)) { - LOGW("write_snapshot_file error writing header %s", strerror(errno)); + ALOGW("write_snapshot_file error writing header %s", strerror(errno)); return errno; } @@ -178,14 +178,14 @@ write_snapshot_file(int fd, const KeyedVector<String8,FileRec>& snapshot) amt = write(fd, &r.s, sizeof(FileState)); if (amt != sizeof(FileState)) { - LOGW("write_snapshot_file error writing header %s", strerror(errno)); + ALOGW("write_snapshot_file error writing header %s", strerror(errno)); return 1; } // filename is not NULL terminated, but it is padded amt = write(fd, name.string(), nameLen); if (amt != nameLen) { - LOGW("write_snapshot_file error writing filename %s", strerror(errno)); + ALOGW("write_snapshot_file error writing filename %s", strerror(errno)); return 1; } int paddingLen = ROUND_UP[nameLen % 4]; @@ -193,7 +193,7 @@ write_snapshot_file(int fd, const KeyedVector<String8,FileRec>& snapshot) int padding = 0xabababab; amt = write(fd, &padding, paddingLen); if (amt != paddingLen) { - LOGW("write_snapshot_file error writing %d bytes of filename padding %s", + ALOGW("write_snapshot_file error writing %d bytes of filename padding %s", paddingLen, strerror(errno)); return 1; } @@ -232,7 +232,7 @@ write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8& lseek(fd, 0, SEEK_SET); if (sizeof(metadata) != 16) { - LOGE("ERROR: metadata block is the wrong size!"); + ALOGE("ERROR: metadata block is the wrong size!"); } bytesLeft = fileSize + sizeof(metadata); @@ -280,7 +280,7 @@ write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8& } } } - LOGE("write_update_file size mismatch for %s. expected=%d actual=%d." + ALOGE("write_update_file size mismatch for %s. expected=%d actual=%d." " You aren't doing proper locking!", realFilename, fileSize, fileSize-bytesLeft); } @@ -525,7 +525,7 @@ int write_tarfile(const String8& packageName, const String8& domain, struct stat64 s; if (lstat64(filepath.string(), &s) != 0) { err = errno; - LOGE("Error %d (%s) from lstat64(%s)", err, strerror(err), filepath.string()); + ALOGE("Error %d (%s) from lstat64(%s)", err, strerror(err), filepath.string()); return err; } @@ -540,7 +540,7 @@ int write_tarfile(const String8& packageName, const String8& domain, int fd = open(filepath.string(), O_RDONLY); if (fd < 0) { err = errno; - LOGE("Error %d (%s) from open(%s)", err, strerror(err), filepath.string()); + ALOGE("Error %d (%s) from open(%s)", err, strerror(err), filepath.string()); return err; } @@ -551,7 +551,7 @@ int write_tarfile(const String8& packageName, const String8& domain, char* paxData = buf + 1024; if (buf == NULL) { - LOGE("Out of mem allocating transfer buffer"); + ALOGE("Out of mem allocating transfer buffer"); err = ENOMEM; goto cleanup; } @@ -591,7 +591,7 @@ int write_tarfile(const String8& packageName, const String8& domain, } else if (S_ISREG(s.st_mode)) { type = '0'; // tar magic: '0' == normal file } else { - LOGW("Error: unknown file mode 0%o [%s]", s.st_mode, filepath.string()); + ALOGW("Error: unknown file mode 0%o [%s]", s.st_mode, filepath.string()); goto cleanup; } buf[156] = type; @@ -628,7 +628,7 @@ int write_tarfile(const String8& packageName, const String8& domain, // [ 329 : 8 ] and [ 337 : 8 ] devmajor/devminor, not used - LOGI(" Name: %s", fullname.string()); + ALOGI(" Name: %s", fullname.string()); // If we're using a pax extended header, build & write that here; lengths are // already preflighted @@ -688,11 +688,11 @@ int write_tarfile(const String8& packageName, const String8& domain, ssize_t nRead = read(fd, buf, toRead); if (nRead < 0) { err = errno; - LOGE("Unable to read file [%s], err=%d (%s)", filepath.string(), + ALOGE("Unable to read file [%s], err=%d (%s)", filepath.string(), err, strerror(err)); break; } else if (nRead == 0) { - LOGE("EOF but expect %lld more bytes in [%s]", (long long) toWrite, + ALOGE("EOF but expect %lld more bytes in [%s]", (long long) toWrite, filepath.string()); err = EIO; break; @@ -759,7 +759,7 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in) file_metadata_v1 metadata; amt = in->ReadEntityData(&metadata, sizeof(metadata)); if (amt != sizeof(metadata)) { - LOGW("Could not read metadata for %s -- %ld / %s", filename.string(), + ALOGW("Could not read metadata for %s -- %ld / %s", filename.string(), (long)amt, strerror(errno)); return EIO; } @@ -768,7 +768,7 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in) if (metadata.version > CURRENT_METADATA_VERSION) { if (!m_loggedUnknownMetadata) { m_loggedUnknownMetadata = true; - LOGW("Restoring file with unsupported metadata version %d (currently %d)", + ALOGW("Restoring file with unsupported metadata version %d (currently %d)", metadata.version, CURRENT_METADATA_VERSION); } } @@ -778,7 +778,7 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in) crc = crc32(0L, Z_NULL, 0); fd = open(filename.string(), O_CREAT|O_RDWR|O_TRUNC, mode); if (fd == -1) { - LOGW("Could not open file %s -- %s", filename.string(), strerror(errno)); + ALOGW("Could not open file %s -- %s", filename.string(), strerror(errno)); return errno; } @@ -786,7 +786,7 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in) err = write(fd, buf, amt); if (err != amt) { close(fd); - LOGW("Error '%s' writing '%s'", strerror(errno), filename.string()); + ALOGW("Error '%s' writing '%s'", strerror(errno), filename.string()); return errno; } crc = crc32(crc, (Bytef*)buf, amt); @@ -797,7 +797,7 @@ RestoreHelperBase::WriteFile(const String8& filename, BackupDataReader* in) // Record for the snapshot err = stat(filename.string(), &st); if (err != 0) { - LOGW("Error stating file that we just created %s", filename.string()); + ALOGW("Error stating file that we just created %s", filename.string()); return errno; } diff --git a/libs/utils/BlobCache.cpp b/libs/utils/BlobCache.cpp index d38aae9..e52cf2f 100644 --- a/libs/utils/BlobCache.cpp +++ b/libs/utils/BlobCache.cpp @@ -48,32 +48,32 @@ BlobCache::BlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxTotalSize mRandState[1] = (now >> 16) & 0xFFFF; mRandState[2] = (now >> 32) & 0xFFFF; #endif - LOGV("initializing random seed using %lld", now); + ALOGV("initializing random seed using %lld", now); } void BlobCache::set(const void* key, size_t keySize, const void* value, size_t valueSize) { if (mMaxKeySize < keySize) { - LOGV("set: not caching because the key is too large: %d (limit: %d)", + ALOGV("set: not caching because the key is too large: %d (limit: %d)", keySize, mMaxKeySize); return; } if (mMaxValueSize < valueSize) { - LOGV("set: not caching because the value is too large: %d (limit: %d)", + ALOGV("set: not caching because the value is too large: %d (limit: %d)", valueSize, mMaxValueSize); return; } if (mMaxTotalSize < keySize + valueSize) { - LOGV("set: not caching because the combined key/value size is too " + ALOGV("set: not caching because the combined key/value size is too " "large: %d (limit: %d)", keySize + valueSize, mMaxTotalSize); return; } if (keySize == 0) { - LOGW("set: not caching because keySize is 0"); + ALOGW("set: not caching because keySize is 0"); return; } if (valueSize <= 0) { - LOGW("set: not caching because valueSize is 0"); + ALOGW("set: not caching because valueSize is 0"); return; } @@ -93,7 +93,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value, clean(); continue; } else { - LOGV("set: not caching new key/value pair because the " + ALOGV("set: not caching new key/value pair because the " "total cache size limit would be exceeded: %d " "(limit: %d)", keySize + valueSize, mMaxTotalSize); @@ -102,7 +102,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value, } mCacheEntries.add(CacheEntry(keyBlob, valueBlob)); mTotalSize = newTotalSize; - LOGV("set: created new cache entry with %d byte key and %d byte value", + ALOGV("set: created new cache entry with %d byte key and %d byte value", keySize, valueSize); } else { // Update the existing cache entry. @@ -115,7 +115,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value, clean(); continue; } else { - LOGV("set: not caching new value because the total cache " + ALOGV("set: not caching new value because the total cache " "size limit would be exceeded: %d (limit: %d)", keySize + valueSize, mMaxTotalSize); break; @@ -123,7 +123,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value, } mCacheEntries.editItemAt(index).setValue(valueBlob); mTotalSize = newTotalSize; - LOGV("set: updated existing cache entry with %d byte key and %d byte " + ALOGV("set: updated existing cache entry with %d byte key and %d byte " "value", keySize, valueSize); } break; @@ -133,7 +133,7 @@ void BlobCache::set(const void* key, size_t keySize, const void* value, size_t BlobCache::get(const void* key, size_t keySize, void* value, size_t valueSize) { if (mMaxKeySize < keySize) { - LOGV("get: not searching because the key is too large: %d (limit %d)", + ALOGV("get: not searching because the key is too large: %d (limit %d)", keySize, mMaxKeySize); return 0; } @@ -141,7 +141,7 @@ size_t BlobCache::get(const void* key, size_t keySize, void* value, CacheEntry dummyEntry(dummyKey, NULL); ssize_t index = mCacheEntries.indexOf(dummyEntry); if (index < 0) { - LOGV("get: no cache entry found for key of size %d", keySize); + ALOGV("get: no cache entry found for key of size %d", keySize); return 0; } @@ -150,10 +150,10 @@ size_t BlobCache::get(const void* key, size_t keySize, void* value, sp<Blob> valueBlob(mCacheEntries[index].getValue()); size_t valueBlobSize = valueBlob->getSize(); if (valueBlobSize <= valueSize) { - LOGV("get: copying %d bytes to caller's buffer", valueBlobSize); + ALOGV("get: copying %d bytes to caller's buffer", valueBlobSize); memcpy(value, valueBlob->getData(), valueBlobSize); } else { - LOGV("get: caller's buffer is too small for value: %d (needs %d)", + ALOGV("get: caller's buffer is too small for value: %d (needs %d)", valueSize, valueBlobSize); } return valueBlobSize; @@ -183,13 +183,13 @@ size_t BlobCache::getFdCount() const { status_t BlobCache::flatten(void* buffer, size_t size, int fds[], size_t count) const { if (count != 0) { - LOGE("flatten: nonzero fd count: %d", count); + ALOGE("flatten: nonzero fd count: %d", count); return BAD_VALUE; } // Write the cache header if (size < sizeof(Header)) { - LOGE("flatten: not enough room for cache header"); + ALOGE("flatten: not enough room for cache header"); return BAD_VALUE; } Header* header = reinterpret_cast<Header*>(buffer); @@ -210,7 +210,7 @@ status_t BlobCache::flatten(void* buffer, size_t size, int fds[], size_t count) size_t entrySize = sizeof(EntryHeader) + keySize + valueSize; if (byteOffset + entrySize > size) { - LOGE("flatten: not enough room for cache entries"); + ALOGE("flatten: not enough room for cache entries"); return BAD_VALUE; } @@ -234,18 +234,18 @@ status_t BlobCache::unflatten(void const* buffer, size_t size, int fds[], mCacheEntries.clear(); if (count != 0) { - LOGE("unflatten: nonzero fd count: %d", count); + ALOGE("unflatten: nonzero fd count: %d", count); return BAD_VALUE; } // Read the cache header if (size < sizeof(Header)) { - LOGE("unflatten: not enough room for cache header"); + ALOGE("unflatten: not enough room for cache header"); return BAD_VALUE; } const Header* header = reinterpret_cast<const Header*>(buffer); if (header->mMagicNumber != blobCacheMagic) { - LOGE("unflatten: bad magic number: %d", header->mMagicNumber); + ALOGE("unflatten: bad magic number: %d", header->mMagicNumber); return BAD_VALUE; } if (header->mBlobCacheVersion != blobCacheVersion || @@ -261,7 +261,7 @@ status_t BlobCache::unflatten(void const* buffer, size_t size, int fds[], for (size_t i = 0; i < numEntries; i++) { if (byteOffset + sizeof(EntryHeader) > size) { mCacheEntries.clear(); - LOGE("unflatten: not enough room for cache entry headers"); + ALOGE("unflatten: not enough room for cache entry headers"); return BAD_VALUE; } @@ -273,7 +273,7 @@ status_t BlobCache::unflatten(void const* buffer, size_t size, int fds[], if (byteOffset + entrySize > size) { mCacheEntries.clear(); - LOGE("unflatten: not enough room for cache entry headers"); + ALOGE("unflatten: not enough room for cache entry headers"); return BAD_VALUE; } diff --git a/libs/utils/CallStack.cpp b/libs/utils/CallStack.cpp index 55b6024..bd7e239 100644 --- a/libs/utils/CallStack.cpp +++ b/libs/utils/CallStack.cpp @@ -328,7 +328,7 @@ void CallStack::dump(const char* prefix) const * get very deep. So we request function names of each frame individually. */ for (int i=0; i<int(mCount); i++) { - LOGD("%s", toStringSingleLevel(prefix, i).string()); + ALOGD("%s", toStringSingleLevel(prefix, i).string()); } } diff --git a/libs/utils/FileMap.cpp b/libs/utils/FileMap.cpp index c220a90..9ce370e 100644 --- a/libs/utils/FileMap.cpp +++ b/libs/utils/FileMap.cpp @@ -64,12 +64,12 @@ FileMap::~FileMap(void) } #ifdef HAVE_POSIX_FILEMAP if (mBasePtr && munmap(mBasePtr, mBaseLength) != 0) { - LOGD("munmap(%p, %d) failed\n", mBasePtr, (int) mBaseLength); + ALOGD("munmap(%p, %d) failed\n", mBasePtr, (int) mBaseLength); } #endif #ifdef HAVE_WIN32_FILEMAP if (mBasePtr && UnmapViewOfFile(mBasePtr) == 0) { - LOGD("UnmapViewOfFile(%p) failed, error = %ld\n", mBasePtr, + ALOGD("UnmapViewOfFile(%p) failed, error = %ld\n", mBasePtr, GetLastError() ); } if (mFileMapping != INVALID_HANDLE_VALUE) { @@ -108,7 +108,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le mFileHandle = (HANDLE) _get_osfhandle(fd); mFileMapping = CreateFileMapping( mFileHandle, NULL, protect, 0, 0, NULL); if (mFileMapping == NULL) { - LOGE("CreateFileMapping(%p, %lx) failed with error %ld\n", + ALOGE("CreateFileMapping(%p, %lx) failed with error %ld\n", mFileHandle, protect, GetLastError() ); return false; } @@ -123,7 +123,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le (DWORD)(adjOffset), adjLength ); if (mBasePtr == NULL) { - LOGE("MapViewOfFile(%ld, %ld) failed with error %ld\n", + ALOGE("MapViewOfFile(%ld, %ld) failed with error %ld\n", adjOffset, adjLength, GetLastError() ); CloseHandle(mFileMapping); mFileMapping = INVALID_HANDLE_VALUE; @@ -147,7 +147,7 @@ bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t le #if NOT_USING_KLIBC mPageSize = sysconf(_SC_PAGESIZE); if (mPageSize == -1) { - LOGE("could not get _SC_PAGESIZE\n"); + ALOGE("could not get _SC_PAGESIZE\n"); return false; } #else @@ -175,7 +175,7 @@ try_again: goto try_again; } - LOGE("mmap(%ld,%ld) failed: %s\n", + ALOGE("mmap(%ld,%ld) failed: %s\n", (long) adjOffset, (long) adjLength, strerror(errno)); return false; } @@ -190,7 +190,7 @@ try_again: assert(mBasePtr != NULL); - LOGV("MAP: base %p/%d data %p/%d\n", + ALOGV("MAP: base %p/%d data %p/%d\n", mBasePtr, (int) mBaseLength, mDataPtr, (int) mDataLength); return true; @@ -217,7 +217,7 @@ int FileMap::advise(MapAdvice advice) cc = madvise(mBasePtr, mBaseLength, sysAdvice); if (cc != 0) - LOGW("madvise(%d) failed: %s\n", sysAdvice, strerror(errno)); + ALOGW("madvise(%d) failed: %s\n", sysAdvice, strerror(errno)); return cc; #else return -1; diff --git a/libs/utils/Looper.cpp b/libs/utils/Looper.cpp index b54fb9d..d1aa664 100644 --- a/libs/utils/Looper.cpp +++ b/libs/utils/Looper.cpp @@ -163,7 +163,7 @@ sp<Looper> Looper::prepare(int opts) { Looper::setForThread(looper); } if (looper->getAllowNonCallbacks() != allowNonCallbacks) { - LOGW("Looper already prepared for this thread with a different value for the " + ALOGW("Looper already prepared for this thread with a different value for the " "ALOOPER_PREPARE_ALLOW_NON_CALLBACKS option."); } return looper; @@ -185,7 +185,7 @@ int Looper::pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outDa int events = response.events; void* data = response.request.data; #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ pollOnce - returning signalled identifier %d: " + ALOGD("%p ~ pollOnce - returning signalled identifier %d: " "fd=%d, events=0x%x, data=%p", this, ident, fd, events, data); #endif @@ -198,7 +198,7 @@ int Looper::pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outDa if (result != 0) { #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ pollOnce - returning result %d", this, result); + ALOGD("%p ~ pollOnce - returning result %d", this, result); #endif if (outFd != NULL) *outFd = 0; if (outEvents != NULL) *outEvents = NULL; @@ -212,7 +212,7 @@ int Looper::pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outDa int Looper::pollInner(int timeoutMillis) { #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ pollOnce - waiting: timeoutMillis=%d", this, timeoutMillis); + ALOGD("%p ~ pollOnce - waiting: timeoutMillis=%d", this, timeoutMillis); #endif // Adjust the timeout based on when the next message is due. @@ -224,7 +224,7 @@ int Looper::pollInner(int timeoutMillis) { timeoutMillis = messageTimeoutMillis; } #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ pollOnce - next message in %lldns, adjusted timeout: timeoutMillis=%d", + ALOGD("%p ~ pollOnce - next message in %lldns, adjusted timeout: timeoutMillis=%d", this, mNextMessageUptime - now, timeoutMillis); #endif } @@ -262,7 +262,7 @@ int Looper::pollInner(int timeoutMillis) { if (errno == EINTR) { goto Done; } - LOGW("Poll failed with an unexpected error, errno=%d", errno); + ALOGW("Poll failed with an unexpected error, errno=%d", errno); result = ALOOPER_POLL_ERROR; goto Done; } @@ -270,7 +270,7 @@ int Looper::pollInner(int timeoutMillis) { // Check for poll timeout. if (eventCount == 0) { #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ pollOnce - timeout", this); + ALOGD("%p ~ pollOnce - timeout", this); #endif result = ALOOPER_POLL_TIMEOUT; goto Done; @@ -278,7 +278,7 @@ int Looper::pollInner(int timeoutMillis) { // Handle all events. #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ pollOnce - handling events from %d fds", this, eventCount); + ALOGD("%p ~ pollOnce - handling events from %d fds", this, eventCount); #endif #ifdef LOOPER_USES_EPOLL @@ -289,7 +289,7 @@ int Looper::pollInner(int timeoutMillis) { if (epollEvents & EPOLLIN) { awoken(); } else { - LOGW("Ignoring unexpected epoll events 0x%x on wake read pipe.", epollEvents); + ALOGW("Ignoring unexpected epoll events 0x%x on wake read pipe.", epollEvents); } } else { ssize_t requestIndex = mRequests.indexOfKey(fd); @@ -301,7 +301,7 @@ int Looper::pollInner(int timeoutMillis) { if (epollEvents & EPOLLHUP) events |= ALOOPER_EVENT_HANGUP; pushResponse(events, mRequests.valueAt(requestIndex)); } else { - LOGW("Ignoring unexpected epoll events 0x%x on fd %d that is " + ALOGW("Ignoring unexpected epoll events 0x%x on fd %d that is " "no longer registered.", epollEvents, fd); } } @@ -317,7 +317,7 @@ Done: ; if (pollEvents & POLLIN) { awoken(); } else { - LOGW("Ignoring unexpected poll events 0x%x on wake read pipe.", pollEvents); + ALOGW("Ignoring unexpected poll events 0x%x on wake read pipe.", pollEvents); } } else { int events = 0; @@ -353,7 +353,7 @@ Done: - milliseconds_to_nanoseconds(timeoutMillis); } if (mSampledPolls == SAMPLED_POLLS_TO_AGGREGATE) { - LOGD("%p ~ poll latency statistics: %0.3fms zero timeout, %0.3fms non-zero timeout", this, + ALOGD("%p ~ poll latency statistics: %0.3fms zero timeout, %0.3fms non-zero timeout", this, 0.000001f * float(mSampledZeroPollLatencySum) / mSampledZeroPollCount, 0.000001f * float(mSampledTimeoutPollLatencySum) / mSampledTimeoutPollCount); mSampledPolls = 0; @@ -382,7 +382,7 @@ Done: mLock.unlock(); #if DEBUG_POLL_AND_WAKE || DEBUG_CALLBACKS - LOGD("%p ~ pollOnce - sending message: handler=%p, what=%d", + ALOGD("%p ~ pollOnce - sending message: handler=%p, what=%d", this, handler.get(), message.what); #endif handler->handleMessage(message); @@ -410,7 +410,7 @@ Done: int events = response.events; void* data = response.request.data; #if DEBUG_POLL_AND_WAKE || DEBUG_CALLBACKS - LOGD("%p ~ pollOnce - invoking fd event callback %p: fd=%d, events=0x%x, data=%p", + ALOGD("%p ~ pollOnce - invoking fd event callback %p: fd=%d, events=0x%x, data=%p", this, callback, fd, events, data); #endif int callbackResult = callback(fd, events, data); @@ -451,7 +451,7 @@ int Looper::pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outDat void Looper::wake() { #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ wake", this); + ALOGD("%p ~ wake", this); #endif #ifdef LOOPER_STATISTICS @@ -468,19 +468,19 @@ void Looper::wake() { if (nWrite != 1) { if (errno != EAGAIN) { - LOGW("Could not write wake signal, errno=%d", errno); + ALOGW("Could not write wake signal, errno=%d", errno); } } } void Looper::awoken() { #if DEBUG_POLL_AND_WAKE - LOGD("%p ~ awoken", this); + ALOGD("%p ~ awoken", this); #endif #ifdef LOOPER_STATISTICS if (mPendingWakeCount == 0) { - LOGD("%p ~ awoken: spurious!", this); + ALOGD("%p ~ awoken: spurious!", this); } else { mSampledWakeCycles += 1; mSampledWakeCountSum += mPendingWakeCount; @@ -488,7 +488,7 @@ void Looper::awoken() { mPendingWakeCount = 0; mPendingWakeTime = -1; if (mSampledWakeCycles == SAMPLED_WAKE_CYCLES_TO_AGGREGATE) { - LOGD("%p ~ wake statistics: %0.3fms wake latency, %0.3f wakes per cycle", this, + ALOGD("%p ~ wake statistics: %0.3fms wake latency, %0.3f wakes per cycle", this, 0.000001f * float(mSampledWakeLatencySum) / mSampledWakeCycles, float(mSampledWakeCountSum) / mSampledWakeCycles); mSampledWakeCycles = 0; @@ -514,18 +514,18 @@ void Looper::pushResponse(int events, const Request& request) { int Looper::addFd(int fd, int ident, int events, ALooper_callbackFunc callback, void* data) { #if DEBUG_CALLBACKS - LOGD("%p ~ addFd - fd=%d, ident=%d, events=0x%x, callback=%p, data=%p", this, fd, ident, + ALOGD("%p ~ addFd - fd=%d, ident=%d, events=0x%x, callback=%p, data=%p", this, fd, ident, events, callback, data); #endif if (! callback) { if (! mAllowNonCallbacks) { - LOGE("Invalid attempt to set NULL callback but not allowed for this looper."); + ALOGE("Invalid attempt to set NULL callback but not allowed for this looper."); return -1; } if (ident < 0) { - LOGE("Invalid attempt to set NULL callback with ident <= 0."); + ALOGE("Invalid attempt to set NULL callback with ident <= 0."); return -1; } } @@ -553,14 +553,14 @@ int Looper::addFd(int fd, int ident, int events, ALooper_callbackFunc callback, if (requestIndex < 0) { int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, fd, & eventItem); if (epollResult < 0) { - LOGE("Error adding epoll events for fd %d, errno=%d", fd, errno); + ALOGE("Error adding epoll events for fd %d, errno=%d", fd, errno); return -1; } mRequests.add(fd, request); } else { int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_MOD, fd, & eventItem); if (epollResult < 0) { - LOGE("Error modifying epoll events for fd %d, errno=%d", fd, errno); + ALOGE("Error modifying epoll events for fd %d, errno=%d", fd, errno); return -1; } mRequests.replaceValueAt(requestIndex, request); @@ -598,7 +598,7 @@ int Looper::addFd(int fd, int ident, int events, ALooper_callbackFunc callback, int Looper::removeFd(int fd) { #if DEBUG_CALLBACKS - LOGD("%p ~ removeFd - fd=%d", this, fd); + ALOGD("%p ~ removeFd - fd=%d", this, fd); #endif #ifdef LOOPER_USES_EPOLL @@ -611,7 +611,7 @@ int Looper::removeFd(int fd) { int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_DEL, fd, NULL); if (epollResult < 0) { - LOGE("Error removing epoll events for fd %d, errno=%d", fd, errno); + ALOGE("Error removing epoll events for fd %d, errno=%d", fd, errno); return -1; } @@ -675,7 +675,7 @@ void Looper::sendMessageDelayed(nsecs_t uptimeDelay, const sp<MessageHandler>& h void Looper::sendMessageAtTime(nsecs_t uptime, const sp<MessageHandler>& handler, const Message& message) { #if DEBUG_CALLBACKS - LOGD("%p ~ sendMessageAtTime - uptime=%lld, handler=%p, what=%d", + ALOGD("%p ~ sendMessageAtTime - uptime=%lld, handler=%p, what=%d", this, uptime, handler.get(), message.what); #endif @@ -708,7 +708,7 @@ void Looper::sendMessageAtTime(nsecs_t uptime, const sp<MessageHandler>& handler void Looper::removeMessages(const sp<MessageHandler>& handler) { #if DEBUG_CALLBACKS - LOGD("%p ~ removeMessages - handler=%p", this, handler.get()); + ALOGD("%p ~ removeMessages - handler=%p", this, handler.get()); #endif { // acquire lock @@ -725,7 +725,7 @@ void Looper::removeMessages(const sp<MessageHandler>& handler) { void Looper::removeMessages(const sp<MessageHandler>& handler, int what) { #if DEBUG_CALLBACKS - LOGD("%p ~ removeMessages - handler=%p, what=%d", this, handler.get(), what); + ALOGD("%p ~ removeMessages - handler=%p, what=%d", this, handler.get(), what); #endif { // acquire lock diff --git a/libs/utils/ObbFile.cpp b/libs/utils/ObbFile.cpp index 2907b56..ddf5991 100644 --- a/libs/utils/ObbFile.cpp +++ b/libs/utils/ObbFile.cpp @@ -90,14 +90,14 @@ bool ObbFile::readFrom(const char* filename) fd = ::open(filename, O_RDONLY); if (fd < 0) { - LOGW("couldn't open file %s: %s", filename, strerror(errno)); + ALOGW("couldn't open file %s: %s", filename, strerror(errno)); goto out; } success = readFrom(fd); close(fd); if (!success) { - LOGW("failed to read from %s (fd=%d)\n", filename, fd); + ALOGW("failed to read from %s (fd=%d)\n", filename, fd); } out: @@ -107,7 +107,7 @@ out: bool ObbFile::readFrom(int fd) { if (fd < 0) { - LOGW("attempt to read from invalid fd\n"); + ALOGW("attempt to read from invalid fd\n"); return false; } @@ -120,9 +120,9 @@ bool ObbFile::parseObbFile(int fd) if (fileLength < kFooterMinSize) { if (fileLength < 0) { - LOGW("error seeking in ObbFile: %s\n", strerror(errno)); + ALOGW("error seeking in ObbFile: %s\n", strerror(errno)); } else { - LOGW("file is only %lld (less than %d minimum)\n", fileLength, kFooterMinSize); + ALOGW("file is only %lld (less than %d minimum)\n", fileLength, kFooterMinSize); } return false; } @@ -136,13 +136,13 @@ bool ObbFile::parseObbFile(int fd) char *footer = new char[kFooterTagSize]; actual = TEMP_FAILURE_RETRY(read(fd, footer, kFooterTagSize)); if (actual != kFooterTagSize) { - LOGW("couldn't read footer signature: %s\n", strerror(errno)); + ALOGW("couldn't read footer signature: %s\n", strerror(errno)); return false; } unsigned int fileSig = get4LE((unsigned char*)footer + sizeof(int32_t)); if (fileSig != kSignature) { - LOGW("footer didn't match magic string (expected 0x%08x; got 0x%08x)\n", + ALOGW("footer didn't match magic string (expected 0x%08x; got 0x%08x)\n", kSignature, fileSig); return false; } @@ -150,13 +150,13 @@ bool ObbFile::parseObbFile(int fd) footerSize = get4LE((unsigned char*)footer); if (footerSize > (size_t)fileLength - kFooterTagSize || footerSize > kMaxBufSize) { - LOGW("claimed footer size is too large (0x%08zx; file size is 0x%08llx)\n", + ALOGW("claimed footer size is too large (0x%08zx; file size is 0x%08llx)\n", footerSize, fileLength); return false; } if (footerSize < (kFooterMinSize - kFooterTagSize)) { - LOGW("claimed footer size is too small (0x%zx; minimum size is 0x%x)\n", + ALOGW("claimed footer size is too small (0x%zx; minimum size is 0x%x)\n", footerSize, kFooterMinSize - kFooterTagSize); return false; } @@ -164,7 +164,7 @@ bool ObbFile::parseObbFile(int fd) off64_t fileOffset = fileLength - footerSize - kFooterTagSize; if (lseek64(fd, fileOffset, SEEK_SET) != fileOffset) { - LOGW("seek %lld failed: %s\n", fileOffset, strerror(errno)); + ALOGW("seek %lld failed: %s\n", fileOffset, strerror(errno)); return false; } @@ -172,27 +172,27 @@ bool ObbFile::parseObbFile(int fd) char* scanBuf = (char*)malloc(footerSize); if (scanBuf == NULL) { - LOGW("couldn't allocate scanBuf: %s\n", strerror(errno)); + ALOGW("couldn't allocate scanBuf: %s\n", strerror(errno)); return false; } actual = TEMP_FAILURE_RETRY(read(fd, scanBuf, footerSize)); // readAmount is guaranteed to be less than kMaxBufSize if (actual != (ssize_t)footerSize) { - LOGI("couldn't read ObbFile footer: %s\n", strerror(errno)); + ALOGI("couldn't read ObbFile footer: %s\n", strerror(errno)); free(scanBuf); return false; } #ifdef DEBUG for (int i = 0; i < footerSize; ++i) { - LOGI("char: 0x%02x\n", scanBuf[i]); + ALOGI("char: 0x%02x\n", scanBuf[i]); } #endif uint32_t sigVersion = get4LE((unsigned char*)scanBuf); if (sigVersion != kSigVersion) { - LOGW("Unsupported ObbFile version %d\n", sigVersion); + ALOGW("Unsupported ObbFile version %d\n", sigVersion); free(scanBuf); return false; } @@ -205,7 +205,7 @@ bool ObbFile::parseObbFile(int fd) size_t packageNameLen = get4LE((unsigned char*)scanBuf + kPackageNameLenOffset); if (packageNameLen == 0 || packageNameLen > (footerSize - kPackageNameOffset)) { - LOGW("bad ObbFile package name length (0x%04zx; 0x%04zx possible)\n", + ALOGW("bad ObbFile package name length (0x%04zx; 0x%04zx possible)\n", packageNameLen, footerSize - kPackageNameOffset); free(scanBuf); return false; @@ -217,7 +217,7 @@ bool ObbFile::parseObbFile(int fd) free(scanBuf); #ifdef DEBUG - LOGI("Obb scan succeeded: packageName=%s, version=%d\n", mPackageName.string(), mVersion); + ALOGI("Obb scan succeeded: packageName=%s, version=%d\n", mPackageName.string(), mVersion); #endif return true; @@ -237,7 +237,7 @@ bool ObbFile::writeTo(const char* filename) out: if (!success) { - LOGW("failed to write to %s: %s\n", filename, strerror(errno)); + ALOGW("failed to write to %s: %s\n", filename, strerror(errno)); } return success; } @@ -251,7 +251,7 @@ bool ObbFile::writeTo(int fd) lseek64(fd, 0, SEEK_END); if (mPackageName.size() == 0 || mVersion == -1) { - LOGW("tried to write uninitialized ObbFile data\n"); + ALOGW("tried to write uninitialized ObbFile data\n"); return false; } @@ -260,48 +260,48 @@ bool ObbFile::writeTo(int fd) put4LE(intBuf, kSigVersion); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { - LOGW("couldn't write signature version: %s\n", strerror(errno)); + ALOGW("couldn't write signature version: %s\n", strerror(errno)); return false; } put4LE(intBuf, mVersion); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { - LOGW("couldn't write package version\n"); + ALOGW("couldn't write package version\n"); return false; } put4LE(intBuf, mFlags); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { - LOGW("couldn't write package version\n"); + ALOGW("couldn't write package version\n"); return false; } if (write(fd, mSalt, sizeof(mSalt)) != (ssize_t)sizeof(mSalt)) { - LOGW("couldn't write salt: %s\n", strerror(errno)); + ALOGW("couldn't write salt: %s\n", strerror(errno)); return false; } size_t packageNameLen = mPackageName.size(); put4LE(intBuf, packageNameLen); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { - LOGW("couldn't write package name length: %s\n", strerror(errno)); + ALOGW("couldn't write package name length: %s\n", strerror(errno)); return false; } if (write(fd, mPackageName.string(), packageNameLen) != (ssize_t)packageNameLen) { - LOGW("couldn't write package name: %s\n", strerror(errno)); + ALOGW("couldn't write package name: %s\n", strerror(errno)); return false; } put4LE(intBuf, kPackageNameOffset + packageNameLen); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { - LOGW("couldn't write footer size: %s\n", strerror(errno)); + ALOGW("couldn't write footer size: %s\n", strerror(errno)); return false; } put4LE(intBuf, kSignature); if (write(fd, &intBuf, sizeof(uint32_t)) != (ssize_t)sizeof(uint32_t)) { - LOGW("couldn't write footer magic signature: %s\n", strerror(errno)); + ALOGW("couldn't write footer magic signature: %s\n", strerror(errno)); return false; } @@ -322,7 +322,7 @@ bool ObbFile::removeFrom(const char* filename) out: if (!success) { - LOGW("failed to remove signature from %s: %s\n", filename, strerror(errno)); + ALOGW("failed to remove signature from %s: %s\n", filename, strerror(errno)); } return success; } diff --git a/libs/utils/PropertyMap.cpp b/libs/utils/PropertyMap.cpp index d472d45..5520702 100644 --- a/libs/utils/PropertyMap.cpp +++ b/libs/utils/PropertyMap.cpp @@ -84,7 +84,7 @@ bool PropertyMap::tryGetProperty(const String8& key, int32_t& outValue) const { char* end; int value = strtol(stringValue.string(), & end, 10); if (*end != '\0') { - LOGW("Property key '%s' has invalid value '%s'. Expected an integer.", + ALOGW("Property key '%s' has invalid value '%s'. Expected an integer.", key.string(), stringValue.string()); return false; } @@ -101,7 +101,7 @@ bool PropertyMap::tryGetProperty(const String8& key, float& outValue) const { char* end; float value = strtof(stringValue.string(), & end); if (*end != '\0') { - LOGW("Property key '%s' has invalid value '%s'. Expected a float.", + ALOGW("Property key '%s' has invalid value '%s'. Expected a float.", key.string(), stringValue.string()); return false; } @@ -121,11 +121,11 @@ status_t PropertyMap::load(const String8& filename, PropertyMap** outMap) { Tokenizer* tokenizer; status_t status = Tokenizer::open(filename, &tokenizer); if (status) { - LOGE("Error %d opening property file %s.", status, filename.string()); + ALOGE("Error %d opening property file %s.", status, filename.string()); } else { PropertyMap* map = new PropertyMap(); if (!map) { - LOGE("Error allocating property map."); + ALOGE("Error allocating property map."); status = NO_MEMORY; } else { #if DEBUG_PARSER_PERFORMANCE @@ -135,7 +135,7 @@ status_t PropertyMap::load(const String8& filename, PropertyMap** outMap) { status = parser.parse(); #if DEBUG_PARSER_PERFORMANCE nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime; - LOGD("Parsed property file '%s' %d lines in %0.3fms.", + ALOGD("Parsed property file '%s' %d lines in %0.3fms.", tokenizer->getFilename().string(), tokenizer->getLineNumber(), elapsedTime / 1000000.0); #endif @@ -163,7 +163,7 @@ PropertyMap::Parser::~Parser() { status_t PropertyMap::Parser::parse() { while (!mTokenizer->isEof()) { #if DEBUG_PARSER - LOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), + ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), mTokenizer->peekRemainderOfLine().string()); #endif @@ -172,14 +172,14 @@ status_t PropertyMap::Parser::parse() { if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') { String8 keyToken = mTokenizer->nextToken(WHITESPACE_OR_PROPERTY_DELIMITER); if (keyToken.isEmpty()) { - LOGE("%s: Expected non-empty property key.", mTokenizer->getLocation().string()); + ALOGE("%s: Expected non-empty property key.", mTokenizer->getLocation().string()); return BAD_VALUE; } mTokenizer->skipDelimiters(WHITESPACE); if (mTokenizer->nextChar() != '=') { - LOGE("%s: Expected '=' between property key and value.", + ALOGE("%s: Expected '=' between property key and value.", mTokenizer->getLocation().string()); return BAD_VALUE; } @@ -188,21 +188,21 @@ status_t PropertyMap::Parser::parse() { String8 valueToken = mTokenizer->nextToken(WHITESPACE); if (valueToken.find("\\", 0) >= 0 || valueToken.find("\"", 0) >= 0) { - LOGE("%s: Found reserved character '\\' or '\"' in property value.", + ALOGE("%s: Found reserved character '\\' or '\"' in property value.", mTokenizer->getLocation().string()); return BAD_VALUE; } mTokenizer->skipDelimiters(WHITESPACE); if (!mTokenizer->isEol()) { - LOGE("%s: Expected end of line, got '%s'.", + ALOGE("%s: Expected end of line, got '%s'.", mTokenizer->getLocation().string(), mTokenizer->peekRemainderOfLine().string()); return BAD_VALUE; } if (mMap->hasProperty(keyToken)) { - LOGE("%s: Duplicate property value for key '%s'.", + ALOGE("%s: Duplicate property value for key '%s'.", mTokenizer->getLocation().string(), keyToken.string()); return BAD_VALUE; } diff --git a/libs/utils/RefBase.cpp b/libs/utils/RefBase.cpp index 37d061c..e80a795 100644 --- a/libs/utils/RefBase.cpp +++ b/libs/utils/RefBase.cpp @@ -98,12 +98,12 @@ public: #if DEBUG_REFS_FATAL_SANITY_CHECKS LOG_ALWAYS_FATAL("Strong references remain!"); #else - LOGE("Strong references remain:"); + ALOGE("Strong references remain:"); #endif ref_entry* refs = mStrongRefs; while (refs) { char inc = refs->ref >= 0 ? '+' : '-'; - LOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref); + ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref); #if DEBUG_REFS_CALLSTACK_ENABLED refs->stack.dump(); #endif @@ -116,12 +116,12 @@ public: #if DEBUG_REFS_FATAL_SANITY_CHECKS LOG_ALWAYS_FATAL("Weak references remain:"); #else - LOGE("Weak references remain!"); + ALOGE("Weak references remain!"); #endif ref_entry* refs = mWeakRefs; while (refs) { char inc = refs->ref >= 0 ? '+' : '-'; - LOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref); + ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref); #if DEBUG_REFS_CALLSTACK_ENABLED refs->stack.dump(); #endif @@ -129,7 +129,7 @@ public: } } if (dumpStack) { - LOGE("above errors at:"); + ALOGE("above errors at:"); CallStack stack; stack.update(); stack.dump(); @@ -137,13 +137,13 @@ public: } void addStrongRef(const void* id) { - //LOGD_IF(mTrackEnabled, + //ALOGD_IF(mTrackEnabled, // "addStrongRef: RefBase=%p, id=%p", mBase, id); addRef(&mStrongRefs, id, mStrong); } void removeStrongRef(const void* id) { - //LOGD_IF(mTrackEnabled, + //ALOGD_IF(mTrackEnabled, // "removeStrongRef: RefBase=%p, id=%p", mBase, id); if (!mRetain) { removeRef(&mStrongRefs, id); @@ -153,7 +153,7 @@ public: } void renameStrongRefId(const void* old_id, const void* new_id) { - //LOGD_IF(mTrackEnabled, + //ALOGD_IF(mTrackEnabled, // "renameStrongRefId: RefBase=%p, oid=%p, nid=%p", // mBase, old_id, new_id); renameRefsId(mStrongRefs, old_id, new_id); @@ -203,9 +203,9 @@ public: if (rc >= 0) { write(rc, text.string(), text.length()); close(rc); - LOGD("STACK TRACE for %p saved in %s", this, name); + ALOGD("STACK TRACE for %p saved in %s", this, name); } - else LOGE("FAILED TO PRINT STACK TRACE for %p in %s: %s", this, + else ALOGE("FAILED TO PRINT STACK TRACE for %p in %s: %s", this, name, strerror(errno)); } } @@ -263,14 +263,14 @@ private: id, mBase, this); #endif - LOGE("RefBase: removing id %p on RefBase %p" + ALOGE("RefBase: removing id %p on RefBase %p" "(weakref_type %p) that doesn't exist!", id, mBase, this); ref = head; while (ref) { char inc = ref->ref >= 0 ? '+' : '-'; - LOGD("\t%c ID %p (ref %d):", inc, ref->id, ref->ref); + ALOGD("\t%c ID %p (ref %d):", inc, ref->id, ref->ref); ref = ref->next; } @@ -332,9 +332,9 @@ void RefBase::incStrong(const void* id) const refs->addStrongRef(id); const int32_t c = android_atomic_inc(&refs->mStrong); - LOG_ASSERT(c > 0, "incStrong() called on %p after last strong ref", refs); + ALOG_ASSERT(c > 0, "incStrong() called on %p after last strong ref", refs); #if PRINT_REFS - LOGD("incStrong of %p from %p: cnt=%d\n", this, id, c); + ALOGD("incStrong of %p from %p: cnt=%d\n", this, id, c); #endif if (c != INITIAL_STRONG_VALUE) { return; @@ -350,9 +350,9 @@ void RefBase::decStrong(const void* id) const refs->removeStrongRef(id); const int32_t c = android_atomic_dec(&refs->mStrong); #if PRINT_REFS - LOGD("decStrong of %p from %p: cnt=%d\n", this, id, c); + ALOGD("decStrong of %p from %p: cnt=%d\n", this, id, c); #endif - LOG_ASSERT(c >= 1, "decStrong() called on %p too many times", refs); + ALOG_ASSERT(c >= 1, "decStrong() called on %p too many times", refs); if (c == 1) { refs->mBase->onLastStrongRef(id); if ((refs->mFlags&OBJECT_LIFETIME_MASK) == OBJECT_LIFETIME_STRONG) { @@ -369,10 +369,10 @@ void RefBase::forceIncStrong(const void* id) const refs->addStrongRef(id); const int32_t c = android_atomic_inc(&refs->mStrong); - LOG_ASSERT(c >= 0, "forceIncStrong called on %p after ref count underflow", + ALOG_ASSERT(c >= 0, "forceIncStrong called on %p after ref count underflow", refs); #if PRINT_REFS - LOGD("forceIncStrong of %p from %p: cnt=%d\n", this, id, c); + ALOGD("forceIncStrong of %p from %p: cnt=%d\n", this, id, c); #endif switch (c) { @@ -399,7 +399,7 @@ void RefBase::weakref_type::incWeak(const void* id) weakref_impl* const impl = static_cast<weakref_impl*>(this); impl->addWeakRef(id); const int32_t c = android_atomic_inc(&impl->mWeak); - LOG_ASSERT(c >= 0, "incWeak called on %p after last weak ref", this); + ALOG_ASSERT(c >= 0, "incWeak called on %p after last weak ref", this); } @@ -408,7 +408,7 @@ void RefBase::weakref_type::decWeak(const void* id) weakref_impl* const impl = static_cast<weakref_impl*>(this); impl->removeWeakRef(id); const int32_t c = android_atomic_dec(&impl->mWeak); - LOG_ASSERT(c >= 1, "decWeak called on %p too many times", this); + ALOG_ASSERT(c >= 1, "decWeak called on %p too many times", this); if (c != 1) return; if ((impl->mFlags&OBJECT_LIFETIME_WEAK) == OBJECT_LIFETIME_STRONG) { @@ -421,7 +421,7 @@ void RefBase::weakref_type::decWeak(const void* id) // destroy the object now. delete impl->mBase; } else { - // LOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase); + // ALOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase); delete impl; } } else { @@ -442,7 +442,7 @@ bool RefBase::weakref_type::attemptIncStrong(const void* id) weakref_impl* const impl = static_cast<weakref_impl*>(this); int32_t curCount = impl->mStrong; - LOG_ASSERT(curCount >= 0, "attemptIncStrong called on %p after underflow", + ALOG_ASSERT(curCount >= 0, "attemptIncStrong called on %p after underflow", this); while (curCount > 0 && curCount != INITIAL_STRONG_VALUE) { if (android_atomic_cmpxchg(curCount, curCount+1, &impl->mStrong) == 0) { @@ -487,7 +487,7 @@ bool RefBase::weakref_type::attemptIncStrong(const void* id) impl->addStrongRef(id); #if PRINT_REFS - LOGD("attemptIncStrong of %p from %p: cnt=%d\n", this, id, curCount); + ALOGD("attemptIncStrong of %p from %p: cnt=%d\n", this, id, curCount); #endif if (curCount == INITIAL_STRONG_VALUE) { @@ -503,7 +503,7 @@ bool RefBase::weakref_type::attemptIncWeak(const void* id) weakref_impl* const impl = static_cast<weakref_impl*>(this); int32_t curCount = impl->mWeak; - LOG_ASSERT(curCount >= 0, "attemptIncWeak called on %p after underflow", + ALOG_ASSERT(curCount >= 0, "attemptIncWeak called on %p after underflow", this); while (curCount > 0) { if (android_atomic_cmpxchg(curCount, curCount+1, &impl->mWeak) == 0) { diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp index 6cf01c8..15b83bb 100644 --- a/libs/utils/ResourceTypes.cpp +++ b/libs/utils/ResourceTypes.cpp @@ -69,7 +69,7 @@ namespace android { static void printToLogFunc(void* cookie, const char* txt) { - LOGV("%s", txt); + ALOGV("%s", txt); } // Standard C isspace() is only required to look at the low byte of its input, so @@ -107,20 +107,20 @@ static status_t validate_chunk(const ResChunk_header* chunk, if ((ssize_t)size <= (dataEnd-((const uint8_t*)chunk))) { return NO_ERROR; } - LOGW("%s data size %p extends beyond resource end %p.", + ALOGW("%s data size %p extends beyond resource end %p.", name, (void*)size, (void*)(dataEnd-((const uint8_t*)chunk))); return BAD_TYPE; } - LOGW("%s size 0x%x or headerSize 0x%x is not on an integer boundary.", + ALOGW("%s size 0x%x or headerSize 0x%x is not on an integer boundary.", name, (int)size, (int)headerSize); return BAD_TYPE; } - LOGW("%s size %p is smaller than header size %p.", + ALOGW("%s size %p is smaller than header size %p.", name, (void*)size, (void*)(int)headerSize); return BAD_TYPE; } - LOGW("%s header size %p is too small.", + ALOGW("%s header size %p is too small.", name, (void*)(int)headerSize); return BAD_TYPE; } @@ -221,11 +221,11 @@ static void deserializeInternal(const void* inData, Res_png_9patch* outData) { static bool assertIdmapHeader(const uint32_t* map, size_t sizeBytes) { if (sizeBytes < ResTable::IDMAP_HEADER_SIZE_BYTES) { - LOGW("idmap assertion failed: size=%d bytes\n", sizeBytes); + ALOGW("idmap assertion failed: size=%d bytes\n", sizeBytes); return false; } if (*map != htodl(IDMAP_MAGIC)) { // htodl: map data expected to be in correct endianess - LOGW("idmap assertion failed: invalid magic found (is 0x%08x, expected 0x%08x)\n", + ALOGW("idmap assertion failed: invalid magic found (is 0x%08x, expected 0x%08x)\n", *map, htodl(IDMAP_MAGIC)); return false; } @@ -246,11 +246,11 @@ static status_t idmapLookup(const uint32_t* map, size_t sizeBytes, uint32_t key, const uint32_t typeCount = *map; if (type > typeCount) { - LOGW("Resource ID map: type=%d exceeds number of types=%d\n", type, typeCount); + ALOGW("Resource ID map: type=%d exceeds number of types=%d\n", type, typeCount); return UNKNOWN_ERROR; } if (typeCount > size) { - LOGW("Resource ID map: number of types=%d exceeds size of map=%d\n", typeCount, size); + ALOGW("Resource ID map: number of types=%d exceeds size of map=%d\n", typeCount, size); return UNKNOWN_ERROR; } const uint32_t typeOffset = map[type]; @@ -259,7 +259,7 @@ static status_t idmapLookup(const uint32_t* map, size_t sizeBytes, uint32_t key, return NO_ERROR; } if (typeOffset + 1 > size) { - LOGW("Resource ID map: type offset=%d exceeds reasonable value, size of map=%d\n", + ALOGW("Resource ID map: type offset=%d exceeds reasonable value, size of map=%d\n", typeOffset, size); return UNKNOWN_ERROR; } @@ -271,7 +271,7 @@ static status_t idmapLookup(const uint32_t* map, size_t sizeBytes, uint32_t key, } const uint32_t index = typeOffset + 2 + entry - entryOffset; if (index > size) { - LOGW("Resource ID map: entry index=%d exceeds size of map=%d\n", index, size); + ALOGW("Resource ID map: entry index=%d exceeds size of map=%d\n", index, size); *outValue = 0; return NO_ERROR; } @@ -296,7 +296,7 @@ static status_t getIdmapPackageId(const uint32_t* map, size_t mapSize, uint32_t Res_png_9patch* Res_png_9patch::deserialize(const void* inData) { if (sizeof(void*) != sizeof(int32_t)) { - LOGE("Cannot deserialize on non 32-bit system\n"); + ALOGE("Cannot deserialize on non 32-bit system\n"); return NULL; } deserializeInternal(inData, (Res_png_9patch*) inData); @@ -358,7 +358,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) if (mHeader->header.headerSize > mHeader->header.size || mHeader->header.size > size) { - LOGW("Bad string block: header size %d or total size %d is larger than data size %d\n", + ALOGW("Bad string block: header size %d or total size %d is larger than data size %d\n", (int)mHeader->header.headerSize, (int)mHeader->header.size, (int)size); return (mError=BAD_TYPE); } @@ -370,7 +370,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) if ((mHeader->stringCount*sizeof(uint32_t) < mHeader->stringCount) // uint32 overflow? || (mHeader->header.headerSize+(mHeader->stringCount*sizeof(uint32_t))) > size) { - LOGW("Bad string block: entry of %d items extends past data size %d\n", + ALOGW("Bad string block: entry of %d items extends past data size %d\n", (int)(mHeader->header.headerSize+(mHeader->stringCount*sizeof(uint32_t))), (int)size); return (mError=BAD_TYPE); @@ -388,7 +388,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) mStrings = (const void*) (((const uint8_t*)data)+mHeader->stringsStart); if (mHeader->stringsStart >= (mHeader->header.size-sizeof(uint16_t))) { - LOGW("Bad string block: string pool starts at %d, after total size %d\n", + ALOGW("Bad string block: string pool starts at %d, after total size %d\n", (int)mHeader->stringsStart, (int)mHeader->header.size); return (mError=BAD_TYPE); } @@ -398,13 +398,13 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) } else { // check invariant: styles starts before end of data if (mHeader->stylesStart >= (mHeader->header.size-sizeof(uint16_t))) { - LOGW("Bad style block: style block starts at %d past data size of %d\n", + ALOGW("Bad style block: style block starts at %d past data size of %d\n", (int)mHeader->stylesStart, (int)mHeader->header.size); return (mError=BAD_TYPE); } // check invariant: styles follow the strings if (mHeader->stylesStart <= mHeader->stringsStart) { - LOGW("Bad style block: style block starts at %d, before strings at %d\n", + ALOGW("Bad style block: style block starts at %d, before strings at %d\n", (int)mHeader->stylesStart, (int)mHeader->stringsStart); return (mError=BAD_TYPE); } @@ -414,7 +414,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) // check invariant: stringCount > 0 requires a string pool to exist if (mStringPoolSize == 0) { - LOGW("Bad string block: stringCount is %d but pool size is 0\n", (int)mHeader->stringCount); + ALOGW("Bad string block: stringCount is %d but pool size is 0\n", (int)mHeader->stringCount); return (mError=BAD_TYPE); } @@ -437,7 +437,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) ((uint8_t*)mStrings)[mStringPoolSize-1] != 0) || (!mHeader->flags&ResStringPool_header::UTF8_FLAG && ((char16_t*)mStrings)[mStringPoolSize-1] != 0)) { - LOGW("Bad string block: last string is not 0-terminated\n"); + ALOGW("Bad string block: last string is not 0-terminated\n"); return (mError=BAD_TYPE); } } else { @@ -449,12 +449,12 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) mEntryStyles = mEntries + mHeader->stringCount; // invariant: integer overflow in calculating mEntryStyles if (mEntryStyles < mEntries) { - LOGW("Bad string block: integer overflow finding styles\n"); + ALOGW("Bad string block: integer overflow finding styles\n"); return (mError=BAD_TYPE); } if (((const uint8_t*)mEntryStyles-(const uint8_t*)mHeader) > (int)size) { - LOGW("Bad string block: entry of %d styles extends past data size %d\n", + ALOGW("Bad string block: entry of %d styles extends past data size %d\n", (int)((const uint8_t*)mEntryStyles-(const uint8_t*)mHeader), (int)size); return (mError=BAD_TYPE); @@ -462,7 +462,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) mStyles = (const uint32_t*) (((const uint8_t*)data)+mHeader->stylesStart); if (mHeader->stylesStart >= mHeader->header.size) { - LOGW("Bad string block: style pool starts %d, after total size %d\n", + ALOGW("Bad string block: style pool starts %d, after total size %d\n", (int)mHeader->stylesStart, (int)mHeader->header.size); return (mError=BAD_TYPE); } @@ -487,7 +487,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData) }; if (memcmp(&mStyles[mStylePoolSize-(sizeof(endSpan)/sizeof(uint32_t))], &endSpan, sizeof(endSpan)) != 0) { - LOGW("Bad string block: last style is not 0xFFFFFFFF-terminated\n"); + ALOGW("Bad string block: last style is not 0xFFFFFFFF-terminated\n"); return (mError=BAD_TYPE); } } else { @@ -581,7 +581,7 @@ const uint16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const if ((uint32_t)(str+*u16len-strings) < mStringPoolSize) { return str; } else { - LOGW("Bad string block: string #%d extends to %d, past end at %d\n", + ALOGW("Bad string block: string #%d extends to %d, past end at %d\n", (int)idx, (int)(str+*u16len-strings), (int)mStringPoolSize); } } else { @@ -601,7 +601,7 @@ const uint16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const ssize_t actualLen = utf8_to_utf16_length(u8str, u8len); if (actualLen < 0 || (size_t)actualLen != *u16len) { - LOGW("Bad string block: string #%lld decoded length is not correct " + ALOGW("Bad string block: string #%lld decoded length is not correct " "%lld vs %llu\n", (long long)idx, (long long)actualLen, (long long)*u16len); return NULL; @@ -609,7 +609,7 @@ const uint16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const char16_t *u16str = (char16_t *)calloc(*u16len+1, sizeof(char16_t)); if (!u16str) { - LOGW("No memory when trying to allocate decode cache for string #%d\n", + ALOGW("No memory when trying to allocate decode cache for string #%d\n", (int)idx); return NULL; } @@ -618,13 +618,13 @@ const uint16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const mCache[idx] = u16str; return u16str; } else { - LOGW("Bad string block: string #%lld extends to %lld, past end at %lld\n", + ALOGW("Bad string block: string #%lld extends to %lld, past end at %lld\n", (long long)idx, (long long)(u8str+u8len-strings), (long long)mStringPoolSize); } } } else { - LOGW("Bad string block: string #%d entry is at %d, past end at %d\n", + ALOGW("Bad string block: string #%d entry is at %d, past end at %d\n", (int)idx, (int)(off*sizeof(uint16_t)), (int)(mStringPoolSize*sizeof(uint16_t))); } @@ -646,12 +646,12 @@ const char* ResStringPool::string8At(size_t idx, size_t* outLen) const if ((uint32_t)(str+encLen-strings) < mStringPoolSize) { return (const char*)str; } else { - LOGW("Bad string block: string #%d extends to %d, past end at %d\n", + ALOGW("Bad string block: string #%d extends to %d, past end at %d\n", (int)idx, (int)(str+encLen-strings), (int)mStringPoolSize); } } } else { - LOGW("Bad string block: string #%d entry is at %d, past end at %d\n", + ALOGW("Bad string block: string #%d entry is at %d, past end at %d\n", (int)idx, (int)(off*sizeof(uint16_t)), (int)(mStringPoolSize*sizeof(uint16_t))); } @@ -671,7 +671,7 @@ const ResStringPool_span* ResStringPool::styleAt(size_t idx) const if (off < mStylePoolSize) { return (const ResStringPool_span*)(mStyles+off); } else { - LOGW("Bad string block: style #%d entry is at %d, past end at %d\n", + ALOGW("Bad string block: style #%d entry is at %d, past end at %d\n", (int)idx, (int)(off*sizeof(uint32_t)), (int)(mStylePoolSize*sizeof(uint32_t))); } @@ -1087,7 +1087,7 @@ ResXMLParser::event_code_t ResXMLParser::nextNode() do { const ResXMLTree_node* next = (const ResXMLTree_node*) (((const uint8_t*)mCurNode) + dtohl(mCurNode->header.size)); - //LOGW("Next node: prev=%p, next=%p\n", mCurNode, next); + //ALOGW("Next node: prev=%p, next=%p\n", mCurNode, next); if (((const uint8_t*)next) >= mTree.mDataEnd) { mCurNode = NULL; @@ -1120,14 +1120,14 @@ ResXMLParser::event_code_t ResXMLParser::nextNode() minExtSize = sizeof(ResXMLTree_cdataExt); break; default: - LOGW("Unknown XML block: header type %d in node at %d\n", + ALOGW("Unknown XML block: header type %d in node at %d\n", (int)dtohs(next->header.type), (int)(((const uint8_t*)next)-((const uint8_t*)mTree.mHeader))); continue; } if ((totalSize-headerSize) < minExtSize) { - LOGW("Bad XML block: header type 0x%x in node at 0x%x has size %d, need %d\n", + ALOGW("Bad XML block: header type 0x%x in node at 0x%x has size %d, need %d\n", (int)dtohs(next->header.type), (int)(((const uint8_t*)next)-((const uint8_t*)mTree.mHeader)), (int)(totalSize-headerSize), (int)minExtSize); @@ -1164,7 +1164,7 @@ ResXMLTree::ResXMLTree() : ResXMLParser(*this) , mError(NO_INIT), mOwnedData(NULL) { - //LOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1); + //ALOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1); restart(); } @@ -1172,13 +1172,13 @@ ResXMLTree::ResXMLTree(const void* data, size_t size, bool copyData) : ResXMLParser(*this) , mError(NO_INIT), mOwnedData(NULL) { - //LOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1); + //ALOGI("Creating ResXMLTree %p #%d\n", this, android_atomic_inc(&gCount)+1); setTo(data, size, copyData); } ResXMLTree::~ResXMLTree() { - //LOGI("Destroying ResXMLTree in %p #%d\n", this, android_atomic_dec(&gCount)-1); + //ALOGI("Destroying ResXMLTree in %p #%d\n", this, android_atomic_dec(&gCount)-1); uninit(); } @@ -1199,7 +1199,7 @@ status_t ResXMLTree::setTo(const void* data, size_t size, bool copyData) mHeader = (const ResXMLTree_header*)data; mSize = dtohl(mHeader->header.size); if (dtohs(mHeader->header.headerSize) > mSize || mSize > size) { - LOGW("Bad XML block: header size %d or total size %d is larger than data size %d\n", + ALOGW("Bad XML block: header size %d or total size %d is larger than data size %d\n", (int)dtohs(mHeader->header.headerSize), (int)dtohl(mHeader->header.size), (int)size); mError = BAD_TYPE; @@ -1259,7 +1259,7 @@ status_t ResXMLTree::setTo(const void* data, size_t size, bool copyData) } if (mRootNode == NULL) { - LOGW("Bad XML block: no root element node found\n"); + ALOGW("Bad XML block: no root element node found\n"); mError = BAD_TYPE; goto done; } @@ -1313,12 +1313,12 @@ status_t ResXMLTree::validateNode(const ResXMLTree_node* node) const if ((dtohs(attrExt->attributeStart)+attrSize) <= (size-headerSize)) { return NO_ERROR; } - LOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n", + ALOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n", (unsigned int)(dtohs(attrExt->attributeStart)+attrSize), (unsigned int)(size-headerSize)); } else { - LOGW("Bad XML start block: node header size 0x%x, size 0x%x\n", + ALOGW("Bad XML start block: node header size 0x%x, size 0x%x\n", (unsigned int)headerSize, (unsigned int)size); } return BAD_TYPE; @@ -1342,21 +1342,21 @@ status_t ResXMLTree::validateNode(const ResXMLTree_node* node) const <= (size-headerSize)) { return NO_ERROR; } - LOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n", + ALOGW("Bad XML block: node attributes use 0x%x bytes, only have 0x%x bytes\n", ((int)dtohs(node->attributeSize))*dtohs(node->attributeCount), (int)(size-headerSize)); return BAD_TYPE; } - LOGW("Bad XML block: node at 0x%x extends beyond data end 0x%x\n", + ALOGW("Bad XML block: node at 0x%x extends beyond data end 0x%x\n", (int)(((const uint8_t*)node)-((const uint8_t*)mHeader)), (int)mSize); return BAD_TYPE; } - LOGW("Bad XML block: node at 0x%x header size 0x%x smaller than total size 0x%x\n", + ALOGW("Bad XML block: node at 0x%x header size 0x%x smaller than total size 0x%x\n", (int)(((const uint8_t*)node)-((const uint8_t*)mHeader)), (int)headerSize, (int)size); return BAD_TYPE; } - LOGW("Bad XML block: node at 0x%x header size 0x%x too small\n", + ALOGW("Bad XML block: node at 0x%x header size 0x%x too small\n", (int)(((const uint8_t*)node)-((const uint8_t*)mHeader)), (int)headerSize); return BAD_TYPE; @@ -1574,7 +1574,7 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force) if (curPackage != p) { const ssize_t pidx = mTable.getResourcePackageIndex(attrRes); if (pidx < 0) { - LOGE("Style contains key with bad package: 0x%08x\n", attrRes); + ALOGE("Style contains key with bad package: 0x%08x\n", attrRes); bag++; continue; } @@ -1594,7 +1594,7 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force) } if (curType != t) { if (t >= curPI->numTypes) { - LOGE("Style contains key with bad type: 0x%08x\n", attrRes); + ALOGE("Style contains key with bad type: 0x%08x\n", attrRes); bag++; continue; } @@ -1612,7 +1612,7 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force) numEntries = curPI->types[t].numEntries; } if (e >= numEntries) { - LOGE("Style contains key with bad entry: 0x%08x\n", attrRes); + ALOGE("Style contains key with bad entry: 0x%08x\n", attrRes); bag++; continue; } @@ -1631,7 +1631,7 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force) mTable.unlock(); - //LOGI("Applying style 0x%08x (force=%d) theme %p...\n", resID, force, this); + //ALOGI("Applying style 0x%08x (force=%d) theme %p...\n", resID, force, this); //dumpToLog(); return NO_ERROR; @@ -1639,7 +1639,7 @@ status_t ResTable::Theme::applyStyle(uint32_t resID, bool force) status_t ResTable::Theme::setTo(const Theme& other) { - //LOGI("Setting theme %p from theme %p...\n", this, &other); + //ALOGI("Setting theme %p from theme %p...\n", this, &other); //dumpToLog(); //other.dumpToLog(); @@ -1670,7 +1670,7 @@ status_t ResTable::Theme::setTo(const Theme& other) } } - //LOGI("Final theme:"); + //ALOGI("Final theme:"); //dumpToLog(); return NO_ERROR; @@ -1712,7 +1712,7 @@ ssize_t ResTable::Theme::getAttribute(uint32_t resID, Res_value* outValue, resID = te.value.data; continue; } - LOGW("Too many attribute references, stopped at: 0x%08x\n", resID); + ALOGW("Too many attribute references, stopped at: 0x%08x\n", resID); return BAD_INDEX; } else if (type != Res_value::TYPE_NULL) { *outValue = te.value; @@ -1752,21 +1752,21 @@ ssize_t ResTable::Theme::resolveAttributeReference(Res_value* inOutValue, void ResTable::Theme::dumpToLog() const { - LOGI("Theme %p:\n", this); + ALOGI("Theme %p:\n", this); for (size_t i=0; i<Res_MAXPACKAGE; i++) { package_info* pi = mPackages[i]; if (pi == NULL) continue; - LOGI(" Package #0x%02x:\n", (int)(i+1)); + ALOGI(" Package #0x%02x:\n", (int)(i+1)); for (size_t j=0; j<pi->numTypes; j++) { type_info& ti = pi->types[j]; if (ti.numEntries == 0) continue; - LOGI(" Type #0x%02x:\n", (int)(j+1)); + ALOGI(" Type #0x%02x:\n", (int)(j+1)); for (size_t k=0; k<ti.numEntries; k++) { theme_entry& te = ti.entries[k]; if (te.value.dataType == Res_value::TYPE_NULL) continue; - LOGI(" 0x%08x: t=0x%x, d=0x%08x (block=%d)\n", + ALOGI(" 0x%08x: t=0x%x, d=0x%08x (block=%d)\n", (int)Res_MAKEID(i, j, k), te.value.dataType, (int)te.value.data, (int)te.stringBlock); } @@ -1779,7 +1779,7 @@ ResTable::ResTable() { memset(&mParams, 0, sizeof(mParams)); memset(mPackageMap, 0, sizeof(mPackageMap)); - //LOGI("Creating ResTable %p\n", this); + //ALOGI("Creating ResTable %p\n", this); } ResTable::ResTable(const void* data, size_t size, void* cookie, bool copyData) @@ -1789,12 +1789,12 @@ ResTable::ResTable(const void* data, size_t size, void* cookie, bool copyData) memset(mPackageMap, 0, sizeof(mPackageMap)); add(data, size, cookie, copyData); LOG_FATAL_IF(mError != NO_ERROR, "Error parsing resource table"); - //LOGI("Creating ResTable %p\n", this); + //ALOGI("Creating ResTable %p\n", this); } ResTable::~ResTable() { - //LOGI("Destroying ResTable in %p\n", this); + //ALOGI("Destroying ResTable in %p\n", this); uninit(); } @@ -1813,7 +1813,7 @@ status_t ResTable::add(Asset* asset, void* cookie, bool copyData, const void* id { const void* data = asset->getBuffer(true); if (data == NULL) { - LOGW("Unable to get buffer of resource asset file"); + ALOGW("Unable to get buffer of resource asset file"); return UNKNOWN_ERROR; } size_t size = (size_t)asset->getLength(); @@ -1867,7 +1867,7 @@ status_t ResTable::add(const void* data, size_t size, void* cookie, const bool notDeviceEndian = htods(0xf0) != 0xf0; LOAD_TABLE_NOISY( - LOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%p, asset=%p, copy=%d " + ALOGV("Adding resources to ResTable: data=%p, size=0x%x, cookie=%p, asset=%p, copy=%d " "idmap=%p\n", data, size, cookie, asset, copyData, idmap)); if (copyData || notDeviceEndian) { @@ -1881,20 +1881,20 @@ status_t ResTable::add(const void* data, size_t size, void* cookie, header->header = (const ResTable_header*)data; header->size = dtohl(header->header->header.size); - //LOGI("Got size 0x%x, again size 0x%x, raw size 0x%x\n", header->size, + //ALOGI("Got size 0x%x, again size 0x%x, raw size 0x%x\n", header->size, // dtohl(header->header->header.size), header->header->header.size); LOAD_TABLE_NOISY(LOGV("Loading ResTable @%p:\n", header->header)); LOAD_TABLE_NOISY(printHexData(2, header->header, header->size < 256 ? header->size : 256, 16, 16, 0, false, printToLogFunc)); if (dtohs(header->header->header.headerSize) > header->size || header->size > size) { - LOGW("Bad resource table: header size 0x%x or total size 0x%x is larger than data size 0x%x\n", + ALOGW("Bad resource table: header size 0x%x or total size 0x%x is larger than data size 0x%x\n", (int)dtohs(header->header->header.headerSize), (int)header->size, (int)size); return (mError=BAD_TYPE); } if (((dtohs(header->header->header.headerSize)|header->size)&0x3) != 0) { - LOGW("Bad resource table: header size 0x%x or total size 0x%x is not on an integer boundary\n", + ALOGW("Bad resource table: header size 0x%x or total size 0x%x is not on an integer boundary\n", (int)dtohs(header->header->header.headerSize), (int)header->size); return (mError=BAD_TYPE); @@ -1927,11 +1927,11 @@ status_t ResTable::add(const void* data, size_t size, void* cookie, return (mError=err); } } else { - LOGW("Multiple string chunks found in resource table."); + ALOGW("Multiple string chunks found in resource table."); } } else if (ctype == RES_TABLE_PACKAGE_TYPE) { if (curPackage >= dtohl(header->header->packageCount)) { - LOGW("More package chunks were found than the %d declared in the header.", + ALOGW("More package chunks were found than the %d declared in the header.", dtohl(header->header->packageCount)); return (mError=BAD_TYPE); } @@ -1949,7 +1949,7 @@ status_t ResTable::add(const void* data, size_t size, void* cookie, } curPackage++; } else { - LOGW("Unknown chunk type %p in table at %p.\n", + ALOGW("Unknown chunk type %p in table at %p.\n", (void*)(int)(ctype), (void*)(((const uint8_t*)chunk) - ((const uint8_t*)header->header))); } @@ -1958,13 +1958,13 @@ status_t ResTable::add(const void* data, size_t size, void* cookie, } if (curPackage < dtohl(header->header->packageCount)) { - LOGW("Fewer package chunks (%d) were found than the %d declared in the header.", + ALOGW("Fewer package chunks (%d) were found than the %d declared in the header.", (int)curPackage, dtohl(header->header->packageCount)); return (mError=BAD_TYPE); } mError = header->values.getError(); if (mError != NO_ERROR) { - LOGW("No string values found in resource table!"); + ALOGW("No string values found in resource table!"); } TABLE_NOISY(LOGV("Returning from add with mError=%d\n", mError)); @@ -2011,20 +2011,20 @@ bool ResTable::getResourceName(uint32_t resID, resource_name* outName) const if (p < 0) { if (Res_GETPACKAGE(resID)+1 == 0) { - LOGW("No package identifier when getting name for resource number 0x%08x", resID); + ALOGW("No package identifier when getting name for resource number 0x%08x", resID); } else { - LOGW("No known package when getting name for resource number 0x%08x", resID); + ALOGW("No known package when getting name for resource number 0x%08x", resID); } return false; } if (t < 0) { - LOGW("No type identifier when getting name for resource number 0x%08x", resID); + ALOGW("No type identifier when getting name for resource number 0x%08x", resID); return false; } const PackageGroup* const grp = mPackageGroups[p]; if (grp == NULL) { - LOGW("Bad identifier when getting name for resource number 0x%08x", resID); + ALOGW("Bad identifier when getting name for resource number 0x%08x", resID); return false; } if (grp->packages.size() > 0) { @@ -2067,14 +2067,14 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag if (p < 0) { if (Res_GETPACKAGE(resID)+1 == 0) { - LOGW("No package identifier when getting value for resource number 0x%08x", resID); + ALOGW("No package identifier when getting value for resource number 0x%08x", resID); } else { - LOGW("No known package when getting value for resource number 0x%08x", resID); + ALOGW("No known package when getting value for resource number 0x%08x", resID); } return BAD_INDEX; } if (t < 0) { - LOGW("No type identifier when getting value for resource number 0x%08x", resID); + ALOGW("No type identifier when getting value for resource number 0x%08x", resID); return BAD_INDEX; } @@ -2089,7 +2089,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag // recently added. const PackageGroup* const grp = mPackageGroups[p]; if (grp == NULL) { - LOGW("Bad identifier when getting value for resource number 0x%08x", resID); + ALOGW("Bad identifier when getting value for resource number 0x%08x", resID); return BAD_INDEX; } @@ -2099,7 +2099,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag if (density > 0) { overrideConfig = (ResTable_config*) malloc(sizeof(ResTable_config)); if (overrideConfig == NULL) { - LOGE("Couldn't malloc ResTable_config for overrides: %s", strerror(errno)); + ALOGE("Couldn't malloc ResTable_config for overrides: %s", strerror(errno)); return BAD_INDEX; } memcpy(overrideConfig, &mParams, sizeof(ResTable_config)); @@ -2122,7 +2122,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag resID, &overlayResID); if (retval == NO_ERROR && overlayResID != 0x0) { // for this loop iteration, this is the type and entry we really want - LOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID); + ALOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID); T = Res_GETTYPE(overlayResID); E = Res_GETENTRY(overlayResID); } else { @@ -2141,7 +2141,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag // overlay package did not specify a default. // Non-overlay packages are still required to provide a default. if (offset < 0 && ip == 0) { - LOGW("Failure getting entry for 0x%08x (t=%d e=%d) in package %zd (error %d)\n", + ALOGW("Failure getting entry for 0x%08x (t=%d e=%d) in package %zd (error %d)\n", resID, T, E, ip, (int)offset); rc = offset; goto out; @@ -2151,7 +2151,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag if ((dtohs(entry->flags)&entry->FLAG_COMPLEX) != 0) { if (!mayBeBag) { - LOGW("Requesting resource %p failed because it is complex\n", + ALOGW("Requesting resource %p failed because it is complex\n", (void*)resID); } continue; @@ -2161,7 +2161,7 @@ ssize_t ResTable::getResource(uint32_t resID, Res_value* outValue, bool mayBeBag << HexDump(type, dtohl(type->header.size)) << endl); if ((size_t)offset > (dtohl(type->header.size)-sizeof(Res_value))) { - LOGW("ResTable_item at %d is beyond type chunk data %d", + ALOGW("ResTable_item at %d is beyond type chunk data %d", (int)offset, dtohl(type->header.size)); rc = BAD_TYPE; goto out; @@ -2307,23 +2307,23 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, const int e = Res_GETENTRY(resID); if (p < 0) { - LOGW("Invalid package identifier when getting bag for resource number 0x%08x", resID); + ALOGW("Invalid package identifier when getting bag for resource number 0x%08x", resID); return BAD_INDEX; } if (t < 0) { - LOGW("No type identifier when getting bag for resource number 0x%08x", resID); + ALOGW("No type identifier when getting bag for resource number 0x%08x", resID); return BAD_INDEX; } //printf("Get bag: id=0x%08x, p=%d, t=%d\n", resID, p, t); PackageGroup* const grp = mPackageGroups[p]; if (grp == NULL) { - LOGW("Bad identifier when getting bag for resource number 0x%08x", resID); + ALOGW("Bad identifier when getting bag for resource number 0x%08x", resID); return false; } if (t >= (int)grp->typeCount) { - LOGW("Type identifier 0x%x is larger than type count 0x%x", + ALOGW("Type identifier 0x%x is larger than type count 0x%x", t+1, (int)grp->typeCount); return BAD_INDEX; } @@ -2334,7 +2334,7 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, const size_t NENTRY = typeConfigs->entryCount; if (e >= (int)NENTRY) { - LOGW("Entry identifier 0x%x is larger than entry count 0x%x", + ALOGW("Entry identifier 0x%x is larger than entry count 0x%x", e, (int)typeConfigs->entryCount); return BAD_INDEX; } @@ -2350,10 +2350,10 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, *outTypeSpecFlags = set->typeSpecFlags; } *outBag = (bag_entry*)(set+1); - //LOGI("Found existing bag for: %p\n", (void*)resID); + //ALOGI("Found existing bag for: %p\n", (void*)resID); return set->numAttrs; } - LOGW("Attempt to retrieve bag 0x%08x which is invalid or in a cycle.", + ALOGW("Attempt to retrieve bag 0x%08x which is invalid or in a cycle.", resID); return BAD_INDEX; } @@ -2401,7 +2401,7 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, resID, &overlayResID); if (retval == NO_ERROR && overlayResID != 0x0) { // for this loop iteration, this is the type and entry we really want - LOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID); + ALOGV("resource map 0x%08x -> 0x%08x\n", resID, overlayResID); T = Res_GETTYPE(overlayResID); E = Res_GETENTRY(overlayResID); } else { @@ -2413,9 +2413,9 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, const ResTable_type* type; const ResTable_entry* entry; const Type* typeClass; - LOGV("Getting entry pkg=%p, t=%d, e=%d\n", package, T, E); + ALOGV("Getting entry pkg=%p, t=%d, e=%d\n", package, T, E); ssize_t offset = getEntry(package, T, E, &mParams, &type, &entry, &typeClass); - LOGV("Resulting offset=%d\n", offset); + ALOGV("Resulting offset=%d\n", offset); if (offset <= 0) { // No {entry, appropriate config} pair found in package. If this // package is an overlay package (ip != 0), this simply means the @@ -2429,7 +2429,7 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, } if ((dtohs(entry->flags)&entry->FLAG_COMPLEX) == 0) { - LOGW("Skipping entry %p in package table %d because it is not complex!\n", + ALOGW("Skipping entry %p in package table %d because it is not complex!\n", (void*)resID, (int)ip); continue; } @@ -2505,7 +2505,7 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag, TABLE_NOISY(printf("Now at %p\n", (void*)curOff)); if ((size_t)curOff > (dtohl(type->header.size)-sizeof(ResTable_map))) { - LOGW("ResTable_map at %d is beyond type chunk data %d", + ALOGW("ResTable_map at %d is beyond type chunk data %d", (int)curOff, dtohl(type->header.size)); return BAD_TYPE; } @@ -2676,7 +2676,7 @@ nope: && name[6] == '_') { int index = atoi(String8(name + 7, nameLen - 7).string()); if (Res_CHECKID(index)) { - LOGW("Array resource index: %d is too large.", + ALOGW("Array resource index: %d is too large.", index); return 0; } @@ -2792,12 +2792,12 @@ nope: offset += typeOffset; if (offset > (dtohl(ty->header.size)-sizeof(ResTable_entry))) { - LOGW("ResTable_entry at %d is beyond type chunk data %d", + ALOGW("ResTable_entry at %d is beyond type chunk data %d", offset, dtohl(ty->header.size)); return 0; } if ((offset&0x3) != 0) { - LOGW("ResTable_entry at %d (pkg=%d type=%d ent=%d) is not on an integer boundary when looking for %s:%s/%s", + ALOGW("ResTable_entry at %d (pkg=%d type=%d ent=%d) is not on an integer boundary when looking for %s:%s/%s", (int)offset, (int)group->id, (int)ti+1, (int)i, String8(package, packageLen).string(), String8(type, typeLen).string(), @@ -2808,7 +2808,7 @@ nope: const ResTable_entry* const entry = (const ResTable_entry*) (((const uint8_t*)ty) + offset); if (dtohs(entry->size) < sizeof(*entry)) { - LOGW("ResTable_entry size %d is too small", dtohs(entry->size)); + ALOGW("ResTable_entry size %d is too small", dtohs(entry->size)); return BAD_TYPE; } @@ -3898,9 +3898,9 @@ void ResTable::getConfigurations(Vector<ResTable_config>* configs) const void ResTable::getLocales(Vector<String8>* locales) const { Vector<ResTable_config> configs; - LOGV("calling getConfigurations"); + ALOGV("calling getConfigurations"); getConfigurations(&configs); - LOGV("called getConfigurations size=%d", (int)configs.size()); + ALOGV("called getConfigurations size=%d", (int)configs.size()); const size_t I = configs.size(); for (size_t i=0; i<I; i++) { char locale[6]; @@ -3924,18 +3924,18 @@ ssize_t ResTable::getEntry( const ResTable_type** outType, const ResTable_entry** outEntry, const Type** outTypeClass) const { - LOGV("Getting entry from package %p\n", package); + ALOGV("Getting entry from package %p\n", package); const ResTable_package* const pkg = package->package; const Type* allTypes = package->getType(typeIndex); - LOGV("allTypes=%p\n", allTypes); + ALOGV("allTypes=%p\n", allTypes); if (allTypes == NULL) { - LOGV("Skipping entry type index 0x%02x because type is NULL!\n", typeIndex); + ALOGV("Skipping entry type index 0x%02x because type is NULL!\n", typeIndex); return 0; } if ((size_t)entryIndex >= allTypes->entryCount) { - LOGW("getEntry failing because entryIndex %d is beyond type entryCount %d", + ALOGW("getEntry failing because entryIndex %d is beyond type entryCount %d", entryIndex, (int)allTypes->entryCount); return BAD_TYPE; } @@ -4039,12 +4039,12 @@ ssize_t ResTable::getEntry( << ", offset=" << (void*)offset << endl); if (offset > (dtohl(type->header.size)-sizeof(ResTable_entry))) { - LOGW("ResTable_entry at 0x%x is beyond type chunk data 0x%x", + ALOGW("ResTable_entry at 0x%x is beyond type chunk data 0x%x", offset, dtohl(type->header.size)); return BAD_TYPE; } if ((offset&0x3) != 0) { - LOGW("ResTable_entry at 0x%x is not on an integer boundary", + ALOGW("ResTable_entry at 0x%x is not on an integer boundary", offset); return BAD_TYPE; } @@ -4052,7 +4052,7 @@ ssize_t ResTable::getEntry( const ResTable_entry* const entry = (const ResTable_entry*) (((const uint8_t*)type) + offset); if (dtohs(entry->size) < sizeof(*entry)) { - LOGW("ResTable_entry size 0x%x is too small", dtohs(entry->size)); + ALOGW("ResTable_entry size 0x%x is too small", dtohs(entry->size)); return BAD_TYPE; } @@ -4077,22 +4077,22 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, const size_t pkgSize = dtohl(pkg->header.size); if (dtohl(pkg->typeStrings) >= pkgSize) { - LOGW("ResTable_package type strings at %p are past chunk size %p.", + ALOGW("ResTable_package type strings at %p are past chunk size %p.", (void*)dtohl(pkg->typeStrings), (void*)pkgSize); return (mError=BAD_TYPE); } if ((dtohl(pkg->typeStrings)&0x3) != 0) { - LOGW("ResTable_package type strings at %p is not on an integer boundary.", + ALOGW("ResTable_package type strings at %p is not on an integer boundary.", (void*)dtohl(pkg->typeStrings)); return (mError=BAD_TYPE); } if (dtohl(pkg->keyStrings) >= pkgSize) { - LOGW("ResTable_package key strings at %p are past chunk size %p.", + ALOGW("ResTable_package key strings at %p are past chunk size %p.", (void*)dtohl(pkg->keyStrings), (void*)pkgSize); return (mError=BAD_TYPE); } if ((dtohl(pkg->keyStrings)&0x3) != 0) { - LOGW("ResTable_package key strings at %p is not on an integer boundary.", + ALOGW("ResTable_package key strings at %p is not on an integer boundary.", (void*)dtohl(pkg->keyStrings)); return (mError=BAD_TYPE); } @@ -4195,7 +4195,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, if ((dtohl(typeSpec->entryCount) > (INT32_MAX/sizeof(uint32_t)) || dtohs(typeSpec->header.headerSize)+(sizeof(uint32_t)*dtohl(typeSpec->entryCount)) > typeSpecSize)) { - LOGW("ResTable_typeSpec entry index to %p extends beyond chunk end %p.", + ALOGW("ResTable_typeSpec entry index to %p extends beyond chunk end %p.", (void*)(dtohs(typeSpec->header.headerSize) +(sizeof(uint32_t)*dtohl(typeSpec->entryCount))), (void*)typeSpecSize); @@ -4203,7 +4203,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, } if (typeSpec->id == 0) { - LOGW("ResTable_type has an id of 0."); + ALOGW("ResTable_type has an id of 0."); return (mError=BAD_TYPE); } @@ -4215,7 +4215,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, t = new Type(header, package, dtohl(typeSpec->entryCount)); package->types.editItemAt(typeSpec->id-1) = t; } else if (dtohl(typeSpec->entryCount) != t->entryCount) { - LOGW("ResTable_typeSpec entry count inconsistent: given %d, previously %d", + ALOGW("ResTable_typeSpec entry count inconsistent: given %d, previously %d", (int)dtohl(typeSpec->entryCount), (int)t->entryCount); return (mError=BAD_TYPE); } @@ -4240,7 +4240,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, (void*)typeSize)); if (dtohs(type->header.headerSize)+(sizeof(uint32_t)*dtohl(type->entryCount)) > typeSize) { - LOGW("ResTable_type entry index to %p extends beyond chunk end %p.", + ALOGW("ResTable_type entry index to %p extends beyond chunk end %p.", (void*)(dtohs(type->header.headerSize) +(sizeof(uint32_t)*dtohl(type->entryCount))), (void*)typeSize); @@ -4248,12 +4248,12 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, } if (dtohl(type->entryCount) != 0 && dtohl(type->entriesStart) > (typeSize-sizeof(ResTable_entry))) { - LOGW("ResTable_type entriesStart at %p extends beyond chunk end %p.", + ALOGW("ResTable_type entriesStart at %p extends beyond chunk end %p.", (void*)dtohl(type->entriesStart), (void*)typeSize); return (mError=BAD_TYPE); } if (type->id == 0) { - LOGW("ResTable_type has an id of 0."); + ALOGW("ResTable_type has an id of 0."); return (mError=BAD_TYPE); } @@ -4265,7 +4265,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, t = new Type(header, package, dtohl(type->entryCount)); package->types.editItemAt(type->id-1) = t; } else if (dtohl(type->entryCount) != t->entryCount) { - LOGW("ResTable_type entry count inconsistent: given %d, previously %d", + ALOGW("ResTable_type entry count inconsistent: given %d, previously %d", (int)dtohl(type->entryCount), (int)t->entryCount); return (mError=BAD_TYPE); } @@ -4273,7 +4273,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg, TABLE_GETENTRY( ResTable_config thisConfig; thisConfig.copyFromDtoH(type->config); - LOGI("Adding config to type %d: imsi:%d/%d lang:%c%c cnt:%c%c " + ALOGI("Adding config to type %d: imsi:%d/%d lang:%c%c cnt:%c%c " "orien:%d touch:%d density:%d key:%d inp:%d nav:%d w:%d h:%d " "swdp:%d wdp:%d hdp:%d\n", type->id, @@ -4346,7 +4346,7 @@ status_t ResTable::createIdmap(const ResTable& overlay, uint32_t originalCrc, ui | (0x0000ffff & (entryIndex)); resource_name resName; if (!this->getResourceName(resID, &resName)) { - LOGW("idmap: resource 0x%08x has spec but lacks values, skipping\n", resID); + ALOGW("idmap: resource 0x%08x has spec but lacks values, skipping\n", resID); continue; } @@ -4368,7 +4368,7 @@ status_t ResTable::createIdmap(const ResTable& overlay, uint32_t originalCrc, ui } #if 0 if (overlayResID != 0) { - LOGD("%s/%s 0x%08x -> 0x%08x\n", + ALOGD("%s/%s 0x%08x -> 0x%08x\n", String8(String16(resName.type)).string(), String8(String16(resName.name)).string(), resID, overlayResID); diff --git a/libs/utils/Static.cpp b/libs/utils/Static.cpp index ceca435..bfcb2da 100644 --- a/libs/utils/Static.cpp +++ b/libs/utils/Static.cpp @@ -57,8 +57,8 @@ protected: virtual status_t writeLines(const struct iovec& vec, size_t N) { //android_writevLog(&vec, N); <-- this is now a no-op - if (N != 1) LOGI("WARNING: writeLines N=%d\n", N); - LOGI("%.*s", vec.iov_len, (const char*) vec.iov_base); + if (N != 1) ALOGI("WARNING: writeLines N=%d\n", N); + ALOGI("%.*s", vec.iov_len, (const char*) vec.iov_base); return NO_ERROR; } }; diff --git a/libs/utils/StopWatch.cpp b/libs/utils/StopWatch.cpp index b5dda2f..595aec3 100644 --- a/libs/utils/StopWatch.cpp +++ b/libs/utils/StopWatch.cpp @@ -39,11 +39,11 @@ StopWatch::~StopWatch() { nsecs_t elapsed = elapsedTime(); const int n = mNumLaps; - LOGD("StopWatch %s (us): %lld ", mName, ns2us(elapsed)); + ALOGD("StopWatch %s (us): %lld ", mName, ns2us(elapsed)); for (int i=0 ; i<n ; i++) { const nsecs_t soFar = mLaps[i].soFar; const nsecs_t thisLap = mLaps[i].thisLap; - LOGD(" [%d: %lld, %lld]", i, ns2us(soFar), ns2us(thisLap)); + ALOGD(" [%d: %lld, %lld]", i, ns2us(soFar), ns2us(thisLap)); } } diff --git a/libs/utils/StreamingZipInflater.cpp b/libs/utils/StreamingZipInflater.cpp index 00498bd..8512170 100644 --- a/libs/utils/StreamingZipInflater.cpp +++ b/libs/utils/StreamingZipInflater.cpp @@ -77,7 +77,7 @@ StreamingZipInflater::~StreamingZipInflater() { } void StreamingZipInflater::initInflateState() { - LOGV("Initializing inflate state"); + ALOGV("Initializing inflate state"); memset(&mInflateState, 0, sizeof(mInflateState)); mInflateState.zalloc = Z_NULL; @@ -138,7 +138,7 @@ ssize_t StreamingZipInflater::read(void* outBuf, size_t count) { if (mInflateState.avail_in == 0) { int err = readNextChunk(); if (err < 0) { - LOGE("Unable to access asset data: %d", err); + ALOGE("Unable to access asset data: %d", err); if (!mStreamNeedsInit) { ::inflateEnd(&mInflateState); initInflateState(); @@ -152,20 +152,20 @@ ssize_t StreamingZipInflater::read(void* outBuf, size_t count) { mInflateState.avail_out = mOutBufSize; /* - LOGV("Inflating to outbuf: avail_in=%u avail_out=%u next_in=%p next_out=%p", + ALOGV("Inflating to outbuf: avail_in=%u avail_out=%u next_in=%p next_out=%p", mInflateState.avail_in, mInflateState.avail_out, mInflateState.next_in, mInflateState.next_out); */ int result = Z_OK; if (mStreamNeedsInit) { - LOGV("Initializing zlib to inflate"); + ALOGV("Initializing zlib to inflate"); result = inflateInit2(&mInflateState, -MAX_WBITS); mStreamNeedsInit = false; } if (result == Z_OK) result = ::inflate(&mInflateState, Z_SYNC_FLUSH); if (result < 0) { // Whoops, inflation failed - LOGE("Error inflating asset: %d", result); + ALOGE("Error inflating asset: %d", result); ::inflateEnd(&mInflateState); initInflateState(); return -1; @@ -192,10 +192,10 @@ int StreamingZipInflater::readNextChunk() { size_t toRead = min_of(mInBufSize, mInTotalSize - mInNextChunkOffset); if (toRead > 0) { ssize_t didRead = ::read(mFd, mInBuf, toRead); - //LOGV("Reading input chunk, size %08x didread %08x", toRead, didRead); + //ALOGV("Reading input chunk, size %08x didread %08x", toRead, didRead); if (didRead < 0) { // TODO: error - LOGE("Error reading asset data"); + ALOGE("Error reading asset data"); return didRead; } else { mInNextChunkOffset += didRead; diff --git a/libs/utils/String16.cpp b/libs/utils/String16.cpp index 4ce1664..94e072f 100644 --- a/libs/utils/String16.cpp +++ b/libs/utils/String16.cpp @@ -112,7 +112,7 @@ String16::String16(const char16_t* o) { size_t len = strlen16(o); SharedBuffer* buf = SharedBuffer::alloc((len+1)*sizeof(char16_t)); - LOG_ASSERT(buf, "Unable to allocate shared buffer"); + ALOG_ASSERT(buf, "Unable to allocate shared buffer"); if (buf) { char16_t* str = (char16_t*)buf->data(); strcpy16(str, o); @@ -126,7 +126,7 @@ String16::String16(const char16_t* o) String16::String16(const char16_t* o, size_t len) { SharedBuffer* buf = SharedBuffer::alloc((len+1)*sizeof(char16_t)); - LOG_ASSERT(buf, "Unable to allocate shared buffer"); + ALOG_ASSERT(buf, "Unable to allocate shared buffer"); if (buf) { char16_t* str = (char16_t*)buf->data(); memcpy(str, o, len*sizeof(char16_t)); diff --git a/libs/utils/String8.cpp b/libs/utils/String8.cpp index 0bc5aff..562f026 100644 --- a/libs/utils/String8.cpp +++ b/libs/utils/String8.cpp @@ -80,7 +80,7 @@ static char* allocFromUTF8(const char* in, size_t len) { if (len > 0) { SharedBuffer* buf = SharedBuffer::alloc(len+1); - LOG_ASSERT(buf, "Unable to allocate shared buffer"); + ALOG_ASSERT(buf, "Unable to allocate shared buffer"); if (buf) { char* str = (char*)buf->data(); memcpy(str, in, len); @@ -103,7 +103,7 @@ static char* allocFromUTF16(const char16_t* in, size_t len) } SharedBuffer* buf = SharedBuffer::alloc(bytes+1); - LOG_ASSERT(buf, "Unable to allocate shared buffer"); + ALOG_ASSERT(buf, "Unable to allocate shared buffer"); if (!buf) { return getEmptyString(); } @@ -125,7 +125,7 @@ static char* allocFromUTF32(const char32_t* in, size_t len) } SharedBuffer* buf = SharedBuffer::alloc(bytes+1); - LOG_ASSERT(buf, "Unable to allocate shared buffer"); + ALOG_ASSERT(buf, "Unable to allocate shared buffer"); if (!buf) { return getEmptyString(); } diff --git a/libs/utils/SystemClock.cpp b/libs/utils/SystemClock.cpp index 062e6d7..8b8ac10 100644 --- a/libs/utils/SystemClock.cpp +++ b/libs/utils/SystemClock.cpp @@ -64,25 +64,25 @@ int setCurrentTimeMillis(int64_t millis) tv.tv_sec = (time_t) (millis / 1000LL); tv.tv_usec = (suseconds_t) ((millis % 1000LL) * 1000LL); - LOGD("Setting time of day to sec=%d\n", (int) tv.tv_sec); + ALOGD("Setting time of day to sec=%d\n", (int) tv.tv_sec); #ifdef HAVE_ANDROID_OS fd = open("/dev/alarm", O_RDWR); if(fd < 0) { - LOGW("Unable to open alarm driver: %s\n", strerror(errno)); + ALOGW("Unable to open alarm driver: %s\n", strerror(errno)); return -1; } ts.tv_sec = tv.tv_sec; ts.tv_nsec = tv.tv_usec * 1000; res = ioctl(fd, ANDROID_ALARM_SET_RTC, &ts); if(res < 0) { - LOGW("Unable to set rtc to %ld: %s\n", tv.tv_sec, strerror(errno)); + ALOGW("Unable to set rtc to %ld: %s\n", tv.tv_sec, strerror(errno)); ret = -1; } close(fd); #else if (settimeofday(&tv, NULL) != 0) { - LOGW("Unable to set clock to %d.%d: %s\n", + ALOGW("Unable to set clock to %d.%d: %s\n", (int) tv.tv_sec, (int) tv.tv_usec, strerror(errno)); ret = -1; } diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp index 5dbcb75..e343c62 100644 --- a/libs/utils/Threads.cpp +++ b/libs/utils/Threads.cpp @@ -163,7 +163,7 @@ int androidCreateRawThreadEtc(android_thread_func_t entryFunction, (android_pthread_entry)entryFunction, userData); pthread_attr_destroy(&attr); if (result != 0) { - LOGE("androidCreateRawThreadEtc failed (entry=%p, res=%d, errno=%d)\n" + ALOGE("androidCreateRawThreadEtc failed (entry=%p, res=%d, errno=%d)\n" "(android threadPriority=%d)", entryFunction, result, errno, threadPriority); return 0; @@ -205,7 +205,7 @@ static __stdcall unsigned int threadIntermediary(void* vDetails) delete pDetails; - LOG(LOG_VERBOSE, "thread", "thread exiting\n"); + ALOG(LOG_VERBOSE, "thread", "thread exiting\n"); return (unsigned int) result; } @@ -232,7 +232,7 @@ static bool doCreateThread(android_thread_func_t fn, void* arg, android_thread_i if (hThread == NULL) #endif { - LOG(LOG_WARN, "thread", "WARNING: thread create failed\n"); + ALOG(LOG_WARN, "thread", "WARNING: thread create failed\n"); return false; } @@ -470,7 +470,7 @@ status_t Mutex::lock() void Mutex::unlock() { if (!ReleaseMutex((HANDLE) mState)) - LOG(LOG_WARN, "thread", "WARNING: bad result from unlocking mutex\n"); + ALOG(LOG_WARN, "thread", "WARNING: bad result from unlocking mutex\n"); } status_t Mutex::tryLock() @@ -479,7 +479,7 @@ status_t Mutex::tryLock() dwWaitResult = WaitForSingleObject((HANDLE) mState, 0); if (dwWaitResult != WAIT_OBJECT_0 && dwWaitResult != WAIT_TIMEOUT) - LOG(LOG_WARN, "thread", "WARNING: bad result from try-locking mutex\n"); + ALOG(LOG_WARN, "thread", "WARNING: bad result from try-locking mutex\n"); return (dwWaitResult == WAIT_OBJECT_0) ? 0 : -1; } @@ -870,7 +870,7 @@ status_t Thread::requestExitAndWait() { Mutex::Autolock _l(mLock); if (mThread == getThreadId()) { - LOGW( + ALOGW( "Thread (this=%p): don't call waitForExit() from this " "Thread object's thread. It's a guaranteed deadlock!", this); @@ -894,7 +894,7 @@ status_t Thread::join() { Mutex::Autolock _l(mLock); if (mThread == getThreadId()) { - LOGW( + ALOGW( "Thread (this=%p): don't call join() from this " "Thread object's thread. It's a guaranteed deadlock!", this); diff --git a/libs/utils/Timers.cpp b/libs/utils/Timers.cpp index 64a29f5..64b4701 100644 --- a/libs/utils/Timers.cpp +++ b/libs/utils/Timers.cpp @@ -113,7 +113,7 @@ long long DurationTimer::durationUsecs(void) const /*static*/ void DurationTimer::addToTimeval(struct timeval* ptv, long usec) { if (usec < 0) { - LOG(LOG_WARN, "", "Negative values not supported in addToTimeval\n"); + ALOG(LOG_WARN, "", "Negative values not supported in addToTimeval\n"); return; } diff --git a/libs/utils/Tokenizer.cpp b/libs/utils/Tokenizer.cpp index b3445b7..efda2bf 100644 --- a/libs/utils/Tokenizer.cpp +++ b/libs/utils/Tokenizer.cpp @@ -55,12 +55,12 @@ status_t Tokenizer::open(const String8& filename, Tokenizer** outTokenizer) { int fd = ::open(filename.string(), O_RDONLY); if (fd < 0) { result = -errno; - LOGE("Error opening file '%s', %s.", filename.string(), strerror(errno)); + ALOGE("Error opening file '%s', %s.", filename.string(), strerror(errno)); } else { struct stat stat; if (fstat(fd, &stat)) { result = -errno; - LOGE("Error getting size of file '%s', %s.", filename.string(), strerror(errno)); + ALOGE("Error getting size of file '%s', %s.", filename.string(), strerror(errno)); } else { size_t length = size_t(stat.st_size); @@ -80,7 +80,7 @@ status_t Tokenizer::open(const String8& filename, Tokenizer** outTokenizer) { ssize_t nrd = read(fd, buffer, length); if (nrd < 0) { result = -errno; - LOGE("Error reading file '%s', %s.", filename.string(), strerror(errno)); + ALOGE("Error reading file '%s', %s.", filename.string(), strerror(errno)); delete[] buffer; buffer = NULL; } else { @@ -118,7 +118,7 @@ String8 Tokenizer::peekRemainderOfLine() const { String8 Tokenizer::nextToken(const char* delimiters) { #if DEBUG_TOKENIZER - LOGD("nextToken"); + ALOGD("nextToken"); #endif const char* end = getEnd(); const char* tokenStart = mCurrent; @@ -134,7 +134,7 @@ String8 Tokenizer::nextToken(const char* delimiters) { void Tokenizer::nextLine() { #if DEBUG_TOKENIZER - LOGD("nextLine"); + ALOGD("nextLine"); #endif const char* end = getEnd(); while (mCurrent != end) { @@ -148,7 +148,7 @@ void Tokenizer::nextLine() { void Tokenizer::skipDelimiters(const char* delimiters) { #if DEBUG_TOKENIZER - LOGD("skipDelimiters"); + ALOGD("skipDelimiters"); #endif const char* end = getEnd(); while (mCurrent != end) { diff --git a/libs/utils/VectorImpl.cpp b/libs/utils/VectorImpl.cpp index bfb37a6..220ae3e 100644 --- a/libs/utils/VectorImpl.cpp +++ b/libs/utils/VectorImpl.cpp @@ -56,7 +56,7 @@ VectorImpl::VectorImpl(const VectorImpl& rhs) VectorImpl::~VectorImpl() { - LOG_ASSERT(!mCount, + ALOG_ASSERT(!mCount, "[%p] " "subclasses of VectorImpl must call finish_vector()" " in their destructor. Leaking %d bytes.", @@ -66,7 +66,7 @@ VectorImpl::~VectorImpl() VectorImpl& VectorImpl::operator = (const VectorImpl& rhs) { - LOG_ASSERT(mItemSize == rhs.mItemSize, + ALOG_ASSERT(mItemSize == rhs.mItemSize, "Vector<> have different types (this=%p, rhs=%p)", this, &rhs); if (this != &rhs) { release_storage(); @@ -248,7 +248,7 @@ ssize_t VectorImpl::replaceAt(size_t index) ssize_t VectorImpl::replaceAt(const void* prototype, size_t index) { - LOG_ASSERT(index<size(), + ALOG_ASSERT(index<size(), "[%p] replace: index=%d, size=%d", this, (int)index, (int)size()); void* item = editItemLocation(index); @@ -267,7 +267,7 @@ ssize_t VectorImpl::replaceAt(const void* prototype, size_t index) ssize_t VectorImpl::removeItemsAt(size_t index, size_t count) { - LOG_ASSERT((index+count)<=size(), + ALOG_ASSERT((index+count)<=size(), "[%p] remove: index=%d, count=%d, size=%d", this, (int)index, (int)count, (int)size()); @@ -291,7 +291,7 @@ void VectorImpl::clear() void* VectorImpl::editItemLocation(size_t index) { - LOG_ASSERT(index<capacity(), + ALOG_ASSERT(index<capacity(), "[%p] editItemLocation: index=%d, capacity=%d, count=%d", this, (int)index, (int)capacity(), (int)mCount); @@ -303,7 +303,7 @@ void* VectorImpl::editItemLocation(size_t index) const void* VectorImpl::itemLocation(size_t index) const { - LOG_ASSERT(index<capacity(), + ALOG_ASSERT(index<capacity(), "[%p] itemLocation: index=%d, capacity=%d, count=%d", this, (int)index, (int)capacity(), (int)mCount); @@ -346,17 +346,17 @@ void VectorImpl::release_storage() void* VectorImpl::_grow(size_t where, size_t amount) { -// LOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d", +// ALOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d", // this, (int)where, (int)amount, (int)mCount, (int)capacity()); - LOG_ASSERT(where <= mCount, + ALOG_ASSERT(where <= mCount, "[%p] _grow: where=%d, amount=%d, count=%d", this, (int)where, (int)amount, (int)mCount); // caller already checked const size_t new_size = mCount + amount; if (capacity() < new_size) { const size_t new_capacity = max(kMinVectorCapacity, ((new_size*3)+1)/2); -// LOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity); +// ALOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity); if ((mStorage) && (mCount==where) && (mFlags & HAS_TRIVIAL_COPY) && @@ -399,17 +399,17 @@ void VectorImpl::_shrink(size_t where, size_t amount) if (!mStorage) return; -// LOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d", +// ALOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d", // this, (int)where, (int)amount, (int)mCount, (int)capacity()); - LOG_ASSERT(where + amount <= mCount, + ALOG_ASSERT(where + amount <= mCount, "[%p] _shrink: where=%d, amount=%d, count=%d", this, (int)where, (int)amount, (int)mCount); // caller already checked const size_t new_size = mCount - amount; if (new_size*3 < capacity()) { const size_t new_capacity = max(kMinVectorCapacity, new_size*2); -// LOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity); +// ALOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity); if ((where == new_size) && (mFlags & HAS_TRIVIAL_COPY) && (mFlags & HAS_TRIVIAL_DTOR)) diff --git a/libs/utils/ZipFileRO.cpp b/libs/utils/ZipFileRO.cpp index b18c383..1498aac 100644 --- a/libs/utils/ZipFileRO.cpp +++ b/libs/utils/ZipFileRO.cpp @@ -120,7 +120,7 @@ int ZipFileRO::entryToIndex(const ZipEntryRO entry) const { long ent = ((long) entry) - kZipEntryAdj; if (ent < 0 || ent >= mHashTableSize || mHashTable[ent].name == NULL) { - LOGW("Invalid ZipEntryRO %p (%ld)\n", entry, ent); + ALOGW("Invalid ZipEntryRO %p (%ld)\n", entry, ent); return -1; } return ent; @@ -142,7 +142,7 @@ status_t ZipFileRO::open(const char* zipFileName) */ fd = ::open(zipFileName, O_RDONLY | O_BINARY); if (fd < 0) { - LOGW("Unable to open zip '%s': %s\n", zipFileName, strerror(errno)); + ALOGW("Unable to open zip '%s': %s\n", zipFileName, strerror(errno)); return NAME_NOT_FOUND; } @@ -194,7 +194,7 @@ bool ZipFileRO::mapCentralDirectory(void) unsigned char* scanBuf = (unsigned char*) malloc(readAmount); if (scanBuf == NULL) { - LOGW("couldn't allocate scanBuf: %s", strerror(errno)); + ALOGW("couldn't allocate scanBuf: %s", strerror(errno)); free(scanBuf); return false; } @@ -203,14 +203,14 @@ bool ZipFileRO::mapCentralDirectory(void) * Make sure this is a Zip archive. */ if (lseek64(mFd, 0, SEEK_SET) != 0) { - LOGW("seek to start failed: %s", strerror(errno)); + ALOGW("seek to start failed: %s", strerror(errno)); free(scanBuf); return false; } ssize_t actual = TEMP_FAILURE_RETRY(read(mFd, scanBuf, sizeof(int32_t))); if (actual != (ssize_t) sizeof(int32_t)) { - LOGI("couldn't read first signature from zip archive: %s", strerror(errno)); + ALOGI("couldn't read first signature from zip archive: %s", strerror(errno)); free(scanBuf); return false; } @@ -218,11 +218,11 @@ bool ZipFileRO::mapCentralDirectory(void) { unsigned int header = get4LE(scanBuf); if (header == kEOCDSignature) { - LOGI("Found Zip archive, but it looks empty\n"); + ALOGI("Found Zip archive, but it looks empty\n"); free(scanBuf); return false; } else if (header != kLFHSignature) { - LOGV("Not a Zip archive (found 0x%08x)\n", header); + ALOGV("Not a Zip archive (found 0x%08x)\n", header); free(scanBuf); return false; } @@ -243,13 +243,13 @@ bool ZipFileRO::mapCentralDirectory(void) off64_t searchStart = mFileLength - readAmount; if (lseek64(mFd, searchStart, SEEK_SET) != searchStart) { - LOGW("seek %ld failed: %s\n", (long) searchStart, strerror(errno)); + ALOGW("seek %ld failed: %s\n", (long) searchStart, strerror(errno)); free(scanBuf); return false; } actual = TEMP_FAILURE_RETRY(read(mFd, scanBuf, readAmount)); if (actual != (ssize_t) readAmount) { - LOGW("Zip: read " ZD ", expected " ZD ". Failed: %s\n", + ALOGW("Zip: read " ZD ", expected " ZD ". Failed: %s\n", (ZD_TYPE) actual, (ZD_TYPE) readAmount, strerror(errno)); free(scanBuf); return false; @@ -264,12 +264,12 @@ bool ZipFileRO::mapCentralDirectory(void) 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); + ALOGV("+++ Found EOCD at buf+%d\n", i); break; } } if (i < 0) { - LOGD("Zip: EOCD not found, %s is not zip\n", mFileName); + ALOGD("Zip: EOCD not found, %s is not zip\n", mFileName); free(scanBuf); return false; } @@ -290,26 +290,26 @@ bool ZipFileRO::mapCentralDirectory(void) // Verify that they look reasonable. if ((long long) dirOffset + (long long) dirSize > (long long) eocdOffset) { - LOGW("bad offsets (dir %ld, size %u, eocd %ld)\n", + ALOGW("bad offsets (dir %ld, size %u, eocd %ld)\n", (long) dirOffset, dirSize, (long) eocdOffset); return false; } if (numEntries == 0) { - LOGW("empty archive?\n"); + ALOGW("empty archive?\n"); return false; } - LOGV("+++ numEntries=%d dirSize=%d dirOffset=%d\n", + ALOGV("+++ numEntries=%d dirSize=%d dirOffset=%d\n", numEntries, dirSize, dirOffset); mDirectoryMap = new FileMap(); if (mDirectoryMap == NULL) { - LOGW("Unable to create directory map: %s", strerror(errno)); + ALOGW("Unable to create directory map: %s", strerror(errno)); return false; } if (!mDirectoryMap->create(mFileName, mFd, dirOffset, dirSize, true)) { - LOGW("Unable to map '%s' (" ZD " to " ZD "): %s\n", mFileName, + ALOGW("Unable to map '%s' (" ZD " to " ZD "): %s\n", mFileName, (ZD_TYPE) dirOffset, (ZD_TYPE) (dirOffset + dirSize), strerror(errno)); return false; } @@ -341,17 +341,17 @@ bool ZipFileRO::parseZipArchive(void) const unsigned char* ptr = cdPtr; for (int i = 0; i < numEntries; i++) { if (get4LE(ptr) != kCDESignature) { - LOGW("Missed a central dir sig (at %d)\n", i); + ALOGW("Missed a central dir sig (at %d)\n", i); goto bail; } if (ptr + kCDELen > cdPtr + cdLength) { - LOGW("Ran off the end (at %d)\n", i); + ALOGW("Ran off the end (at %d)\n", i); goto bail; } long localHdrOffset = (long) get4LE(ptr + kCDELocalOffset); if (localHdrOffset >= mDirectoryOffset) { - LOGW("bad LFH offset %ld at entry %d\n", localHdrOffset, i); + ALOGW("bad LFH offset %ld at entry %d\n", localHdrOffset, i); goto bail; } @@ -367,12 +367,12 @@ bool ZipFileRO::parseZipArchive(void) ptr += kCDELen + fileNameLen + extraLen + commentLen; if ((size_t)(ptr - cdPtr) > cdLength) { - LOGW("bad CD advance (%d vs " ZD ") at entry %d\n", + ALOGW("bad CD advance (%d vs " ZD ") at entry %d\n", (int) (ptr - cdPtr), (ZD_TYPE) cdLength, i); goto bail; } } - LOGV("+++ zip good scan %d entries\n", numEntries); + ALOGV("+++ zip good scan %d entries\n", numEntries); result = true; bail: @@ -452,7 +452,7 @@ ZipEntryRO ZipFileRO::findEntryByName(const char* fileName) const ZipEntryRO ZipFileRO::findEntryByIndex(int idx) const { if (idx < 0 || idx >= mNumEntries) { - LOGW("Invalid index %d\n", idx); + ALOGW("Invalid index %d\n", idx); return NULL; } @@ -527,7 +527,7 @@ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, if (pOffset != NULL) { long localHdrOffset = get4LE(ptr + kCDELocalOffset); if (localHdrOffset + kLFHLen >= cdOffset) { - LOGE("ERROR: bad local hdr offset in zip\n"); + ALOGE("ERROR: bad local hdr offset in zip\n"); return false; } @@ -544,12 +544,12 @@ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, TEMP_FAILURE_RETRY(pread64(mFd, lfhBuf, sizeof(lfhBuf), localHdrOffset)); if (actual != sizeof(lfhBuf)) { - LOGW("failed reading lfh from offset %ld\n", localHdrOffset); + ALOGW("failed reading lfh from offset %ld\n", localHdrOffset); return false; } if (get4LE(lfhBuf) != kLFHSignature) { - LOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; " + ALOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; " "got: data=0x%08lx\n", localHdrOffset, kLFHSignature, get4LE(lfhBuf)); return false; @@ -567,20 +567,20 @@ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, AutoMutex _l(mFdLock); if (lseek64(mFd, localHdrOffset, SEEK_SET) != localHdrOffset) { - LOGW("failed seeking to lfh at offset %ld\n", localHdrOffset); + ALOGW("failed seeking to lfh at offset %ld\n", localHdrOffset); return false; } ssize_t actual = TEMP_FAILURE_RETRY(read(mFd, lfhBuf, sizeof(lfhBuf))); if (actual != sizeof(lfhBuf)) { - LOGW("failed reading lfh from offset %ld\n", localHdrOffset); + ALOGW("failed reading lfh from offset %ld\n", localHdrOffset); return false; } if (get4LE(lfhBuf) != kLFHSignature) { off64_t actualOffset = lseek64(mFd, 0, SEEK_CUR); - LOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; " + ALOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; " "got: offset=" ZD " data=0x%08lx\n", localHdrOffset, kLFHSignature, (ZD_TYPE) actualOffset, get4LE(lfhBuf)); return false; @@ -591,13 +591,13 @@ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, off64_t dataOffset = localHdrOffset + kLFHLen + get2LE(lfhBuf + kLFHNameLen) + get2LE(lfhBuf + kLFHExtraLen); if (dataOffset >= cdOffset) { - LOGW("bad data offset %ld in zip\n", (long) dataOffset); + ALOGW("bad data offset %ld in zip\n", (long) dataOffset); return false; } /* check lengths */ if ((off64_t)(dataOffset + compLen) > cdOffset) { - LOGW("bad compressed length in zip (%ld + " ZD " > %ld)\n", + ALOGW("bad compressed length in zip (%ld + " ZD " > %ld)\n", (long) dataOffset, (ZD_TYPE) compLen, (long) cdOffset); return false; } @@ -605,7 +605,7 @@ bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, if (method == kCompressStored && (off64_t)(dataOffset + uncompLen) > cdOffset) { - LOGE("ERROR: bad uncompressed length in zip (%ld + " ZD " > %ld)\n", + ALOGE("ERROR: bad uncompressed length in zip (%ld + " ZD " > %ld)\n", (long) dataOffset, (ZD_TYPE) uncompLen, (long) cdOffset); return false; } @@ -754,14 +754,14 @@ bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const if (method == kCompressStored) { ssize_t actual = write(fd, ptr, uncompLen); if (actual < 0) { - LOGE("Write failed: %s\n", strerror(errno)); + ALOGE("Write failed: %s\n", strerror(errno)); goto unmap; } else if ((size_t) actual != uncompLen) { - LOGE("Partial write during uncompress (" ZD " of " ZD ")\n", + ALOGE("Partial write during uncompress (" ZD " of " ZD ")\n", (ZD_TYPE) actual, (ZD_TYPE) uncompLen); goto unmap; } else { - LOGI("+++ successful write\n"); + ALOGI("+++ successful write\n"); } } else { if (!inflateBuffer(fd, ptr, uncompLen, compLen)) @@ -806,10 +806,10 @@ bail: 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", + ALOGE("Installed zlib is not compatible with linked version (%s)\n", ZLIB_VERSION); } else { - LOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); + ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); } goto bail; } @@ -819,7 +819,7 @@ bail: */ zerr = inflate(&zstream, Z_FINISH); if (zerr != Z_STREAM_END) { - LOGW("Zip inflate failed, zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n", + ALOGW("Zip inflate failed, zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n", zerr, zstream.next_in, zstream.avail_in, zstream.next_out, zstream.avail_out); goto z_bail; @@ -827,7 +827,7 @@ bail: /* paranoia */ if (zstream.total_out != uncompLen) { - LOGW("Size mismatch on inflated file (%ld vs " ZD ")\n", + ALOGW("Size mismatch on inflated file (%ld vs " ZD ")\n", zstream.total_out, (ZD_TYPE) uncompLen); goto z_bail; } @@ -873,10 +873,10 @@ bail: 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", + ALOGE("Installed zlib is not compatible with linked version (%s)\n", ZLIB_VERSION); } else { - LOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); + ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); } goto bail; } @@ -890,7 +890,7 @@ bail: */ zerr = inflate(&zstream, Z_NO_FLUSH); if (zerr != Z_OK && zerr != Z_STREAM_END) { - LOGW("zlib inflate: zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n", + ALOGW("zlib inflate: zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n", zerr, zstream.next_in, zstream.avail_in, zstream.next_out, zstream.avail_out); goto z_bail; @@ -903,7 +903,7 @@ bail: long writeSize = zstream.next_out - writeBuf; int cc = write(fd, writeBuf, writeSize); if (cc != (int) writeSize) { - LOGW("write failed in inflate (%d vs %ld)\n", cc, writeSize); + ALOGW("write failed in inflate (%d vs %ld)\n", cc, writeSize); goto z_bail; } @@ -916,7 +916,7 @@ bail: /* paranoia */ if (zstream.total_out != uncompLen) { - LOGW("Size mismatch on inflated file (%ld vs " ZD ")\n", + ALOGW("Size mismatch on inflated file (%ld vs " ZD ")\n", zstream.total_out, (ZD_TYPE) uncompLen); goto z_bail; } diff --git a/libs/utils/ZipUtils.cpp b/libs/utils/ZipUtils.cpp index 9138878..2dbdc1d 100644 --- a/libs/utils/ZipUtils.cpp +++ b/libs/utils/ZipUtils.cpp @@ -77,10 +77,10 @@ using namespace android; 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", + ALOGE("Installed zlib is not compatible with linked version (%s)\n", ZLIB_VERSION); } else { - LOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); + ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); } goto bail; } @@ -95,12 +95,12 @@ using namespace android; if (zstream.avail_in == 0) { getSize = (compRemaining > kReadBufSize) ? kReadBufSize : compRemaining; - LOGV("+++ reading %ld bytes (%ld left)\n", + ALOGV("+++ reading %ld bytes (%ld left)\n", getSize, compRemaining); int cc = read(fd, readBuf, getSize); if (cc != (int) getSize) { - LOGD("inflate read failed (%d vs %ld)\n", + ALOGD("inflate read failed (%d vs %ld)\n", cc, getSize); goto z_bail; } @@ -114,7 +114,7 @@ using namespace android; /* uncompress the data */ zerr = inflate(&zstream, Z_NO_FLUSH); if (zerr != Z_OK && zerr != Z_STREAM_END) { - LOGD("zlib inflate call failed (zerr=%d)\n", zerr); + ALOGD("zlib inflate call failed (zerr=%d)\n", zerr); goto z_bail; } @@ -124,7 +124,7 @@ using namespace android; assert(zerr == Z_STREAM_END); /* other errors should've been caught */ if ((long) zstream.total_out != uncompressedLen) { - LOGW("Size mismatch on inflated file (%ld vs %ld)\n", + ALOGW("Size mismatch on inflated file (%ld vs %ld)\n", zstream.total_out, uncompressedLen); goto z_bail; } @@ -189,10 +189,10 @@ bail: 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", + ALOGE("Installed zlib is not compatible with linked version (%s)\n", ZLIB_VERSION); } else { - LOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); + ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); } goto bail; } @@ -207,12 +207,12 @@ bail: if (zstream.avail_in == 0) { getSize = (compRemaining > kReadBufSize) ? kReadBufSize : compRemaining; - LOGV("+++ reading %ld bytes (%ld left)\n", + ALOGV("+++ reading %ld bytes (%ld left)\n", getSize, compRemaining); int cc = fread(readBuf, 1, getSize, fp); if (cc != (int) getSize) { - LOGD("inflate read failed (%d vs %ld)\n", + ALOGD("inflate read failed (%d vs %ld)\n", cc, getSize); goto z_bail; } @@ -226,7 +226,7 @@ bail: /* uncompress the data */ zerr = inflate(&zstream, Z_NO_FLUSH); if (zerr != Z_OK && zerr != Z_STREAM_END) { - LOGD("zlib inflate call failed (zerr=%d)\n", zerr); + ALOGD("zlib inflate call failed (zerr=%d)\n", zerr); goto z_bail; } @@ -236,7 +236,7 @@ bail: assert(zerr == Z_STREAM_END); /* other errors should've been caught */ if ((long) zstream.total_out != uncompressedLen) { - LOGW("Size mismatch on inflated file (%ld vs %ld)\n", + ALOGW("Size mismatch on inflated file (%ld vs %ld)\n", zstream.total_out, uncompressedLen); goto z_bail; } |