Skip to content

Commit ce058f2

Browse files
committed
minor util changes
1 parent bb481e6 commit ce058f2

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/odr/internal/util/odr_meta_util.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ struct FileMeta;
77
}
88

99
namespace odr::internal::util::meta {
10+
1011
nlohmann::json meta_to_json(const FileMeta &meta);
12+
1113
}

src/odr/internal/util/stream_util.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ using int_type = std::streambuf::int_type;
1111
static constexpr int_type eof = std::streambuf::traits_type::eof();
1212

1313
std::string stream::read(std::istream &in) {
14-
return std::string(std::istreambuf_iterator<char>(in), {});
14+
return {std::istreambuf_iterator<char>(in), {}};
1515
}
1616

1717
std::string stream::read(std::istream &in, std::size_t size) {
1818
std::string result(size, '\0');
19-
in.read(result.data(), size);
19+
in.read(result.data(), static_cast<std::streamsize>(size));
2020
result.resize(in.gcount());
2121
return result;
2222
}
@@ -94,13 +94,13 @@ std::istream &stream::pipe_until(std::istream &in, std::ostream &out,
9494
return in;
9595
}
9696
if (inclusive) {
97-
out.put(c);
97+
out.put(static_cast<char>(c));
9898
}
9999
if (c == until_char) {
100100
return in;
101101
}
102102
if (!inclusive) {
103-
out.put(c);
103+
out.put(static_cast<char>(c));
104104
}
105105
}
106106
}

src/odr/internal/util/string_util.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <vector>
77

88
namespace odr::internal::util::string {
9+
910
bool starts_with(const std::string &string, const std::string &with);
1011
bool ends_with(const std::string &string, const std::string &with);
1112

@@ -26,4 +27,5 @@ std::string to_string(double d, int precision);
2627
std::string u16string_to_string(const std::u16string &string);
2728
std::u16string string_to_u16string(const std::string &string);
2829
std::string c16str_to_string(const char16_t *c16str, std::size_t length);
30+
2931
} // namespace odr::internal::util::string

src/odr/internal/util/xml_util.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class Path;
1717
}
1818

1919
namespace odr::internal::util::xml {
20+
2021
pugi::xml_document parse(const std::string &);
2122
pugi::xml_document parse(std::istream &);
2223
pugi::xml_document parse(const abstract::ReadableFilesystem &, const Path &);
@@ -36,4 +37,5 @@ struct StringToken {
3637
};
3738

3839
std::vector<StringToken> tokenize_text(const std::string &text);
40+
3941
} // namespace odr::internal::util::xml

0 commit comments

Comments
 (0)