[x265] [PATCH] fix output to pipe on Windows

Ma0 mateuszb at poczta.onet.pl
Sat Feb 10 06:19:37 CET 2018


# HG changeset patch
# User Ma0 <mateuszb at poczta.onet.pl>
# Date 1518239805 -3600
#      Sat Feb 10 06:16:45 2018 +0100
# Node ID c4d56ef3611d3c157ce81241b655e953d58308f2
# Parent  1949157705cef7e6e97df116e2f71636f4cb0025
fix output to pipe on Windows

diff -r 1949157705ce -r c4d56ef3611d source/output/raw.cpp
--- a/source/output/raw.cpp	Wed Jan 31 19:44:19 2018 +0530
+++ b/source/output/raw.cpp	Sat Feb 10 06:16:45 2018 +0100
@@ -24,6 +24,14 @@
 
 #include "raw.h"
 
+#if _WIN32
+#include <io.h>
+#include <fcntl.h>
+#if defined(_MSC_VER)
+#pragma warning(disable: 4996) // POSIX setmode and fileno deprecated
+#endif
+#endif
+
 using namespace X265_NS;
 using namespace std;
 
@@ -33,6 +41,9 @@
     if (!strcmp(fname, "-"))
     {
         ofs = stdout;
+#if _WIN32
+        setmode(fileno(stdout), O_BINARY);
+#endif
         return;
     }
     ofs = x265_fopen(fname, "wb");


More information about the x265-devel mailing list