From f37b2bfa61b65d0b911a47cd1d9d1f7e1510c096 Mon Sep 17 00:00:00 2001 From: Loo Rong Jie Date: Tue, 3 Jul 2018 01:41:29 -0700 Subject: [PATCH] [singlejar] Replace setbuffer with setvbuf `setbuffer` is not available on MSVC, use C-standard `setvbuf` from `stdio.h` instead. `setbuffer` was introduced in https://github.com/bazelbuild/bazel/commit/b4cf5e32a94024c1bfdc6ca432677c31306a3fb5. #2241 /cc @laszlocsomor Closes #5500. PiperOrigin-RevId: 203083781 --- src/tools/singlejar/output_jar.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/singlejar/output_jar.cc b/src/tools/singlejar/output_jar.cc index 1bd78daa7b9c9c..aec2cc15a395f5 100644 --- a/src/tools/singlejar/output_jar.cc +++ b/src/tools/singlejar/output_jar.cc @@ -275,7 +275,7 @@ bool OutputJar::Open() { } outpos_ = 0; buffer_.reset(new char[kBufferSize]); - setbuffer(file_, buffer_.get(), kBufferSize); + setvbuf(file_, buffer_.get(), _IOFBF, kBufferSize); if (options_->verbose) { fprintf(stderr, "Writing to %s\n", path()); }