From e1cfa8693fd37664bc872afc33b0bda5914a4648 Mon Sep 17 00:00:00 2001 From: skdltmxn Date: Thu, 7 Jan 2021 04:28:19 +0900 Subject: [PATCH] Use c_str() instead of data() --- src/openrct2/core/Zip.cpp | 2 +- src/openrct2/object/ObjectFactory.cpp | 2 +- src/openrct2/scripting/Plugin.cpp | 2 +- test/tests/ImageImporterTests.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openrct2/core/Zip.cpp b/src/openrct2/core/Zip.cpp index 17fedea1c0..c991e90f1f 100644 --- a/src/openrct2/core/Zip.cpp +++ b/src/openrct2/core/Zip.cpp @@ -31,7 +31,7 @@ public: } int32_t error; - _zip = zip_open(std::string(path).data(), zipOpenMode, &error); + _zip = zip_open(std::string(path).c_str(), zipOpenMode, &error); if (_zip == nullptr) { throw IOException("Unable to open zip file."); diff --git a/src/openrct2/object/ObjectFactory.cpp b/src/openrct2/object/ObjectFactory.cpp index ec1609a7a1..922458db36 100644 --- a/src/openrct2/object/ObjectFactory.cpp +++ b/src/openrct2/object/ObjectFactory.cpp @@ -59,7 +59,7 @@ public: std::vector GetData(std::string_view path) const override { - auto absolutePath = Path::Combine(_basePath, std::string(path).data()); + auto absolutePath = Path::Combine(_basePath, std::string(path).c_str()); return File::ReadAllBytes(absolutePath); } }; diff --git a/src/openrct2/scripting/Plugin.cpp b/src/openrct2/scripting/Plugin.cpp index 94c82fa259..fc7ca48821 100644 --- a/src/openrct2/scripting/Plugin.cpp +++ b/src/openrct2/scripting/Plugin.cpp @@ -158,7 +158,7 @@ PluginType Plugin::ParsePluginType(std::string_view type) void Plugin::CheckForLicence(const DukValue& dukLicence, std::string_view pluginName) { if (dukLicence.type() != DukValue::Type::STRING || dukLicence.as_string().empty()) - log_error("Plugin %s does not specify a licence", std::string(pluginName).data()); + log_error("Plugin %s does not specify a licence", std::string(pluginName).c_str()); } #endif diff --git a/test/tests/ImageImporterTests.cpp b/test/tests/ImageImporterTests.cpp index 5a43fabbb7..04f04d75d7 100644 --- a/test/tests/ImageImporterTests.cpp +++ b/test/tests/ImageImporterTests.cpp @@ -21,7 +21,7 @@ class ImageImporterTests : public testing::Test public: static std::string GetImagePath(const std::string& name) { - return Path::Combine(TestData::GetBasePath(), "images", name.data()); + return Path::Combine(TestData::GetBasePath(), "images", name.c_str()); } static uint32_t GetHash(void* buffer, size_t bufferLength)