Commit c98ffb7e authored by Luca Bacci's avatar Luca Bacci Committed by Jehan
Browse files

Replace uses of plain fopen () with GLib's g_fopen ()

On Windows fopen () is limited to the current codepage,
GLib's g_fopen () instead accepts full UTF-8 by calling
_wfopen () internally (or a similar wide-char CRT routine).
parent afe9625b
......@@ -32,6 +32,7 @@
#include <locale.h>
#include <gio/gio.h>
#include <glib/gstdio.h>
#ifdef G_OS_WIN32
#include <io.h> /* get_osfhandle */
......@@ -863,7 +864,7 @@ WinMain (struct HINSTANCE__ *hInstance,
static void
wait_console_window (void)
{
FILE *console = fopen ("CONOUT$", "w");
FILE *console = g_fopen ("CONOUT$", "w");
SetConsoleTitleW (g_utf8_to_utf16 (_("GIMP output. Type any character to close this window."), -1, NULL, NULL, NULL));
fprintf (console, _("(Type any character to close this window)\n"));
......
......@@ -50,6 +50,7 @@
#endif
#include <glib.h>
#include <glib/gstdio.h>
#ifndef G_OS_WIN32
#include "libgimpbase/gimpsignal.h"
......@@ -979,7 +980,7 @@ gimp_plugin_sigfatal_handler (PEXCEPTION_POINTERS pExceptionInfo)
guchar buffer[256];
size_t read_len;
stream = fopen (plug_in_backtrace_path, "r");
stream = g_fopen (plug_in_backtrace_path, "r");
do
{
/* Just read and output directly the file content. */
......
......@@ -594,7 +594,7 @@ fits_open (const gchar *filename,
fp = g_fopen (filename, reading ? "rb" : "wb");
if (fp == NULL)
FITS_RETURN ("fits_open: fopen() failed", NULL);
FITS_RETURN ("fits_open: g_fopen() failed", NULL);
ff = fits_new_filestruct ();
if (ff == NULL)
......
......@@ -44,6 +44,7 @@
#include <setjmp.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <jpeglib.h>
#include <jerror.h>
......@@ -855,7 +856,7 @@ analyze_file (gchar *filename)
gint num_quant_tables;
GSList *source_list;
if ((f = fopen (filename, "rb")) == NULL)
if ((f = g_fopen (filename, "rb")) == NULL)
{
g_printerr ("Cannot open '%s'\n", filename);
return FALSE;
......
......@@ -378,7 +378,7 @@ load_thumbnail_image (GFile *file,
GimpImage *image = NULL;
GFile *file_out = gimp_temp_file ("jpg");
GFile *thumb_pp3_file = gimp_temp_file ("pp3");
FILE *thumb_pp3_f = fopen (g_file_peek_path (thumb_pp3_file), "w");
FILE *thumb_pp3_f = g_fopen (g_file_peek_path (thumb_pp3_file), "w");
gchar *rawtherapee_stdout = NULL;
const char *pp3_content =
"[Version]\n"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment