Skip to content

Commit 30fd18e

Browse files
vonosmasgithub-actions[bot]
authored andcommitted
Automerge: [libc] Fix -Wshorten-64-to-32 in fileop_test. (#168451)
Explicitly cast 0 to size_t type to match fread() return type. This follows the pattern used elsewhere in this file, and fixes -Wshorten-64-to-32 warnings when building the test.
2 parents b8be4b0 + 5bba4fd commit 30fd18e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libc/test/src/stdio/fileop_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ TEST_F(LlvmLibcFILETest, SimpleFileOperations) {
101101

102102
// This is not a readable file.
103103
ASSERT_THAT(LIBC_NAMESPACE::fread(data, 1, 1, file),
104-
returns(EQ(0)).with_errno(NE(0)));
104+
returns(EQ(size_t(0))).with_errno(NE(0)));
105105

106106
ASSERT_EQ(0, LIBC_NAMESPACE::fclose(file));
107107

@@ -175,7 +175,7 @@ TEST_F(LlvmLibcFILETest, FOpenFWriteSizeGreaterThanOne) {
175175
// Trying to read more should fetch nothing.
176176
ASSERT_THAT(
177177
LIBC_NAMESPACE::fread(read_data, sizeof(MyStruct), WRITE_NMEMB, file),
178-
returns(EQ(0)).with_errno(EQ(0)));
178+
returns(EQ(size_t(0))).with_errno(EQ(0)));
179179
EXPECT_NE(LIBC_NAMESPACE::feof(file), 0);
180180
EXPECT_EQ(LIBC_NAMESPACE::ferror(file), 0);
181181
ASSERT_EQ(LIBC_NAMESPACE::fclose(file), 0);

0 commit comments

Comments
 (0)