From e2e10f33d85745f046d8c934032c18e6393e625e Mon Sep 17 00:00:00 2001 From: Yevgen Muntyan <17531749+muntyan@users.noreply.github.com> Date: Tue, 11 Dec 2007 06:36:03 -0600 Subject: [PATCH] Use binary mode with fopen() --- moo/mooapp/mooapp.c | 2 +- moo/mooedit/moocommand.c | 2 +- moo/mooedit/plugins/completion/completion.c | 2 +- moo/mooterm/mootermhelper.c | 4 ++-- moo/mooutils/mooutils-misc.c | 4 ++-- moo/mooutils/xdgmime/xdgmime.c | 2 +- moo/mooutils/xdgmime/xdgmimealias.c | 2 +- moo/mooutils/xdgmime/xdgmimecache.c | 2 +- moo/mooutils/xdgmime/xdgmimeglob.c | 2 +- moo/mooutils/xdgmime/xdgmimemagic.c | 2 +- moo/mooutils/xdgmime/xdgmimeparent.c | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/moo/mooapp/mooapp.c b/moo/mooapp/mooapp.c index 2feb1783..8348f6f4 100644 --- a/moo/mooapp/mooapp.c +++ b/moo/mooapp/mooapp.c @@ -729,7 +729,7 @@ moo_app_python_run_file (MooApp *app, g_return_val_if_fail (filename != NULL, FALSE); g_return_val_if_fail (moo_python_running (), FALSE); - file = _moo_fopen (filename, "r"); + file = _moo_fopen (filename, "rb"); g_return_val_if_fail (file != NULL, FALSE); res = moo_python_run_file (file, filename, NULL, NULL); diff --git a/moo/mooedit/moocommand.c b/moo/mooedit/moocommand.c index b2d6a8ca..95171444 100644 --- a/moo/mooedit/moocommand.c +++ b/moo/mooedit/moocommand.c @@ -1009,7 +1009,7 @@ get_options_from_file (MooCommandFactory *factory, FILE *file; char buf[2048]; - if (!(file = g_fopen (filename, "r"))) + if (!(file = g_fopen (filename, "rb"))) { g_warning ("%s: could not open file %s", G_STRFUNC, filename); return; diff --git a/moo/mooedit/plugins/completion/completion.c b/moo/mooedit/plugins/completion/completion.c index 23918010..d7ea04d3 100644 --- a/moo/mooedit/plugins/completion/completion.c +++ b/moo/mooedit/plugins/completion/completion.c @@ -281,7 +281,7 @@ cmpl_data_read_python_file (CmplData *data) if (!moo_python_running ()) return; - file = _moo_fopen (data->path, "r"); + file = _moo_fopen (data->path, "rb"); g_return_if_fail (file != NULL); dict = moo_python_create_script_dict ("__completion_module__"); diff --git a/moo/mooterm/mootermhelper.c b/moo/mooterm/mootermhelper.c index 787b0664..55d9d5ee 100644 --- a/moo/mooterm/mootermhelper.c +++ b/moo/mooterm/mootermhelper.c @@ -56,11 +56,11 @@ writelog (const char *format, ...) if (been_here) { - logfile = fopen (LOGFILE, "a+"); + logfile = fopen (LOGFILE, "ab+"); } else { - logfile = fopen (LOGFILE, "w+"); + logfile = fopen (LOGFILE, "wb+"); been_here = 1; } diff --git a/moo/mooutils/mooutils-misc.c b/moo/mooutils/mooutils-misc.c index c197e5a2..b87139f0 100644 --- a/moo/mooutils/mooutils-misc.c +++ b/moo/mooutils/mooutils-misc.c @@ -877,12 +877,12 @@ print_func_file (const char *string) if (!moo_log_file_written) { - file = fopen (moo_log_file, "w+"); + file = fopen (moo_log_file, "wb+"); moo_log_file_written = TRUE; } else { - file = fopen (moo_log_file, "a+"); + file = fopen (moo_log_file, "ab+"); } if (file) diff --git a/moo/mooutils/xdgmime/xdgmime.c b/moo/mooutils/xdgmime/xdgmime.c index 258a3801..ee050aeb 100644 --- a/moo/mooutils/xdgmime/xdgmime.c +++ b/moo/mooutils/xdgmime/xdgmime.c @@ -452,7 +452,7 @@ xdg_mime_get_mime_type_for_file (const char *file_name, if (data == NULL) return XDG_MIME_TYPE_UNKNOWN; - file = fopen (file_name, "r"); + file = fopen (file_name, "rb"); if (file == NULL) { free (data); diff --git a/moo/mooutils/xdgmime/xdgmimealias.c b/moo/mooutils/xdgmime/xdgmimealias.c index 12ce4289..f8067449 100644 --- a/moo/mooutils/xdgmime/xdgmimealias.c +++ b/moo/mooutils/xdgmime/xdgmimealias.c @@ -120,7 +120,7 @@ _xdg_mime_alias_read_from_file (XdgAliasList *list, char line[255]; int alloc; - file = fopen (file_name, "r"); + file = fopen (file_name, "rb"); if (file == NULL) return; diff --git a/moo/mooutils/xdgmime/xdgmimecache.c b/moo/mooutils/xdgmime/xdgmimecache.c index 75052ad3..919f9026 100644 --- a/moo/mooutils/xdgmime/xdgmimecache.c +++ b/moo/mooutils/xdgmime/xdgmimecache.c @@ -713,7 +713,7 @@ _xdg_mime_cache_get_mime_type_for_file (const char *file_name, if (data == NULL) return XDG_MIME_TYPE_UNKNOWN; - file = fopen (file_name, "r"); + file = fopen (file_name, "rb"); if (file == NULL) { free (data); diff --git a/moo/mooutils/xdgmime/xdgmimeglob.c b/moo/mooutils/xdgmime/xdgmimeglob.c index d94d0f51..1104e99d 100644 --- a/moo/mooutils/xdgmime/xdgmimeglob.c +++ b/moo/mooutils/xdgmime/xdgmimeglob.c @@ -521,7 +521,7 @@ _xdg_mime_glob_read_from_file (XdgGlobHash *glob_hash, FILE *glob_file; char line[255]; - glob_file = fopen (file_name, "r"); + glob_file = fopen (file_name, "rb"); if (glob_file == NULL) return; diff --git a/moo/mooutils/xdgmime/xdgmimemagic.c b/moo/mooutils/xdgmime/xdgmimemagic.c index 5441e6d6..4e07acb4 100644 --- a/moo/mooutils/xdgmime/xdgmimemagic.c +++ b/moo/mooutils/xdgmime/xdgmimemagic.c @@ -808,7 +808,7 @@ _xdg_mime_magic_read_from_file (XdgMimeMagic *mime_magic, FILE *magic_file; char header[12]; - magic_file = fopen (file_name, "r"); + magic_file = fopen (file_name, "rb"); if (magic_file == NULL) return; diff --git a/moo/mooutils/xdgmime/xdgmimeparent.c b/moo/mooutils/xdgmime/xdgmimeparent.c index d5e15786..249112b7 100644 --- a/moo/mooutils/xdgmime/xdgmimeparent.c +++ b/moo/mooutils/xdgmime/xdgmimeparent.c @@ -126,7 +126,7 @@ _xdg_mime_parent_read_from_file (XdgParentList *list, int i, alloc; XdgMimeParents *entry; - file = fopen (file_name, "r"); + file = fopen (file_name, "rb"); if (file == NULL) return;