Fix child-process communication (video monitor in particular)

103ef2ba08 introduced an API to write raw data (const void*)
to a child process, along with the previous API to
write (std::string const&)

VideoMonitor uses write_to_stdin("fixed text"), and g++
interprets this to use the (const void*) API instead
of the std::string, which breaks communication.
This commit is contained in:
Robin Gareus 2019-11-09 06:28:55 +01:00
parent edf9478fda
commit a8a699133e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 17 additions and 0 deletions

View File

@ -180,6 +180,14 @@ class LIBPBD_API SystemExec
*/
size_t write_to_stdin (std::string const& d, size_t len=0);
/** write into child-program's STDIN
* @param d text to write
* @param len length of data to write, if it is 0 (zero), d.length() is
* used to determine the number of bytes to transmit.
* @return number of bytes written.
*/
size_t write_to_stdin (const char* d, size_t len=0);
/** write into child-program's STDIN
* @param data data to write
* @param bytes length of data to write

View File

@ -401,6 +401,15 @@ SystemExec::write_to_stdin (std::string const& d, size_t len)
return write_to_stdin ((const void*)data, len);
}
size_t
SystemExec::write_to_stdin (const char* data, size_t len)
{
if (len == 0) {
len = strlen (data);
}
return write_to_stdin ((const void*)data, len);
}
#ifdef PLATFORM_WINDOWS /* Windows Process */
/* HELPER FUNCTIONS */