forked from rosebudai/OpenRCT2-Web
Close #24665: Don't return empty strings with quotes for std::string
This commit is contained in:
1 parent
62418a9588
commit
b47506dd90
19 files changed
+23
-23
No files matched your search
@@ -167,7 +167,7 @@ namespace OpenRCT2::Ui
|
||||
else
|
||||
{
|
||||
SDL_RaiseWindow(window);
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace OpenRCT2::Ui::FileBrowser
|
||||
Guard::Fail("Unsupported load/save directory type.");
|
||||
}
|
||||
|
||||
return "";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
u8string RemovePatternWildcard(u8string_view pattern)
|
||||
|
||||
@@ -375,7 +375,7 @@ namespace OpenRCT2::Scripting
|
||||
return widget->string;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
void text_set(std::string value)
|
||||
|
||||
@@ -1559,7 +1559,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
return rideObject->GetDescription();
|
||||
}
|
||||
default:
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2209,7 +2209,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
const auto* ride = GetRide(rideId);
|
||||
if (ride == nullptr)
|
||||
return "";
|
||||
return {};
|
||||
return ride->getName();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace OpenRCT2::Http
|
||||
auto jstringToString = [](JNIEnv* env, jstring jstr) -> std::string {
|
||||
if (jstr == nullptr)
|
||||
{
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
const char* cstr = env->GetStringUTFChars(jstr, nullptr);
|
||||
std::string str = cstr;
|
||||
|
||||
@@ -63,7 +63,7 @@ const utf8* StringBuilder::GetBuffer() const
|
||||
{
|
||||
// buffer may be empty, so return an immutable empty string
|
||||
if (_buffer.empty())
|
||||
return "";
|
||||
return u8"";
|
||||
return _buffer.c_str();
|
||||
}
|
||||
|
||||
|
||||
@@ -275,5 +275,5 @@ std::string ScreenshotDump()
|
||||
{
|
||||
return drawingEngine->Screenshot();
|
||||
}
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
@@ -179,7 +179,7 @@ std::string ScreenshotDumpPNG(RenderTarget& rt)
|
||||
|
||||
if (!path.has_value())
|
||||
{
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
if (WriteDpiToFile(path.value(), rt, gPalette))
|
||||
@@ -187,7 +187,7 @@ std::string ScreenshotDumpPNG(RenderTarget& rt)
|
||||
return path.value();
|
||||
}
|
||||
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
static int32_t GetHighestBaseClearanceZ(const CoordsXY& location, const bool useViewClipping)
|
||||
|
||||
@@ -2192,7 +2192,7 @@ std::string_view MapToNewObjectIdentifier(std::string_view s)
|
||||
{
|
||||
return it->second;
|
||||
}
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
static const std::unordered_map<std::string_view, std::string_view> kDATPathNames = {
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace OpenRCT2::Platform
|
||||
return expectedPath;
|
||||
}
|
||||
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@ namespace OpenRCT2::RCT1
|
||||
const ScenarioIndexEntry* scenarioEntry = _scenarioRepository->GetByInternalName(_s4.ScenarioName);
|
||||
if (scenarioEntry == nullptr)
|
||||
{
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
return Path::GetFileName(scenarioEntry->Path);
|
||||
|
||||
@@ -107,7 +107,7 @@ static u8string_view TrackDesignGetStationObjectIdentifier(const Ride& ride)
|
||||
{
|
||||
const auto* stationObject = ride.getStationObject();
|
||||
if (stationObject == nullptr)
|
||||
return "";
|
||||
return {};
|
||||
|
||||
return stationObject->GetIdentifier();
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenRCT2::Scripting
|
||||
return std::string{ it->first };
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
void ScLitter::litterType_set(const std::string& litterType)
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
return peep->Is<Staff>() ? "staff" : "guest";
|
||||
}
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string name_get() const
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace OpenRCT2::Scripting
|
||||
break;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
void ScStaff::staffType_set(const std::string& value)
|
||||
@@ -163,7 +163,7 @@ namespace OpenRCT2::Scripting
|
||||
auto peep = GetStaff();
|
||||
if (peep == nullptr)
|
||||
{
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
auto& costumes = costumesByStaffType(peep->AssignedStaffType);
|
||||
|
||||
@@ -536,7 +536,7 @@ namespace OpenRCT2::Scripting
|
||||
if (it != BreakdownMap.end())
|
||||
return std::string(it->first);
|
||||
}
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
uint8_t ScRide::downtime_get() const
|
||||
|
||||
@@ -78,9 +78,9 @@ namespace OpenRCT2::Scripting
|
||||
case WeatherType::Blizzard:
|
||||
return "blizzard";
|
||||
case WeatherType::Count:
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string type_get() const
|
||||
@@ -88,7 +88,7 @@ namespace OpenRCT2::Scripting
|
||||
auto& objManager = GetContext()->GetObjectManager();
|
||||
auto* climateObj = objManager.GetLoadedObject<ClimateObject>(0);
|
||||
if (climateObj == nullptr)
|
||||
return "";
|
||||
return {};
|
||||
|
||||
return climateObj->getScriptName();
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -2555,7 +2555,7 @@ GHC_INLINE path path::extension() const
|
||||
impl_string_type fn = filename().string();
|
||||
impl_string_type::size_type pos = fn.find_last_of('.');
|
||||
if (pos == std::string::npos || pos == 0) {
|
||||
return "";
|
||||
return {};
|
||||
}
|
||||
return fn.substr(pos);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user