diff options
-rw-r--r-- | json-glib/json-glib-format.c | 11 | ||||
-rw-r--r-- | json-glib/json-glib-validate.c | 2 |
2 files changed, 12 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) { diff --git a/json-glib/json-glib-validate.c b/json-glib/json-glib-validate.c index 97bd53d..2eb013a 100644 --- a/json-glib/json-glib-validate.c +++ b/json-glib/json-glib-validate.c @@ -23,7 +23,9 @@ #include "config.h" +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #include <stdlib.h> #include <stdio.h> #include <locale.h> |