Use std::optional instead of mbgl::optional (#911)

This commit is contained in:
Bart Louwers
2023-03-17 12:51:59 +01:00
committed by GitHub
parent 36846439c6
commit 15ad65dd3d
482 changed files with 2605 additions and 2652 deletions

View File

@@ -94,13 +94,13 @@ bool copyFile(JNIEnv* env,
bool stateOk = true;
if (env->CallBooleanMethod(fileToCopy.get(), fileExists)) {
mbgl::Log::Warning(mbgl::Event::General, "File '%s' already exists", filePath.c_str());
mbgl::Log::Warning(mbgl::Event::General, "File '" + filePath + "' already exists");
} else {
std::unique_ptr<AAsset, std::function<void(AAsset*)>> fileAsset(
AAssetManager_open(assetManager, fileName.c_str(), AASSET_MODE_BUFFER),
[](AAsset* asset) { AAsset_close(asset); });
if (fileAsset == nullptr) {
mbgl::Log::Warning(mbgl::Event::General, "Failed to open asset file %s", fileName.c_str());
mbgl::Log::Warning(mbgl::Event::General, "Failed to open asset file " + fileName);
return false;
}
const void* fileData = AAsset_getBuffer(fileAsset.get());
@@ -111,12 +111,12 @@ bool copyFile(JNIEnv* env,
stateOk = newFile != nullptr;
if (!stateOk) {
mbgl::Log::Warning(mbgl::Event::General, "Failed to create new file entry %s", fileName.c_str());
mbgl::Log::Warning(mbgl::Event::General, "Failed to create new file entry " + fileName);
} else {
auto res = static_cast<off_t>(std::fwrite(fileData, sizeof(char), fileLen, newFile.get()));
if (fileLen != res) {
mbgl::Log::Warning(
mbgl::Event::General, "Failed to generate file entry %s from assets", fileName.c_str());
mbgl::Event::General, "Failed to generate file entry" + fileName + "from assets");
}
}
}
@@ -184,7 +184,7 @@ void unZipFile(JNIEnv* env, const std::string& zipFilePath, const std::string& d
if (!success) {
mbgl::Log::Warning(
mbgl::Event::General, "Failed to create folder entry %s from zip", fileNameStr.c_str());
mbgl::Event::General, "Failed to create folder entry " + fileNameStr + " from zip");
}
}
} else if (!(env->CallBooleanMethod(f, fileExists))) {
@@ -194,7 +194,7 @@ void unZipFile(JNIEnv* env, const std::string& zipFilePath, const std::string& d
if (!success) {
mbgl::Log::Warning(
mbgl::Event::General, "Failed to create folder entry %s from zip", fileNameStr.c_str());
mbgl::Event::General, "Failed to create folder entry" + fileNameStr + "from zip");
continue;
}
@@ -215,7 +215,7 @@ void unZipFile(JNIEnv* env, const std::string& zipFilePath, const std::string& d
if (env->CallBooleanMethod(fileToDelete.get(), fileExists)) {
jboolean success = (env->CallBooleanMethod(fileToDelete.get(), deleteFile));
if (!success) {
mbgl::Log::Warning(mbgl::Event::General, "Failed to delete file entry %s", zipFilePath.c_str());
mbgl::Log::Warning(mbgl::Event::General, "Failed to delete file entry " + zipFilePath);
}
}
}