mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-16 14:08:59 +07:00
Merge remote-tracking branch 'origin/master' into feature/label
This commit is contained in:
@@ -95,7 +95,7 @@ namespace e2d
|
|||||||
const str log_text = log_text_format(lvl, text);
|
const str log_text = log_text_format(lvl, text);
|
||||||
const std::ptrdiff_t rprintf = std::printf("%s", log_text.c_str());
|
const std::ptrdiff_t rprintf = std::printf("%s", log_text.c_str());
|
||||||
return rprintf >= 0
|
return rprintf >= 0
|
||||||
&& math::numeric_cast<std::size_t>(rprintf) == log_text.length();
|
&& math::numeric_cast<std::size_t>(rprintf) == log_text.size();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ namespace
|
|||||||
if ( ver ) {
|
if ( ver ) {
|
||||||
const str_view ver_str = str_view(reinterpret_cast<const char*>(ver));
|
const str_view ver_str = str_view(reinterpret_cast<const char*>(ver));
|
||||||
const std::size_t dot = ver_str.find('.');
|
const std::size_t dot = ver_str.find('.');
|
||||||
if ( dot > 0 && dot + 1 < ver_str.length() ) {
|
if ( dot > 0 && dot + 1 < ver_str.size() ) {
|
||||||
major = ver[dot - 1] - '0';
|
major = ver[dot - 1] - '0';
|
||||||
minor = ver[dot + 1] - '0';
|
minor = ver[dot + 1] - '0';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ namespace e2d
|
|||||||
mz_zip_archive_file_stat file_stat;
|
mz_zip_archive_file_stat file_stat;
|
||||||
if ( mz_zip_reader_file_stat(state_->archive.get(), i, &file_stat) ) {
|
if ( mz_zip_reader_file_stat(state_->archive.get(), i, &file_stat) ) {
|
||||||
const str_view filename{file_stat.m_filename};
|
const str_view filename{file_stat.m_filename};
|
||||||
if ( filename.length() > parent.length() && strings::starts_with(filename, parent) ) {
|
if ( filename.size() > parent.size() && strings::starts_with(filename, parent) ) {
|
||||||
func(file_stat.m_filename, !!file_stat.m_is_directory);
|
func(file_stat.m_filename, !!file_stat.m_is_directory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ namespace
|
|||||||
|
|
||||||
u32 file_version = 0;
|
u32 file_version = 0;
|
||||||
char* file_signature = static_cast<char*>(E2D_CLEAR_ALLOCA(
|
char* file_signature = static_cast<char*>(E2D_CLEAR_ALLOCA(
|
||||||
mesh_file_signature.length() + 1));
|
mesh_file_signature.size() + 1));
|
||||||
|
|
||||||
iseq.read(file_signature, mesh_file_signature.length())
|
iseq.read(file_signature, mesh_file_signature.size())
|
||||||
.read(file_version);
|
.read(file_version);
|
||||||
|
|
||||||
return iseq.success()
|
return iseq.success()
|
||||||
|
|||||||
@@ -55,14 +55,14 @@ namespace e2d::path
|
|||||||
const str name = filename(path);
|
const str name = filename(path);
|
||||||
return name.empty()
|
return name.empty()
|
||||||
? str(path)
|
? str(path)
|
||||||
: str(path.substr(0, path.length() - name.length()));
|
: str(path.substr(0, path.size() - name.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
str remove_extension(str_view path) {
|
str remove_extension(str_view path) {
|
||||||
const str ext = extension(path);
|
const str ext = extension(path);
|
||||||
return ext.empty()
|
return ext.empty()
|
||||||
? str(path)
|
? str(path)
|
||||||
: str(path.substr(0, path.length() - ext.length()));
|
: str(path.substr(0, path.size() - ext.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
str replace_filename(str_view path, str_view filename) {
|
str replace_filename(str_view path, str_view filename) {
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ namespace
|
|||||||
|
|
||||||
u32 file_version = 0;
|
u32 file_version = 0;
|
||||||
char* file_signature = static_cast<char*>(E2D_CLEAR_ALLOCA(
|
char* file_signature = static_cast<char*>(E2D_CLEAR_ALLOCA(
|
||||||
shape_file_signature.length() + 1));
|
shape_file_signature.size() + 1));
|
||||||
|
|
||||||
iseq.read(file_signature, shape_file_signature.length())
|
iseq.read(file_signature, shape_file_signature.size())
|
||||||
.read(file_version);
|
.read(file_version);
|
||||||
|
|
||||||
return iseq.success()
|
return iseq.success()
|
||||||
|
|||||||
@@ -329,12 +329,12 @@ namespace e2d::strings
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool starts_with(str_view input, str_view test) noexcept {
|
bool starts_with(str_view input, str_view test) noexcept {
|
||||||
return input.length() >= test.length()
|
return input.size() >= test.size()
|
||||||
&& 0 == input.compare(0, test.length(), test);
|
&& 0 == input.compare(0, test.size(), test);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ends_with(str_view input, str_view test) noexcept {
|
bool ends_with(str_view input, str_view test) noexcept {
|
||||||
return input.length() >= test.length()
|
return input.size() >= test.size()
|
||||||
&& 0 == input.compare(input.length() - test.length(), test.length(), test);
|
&& 0 == input.compare(input.size() - test.size(), test.size(), test);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace
|
|||||||
}
|
}
|
||||||
return std::make_pair(
|
return std::make_pair(
|
||||||
str(schemepath.substr(0, sep_pos)),
|
str(schemepath.substr(0, sep_pos)),
|
||||||
str(schemepath.substr(sep_pos + scheme_separator.length())));
|
str(schemepath.substr(sep_pos + scheme_separator.size())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user