From 804e819c1bf64d4df483107e02e896b29e58b3f1 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Wed, 23 Aug 2023 02:22:53 +0000 Subject: Move String8 path functions to androidfw and aapt Test: m checkbuild Bug: 295394788 Change-Id: I9488bc5632cbd47c83f6b5f2df4c87eb324a1e8e --- tools/aapt/Images.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'tools/aapt/Images.cpp') diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp index c6c7e960ba2a..cd4de90f12f6 100644 --- a/tools/aapt/Images.cpp +++ b/tools/aapt/Images.cpp @@ -8,6 +8,7 @@ #include "Images.h" +#include #include #include @@ -1357,7 +1358,7 @@ static bool write_png_protected(png_structp write_ptr, String8& printableName, p status_t preProcessImage(const Bundle* bundle, const sp& /* assets */, const sp& file, String8* /* outNewLeafName */) { - String8 ext(file->getPath().getPathExtension()); + String8 ext(getPathExtension(file->getPath())); // We currently only process PNG images. if (strcmp(ext.c_str(), ".png") != 0) { @@ -1518,7 +1519,7 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con // Check to see if we're dealing with a 9-patch // If we are, process appropriately - if (source.getBasePath().getPathExtension() == ".9") { + if (getPathExtension(getBasePath(source)) == ".9") { if (do_9patch(source.c_str(), &imageInfo) != NO_ERROR) { return error; } @@ -1584,12 +1585,12 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con status_t postProcessImage(const Bundle* bundle, const sp& assets, ResourceTable* table, const sp& file) { - String8 ext(file->getPath().getPathExtension()); + String8 ext(getPathExtension(file->getPath())); // At this point, now that we have all the resource data, all we need to // do is compile XML files. if (strcmp(ext.c_str(), ".xml") == 0) { - String16 resourceName(parseResourceName(file->getSourceFile().getPathLeaf())); + String16 resourceName(parseResourceName(getPathLeaf(file->getSourceFile()))); return compileXmlFile(bundle, assets, resourceName, file, table); } -- cgit v1.2.3-59-g8ed1b