[flang-commits] [PATCH] D106726: [flang][msvc] Fix external-io unittest.
Michael Kruse via Phabricator via flang-commits
flang-commits at lists.llvm.org
Mon Jul 26 13:34:56 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcbad57613e76: [flang][msvc] Fix external-io unittest. (authored by Meinersbur).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106726/new/
https://reviews.llvm.org/D106726
Files:
flang/runtime/file.cpp
flang/runtime/unit.cpp
Index: flang/runtime/unit.cpp
===================================================================
--- flang/runtime/unit.cpp
+++ flang/runtime/unit.cpp
@@ -687,13 +687,13 @@
if (const char *p{
FindLastNewline(Frame(), prevNL - 1 - frameOffsetInFile_)}) {
recordOffsetInFrame_ = p - Frame() + 1;
- *recordLength = prevNL - (frameOffsetInFile_ + recordOffsetInFrame_);
+ recordLength = prevNL - (frameOffsetInFile_ + recordOffsetInFrame_);
break;
}
}
if (frameOffsetInFile_ == 0) {
recordOffsetInFrame_ = 0;
- *recordLength = prevNL;
+ recordLength = prevNL;
break;
}
frameOffsetInFile_ -= std::min<std::int64_t>(frameOffsetInFile_, 1024);
Index: flang/runtime/file.cpp
===================================================================
--- flang/runtime/file.cpp
+++ flang/runtime/file.cpp
@@ -45,7 +45,8 @@
if (::GetTempFileNameA(tempDirName, "Fortran", uUnique, tempFileName) == 0) {
return -1;
}
- int fd{::_open(tempFileName, _O_CREAT | _O_TEMPORARY, _S_IREAD | _S_IWRITE)};
+ int fd{::_open(
+ tempFileName, _O_CREAT | _O_TEMPORARY | _O_RDWR, _S_IREAD | _S_IWRITE)};
#else
char path[]{"/tmp/Fortran-Scratch-XXXXXX"};
int fd{::mkstemp(path)};
@@ -245,7 +246,7 @@
inline static int openfile_ftruncate(int fd, OpenFile::FileOffset at) {
#ifdef _WIN32
- return !::_chsize(fd, at);
+ return ::_chsize(fd, at);
#else
return ::ftruncate(fd, at);
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106726.361779.patch
Type: text/x-patch
Size: 1492 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20210726/430ee38b/attachment.bin>
More information about the flang-commits
mailing list