Codechange: Pass std::string_view from drivers instead of char *.

This commit is contained in:
Peter Nelson
2024-04-09 02:47:14 +01:00
committed by Peter Nelson
parent a42aa1a086
commit 332cbca36e
52 changed files with 161 additions and 161 deletions

View File

@@ -148,15 +148,15 @@ bool DriverFactoryBase::SelectDriverImpl(const std::string &name, Driver::Type t
Driver *newd = d->CreateInstance();
*GetActiveDriver(type) = newd;
const char *err = newd->Start({});
if (err == nullptr) {
auto err = newd->Start({});
if (!err) {
Debug(driver, 1, "Successfully probed {} driver '{}'", GetDriverTypeName(type), d->name);
delete oldd;
return true;
}
*GetActiveDriver(type) = oldd;
Debug(driver, 1, "Probing {} driver '{}' failed with error: {}", GetDriverTypeName(type), d->name, err);
Debug(driver, 1, "Probing {} driver '{}' failed with error: {}", GetDriverTypeName(type), d->name, *err);
delete newd;
if (type == Driver::DT_VIDEO && _video_hw_accel && d->UsesHardwareAcceleration()) {
@@ -192,10 +192,10 @@ bool DriverFactoryBase::SelectDriverImpl(const std::string &name, Driver::Type t
/* Found our driver, let's try it */
Driver *newd = d->CreateInstance();
const char *err = newd->Start(parms);
if (err != nullptr) {
auto err = newd->Start(parms);
if (err) {
delete newd;
UserError("Unable to load driver '{}'. The error was: {}", d->name, err);
UserError("Unable to load driver '{}'. The error was: {}", d->name, *err);
}
Debug(driver, 1, "Successfully loaded {} driver '{}'", GetDriverTypeName(type), d->name);