@@ -47,12 +47,13 @@ public:
4747
4848 // / On construction, an ROptions parameter can customize the RRawFile behavior
4949 struct ROptions {
50+ static constexpr size_t kUseDefaultBlockSize = std::size_t (-1 ); // /< Use protocol-dependent default block size
51+
5052 ELineBreaks fLineBreak = ELineBreaks::kAuto ;
51- // / Read at least fBlockSize bytes at a time. A value of zero turns off I/O buffering. A negative value indicates
52- // / that the protocol-dependent default block size should be used.
53+ // / Read at least fBlockSize bytes at a time. A value of zero turns off I/O buffering.
5354 // / After construction, a negative block size is used to store the block size value when buffering is turned off
5455 // / (see `SetBuffering()`).
55- int fBlockSize = - 1 ;
56+ size_t fBlockSize = kUseDefaultBlockSize ;
5657 // Define an empty constructor to work around a bug in Clang: https://github.com/llvm/llvm-project/issues/36032
5758 ROptions () {}
5859 };
@@ -119,6 +120,8 @@ private:
119120 std::uint64_t fFileSize = kUnknownFileSize ;
120121 // / Files are opened lazily and only when required; the open state is kept by this flag
121122 bool fIsOpen = false ;
123+ // / Runtime switch to decide if reads are buffered or directly sent to ReadAtImpl()
124+ bool fIsBuffering = true ;
122125
123126protected:
124127 std::string fUrl ;
@@ -180,7 +183,7 @@ public:
180183 // / Turn off buffered reads; all scalar read requests go directly to the implementation. Buffering can be turned
181184 // / back on.
182185 void SetBuffering (bool value);
183- bool IsBuffering () const { return fOptions . fBlockSize > 0 ; }
186+ bool IsBuffering () const { return fIsBuffering ; }
184187
185188 // / Read the next line starting from the current value of fFilePos. Returns false if the end of the file is reached.
186189 bool Readln (std::string &line);
0 commit comments