Boilerplate: Open pipe in binary mode on Windows

Avoids a translation from LF to CRLF, which messes up the
expected byte counts.

Note that popen() on GLibc does not support the 'b' mode,
so this change is for Windows only. From the POSIX.2024
spec:

 > The behavior of popen() is specified for values of mode of "r",
 > "w", "re", and "we". Other modes such as "rb" and "wb" might be
 > supported by specific implementations, but these would not be
 > portable features.
This commit is contained in:
Luca Bacci 2025-02-04 11:30:03 +01:00
parent 0ca7d6e6a2
commit 1ee2d140b6

View file

@ -945,7 +945,11 @@ POPEN:
*close_cb = pclose;
sprintf (command, "%s %s %d", any2ppm, filename, page);
#ifndef _WIN32
return popen (command, "r");
#else
return popen (command, "rb");
#endif
}
static cairo_bool_t