ipcpipeline: Minimal fixes that allow building with MSVC
authorNirbheek Chauhan <nirbheek@centricular.com>
Sun, 12 Jan 2020 02:11:34 +0000 (07:41 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Tue, 14 Jan 2020 03:53:02 +0000 (09:23 +0530)
sys/ipcpipeline/gstipcpipelinecomm.c
sys/ipcpipeline/gstipcpipelinesrc.c

index 5ba913b..9176f49 100644 (file)
 #  include "config.h"
 #endif
 
-#include <unistd.h>
+#ifdef HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+#ifdef _MSC_VER
+/* ssize_t is not available, so match return value of read()/write() on MSVC */
+#define ssize_t int
+#endif
 #include <errno.h>
 #include <string.h>
 #include <gst/base/gstbytewriter.h>
@@ -219,7 +225,8 @@ write_to_fd_raw (GstIpcPipelineComm * comm, const void *data, size_t size)
   gboolean ret = TRUE;
 
   offset = 0;
-  GST_TRACE_OBJECT (comm->element, "Writing %zu bytes to fdout", size);
+  GST_TRACE_OBJECT (comm->element, "Writing %u bytes to fdout",
+      (unsigned) size);
   while (size) {
     ssize_t written =
         write (comm->fdout, (const unsigned char *) data + offset, size);
index 4a2abcb..fbb7568 100644 (file)
@@ -295,8 +295,8 @@ gst_ipc_pipeline_src_log_queue (GstIpcPipelineSrc * src)
     } else if (GST_IS_QUERY (object)) {
       GST_LOG_OBJECT (src, "  #%u: %s query", n, GST_QUERY_TYPE_NAME (object));
     } else if (GST_IS_BUFFER (object)) {
-      GST_LOG_OBJECT (src, "  #%u: %zu bytes buffer", n,
-          (size_t) gst_buffer_get_size (object));
+      GST_LOG_OBJECT (src, "  #%u: %" G_GSIZE_FORMAT " bytes buffer", n,
+          gst_buffer_get_size (object));
     } else {
       GST_LOG_OBJECT (src, "  #%u: unknown item in queue", n);
     }