fix some dumb gcc warnings

master
Daniel Kolesa 2019-01-28 02:53:09 +01:00
parent 1ac481d887
commit 3cc97f6fab
3 changed files with 13 additions and 13 deletions

View File

@ -180,7 +180,7 @@ namespace detail {
}; };
inline char const *escape_fmt_char(char v, char quote) { 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)]; return fmt_escapes[std::size_t(v)];
} else if (v == 0x7F) { } else if (v == 0x7F) {
return "\\x7F"; return "\\x7F";

View File

@ -225,13 +225,13 @@ struct path {
* the path are reset and the path is started over. * the path are reset and the path is started over.
*/ */
template<typename R> template<typename R>
path(R range, format fmt = format::native): path(R irange, format fmt = format::native):
p_path("."), p_fmt(path_fmt(fmt)) p_path("."), p_fmt(path_fmt(fmt))
{ {
if constexpr(std::is_constructible_v<std::string, R const &>) { if constexpr(std::is_constructible_v<std::string, R const &>) {
append_str(std::string{range}); append_str(std::string{irange});
} else if (!range.empty()) { } else if (!irange.empty()) {
for (auto const &elem: range) { for (auto const &elem: irange) {
append_str(std::string{elem}); append_str(std::string{elem});
} }
} }
@ -333,19 +333,19 @@ struct path {
*/ */
string_range drive() const noexcept { string_range drive() const noexcept {
if (is_win()) { if (is_win()) {
string_range path = p_path; string_range tpath = p_path;
if (has_dslash(path)) { if (has_dslash(tpath)) {
char const *endp = strchr(p_path.data() + 2, '\\'); char const *endp = strchr(p_path.data() + 2, '\\');
if (!endp) { if (!endp) {
return path; return tpath;
} }
char const *pendp = strchr(endp + 1, '\\'); char const *pendp = strchr(endp + 1, '\\');
if (!pendp) { if (!pendp) {
return path; return tpath;
} }
return string_range{path.data(), pendp}; return string_range{tpath.data(), pendp};
} else if (has_letter(path)) { } else if (has_letter(tpath)) {
return path.slice(0, 2); return tpath.slice(0, 2);
} }
} }
return nullptr; return nullptr;

View File

@ -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()}; throw fs_error{"stat failure", p, errno_ec()};
} }
return file_status{ 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), mtime::get(sb),
std::uintmax_t(sb.st_size), std::uintmax_t(sb.st_size),
std::uintmax_t(sb.st_nlink) std::uintmax_t(sb.st_nlink)