Revision: 45459
http://sourceforge.net/p/vice-emu/code/45459
Author: compyx
Date: 2025-01-10 11:24:41 +0000 (Fri, 10 Jan 2025)
Log Message:
-----------
Unbreak Windows build, hopefully
Introduce `VICE_PID_INVALID` constant to portably indicate an invalid pid.
Defined as -1 on Unix/MacOS, NULL on Windows (HANDLE is a typedef for void* on
Windows).
Modified Paths:
--------------
trunk/vice/src/arch/shared/coproc.h
trunk/vice/src/gfxoutputdrv/ffmpegexedrv.c
Modified: trunk/vice/src/arch/shared/coproc.h
===================================================================
--- trunk/vice/src/arch/shared/coproc.h 2025-01-10 11:10:18 UTC (rev 45458)
+++ trunk/vice/src/arch/shared/coproc.h 2025-01-10 11:24:41 UTC (rev 45459)
@@ -31,9 +31,11 @@
#if defined(WINDOWS_COMPILE)
#include <windows.h>
typedef HANDLE vice_pid_t;
+#define VICE_PID_INVALID NULL
#else
#include <sys/types.h>
typedef pid_t vice_pid_t;
+#define VICE_PID_INVALID -1
#endif
int fork_coproc(int *fd_wr, int *fd_rd, char *cmd, vice_pid_t *childpid);
Modified: trunk/vice/src/gfxoutputdrv/ffmpegexedrv.c
===================================================================
--- trunk/vice/src/gfxoutputdrv/ffmpegexedrv.c 2025-01-10 11:10:18 UTC (rev 45458)
+++ trunk/vice/src/gfxoutputdrv/ffmpegexedrv.c 2025-01-10 11:24:41 UTC (rev 45459)
@@ -570,7 +570,7 @@
#else
static int test_stdin = -1;
static int test_stdout = -1;
- static vice_pid_t test_pid = -1;
+ static vice_pid_t test_pid = VICE_PID_INVALID;
int res = -1;
size_t n;
static char output[0x40];
@@ -578,9 +578,9 @@
"ffmpeg 2>&1" /* redirect stderr to stdout. this better works on the big 3 */
};
/* kill old process in case it is still running for whatever reason */
- if (test_pid != -1) {
+ if (test_pid != VICE_PID_INVALID) {
kill_coproc(test_pid);
- test_pid = -1;
+ test_pid = VICE_PID_INVALID;
}
if (test_stdin != -1) {
close(test_stdin);
@@ -597,8 +597,13 @@
goto testend;
}
/*log_printf("test_ffmpeg_executable pid:%d stdin:%d stdout:%d", test_pid, test_stdin, test_stdout);*/
+#ifdef WINDOWS_COMPILE
+ if (test_pid == VICE_PID_INVALDI) {
+ log_error(ffmpeg_log, "Cannot fork ffmpeg process '%s' (pid == NULL).", command);
+#else
if (test_pid <= 0) {
log_error(ffmpeg_log, "Cannot fork ffmpeg process '%s' (pid <= 0).", command);
+#endif
goto testend;
}
@@ -618,9 +623,9 @@
}
testend:
/* kill new process */
- if (test_pid != -1) {
+ if (test_pid != VICE_PID_INVALID) {
kill_coproc(test_pid);
- test_pid = -1;
+ test_pid = VICE_PID_INVALID;
}
if (test_stdin != -1) {
close(test_stdin);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|