openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/glib-2.0/1_2.60.3-r0/glib-2.60.3/glib/gstdio.c
FILE* g_fopen(const gchar* filename, const gchar* mode)
{
#ifdef G_OS_WIN32
    wchar_t* wfilename = g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
    wchar_t* wmode;
    gchar* mode2;
    FILE* retval;
    int save_errno;

    if (wfilename == NULL)
    {
        errno = EINVAL;
        return NULL;
    }

    mode2 = _g_win32_get_mode_alias(mode);
    wmode = g_utf8_to_utf16(mode2, -1, NULL, NULL, NULL);
    g_free(mode2);

    if (wmode == NULL)
    {
        g_free(wfilename);
        errno = EINVAL;
        return NULL;
    }

    retval = _wfopen(wfilename, wmode);
    save_errno = errno;

    g_free(wfilename);
    g_free(wmode);

    errno = save_errno;
    return retval;
#else
    return fopen(filename, mode);
#endif
}
/**
 * g_fopen:
 * @filename: (type filename): a pathname in the GLib file name encoding
 *     (UTF-8 on Windows)
 * @mode: a string describing the mode in which the file should be opened
 *
 * A wrapper for the stdio fopen() function. The fopen() function
 * opens a file and associates a new stream with it.
 *
 * Because file descriptors are specific to the C library on Windows,
 * and a file descriptor is part of the FILE struct, the FILE* returned
 * by this function makes sense only to functions in the same C library.
 * Thus if the GLib-using code uses a different C library than GLib does,
 * the FILE* returned by this function cannot be passed to C library
 * functions like fprintf() or fread().
 *
 * See your C library manual for more details about fopen().
 *
 * Returns: A FILE* if the file was successfully opened, or %NULL if
 *     an error occurred
 *
 * Since: 2.6
 */
@filename: (type filename): a pathname in the GLib file name encoding
(UTF-8 on Windows)
@mode: a string describing the mode in which the file should be opened

A wrapper for the stdio fopen() function. The fopen() function
opens a file and associates a new stream with it.

Because file descriptors are specific to the C library on Windows,
and a file descriptor is part of the FILE struct, the FILE* returned
by this function makes sense only to functions in the same C library.
Thus if the GLib-using code uses a different C library than GLib does,
the FILE* returned by this function cannot be passed to C library
functions like fprintf() or fread().

See your C library manual for more details about fopen().

A FILE* if the file was successfully opened, or %NULL if
an error occurred


@filename : ( type filename ) : a pathname in the GLib file name encoding ( UTF - 8 on Windows ) @mode : a string describing the mode in which the file should be opened A wrapper for the stdio fopen () function . The fopen () function opens a file and associates a new stream with it . Because file descriptors are specific to the C library on Windows and a file descriptor is part of the FILE struct the FILE * returned by this function makes sense only to functions in the same C library . Thus if the GLib - using code uses a different C library than GLib does the FILE * returned by this function cannot be passed to C library functions like fprintf () or fread () . See your C library manual for more details about fopen () . A FILE * if the file was successfully opened or %NULL if an error occurred
FILE* g_fopen(const gchar* filename, const gchar* mode)
{
#ifdef G_OS_WIN32
    wchar_t* wfilename = g_utf8_to_utf16(filename, -1, NULL, NULL, NULL);
    wchar_t* wmode;
    gchar* mode2;
    FILE* retval;
    int save_errno;
    if (wfilename == NULL)
    {
        errno = EINVAL;
        return NULL;
    }
    mode2 = _g_win32_get_mode_alias(mode);
    wmode = g_utf8_to_utf16(mode2, -1, NULL, NULL, NULL);
    g_free(mode2);
    if (wmode == NULL)
    {
        g_free(wfilename);
        errno = EINVAL;
        return NULL;
    }
    retval = _wfopen(wfilename, wmode);
    save_errno = errno;
    g_free(wfilename);
    g_free(wmode);
    errno = save_errno;
    return retval;
#else
    return fopen(filename, mode);
#endif
}
FILE * g_fopen ( const gchar * filename , const gchar * mode ) { #ifdef G_OS_WIN32 wchar_t * wfilename = g_utf8_to_utf16 ( filename , -1 , NULL , NULL , NULL ) ; wchar_t * wmode ; gchar * mode2 ; FILE * retval ; int save_errno ; if ( wfilename == NULL ) { errno = EINVAL ; return NULL ; } mode2 = _g_win32_get_mode_alias ( mode ) ; wmode = g_utf8_to_utf16 ( mode2 , -1 , NULL , NULL , NULL ) ; g_free ( mode2 ) ; if ( wmode == NULL ) { g_free ( wfilename ) ; errno = EINVAL ; return NULL ; } retval = _wfopen ( wfilename , wmode ) ; save_errno = errno ; g_free ( wfilename ) ; g_free ( wmode ) ; errno = save_errno ; return retval ; #else return fopen ( filename , mode ) ; #endif }
g_fopen:
 @filename: (type filename): a pathname in the GLib file name encoding
     (UTF-8 on Windows)
 @mode: a string describing the mode in which the file should be opened
g_fopen : @filename : ( type filename ) : a pathname in the GLib file name encoding ( UTF - 8 on Windows ) @mode : a string describing the mode in which the file should be opened