mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-14 15:01:05 +00:00
Fix warnings.
This commit is contained in:
parent
1a6d365db5
commit
d13946bfb7
@ -154,12 +154,12 @@ TEST(FileTest, DefaultCtor) {
|
|||||||
// Checks if the file is open by reading one character from it.
|
// Checks if the file is open by reading one character from it.
|
||||||
bool IsOpen(int fd) {
|
bool IsOpen(int fd) {
|
||||||
char buffer;
|
char buffer;
|
||||||
return read(fd, &buffer, 1) == 1;
|
return FMT_POSIX(read(fd, &buffer, 1)) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsClosedInternal(int fd) {
|
bool IsClosedInternal(int fd) {
|
||||||
char buffer;
|
char buffer;
|
||||||
std::streamsize result = read(fd, &buffer, 1);
|
std::streamsize result = FMT_POSIX(read(fd, &buffer, 1));
|
||||||
return result == -1 && errno == EBADF;
|
return result == -1 && errno == EBADF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ TEST(FileTest, DtorCloseError) {
|
|||||||
// The close function must be called inside EXPECT_STDERR, otherwise
|
// The close function must be called inside EXPECT_STDERR, otherwise
|
||||||
// the system may allocate freed file descriptor when redirecting the
|
// the system may allocate freed file descriptor when redirecting the
|
||||||
// output in EXPECT_STDERR.
|
// output in EXPECT_STDERR.
|
||||||
EXPECT_STDERR(close(f->descriptor()); delete f,
|
EXPECT_STDERR(FMT_POSIX(close(f->descriptor())); delete f,
|
||||||
FormatSystemErrorMessage(EBADF, "cannot close file") + "\n");
|
FormatSystemErrorMessage(EBADF, "cannot close file") + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ std::string OutputRedirector::Read() {
|
|||||||
// Restore output.
|
// Restore output.
|
||||||
if (std::fflush(file_) != 0)
|
if (std::fflush(file_) != 0)
|
||||||
fmt::ThrowSystemError(errno, "cannot flush stream");
|
fmt::ThrowSystemError(errno, "cannot flush stream");
|
||||||
saved_.dup2(fileno(file_));
|
saved_.dup2(FMT_POSIX(fileno(file_)));
|
||||||
|
|
||||||
// Read everything from the pipe.
|
// Read everything from the pipe.
|
||||||
std::string content;
|
std::string content;
|
||||||
@ -174,7 +174,7 @@ std::string OutputRedirector::Read() {
|
|||||||
std::streamsize count = 0;
|
std::streamsize count = 0;
|
||||||
do {
|
do {
|
||||||
count = read_end_.read(buffer, BUFFER_SIZE);
|
count = read_end_.read(buffer, BUFFER_SIZE);
|
||||||
content.append(buffer, count);
|
content.append(buffer, static_cast<std::size_t>(count));
|
||||||
} while (count != 0);
|
} while (count != 0);
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user