summaryrefslogtreecommitdiff
path: root/json-glib/json-glib-format.c
diff options
context:
space:
mode:
Diffstat (limited to 'json-glib/json-glib-format.c')
-rw-r--r--json-glib/json-glib-format.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/json-glib/json-glib-format.c b/json-glib/json-glib-format.c
index f10cee9..d39b325 100644
--- a/json-glib/json-glib-format.c
+++ b/json-glib/json-glib-format.c
@@ -23,7 +23,10 @@
#include "config.h"
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
+
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
@@ -33,6 +36,12 @@
#include <glib/gi18n.h>
#include <json-glib/json-glib.h>
+#if defined (G_OS_WIN32) && !defined (HAVE_UNISTD_H)
+#include <io.h>
+
+#define STDOUT_FILENO 1
+#endif
+
static char **files = NULL;
static gboolean prettify = FALSE;
static int indent_spaces = 2;
@@ -89,7 +98,7 @@ format (JsonParser *parser,
p = data;
while (len > 0)
{
- ssize_t written = write (STDOUT_FILENO, p, len);
+ gssize written = write (STDOUT_FILENO, p, len);
if (written == -1 && errno != EINTR)
{