Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: I00a4b904f9449e6f93b7fd35eac28640d7929e69
This commit is contained in:
Steve Block 2012-01-05 23:22:43 +00:00 committed by Alex Ray
parent a1d3391b1e
commit 61d341b8d3
13 changed files with 191 additions and 191 deletions

View file

@ -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;
}
@ -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;
}

View file

@ -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;
}
@ -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];
@ -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;
}
@ -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();
}
@ -727,7 +727,7 @@ Asset* AssetManager::openIdmapLocked(const struct asset_path& ap) const
if (ass) {
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;
@ -1074,13 +1074,13 @@ 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;
}
@ -1096,7 +1096,7 @@ Asset* AssetManager::openAssetFromZipLocked(const ZipFileRO* pZipFile,
}
if (pAsset == NULL) {
/* unexpected */
LOGW("create from segment failed\n");
ALOGW("create from segment failed\n");
}
return pAsset;
@ -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;
}

View file

@ -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;
}
@ -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;
@ -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;
}

View file

@ -69,11 +69,11 @@ void BlobCache::set(const void* key, size_t keySize, const void* value,
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;
}

View file

@ -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;

View file

@ -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;
@ -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;
}
@ -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;
@ -468,7 +468,7 @@ 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);
}
}
}

View file

@ -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,7 +172,7 @@ 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;
}
@ -192,7 +192,7 @@ bool ObbFile::parseObbFile(int fd)
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;
@ -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;
}

View file

@ -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;
}

View file

@ -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;
}
@ -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);
@ -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;
@ -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;
@ -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();
@ -1888,13 +1888,13 @@ status_t ResTable::add(const void* data, size_t size, void* cookie,
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;
}
@ -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;
}
@ -2353,7 +2353,7 @@ ssize_t ResTable::getBagLocked(uint32_t resID, const bag_entry** outBag,
//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;
}
@ -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;
}
@ -3935,7 +3935,7 @@ ssize_t ResTable::getEntry(
}
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);
}
@ -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;
}

View file

@ -69,20 +69,20 @@ int setCurrentTimeMillis(int64_t millis)
#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;
}

View file

@ -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);

View file

@ -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,7 +203,7 @@ 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;
}
@ -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;
@ -290,12 +290,12 @@ 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;
}
@ -304,12 +304,12 @@ bool ZipFileRO::mapCentralDirectory(void)
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,7 +367,7 @@ 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;
}
@ -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;
}
@ -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;
}
@ -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;
}
@ -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;
}

View file

@ -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;
}
@ -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;
}