mirror of
https://github.com/enduro2d/enduro2d.git
synced 2025-12-15 00:11:55 +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 std::ptrdiff_t rprintf = std::printf("%s", log_text.c_str());
|
||||
return rprintf >= 0
|
||||
&& math::numeric_cast<std::size_t>(rprintf) == log_text.length();
|
||||
&& math::numeric_cast<std::size_t>(rprintf) == log_text.size();
|
||||
} catch (...) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace
|
||||
if ( ver ) {
|
||||
const str_view ver_str = str_view(reinterpret_cast<const char*>(ver));
|
||||
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';
|
||||
minor = ver[dot + 1] - '0';
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ namespace e2d
|
||||
mz_zip_archive_file_stat file_stat;
|
||||
if ( mz_zip_reader_file_stat(state_->archive.get(), i, &file_stat) ) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ namespace
|
||||
|
||||
u32 file_version = 0;
|
||||
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);
|
||||
|
||||
return iseq.success()
|
||||
|
||||
@@ -55,14 +55,14 @@ namespace e2d::path
|
||||
const str name = filename(path);
|
||||
return name.empty()
|
||||
? str(path)
|
||||
: str(path.substr(0, path.length() - name.length()));
|
||||
: str(path.substr(0, path.size() - name.size()));
|
||||
}
|
||||
|
||||
str remove_extension(str_view path) {
|
||||
const str ext = extension(path);
|
||||
return ext.empty()
|
||||
? 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) {
|
||||
|
||||
@@ -23,9 +23,9 @@ namespace
|
||||
|
||||
u32 file_version = 0;
|
||||
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);
|
||||
|
||||
return iseq.success()
|
||||
|
||||
@@ -329,12 +329,12 @@ namespace e2d::strings
|
||||
}
|
||||
|
||||
bool starts_with(str_view input, str_view test) noexcept {
|
||||
return input.length() >= test.length()
|
||||
&& 0 == input.compare(0, test.length(), test);
|
||||
return input.size() >= test.size()
|
||||
&& 0 == input.compare(0, test.size(), test);
|
||||
}
|
||||
|
||||
bool ends_with(str_view input, str_view test) noexcept {
|
||||
return input.length() >= test.length()
|
||||
&& 0 == input.compare(input.length() - test.length(), test.length(), test);
|
||||
return input.size() >= test.size()
|
||||
&& 0 == input.compare(input.size() - test.size(), test.size(), test);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace
|
||||
}
|
||||
return std::make_pair(
|
||||
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