summaryrefslogtreecommitdiff
path: root/cmds/bootanimation/BootAnimation.cpp
diff options
context:
space:
mode:
author Tomasz Wasilczyk <twasilczyk@google.com> 2023-08-23 19:16:45 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-08-23 19:16:45 +0000
commitb0f9564c48311768667e5778417d2f8dabb6202f (patch)
tree33970e4a09a2fd402a0ed65b656a6180529ffab5 /cmds/bootanimation/BootAnimation.cpp
parent63d99ccbfe89449c0d8c95f9e7e07688289a3317 (diff)
parent51858976fedeb6ecad2badee261c7d64b1827499 (diff)
Merge "Migrate from android::String path functions to std::filesystem" into main am: e27e15d330 am: 51858976fe
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2721506 Change-Id: I2d39f1847e08a6bb351825d07e6050d16343ea46 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'cmds/bootanimation/BootAnimation.cpp')
-rw-r--r--cmds/bootanimation/BootAnimation.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index 782351c14399..b8d56008657d 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -17,6 +17,7 @@
#define LOG_NDEBUG 0
#define LOG_TAG "BootAnimation"
+#include <filesystem>
#include <vector>
#include <stdint.h>
@@ -1269,10 +1270,10 @@ bool BootAnimation::preloadZip(Animation& animation) {
continue;
}
- const String8 entryName(name);
- const String8 path(entryName.getPathDir());
- const String8 leaf(entryName.getPathLeaf());
- if (leaf.size() > 0) {
+ const std::filesystem::path entryName(name);
+ const std::filesystem::path path(entryName.parent_path());
+ const std::filesystem::path leaf(entryName.filename());
+ if (!leaf.empty()) {
if (entryName == CLOCK_FONT_ZIP_NAME) {
FileMap* map = zip->createEntryFileMap(entry);
if (map) {
@@ -1290,7 +1291,7 @@ bool BootAnimation::preloadZip(Animation& animation) {
}
for (size_t j = 0; j < pcount; j++) {
- if (path == animation.parts[j].path) {
+ if (path.string() == animation.parts[j].path.c_str()) {
uint16_t method;
// supports only stored png files
if (zip->getEntryInfo(entry, &method, nullptr, nullptr, nullptr, nullptr, nullptr)) {
@@ -1307,7 +1308,7 @@ bool BootAnimation::preloadZip(Animation& animation) {
map->getDataLength());
} else {
Animation::Frame frame;
- frame.name = leaf;
+ frame.name = leaf.c_str();
frame.map = map;
frame.trimWidth = animation.width;
frame.trimHeight = animation.height;