[flang] Fix Boolean flag arguments

Two sites in io-api.cpp pass the wrong Boolean flag value to
signify that a new anonymous unit is a formatted file.

Differential Revision: https://reviews.llvm.org/D100419

GitOrigin-RevId: 17e2f236f05a8eb73bd66d5f286dccc14d412e74
diff --git a/runtime/buffer.h b/runtime/buffer.h
index c601ee7..1097824 100644
--- a/runtime/buffer.h
+++ b/runtime/buffer.h
@@ -79,7 +79,7 @@
       MakeDataContiguous(handler, bytes);
       RUNTIME_CHECK(handler, at == fileOffset_ + frame_);
     }
-    while (FrameLength() < bytes) {
+    if (FrameLength() < bytes) {
       auto next{start_ + length_};
       RUNTIME_CHECK(handler, next < size_);
       auto minBytes{bytes - FrameLength()};
@@ -88,9 +88,6 @@
           fileOffset_ + length_, buffer_ + next, minBytes, maxBytes, handler)};
       length_ += got;
       RUNTIME_CHECK(handler, length_ <= size_);
-      if (got < minBytes) {
-        break; // error or EOF & program can handle it
-      }
     }
     return FrameLength();
   }
diff --git a/runtime/io-api.cpp b/runtime/io-api.cpp
index 069e57f..c9cfb20 100644
--- a/runtime/io-api.cpp
+++ b/runtime/io-api.cpp
@@ -310,7 +310,7 @@
     ExternalUnit unitNumber, const char *sourceFile, int sourceLine) {
   Terminator terminator{sourceFile, sourceLine};
   ExternalFileUnit &unit{ExternalFileUnit::LookUpOrCreateAnonymous(
-      unitNumber, Direction::Output, true /*formatted*/, terminator)};
+      unitNumber, Direction::Output, false /*formatted*/, terminator)};
   return &unit.BeginIoStatement<ExternalMiscIoStatementState>(
       unit, ExternalMiscIoStatementState::Endfile, sourceFile, sourceLine);
 }
@@ -319,7 +319,7 @@
     ExternalUnit unitNumber, const char *sourceFile, int sourceLine) {
   Terminator terminator{sourceFile, sourceLine};
   ExternalFileUnit &unit{ExternalFileUnit::LookUpOrCreateAnonymous(
-      unitNumber, Direction::Input, true /*formatted*/, terminator)};
+      unitNumber, Direction::Input, false /*formatted*/, terminator)};
   return &unit.BeginIoStatement<ExternalMiscIoStatementState>(
       unit, ExternalMiscIoStatementState::Rewind, sourceFile, sourceLine);
 }