diff --git a/ostd/format.hh b/ostd/format.hh index 2de816f..50c5524 100644 --- a/ostd/format.hh +++ b/ostd/format.hh @@ -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(v) < 0x20) || (v == quote)) { return fmt_escapes[std::size_t(v)]; } else if (v == 0x7F) { return "\\x7F"; diff --git a/ostd/path.hh b/ostd/path.hh index c5d97a9..f9c431e 100644 --- a/ostd/path.hh +++ b/ostd/path.hh @@ -225,13 +225,13 @@ struct path { * the path are reset and the path is started over. */ template - 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) { - 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; diff --git a/src/posix/path.cc b/src/posix/path.cc index 65c1760..20e3921 100644 --- a/src/posix/path.cc +++ b/src/posix/path.cc @@ -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)