forked from OctaForge/libostd
fix some dumb gcc warnings
This commit is contained in:
parent
1ac481d887
commit
3cc97f6fab
|
@ -180,7 +180,7 @@ namespace detail {
|
|||
};
|
||||
|
||||
inline char const *escape_fmt_char(char v, char quote) {
|
||||
if ((v >= 0 && v < 0x20) || (v == quote)) {
|
||||
if ((static_cast<unsigned char>(v) < 0x20) || (v == quote)) {
|
||||
return fmt_escapes[std::size_t(v)];
|
||||
} else if (v == 0x7F) {
|
||||
return "\\x7F";
|
||||
|
|
22
ostd/path.hh
22
ostd/path.hh
|
@ -225,13 +225,13 @@ struct path {
|
|||
* the path are reset and the path is started over.
|
||||
*/
|
||||
template<typename R>
|
||||
path(R range, format fmt = format::native):
|
||||
path(R irange, format fmt = format::native):
|
||||
p_path("."), p_fmt(path_fmt(fmt))
|
||||
{
|
||||
if constexpr(std::is_constructible_v<std::string, R const &>) {
|
||||
append_str(std::string{range});
|
||||
} else if (!range.empty()) {
|
||||
for (auto const &elem: range) {
|
||||
append_str(std::string{irange});
|
||||
} else if (!irange.empty()) {
|
||||
for (auto const &elem: irange) {
|
||||
append_str(std::string{elem});
|
||||
}
|
||||
}
|
||||
|
@ -333,19 +333,19 @@ struct path {
|
|||
*/
|
||||
string_range drive() const noexcept {
|
||||
if (is_win()) {
|
||||
string_range path = p_path;
|
||||
if (has_dslash(path)) {
|
||||
string_range tpath = p_path;
|
||||
if (has_dslash(tpath)) {
|
||||
char const *endp = strchr(p_path.data() + 2, '\\');
|
||||
if (!endp) {
|
||||
return path;
|
||||
return tpath;
|
||||
}
|
||||
char const *pendp = strchr(endp + 1, '\\');
|
||||
if (!pendp) {
|
||||
return path;
|
||||
return tpath;
|
||||
}
|
||||
return string_range{path.data(), pendp};
|
||||
} else if (has_letter(path)) {
|
||||
return path.slice(0, 2);
|
||||
return string_range{tpath.data(), pendp};
|
||||
} else if (has_letter(tpath)) {
|
||||
return tpath.slice(0, 2);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
|
|
|
@ -113,7 +113,7 @@ static file_status status_get(path const &p, int ret, struct stat &sb) {
|
|||
throw fs_error{"stat failure", p, errno_ec()};
|
||||
}
|
||||
return file_status{
|
||||
file_mode{mode_to_type(sb.st_mode), perms{sb.st_mode & 07777}},
|
||||
file_mode{mode_to_type(sb.st_mode), perms{int(sb.st_mode) & 07777}},
|
||||
mtime::get(sb),
|
||||
std::uintmax_t(sb.st_size),
|
||||
std::uintmax_t(sb.st_nlink)
|
||||
|
|
Loading…
Reference in a new issue