mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-19 20:18:49 +00:00
Fix warnings.
This commit is contained in:
parent
5cf3b6dc7d
commit
eb09e58697
@ -148,7 +148,8 @@ std::string GetSystemErrorMessage(int error_code) {
|
||||
enum { BUFFER_SIZE = 200 };
|
||||
char buffer[BUFFER_SIZE];
|
||||
EXPECT_EQ(0, strerror_s(buffer, BUFFER_SIZE, error_code));
|
||||
EXPECT_LT(std::strlen(buffer), BUFFER_SIZE - 1);
|
||||
std::size_t max_len = BUFFER_SIZE - 1;
|
||||
EXPECT_LT(std::strlen(buffer), max_len);
|
||||
return buffer;
|
||||
#endif
|
||||
}
|
||||
|
@ -262,7 +262,8 @@ std::string Read(File &f, std::size_t count) {
|
||||
std::size_t offset = 0;
|
||||
do {
|
||||
n = f.read(&buffer[offset], count - offset);
|
||||
offset += n;
|
||||
// We can't read more than size_t bytes since count has type size_t.
|
||||
offset += static_cast<std::size_t>(n);
|
||||
} while (offset < count && n != 0);
|
||||
buffer.resize(offset);
|
||||
return buffer;
|
||||
@ -275,7 +276,9 @@ void Write(File &f, fmt::StringRef s) {
|
||||
do {
|
||||
std::streamsize count = f.write(ptr, num_chars_left);
|
||||
ptr += count;
|
||||
num_chars_left -= count;
|
||||
// We can't write more than size_t bytes since num_chars_left
|
||||
// has type size_t.
|
||||
num_chars_left -= static_cast<std::size_t>(count);
|
||||
} while (num_chars_left != 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user