[keel,studio] Cleanup string handling

This commit is contained in:
Gary Talent 2023-12-03 22:26:25 -06:00
parent ce514d586c
commit 26a2d340d6
3 changed files with 6 additions and 6 deletions

View File

@ -233,7 +233,7 @@ class AssetManager {
template<typename T>
AssetTypeManager<T> *getTypeManager() noexcept {
constexpr auto typeName = ox::requireModelTypeName<T>();
static_assert(ox_strcmp(typeName, "") != 0, "Types must have TypeName to use AssetManager");
static_assert(ox::StringView(typeName) != "", "Types must have TypeName to use AssetManager");
auto &am = m_assetTypeManagers[typeName];
if (!am) {
am = ox::make_unique<AssetTypeManager<T>>();

View File

@ -24,10 +24,10 @@ ox::Result<char*> loadRom(ox::CRStringView path) noexcept {
auto buff = new char[static_cast<std::size_t>(size)];
file.read(buff, size);
return buff;
} catch (const std::ios_base::failure &e) {
} catch (std::ios_base::failure const&e) {
oxErrorf("Could not read ROM file due to file IO failure: {}", e.what());
return OxError(2, "Could not read ROM file");
} catch (const std::bad_alloc &e) {
} catch (std::bad_alloc const&e) {
oxErrorf("Could not read ROM file due to new failure: {}", e.what());
return OxError(2, "Could not allocate memory for ROM file");
}

View File

@ -64,7 +64,7 @@ ox::Error writeConfig(keel::Context *ctx, T *data) noexcept {
}
template<typename T, typename Func>
void openConfig(keel::Context *ctx, const auto &name, Func f) noexcept {
void openConfig(keel::Context *ctx, ox::CRStringView name, Func f) noexcept {
oxAssert(name != "", "Config type has no TypeName");
const auto [c, err] = readConfig<T>(ctx, name);
oxLogError(err);
@ -78,8 +78,8 @@ void openConfig(keel::Context *ctx, Func f) noexcept {
}
template<typename T, typename Func>
void editConfig(keel::Context *ctx, const auto &name, Func f) noexcept {
oxAssert(ox_strcmp(name, ""), "Config type has no TypeName");
void editConfig(keel::Context *ctx, ox::CRStringView name, Func f) noexcept {
oxAssert(name != "", "Config type has no TypeName");
auto [c, err] = readConfig<T>(ctx, name);
oxLogError(err);
f(&c);