Skip to content

Commit

Permalink
[libc][obvious] fix sign warning in file_writer
Browse files Browse the repository at this point in the history
In the sign writer, a size_t was being compared to an int. This patch
casts the size_t to an int so that the comparison doesn't cause a sign
comparison warning.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D127984
  • Loading branch information
michaelrj-google committed Jun 17, 2022
1 parent fb3477a commit ad709a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libc/src/stdio/printf_core/file_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace printf_core {

int FileWriter::write(const char *__restrict to_write, size_t len) {
int written = file->write_unlocked(to_write, len);
if (written != len)
if (written != static_cast<int>(len))
written = -1;
if (file->error_unlocked())
written = -2;
Expand Down

0 comments on commit ad709a7

Please sign in to comment.