ref: 6698585c2cd75b34b5ffbce7bb87adaf6d8ac061
parent: 2a13b33f5890de7e010b4d93d73d8ae227d0e6e9
author: Chris Bagwell <chris@cnpbagwell.com>
date: Tue Oct 4 05:56:55 EDT 2011
Use "rb" with popen() on windows.
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,6 +44,7 @@
o Fixed man page description for unsigned samples and change
CVS to git references. (Ulrich Klauer)
+ o When using pipes (-p) on Windows, set file mode to binary. (cbagwell)
sox-14.3.2 2011-02-27
----------
--- a/src/formats.c
+++ b/src/formats.c
@@ -372,7 +372,10 @@
if (*identifier == '|') {
FILE * f = NULL;
#ifdef HAVE_POPEN
- f = popen(identifier + 1, "r");
+#ifndef POPEN_MODE
+#define POPEN_MODE "r"
+#endif
+ f = popen(identifier + 1, POPEN_MODE);
*io_type = lsx_io_pipe;
#else
lsx_fail("this build of SoX cannot open pipes");
@@ -385,7 +388,7 @@
char const * const command_format = "wget --no-check-certificate -q -O- \"%s\"";
char * command = lsx_malloc(strlen(command_format) + strlen(identifier));
sprintf(command, command_format, identifier);
- f = popen(command, "r");
+ f = popen(command, POPEN_MODE);
free(command);
*io_type = lsx_io_url;
#else
--- a/src/util.h
+++ b/src/util.h
@@ -106,6 +106,7 @@
#define open _open
#define pclose _pclose
#define popen _popen
+#define POPEN_MODE "rb"
#define setmode _setmode
#define snprintf _snprintf