[ox] Make ox::String::String(const char*) explicit
This commit is contained in:
@@ -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 {
|
||||
|
14
deps/ox/src/ox/fs/test/tests.cpp
vendored
14
deps/ox/src/ox/fs/test/tests.cpp
vendored
@@ -58,7 +58,7 @@ const std::map<std::string_view, std::function<ox::Error(std::string_view)>> 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<char*>(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<std::string_view, std::function<ox::Error(std::string_view)>> 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<char*>(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<std::string_view, std::function<ox::Error(std::string_view)>> 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<char*>(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<std::string_view, std::function<ox::Error(std::string_view)>> 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<char*>(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<std::string_view, std::function<ox::Error(std::string_view)>> 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<char*>(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<std::string_view, std::function<ox::Error(std::string_view)>> 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<char*>(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<std::string_view, std::function<ox::Error(std::string_view)>> 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<char*>(ox_alloca(path.len() + 1));
|
||||
oxAssert(it.fileName(buff, path.len()) == 0 && ox_strcmp(buff, "charset.gbag") == 0, "PathIterator shows incorrect file name");
|
||||
|
2
deps/ox/src/ox/fs/tool.cpp
vendored
2
deps/ox/src/ox/fs/tool.cpp
vendored
@@ -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);
|
||||
|
Reference in New Issue
Block a user