Blame glib/gstdio.h

Packit ae235b
/* gstdio.h - GFilename wrappers for C library functions
Packit ae235b
 *
Packit ae235b
 * Copyright 2004 Tor Lillqvist
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General Public License
Packit ae235b
 * along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 */
Packit ae235b
Packit ae235b
#ifndef __G_STDIO_H__
Packit ae235b
#define __G_STDIO_H__
Packit ae235b
Packit ae235b
#include <glib/gprintf.h>
Packit ae235b
Packit ae235b
#include <sys/stat.h>
Packit ae235b
Packit ae235b
G_BEGIN_DECLS
Packit ae235b
Packit ae235b
#if (defined (__MINGW64_VERSION_MAJOR) || defined (_MSC_VER)) && !defined(_WIN64)
Packit ae235b
Packit ae235b
/* Make it clear that we mean the struct with 32-bit st_size and
Packit ae235b
 * 32-bit st_*time fields as that is how the 32-bit GLib DLL normally
Packit ae235b
 * has been compiled. If you get a compiler warning when calling
Packit ae235b
 * g_stat(), do take it seriously and make sure that the type of
Packit ae235b
 * struct stat the code in GLib fills in matches the struct the type
Packit ae235b
 * of struct stat you pass to g_stat(). To avoid hassle, to get file
Packit ae235b
 * attributes just use the GIO API instead which doesn't use struct
Packit ae235b
 * stat.
Packit ae235b
 *
Packit ae235b
 * Sure, it would be nicer to use a struct with 64-bit st_size and
Packit ae235b
 * 64-bit st_*time fields, but changing that now would break ABI. And
Packit ae235b
 * in MinGW, a plain "struct stat" is the one with 32-bit st_size and
Packit ae235b
 * st_*time fields.
Packit ae235b
 */
Packit ae235b
Packit ae235b
typedef struct _stat32 GStatBuf;
Packit ae235b
Packit ae235b
#else
Packit ae235b
Packit ae235b
typedef struct stat GStatBuf;
Packit ae235b
Packit ae235b
#endif
Packit ae235b
Packit ae235b
#if defined(G_OS_UNIX) && !defined(G_STDIO_NO_WRAP_ON_UNIX)
Packit ae235b
Packit ae235b
/* Just pass on to the system functions, so there's no potential for data
Packit ae235b
 * format mismatches, especially with large file interfaces. 
Packit ae235b
 * A few functions can't be handled in this way, since they are not defined
Packit ae235b
 * in a portable system header that we could include here.
Packit ae235b
 */
Packit ae235b
Packit ae235b
#ifndef __GTK_DOC_IGNORE__
Packit ae235b
#define g_chmod   chmod
Packit ae235b
#define g_open    open
Packit ae235b
#define g_creat   creat
Packit ae235b
#define g_rename  rename
Packit ae235b
#define g_mkdir   mkdir
Packit ae235b
#define g_stat    stat
Packit ae235b
#define g_lstat   lstat
Packit ae235b
#define g_remove  remove
Packit ae235b
#define g_fopen   fopen
Packit ae235b
#define g_freopen freopen
Packit ae235b
#define g_utime   utime
Packit ae235b
#endif
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_access (const gchar *filename,
Packit ae235b
	      int          mode);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_chdir  (const gchar *path);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_unlink (const gchar *filename);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_rmdir  (const gchar *filename);
Packit ae235b
Packit ae235b
#else /* ! G_OS_UNIX */
Packit ae235b
Packit ae235b
/* Wrappers for C library functions that take pathname arguments. On
Packit ae235b
 * Unix, the pathname is a file name as it literally is in the file
Packit ae235b
 * system. On well-maintained systems with consistent users who know
Packit ae235b
 * what they are doing and no exchange of files with others this would
Packit ae235b
 * be a well-defined encoding, preferably UTF-8. On Windows, the
Packit ae235b
 * pathname is always in UTF-8, even if that is not the on-disk
Packit ae235b
 * encoding, and not the encoding accepted by the C library or Win32
Packit ae235b
 * API.
Packit ae235b
 */
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_access    (const gchar *filename,
Packit ae235b
		 int          mode);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_chmod     (const gchar *filename,
Packit ae235b
		 int          mode);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_open      (const gchar *filename,
Packit ae235b
                 int          flags,
Packit ae235b
                 int          mode);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_creat     (const gchar *filename,
Packit ae235b
                 int          mode);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_rename    (const gchar *oldfilename,
Packit ae235b
                 const gchar *newfilename);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_mkdir     (const gchar *filename,
Packit ae235b
                 int          mode);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_chdir     (const gchar *path);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_stat      (const gchar *filename,
Packit ae235b
                 GStatBuf    *buf);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_lstat     (const gchar *filename,
Packit ae235b
                 GStatBuf    *buf);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_unlink    (const gchar *filename);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_remove    (const gchar *filename);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_rmdir     (const gchar *filename);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
FILE *g_fopen   (const gchar *filename,
Packit ae235b
                 const gchar *mode);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
FILE *g_freopen (const gchar *filename,
Packit ae235b
                 const gchar *mode,
Packit ae235b
                 FILE        *stream);
Packit ae235b
Packit ae235b
struct utimbuf;			/* Don't need the real definition of struct utimbuf when just
Packit ae235b
				 * including this header.
Packit ae235b
				 */
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
int g_utime     (const gchar    *filename,
Packit ae235b
		 struct utimbuf *utb);
Packit ae235b
Packit ae235b
#endif /* G_OS_UNIX */
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_2_36
Packit ae235b
gboolean g_close (gint       fd,
Packit ae235b
                  GError   **error);
Packit ae235b
Packit ae235b
G_END_DECLS
Packit ae235b
Packit ae235b
#endif /* __G_STDIO_H__ */