Added fixes suggested in PR

This commit is contained in:
Tomer Lev 2022-11-10 19:01:29 +02:00
parent 9a74be1558
commit e2be5ddc0c
2 changed files with 15 additions and 3 deletions

View file

@ -202,10 +202,16 @@ void File::SetBuf(bool arg_buffered)
if ( ! f )
return;
#ifndef _MSC_VER
if ( setvbuf(f, NULL, arg_buffered ? _IOFBF : _IOLBF, 0) != 0 )
reporter->Error("setvbuf failed");
#else
// TODO: this turns off buffering altogether because Windows wants us to pass a valid
// buffer and length if we're going to pass one of the other modes. We need to
// investigate the performance ramifications of this.
if ( setvbuf(f, NULL, _IONBF, 0) != 0 )
#endif reporter->Error("setvbuf failed");
buffered = arg_buffered;
buffered = arg_buffered;
}
bool File::Close()