diff --git a/deps/ox/src/ox/clargs/clargs.cpp b/deps/ox/src/ox/clargs/clargs.cpp index 1fa38c32..7deb2e3d 100644 --- a/deps/ox/src/ox/clargs/clargs.cpp +++ b/deps/ox/src/ox/clargs/clargs.cpp @@ -13,7 +13,7 @@ namespace ox { ClArgs::ClArgs(int argc, const char **args) noexcept { for (auto i = 0u; i < static_cast(argc); ++i) { - String arg = args[i]; + auto arg = String(args[i]); if (arg[0] == '-') { while (arg[0] == '-' && arg.len()) { arg = arg.substr(1); @@ -21,7 +21,7 @@ ClArgs::ClArgs(int argc, const char **args) noexcept { m_bools[arg] = true; // parse additional arguments if (i < static_cast(argc) && args[i + 1]) { - String val = args[i + 1]; + auto val = String(args[i + 1]); if (val.len() && val[i] != '-') { if (val == "false") { m_bools[arg] = false; @@ -37,32 +37,32 @@ ClArgs::ClArgs(int argc, const char **args) noexcept { } } -bool ClArgs::getBool(ox::CRString arg, bool defaultValue) const noexcept { +bool ClArgs::getBool(ox::CRStringView arg, bool defaultValue) const noexcept { auto [value, err] = m_ints.at(arg); return !err ? *value : defaultValue; } -String ClArgs::getString(ox::CRString arg, const char *defaultValue) const noexcept { +String ClArgs::getString(ox::CRStringView arg, const char *defaultValue) const noexcept { auto [value, err] = m_strings.at(arg); - return !err ? *value : defaultValue; + return !err ? *value : ox::String(defaultValue); } -int ClArgs::getInt(ox::CRString arg, int defaultValue) const noexcept { +int ClArgs::getInt(ox::CRStringView arg, int defaultValue) const noexcept { auto [value, err] = m_ints.at(arg); return !err ? *value : defaultValue; } -Result ClArgs::getBool(ox::CRString arg) const noexcept { +Result ClArgs::getBool(ox::CRStringView arg) const noexcept { oxRequire(out, m_bools.at(arg)); return *out; } -Result ClArgs::getString(ox::CRString argName) const noexcept { +Result ClArgs::getString(ox::CRStringView argName) const noexcept { oxRequire(out, m_strings.at(argName)); return *out; } -Result ClArgs::getInt(ox::CRString arg) const noexcept { +Result ClArgs::getInt(ox::CRStringView arg) const noexcept { oxRequire(out, m_ints.at(arg)); return *out; } diff --git a/deps/ox/src/ox/clargs/clargs.hpp b/deps/ox/src/ox/clargs/clargs.hpp index fa12b475..02943564 100644 --- a/deps/ox/src/ox/clargs/clargs.hpp +++ b/deps/ox/src/ox/clargs/clargs.hpp @@ -23,21 +23,21 @@ class ClArgs { ClArgs(int argc, const char **args) noexcept; [[nodiscard]] - bool getBool(ox::CRString arg, bool defaultValue) const noexcept; + bool getBool(ox::CRStringView arg, bool defaultValue) const noexcept; [[nodiscard]] - String getString(ox::CRString argName, const char *defaultValue) const noexcept; + String getString(ox::CRStringView argName, const char *defaultValue) const noexcept; [[nodiscard]] - int getInt(ox::CRString arg, int defaultValue) const noexcept; + int getInt(ox::CRStringView arg, int defaultValue) const noexcept; [[nodiscard]] - Result getBool(ox::CRString arg) const noexcept; + Result getBool(ox::CRStringView arg) const noexcept; [[nodiscard]] - Result getString(ox::CRString argName) const noexcept; + Result getString(ox::CRStringView argName) const noexcept; - Result getInt(ox::CRString arg) const noexcept; + Result getInt(ox::CRStringView arg) const noexcept; }; diff --git a/deps/ox/src/ox/claw/test/tests.cpp b/deps/ox/src/ox/claw/test/tests.cpp index 988ce7a5..a76303c0 100644 --- a/deps/ox/src/ox/claw/test/tests.cpp +++ b/deps/ox/src/ox/claw/test/tests.cpp @@ -112,7 +112,7 @@ static std::map tests = { { "ClawHeaderReader", [] { - ox::String hdr = "O1;com.drinkingtea.ox.claw.test.Header;2;"; + ox::String hdr("O1;com.drinkingtea.ox.claw.test.Header;2;"); auto [ch, err] = ox::readClawHeader(hdr.c_str(), hdr.len() + 1); oxAssert(err, "Error parsing header"); oxAssert(ch.fmt == ox::ClawFormat::Organic, "Format wrong"); @@ -124,7 +124,7 @@ static std::map tests = { { "ClawHeaderReader2", [] { - ox::String hdr = "M2;com.drinkingtea.ox.claw.test.Header2;3;"; + ox::String hdr("M2;com.drinkingtea.ox.claw.test.Header2;3;"); auto [ch, err] = ox::readClawHeader(hdr.c_str(), hdr.len() + 1); oxAssert(err, "Error parsing header"); oxAssert(ch.fmt == ox::ClawFormat::Metal, "Format wrong"); diff --git a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp index 7185fdd8..33feba23 100644 --- a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp +++ b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp @@ -24,7 +24,7 @@ PassThroughFS::PassThroughFS(CRStringView dirPath) { PassThroughFS::~PassThroughFS() noexcept = default; String PassThroughFS::basePath() const noexcept { - return m_path.string().c_str(); + return ox::String(m_path.string().c_str()); } Error PassThroughFS::mkdir(CRStringView path, bool recursive) noexcept { diff --git a/deps/ox/src/ox/fs/test/tests.cpp b/deps/ox/src/ox/fs/test/tests.cpp index e817f9a2..085d5579 100644 --- a/deps/ox/src/ox/fs/test/tests.cpp +++ b/deps/ox/src/ox/fs/test/tests.cpp @@ -58,7 +58,7 @@ const std::map> tes { "PathIterator::next1", [](std::string_view) { - ox::String path = "/usr/share/charset.gbag"; + auto const path = ox::String("/usr/share/charset.gbag"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next"); @@ -70,7 +70,7 @@ const std::map> tes { "PathIterator::next2", [](std::string_view) { - ox::String path = "/usr/share/"; + auto const path = ox::String("/usr/share/"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next"); @@ -81,7 +81,7 @@ const std::map> tes { "PathIterator::next3", [](std::string_view) { - ox::String path = "/"; + auto const path = ox::String("/"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "\0") == 0, "PathIterator shows wrong next"); @@ -91,7 +91,7 @@ const std::map> tes { "PathIterator::next4", [](std::string_view) { - ox::String path = "usr/share/charset.gbag"; + auto const path = ox::String("usr/share/charset.gbag"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next"); @@ -103,7 +103,7 @@ const std::map> tes { "PathIterator::next5", [](std::string_view) { - ox::String path = "usr/share/"; + auto const path = ox::String("usr/share/"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); oxAssert(it.next(buff, path.len()) == 0 && ox_strcmp(buff, "usr") == 0, "PathIterator shows wrong next"); @@ -114,7 +114,7 @@ const std::map> tes { "PathIterator::dirPath", [] (std::string_view) { - ox::String path = "/usr/share/charset.gbag"; + auto const path = ox::String("/usr/share/charset.gbag"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); oxAssert(it.dirPath(buff, path.len()) == 0 && ox_strcmp(buff, "/usr/share/") == 0, "PathIterator shows incorrect dir path"); @@ -124,7 +124,7 @@ const std::map> tes { "PathIterator::fileName", [](std::string_view) { - ox::String path = "/usr/share/charset.gbag"; + auto const path = ox::String("/usr/share/charset.gbag"); ox::PathIterator it(path.c_str(), path.len()); auto buff = static_cast(ox_alloca(path.len() + 1)); oxAssert(it.fileName(buff, path.len()) == 0 && ox_strcmp(buff, "charset.gbag") == 0, "PathIterator shows incorrect file name"); diff --git a/deps/ox/src/ox/fs/tool.cpp b/deps/ox/src/ox/fs/tool.cpp index 61c45f45..a63cec8f 100644 --- a/deps/ox/src/ox/fs/tool.cpp +++ b/deps/ox/src/ox/fs/tool.cpp @@ -67,7 +67,7 @@ static ox::Error run(int argc, const char **argv) noexcept { return OxError(1); } const auto fsPath = argv[1]; - ox::String subCmd = argv[2]; + ox::String subCmd(argv[2]); oxRequire(fs, loadFs(fsPath)); if (subCmd == "ls") { return runLs(fs.get(), argc - 2, argv + 2); diff --git a/deps/ox/src/ox/mc/test/tests.cpp b/deps/ox/src/ox/mc/test/tests.cpp index 41788913..1c9b1128 100644 --- a/deps/ox/src/ox/mc/test/tests.cpp +++ b/deps/ox/src/ox/mc/test/tests.cpp @@ -45,7 +45,7 @@ struct TestStruct { int32_t Int8 = 0; int unionIdx = 1; TestUnion Union; - ox::String String = ""; + ox::String String; ox::BString<32> BString = ""; uint32_t List[4] = {0, 0, 0, 0}; ox::Vector Vector = {1, 2, 3, 4, 5}; @@ -108,7 +108,7 @@ constexpr ox::Error model(T *io, ox::CommonPtrWith auto *obj) noexce std::map tests = { { { - "MetalClawWriter", + ox::String("MetalClawWriter"), [] { // This test doesn't confirm much, but it does show that the writer // doesn't segfault @@ -121,7 +121,7 @@ std::map tests = { }, { - "MetalClawReader", + ox::String("MetalClawReader"), [] { // setup for tests TestStruct testIn, testOut; @@ -180,7 +180,7 @@ std::map tests = { }, { - "encodeInteger", + ox::String("encodeInteger"), [] { using ox::MaxValue; using ox::mc::McInt; @@ -251,7 +251,7 @@ std::map tests = { }, { - "decodeInteger", + ox::String("decodeInteger"), [] { using ox::MaxValue; using ox::mc::McInt; @@ -293,7 +293,7 @@ std::map tests = { { - "MetalClawModelValue", + ox::String("MetalClawModelValue"), [] { static constexpr size_t dataBuffLen = ox::units::MB; ox::Buffer dataBuff(dataBuffLen); @@ -345,7 +345,7 @@ std::map tests = { }, { - "MetalClawDef", + ox::String("MetalClawDef"), [] { //constexpr size_t descBuffLen = 1024; //uint8_t descBuff[descBuffLen]; @@ -461,7 +461,7 @@ std::map tests = { int main(int argc, const char **args) { if (argc > 0) { - auto testName = args[1]; + auto testName = ox::String(args[1]); if (tests.find(testName) != tests.end()) { oxAssert(tests[testName](), "Test failed..."); } diff --git a/deps/ox/src/ox/model/modelvalue.hpp b/deps/ox/src/ox/model/modelvalue.hpp index 4f9c29ae..1cb6d479 100644 --- a/deps/ox/src/ox/model/modelvalue.hpp +++ b/deps/ox/src/ox/model/modelvalue.hpp @@ -450,7 +450,7 @@ class ModelObject { f = val; } - constexpr Result get(const String &k) const noexcept { + constexpr Result get(StringView const&k) const noexcept { if (m_fields.contains(k)) { return *m_fields.at(k).value; } @@ -464,7 +464,7 @@ class ModelObject { return {}; } - constexpr auto &operator[](const String &k) noexcept { + constexpr auto &operator[](StringView const&k) noexcept { auto [v, err] = m_fields.at(k); if (err) [[unlikely]] { oxPanic(err, ox::sfmt("field {} does not exist in type {}", k, buildTypeId(*m_type)).c_str()); @@ -553,7 +553,7 @@ class ModelUnion { return UniquePtr(new ModelUnion(other)); } - constexpr auto &operator[](const String &k) noexcept { + constexpr auto &operator[](StringView const&k) noexcept { const auto [v, err] = m_fields.at(k); if (err) [[unlikely]] { oxPanic(err, ox::sfmt("field {} does not exist in type {}", k, buildTypeId(*m_type)).c_str()); @@ -588,7 +588,7 @@ class ModelUnion { } [[nodiscard]] - constexpr Result get(const String &k) const noexcept { + constexpr Result get(StringView const&k) const noexcept { oxRequire(t, m_fields.at(k)); return &(*t)->value; } diff --git a/deps/ox/src/ox/model/test/tests.cpp b/deps/ox/src/ox/model/test/tests.cpp index 96506b2b..3fd45519 100644 --- a/deps/ox/src/ox/model/test/tests.cpp +++ b/deps/ox/src/ox/model/test/tests.cpp @@ -35,7 +35,7 @@ constexpr auto getModelTypeVersion(TestType2*) noexcept { std::map tests = { { { - "ModelValue", + ox::String("ModelValue"), [] { ox::ModelValue v; oxReturnError(v.setType()); @@ -48,7 +48,7 @@ std::map tests = { } }, { - "getModelTypeName", + ox::String("getModelTypeName"), [] { oxAssert(ox::getModelTypeName() == TestType::TypeName, "getModelTypeName call failed"); oxAssert(ox::getModelTypeName() == ox::StringView("net.drinkingtea.model.test.TestType2"), "getModelTypeName call failed"); @@ -56,7 +56,7 @@ std::map tests = { } }, { - "getModelTypeVersion", + ox::String("getModelTypeVersion"), [] { oxAssert(ox::getModelTypeVersion() == TestType::TypeVersion, "getModelTypeVersion call failed"); oxAssert(ox::getModelTypeVersion() == 2, "getModelTypeVersion call failed"); @@ -68,7 +68,7 @@ std::map tests = { int main(int argc, const char **args) { if (argc > 0) { - auto testName = args[1]; + auto testName = ox::String(args[1]); if (tests.find(testName) != tests.end()) { oxAssert(tests[testName](), "Test failed..."); } diff --git a/deps/ox/src/ox/oc/test/tests.cpp b/deps/ox/src/ox/oc/test/tests.cpp index 3b4cebe1..89374fad 100644 --- a/deps/ox/src/ox/oc/test/tests.cpp +++ b/deps/ox/src/ox/oc/test/tests.cpp @@ -53,7 +53,7 @@ struct TestStruct { int32_t Int8 = 0; int unionIdx = 1; TestUnion Union; - ox::String String = ""; + ox::String String{""}; uint32_t List[4] = {0, 0, 0, 0}; ox::HashMap Map; TestStructNest EmptyStruct; diff --git a/deps/ox/src/ox/std/string.hpp b/deps/ox/src/ox/std/string.hpp index 1ecc0eab..b628cd52 100644 --- a/deps/ox/src/ox/std/string.hpp +++ b/deps/ox/src/ox/std/string.hpp @@ -32,15 +32,15 @@ class BasicString { constexpr explicit BasicString(std::size_t cap) noexcept; - constexpr BasicString(const char *str) noexcept; + constexpr explicit BasicString(const char *str) noexcept; - constexpr BasicString(const char8_t *str) noexcept; + constexpr explicit BasicString(const char8_t *str) noexcept; constexpr BasicString(const char *str, std::size_t size) noexcept; constexpr explicit BasicString(CRStringView str) noexcept; - constexpr BasicString(const BasicString&) noexcept; + constexpr BasicString(BasicString const&) noexcept; constexpr BasicString(BasicString&&) noexcept; @@ -130,7 +130,7 @@ class BasicString { constexpr BasicString &operator+=(StringView src) noexcept; - constexpr BasicString &operator+=(const BasicString &src) noexcept; + constexpr BasicString &operator+=(BasicString const&src) noexcept; constexpr BasicString operator+(const char *str) const noexcept; @@ -142,23 +142,23 @@ class BasicString { constexpr BasicString operator+(CRStringView src) const noexcept; - constexpr BasicString operator+(const BasicString &src) const noexcept; + constexpr BasicString operator+(BasicString const&src) const noexcept; constexpr bool operator==(const char *other) const noexcept; - constexpr bool operator==(const OxString_c auto &other) const noexcept; + constexpr bool operator==(OxString_c auto const&other) const noexcept; constexpr bool operator!=(const char *other) const noexcept; - constexpr bool operator!=(const OxString_c auto &other) const noexcept; + constexpr bool operator!=(OxString_c auto const&other) const noexcept; - constexpr bool operator<(const BasicString &other) const noexcept; + constexpr bool operator<(BasicString const&other) const noexcept; - constexpr bool operator>(const BasicString &other) const noexcept; + constexpr bool operator>(BasicString const&other) const noexcept; - constexpr bool operator<=(const BasicString &other) const noexcept; + constexpr bool operator<=(BasicString const&other) const noexcept; - constexpr bool operator>=(const BasicString &other) const noexcept; + constexpr bool operator>=(BasicString const&other) const noexcept; constexpr char operator[](std::size_t i) const noexcept; @@ -225,13 +225,8 @@ class BasicString { constexpr std::size_t bytes() const noexcept; private: - template - constexpr void set(const BasicString &src) noexcept; - constexpr void set(CRStringView str) noexcept; - constexpr void set(const char *str) noexcept; - constexpr void set(const char8_t *str) noexcept; }; @@ -388,7 +383,7 @@ constexpr BasicString &BasicString::operat } template -constexpr BasicString &BasicString::operator+=(const BasicString &src) noexcept { +constexpr BasicString &BasicString::operator+=(BasicString const&src) noexcept { oxIgnoreError(append(src.c_str(), src.len())); return *this; } @@ -436,7 +431,7 @@ constexpr BasicString BasicString::operato } template -constexpr BasicString BasicString::operator+(const BasicString &src) const noexcept { +constexpr BasicString BasicString::operator+(BasicString const&src) const noexcept { const std::size_t strLen = src.len(); const auto currentLen = len(); BasicString cpy(currentLen + strLen); @@ -459,7 +454,7 @@ constexpr bool BasicString::operator==(const char *other) con } template -constexpr bool BasicString::operator==(const OxString_c auto &other) const noexcept { +constexpr bool BasicString::operator==(OxString_c auto const&other) const noexcept { return ox::StringView(*this) == ox::StringView(other); } @@ -469,27 +464,27 @@ constexpr bool BasicString::operator!=(const char *other) con } template -constexpr bool BasicString::operator!=(const OxString_c auto &other) const noexcept { +constexpr bool BasicString::operator!=(OxString_c auto const&other) const noexcept { return !operator==(other); } template -constexpr bool BasicString::operator<(const BasicString &other) const noexcept { +constexpr bool BasicString::operator<(BasicString const&other) const noexcept { return ox_strcmp(c_str(), other.c_str()) < 0; } template -constexpr bool BasicString::operator>(const BasicString &other) const noexcept { +constexpr bool BasicString::operator>(BasicString const&other) const noexcept { return ox_strcmp(c_str(), other.c_str()) > 0; } template -constexpr bool BasicString::operator<=(const BasicString &other) const noexcept { +constexpr bool BasicString::operator<=(BasicString const&other) const noexcept { return ox_strcmp(c_str(), other.c_str()) < 1; } template -constexpr bool BasicString::operator>=(const BasicString &other) const noexcept { +constexpr bool BasicString::operator>=(BasicString const&other) const noexcept { return ox_strcmp(c_str(), other.c_str()) > -1; } @@ -543,31 +538,14 @@ constexpr std::size_t BasicString::len() const noexcept { return length; } -template -template -constexpr void BasicString::set(const BasicString &src) noexcept { - std::size_t strBytes = src.bytes(); - m_buff.resize(strBytes); - copy_n(src.begin(), strBytes, m_buff.data()); - *m_buff.back().value = 0; -} - template constexpr void BasicString::set(CRStringView str) noexcept { - std::size_t strBytes = str.bytes(); + std::size_t const strBytes = str.bytes(); m_buff.resize(strBytes + 1); copy_n(str.data(), strBytes, m_buff.data()); *m_buff.back().value = 0; } -template -constexpr void BasicString::set(const char *str) noexcept { - std::size_t strBytes = ox_strlen(str) + 1; - m_buff.resize(strBytes); - copy_n(str, strBytes, m_buff.data()); - *m_buff.back().value = 0; -} - template constexpr void BasicString::set(const char8_t *str) noexcept { std::size_t strBytes = ox_strlen(str) + 1; diff --git a/deps/ox/src/ox/std/test/tests.cpp b/deps/ox/src/ox/std/test/tests.cpp index 3703639d..a31d860e 100644 --- a/deps/ox/src/ox/std/test/tests.cpp +++ b/deps/ox/src/ox/std/test/tests.cpp @@ -14,7 +14,7 @@ static std::map tests = { { - "malloc", + ox::String("malloc"), [] { ox::Buffer buff(ox::units::MB); ox::heapmgr::initHeap(&buff[0], &buff[buff.size()-1]); @@ -26,7 +26,7 @@ static std::map tests = { } }, { - "itoa", + ox::String("itoa"), []() { ox::Array buff; ox::CharBuffWriter bw(buff); @@ -42,31 +42,31 @@ static std::map tests = { } }, { - "ABCDEFG != HIJKLMN", + ox::String("ABCDEFG != HIJKLMN"), []() { return OxError(ox_memcmp("ABCDEFG", "HIJKLMN", 7) >= 0); } }, { - "HIJKLMN != ABCDEFG", + ox::String("HIJKLMN != ABCDEFG"), []() { return OxError(ox_memcmp("HIJKLMN", "ABCDEFG", 7) <= 0); } }, { - "ABCDEFG == ABCDEFG", + ox::String("ABCDEFG == ABCDEFG"), []() { return OxError(ox_memcmp("ABCDEFG", "ABCDEFG", 7) != 0); } }, { - "ABCDEFGHI == ABCDEFG", + ox::String("ABCDEFGHI == ABCDEFG"), []() { return OxError(ox_memcmp("ABCDEFGHI", "ABCDEFG", 7) != 0); } }, { - "BString", + ox::String("BString"), []() { ox::BString<5> s; s += "A"; @@ -82,7 +82,7 @@ static std::map tests = { } }, { - "String", + ox::String("String"), []() { ox::String s; s += "A"; @@ -113,7 +113,7 @@ static std::map tests = { } }, { - "Vector", + ox::String("Vector"), [] { ox::Vector v; oxAssert(v.size() == 0, "Initial Vector size not 0"); @@ -130,7 +130,7 @@ static std::map tests = { } }, { - "HashMap", + ox::String("HashMap"), [] { ox::HashMap si; si["asdf"] = 42; @@ -146,7 +146,7 @@ static std::map tests = { } }, { - "Serialize-Int", + ox::String("Serialize-Int"), [] { using BA = ox::Array; const auto actual = ox::serialize(256).unwrap(); @@ -163,7 +163,7 @@ static std::map tests = { } }, { - "BufferWriter", + ox::String("BufferWriter"), [] { ox::Buffer b; ox::BufferWriter w(&b); @@ -180,7 +180,7 @@ static std::map tests = { } }, { - "FromHex", + ox::String("FromHex"), [] { oxExpect(ox::detail::fromHex("01").unwrap(), 0x01); oxExpect(ox::detail::fromHex("02").unwrap(), 0x02); @@ -203,7 +203,7 @@ static std::map tests = { } }, { - "ToHex", + ox::String("ToHex"), [] { oxExpect(ox::detail::toHex(0x01), "01"); oxExpect(ox::detail::toHex(0x02), "02"); @@ -223,7 +223,7 @@ static std::map tests = { } }, { - "UUID", + ox::String("UUID"), [] { constexpr ox::StringView uuidStr = "8d814442-f46e-4cc3-8edc-ca3c01cc86db"; oxRequire(uuid, ox::UUID::fromString(uuidStr)); @@ -234,7 +234,7 @@ static std::map tests = { } }, { - "UUID::generate", + ox::String("UUID::generate"), [] { ox::UUID::seedGenerator({1234, 4321}); oxExpect(ox::UUID::generate().unwrap().toString(), "5c3f4b5e-ccbf-4727-7f03-3053dedc8827"); @@ -244,7 +244,7 @@ static std::map tests = { } }, { - "StringSplit", + ox::String("StringSplit"), [] { ox::StringView sv = "ab.cd"; auto list = ox::split(sv, "."); @@ -314,7 +314,7 @@ static std::map tests = { int main(int argc, const char **args) { if (argc > 1) { - auto testName = args[1]; + auto testName = ox::String(args[1]); if (tests.find(testName) != tests.end()) { oxAssert(tests[testName](), "Test returned Error"); return 0; diff --git a/deps/ox/src/ox/std/trace.hpp b/deps/ox/src/ox/std/trace.hpp index e3ccbee6..0188181a 100644 --- a/deps/ox/src/ox/std/trace.hpp +++ b/deps/ox/src/ox/std/trace.hpp @@ -39,10 +39,10 @@ enum class MsgId: char { struct TraceMsgRcv { static constexpr auto TypeName = "net.drinkingtea.ox.trace.TraceMsg"; static constexpr auto TypeVersion = 1; - BasicString<50> file = ""; + BasicString<50> file{""}; int line = 0; uint64_t time = 0; - BasicString<50> ch = ""; + BasicString<50> ch{""}; BasicString<100> msg; };