Loading tools/aapt/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,7 @@ cc_library_host_static { "ResourceTable.cpp", "SourcePos.cpp", "StringPool.cpp", "Utils.cpp", "WorkQueue.cpp", "XMLNode.cpp", "ZipEntry.cpp", Loading tools/aapt/Package.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ #include "OutputSet.h" #include "ResourceTable.h" #include "ResourceFilter.h" #include "Utils.h" #include <androidfw/misc.h> Loading Loading @@ -226,7 +227,7 @@ ssize_t processAssets(Bundle* bundle, ZipFile* zip, const sp<const OutputSet>& o fprintf(stderr, "warning: null file being processed.\n"); } else { String8 storagePath(entry.getPath()); storagePath.convertToResPath(); convertToResPath(storagePath); if (!processFile(bundle, zip, storagePath, entry.getFile())) { return UNKNOWN_ERROR; } Loading tools/aapt/Resource.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ #include "ResourceTable.h" #include "StringPool.h" #include "Symbol.h" #include "Utils.h" #include "WorkQueue.h" #include "XMLNode.h" Loading Loading @@ -321,7 +322,7 @@ static status_t makeFileResources(Bundle* bundle, const sp<AaptAssets>& assets, str++; } String8 resPath = it.getPath(); resPath.convertToResPath(); convertToResPath(resPath); status_t result = table->addEntry(SourcePos(it.getPath(), 0), String16(assets->getPackage()), type16, Loading tools/aapt/ResourceTable.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ #include "ResourceFilter.h" #include "ResourceIdCache.h" #include "SdkConstants.h" #include "Utils.h" #include <algorithm> #include <androidfw/ResourceTypes.h> Loading Loading @@ -4803,7 +4804,7 @@ bool ResourceTable::versionForCompat(const Bundle* bundle, const String16& resou String8 resPath = String8::format("res/%s/%s.xml", newFile->getGroupEntry().toDirName(target->getResourceType()).c_str(), String8(resourceName).c_str()); resPath.convertToResPath(); convertToResPath(resPath); // Add a resource table entry. addEntry(SourcePos(), Loading Loading @@ -4927,7 +4928,7 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle, String8 resPath = String8::format("res/%s/%s.xml", newFile->getGroupEntry().toDirName(target->getResourceType()).c_str(), String8(resourceName).c_str()); resPath.convertToResPath(); convertToResPath(resPath); // Add a resource table entry. if (bundle->getVerbose()) { Loading tools/aapt/Utils.cpp 0 → 100644 +38 −0 Original line number Diff line number Diff line /* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "Utils.h" #include <utils/Compat.h> // Separator used by resource paths. This is not platform dependent contrary // to OS_PATH_SEPARATOR. #define RES_PATH_SEPARATOR '/' using android::String8; void convertToResPath([[maybe_unused]] String8& s) { #if OS_PATH_SEPARATOR != RES_PATH_SEPARATOR size_t len = s.length(); if (len > 0) { char* buf = s.lockBuffer(len); for (char* end = buf + len; buf < end; ++buf) { if (*buf == OS_PATH_SEPARATOR) *buf = RES_PATH_SEPARATOR; } s.unlockBuffer(len); } #endif } Loading
tools/aapt/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,7 @@ cc_library_host_static { "ResourceTable.cpp", "SourcePos.cpp", "StringPool.cpp", "Utils.cpp", "WorkQueue.cpp", "XMLNode.cpp", "ZipEntry.cpp", Loading
tools/aapt/Package.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ #include "OutputSet.h" #include "ResourceTable.h" #include "ResourceFilter.h" #include "Utils.h" #include <androidfw/misc.h> Loading Loading @@ -226,7 +227,7 @@ ssize_t processAssets(Bundle* bundle, ZipFile* zip, const sp<const OutputSet>& o fprintf(stderr, "warning: null file being processed.\n"); } else { String8 storagePath(entry.getPath()); storagePath.convertToResPath(); convertToResPath(storagePath); if (!processFile(bundle, zip, storagePath, entry.getFile())) { return UNKNOWN_ERROR; } Loading
tools/aapt/Resource.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ #include "ResourceTable.h" #include "StringPool.h" #include "Symbol.h" #include "Utils.h" #include "WorkQueue.h" #include "XMLNode.h" Loading Loading @@ -321,7 +322,7 @@ static status_t makeFileResources(Bundle* bundle, const sp<AaptAssets>& assets, str++; } String8 resPath = it.getPath(); resPath.convertToResPath(); convertToResPath(resPath); status_t result = table->addEntry(SourcePos(it.getPath(), 0), String16(assets->getPackage()), type16, Loading
tools/aapt/ResourceTable.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ #include "ResourceFilter.h" #include "ResourceIdCache.h" #include "SdkConstants.h" #include "Utils.h" #include <algorithm> #include <androidfw/ResourceTypes.h> Loading Loading @@ -4803,7 +4804,7 @@ bool ResourceTable::versionForCompat(const Bundle* bundle, const String16& resou String8 resPath = String8::format("res/%s/%s.xml", newFile->getGroupEntry().toDirName(target->getResourceType()).c_str(), String8(resourceName).c_str()); resPath.convertToResPath(); convertToResPath(resPath); // Add a resource table entry. addEntry(SourcePos(), Loading Loading @@ -4927,7 +4928,7 @@ status_t ResourceTable::modifyForCompat(const Bundle* bundle, String8 resPath = String8::format("res/%s/%s.xml", newFile->getGroupEntry().toDirName(target->getResourceType()).c_str(), String8(resourceName).c_str()); resPath.convertToResPath(); convertToResPath(resPath); // Add a resource table entry. if (bundle->getVerbose()) { Loading
tools/aapt/Utils.cpp 0 → 100644 +38 −0 Original line number Diff line number Diff line /* * Copyright (C) 2005 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "Utils.h" #include <utils/Compat.h> // Separator used by resource paths. This is not platform dependent contrary // to OS_PATH_SEPARATOR. #define RES_PATH_SEPARATOR '/' using android::String8; void convertToResPath([[maybe_unused]] String8& s) { #if OS_PATH_SEPARATOR != RES_PATH_SEPARATOR size_t len = s.length(); if (len > 0) { char* buf = s.lockBuffer(len); for (char* end = buf + len; buf < end; ++buf) { if (*buf == OS_PATH_SEPARATOR) *buf = RES_PATH_SEPARATOR; } s.unlockBuffer(len); } #endif }