aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2009-10-21 04:30:15 +0200
committerJay Berkenbilt <ejb@ql.org>2009-10-21 04:30:15 +0200
commitf5d772773e588403bea8b5401f5e305b97dea16f (patch)
treeca0eea89357098dc9cf0fea6bdf0fa052b37dd1f
parent27ee889c0e74e84035c2c208c856729a16d866c7 (diff)
downloadqpdf-f5d772773e588403bea8b5401f5e305b97dea16f.tar.zst
make line buffering os-specific
git-svn-id: svn+q:///qpdf/trunk@852 71b93d88-0707-0410-a8cf-f5a4172ac649
-rw-r--r--include/qpdf/QUtil.hh4
-rw-r--r--libqpdf/QUtil.cc8
-rw-r--r--qpdf/qpdf.cc2
-rw-r--r--qpdf/test_driver.cc2
4 files changed, 14 insertions, 2 deletions
diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh
index 45dc9c5b..d0626a2e 100644
--- a/include/qpdf/QUtil.hh
+++ b/include/qpdf/QUtil.hh
@@ -52,6 +52,10 @@ namespace QUtil
void binary_stdout();
QPDF_DLL
void binary_stdin();
+ // Set stdout to line buffered
+ QPDF_DLL
+ void setLineBuf(FILE*);
+
// May modify argv0
QPDF_DLL
diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc
index bc81ce57..1bdae0fe 100644
--- a/libqpdf/QUtil.cc
+++ b/libqpdf/QUtil.cc
@@ -127,6 +127,14 @@ QUtil::binary_stdin()
#endif
}
+void
+QUtil::setLineBuf(FILE* f)
+{
+#ifndef _WIN32
+ setvbuf(f, (char *) NULL, _IOLBF, 0);
+#endif
+}
+
char*
QUtil::getWhoami(char* argv0)
{
diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc
index f9af8609..431f6dab 100644
--- a/qpdf/qpdf.cc
+++ b/qpdf/qpdf.cc
@@ -534,7 +534,7 @@ parse_encrypt_options(
int main(int argc, char* argv[])
{
whoami = QUtil::getWhoami(argv[0]);
- setvbuf(stdout, (char *) NULL, _IOLBF, 0);
+ QUtil::setLineBuf(stdout);
// For libtool's sake....
if (strncmp(whoami, "lt-", 3) == 0)
diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc
index 68866b54..f4998913 100644
--- a/qpdf/test_driver.cc
+++ b/qpdf/test_driver.cc
@@ -320,7 +320,7 @@ void runtest(int n, char const* filename)
int main(int argc, char* argv[])
{
- setvbuf(stdout, (char *) NULL, _IOLBF, 0);
+ QUtil::setLineBuf(stdout);
if ((whoami = strrchr(argv[0], '/')) == NULL)
{
whoami = argv[0];