mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
gio tool: Fix build on Windows/non-GCC
The recently-added GIO tools is intended to be built on all platforms, so adjust the code a bit to enable this: -Use gssize instead of ssize_t, as ssize_t is not supported by all compilers. -Include io.h on Windows, and define STDIN_FILENO and STDOUT_FILENO if necessary on Windows. https://bugzilla.gnome.org/show_bug.cgi?id=768357
This commit is contained in:
parent
ca03753853
commit
b08a8dc949
@ -23,6 +23,18 @@
|
|||||||
#include <gi18n.h>
|
#include <gi18n.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef STDOUT_FILENO
|
||||||
|
#define STDOUT_FILENO 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "gio-tool.h"
|
#include "gio-tool.h"
|
||||||
|
|
||||||
|
|
||||||
@ -56,7 +68,7 @@ cat (GFile *file)
|
|||||||
res = g_input_stream_read (in, buffer, sizeof (buffer) - 1, NULL, &error);
|
res = g_input_stream_read (in, buffer, sizeof (buffer) - 1, NULL, &error);
|
||||||
if (res > 0)
|
if (res > 0)
|
||||||
{
|
{
|
||||||
ssize_t written;
|
gssize written;
|
||||||
|
|
||||||
p = buffer;
|
p = buffer;
|
||||||
while (res > 0)
|
while (res > 0)
|
||||||
|
@ -22,8 +22,19 @@
|
|||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
#include <gi18n.h>
|
#include <gi18n.h>
|
||||||
|
|
||||||
#include "gio-tool.h"
|
#ifdef G_OS_WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef STDIN_FILENO
|
||||||
|
#define STDIN_FILENO 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gio-tool.h"
|
||||||
|
|
||||||
static char *etag = NULL;
|
static char *etag = NULL;
|
||||||
static gboolean backup = FALSE;
|
static gboolean backup = FALSE;
|
||||||
@ -84,7 +95,7 @@ save (GFile *file)
|
|||||||
res = read (STDIN_FILENO, buffer, 1024);
|
res = read (STDIN_FILENO, buffer, 1024);
|
||||||
if (res > 0)
|
if (res > 0)
|
||||||
{
|
{
|
||||||
ssize_t written;
|
gssize written;
|
||||||
|
|
||||||
p = buffer;
|
p = buffer;
|
||||||
while (res > 0)
|
while (res > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user