[libcxx-commits] [PATCH] D154514: [libc++] Fix incorrect length check in std::basic_filebuf
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jul 12 01:35:15 PDT 2023
mstorsjo added a comment.
In D154514#4478657 <https://reviews.llvm.org/D154514#4478657>, @ldionne wrote:
> @mstorsjo I am seeing some errors on Windows, and on Windows only: https://buildkite.com/llvm-project/libcxx-ci/builds/27632.
>
> Do you think you (or someone else seeing this w/ Windows access) can help troubleshoot this? I expect this is going to be challenging to troubleshoot without being able to repro locally. Otherwise, I'll XFAIL the two tests I added on Windows.
By default the streams are opened in text mode, and in text mode, if you output `\n`, it will actually write `\r\n` to the file. By opening all streams in binary mode, you bypass such translations; add `std::ios::binary` to the `open()` calls. With the attached suggested edits, the buffered_reads test seems to pass for me, I presume the corresponding change for the buffered_writes test fixes that too.
================
Comment at: libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/buffered_reads.pass.cpp:55
+ std::ofstream ofs;
+ ofs.open(p);
+ assert(ofs.is_open());
----------------
================
Comment at: libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/buffered_reads.pass.cpp:71
+ policy(ifs);
+ ifs.open(p, std::ios::ate);
+ assert(ifs.is_open());
----------------
================
Comment at: libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/buffered_reads.pass.cpp:111
+ ofs.imbue(std::locale(std::locale::classic(), new std::codecvt_utf8<wchar_t>));
+ ofs.open(p);
+ assert(ofs.is_open());
----------------
================
Comment at: libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/buffered_reads.pass.cpp:128
+ policy(ifs);
+ ifs.open(p);
+ assert(ifs.is_open());
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154514/new/
https://reviews.llvm.org/D154514
More information about the libcxx-commits
mailing list