Commit 8f258fa4 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Use g_mkdir, not mkdir. (cb_cleanup_sendto): Use g_unlink and g_rmdir, not

2005-03-23  Morten Welinder  <terra@gnome.org>

	* src/workbook-view.c (wb_view_sendto): Use g_mkdir, not mkdir.
	(cb_cleanup_sendto): Use g_unlink and g_rmdir, not unlink and
	rmdir.

	* src/mathfunc.c (random_01): Use g_open, not open.

	* src/main-application.c (warn_about_ancient_gnumerics): use
	g_stat, not stat.

	* src/func.c (function_dump_defs): Use g_fopen, not fopen.

	* src/file-autoft.c (category_list_get_from_dir_list): Use
	g_file_test, not stat.
parent 96d1cbca
2005-03-23 Morten Welinder <terra@gnome.org>
* src/workbook-view.c (wb_view_sendto): Use g_mkdir, not mkdir.
(cb_cleanup_sendto): Use g_unlink and g_rmdir, not unlink and
rmdir.
* src/mathfunc.c (random_01): Use g_open, not open.
* src/main-application.c (warn_about_ancient_gnumerics): use
g_stat, not stat.
* src/func.c (function_dump_defs): Use g_fopen, not fopen.
* src/file-autoft.c (category_list_get_from_dir_list): Use
g_file_test, not stat.
2005-03-23 Stepan Kasal <kasal@ucw.cz>
* configure.in (HAVE_LIBZ): Don't define it, noone uses it, since
......
2005-03-23 Morten Welinder <terra@gnome.org>
* src/workbook-view.c (wb_view_sendto): Use g_mkdir, not mkdir.
(cb_cleanup_sendto): Use g_unlink and g_rmdir, not unlink and
rmdir.
* src/mathfunc.c (random_01): Use g_open, not open.
* src/main-application.c (warn_about_ancient_gnumerics): use
g_stat, not stat.
* src/func.c (function_dump_defs): Use g_fopen, not fopen.
* src/file-autoft.c (category_list_get_from_dir_list): Use
g_file_test, not stat.
2005-03-23 Stepan Kasal <kasal@ucw.cz>
* configure.in (HAVE_LIBZ): Don't define it, noone uses it, since
......
2005-03-23 Morten Welinder <terra@gnome.org>
* ms-escher.c (ms_escher_read_OPT): Use g_fopen, not fopen.
* ms-excel-read.c (excel_read_IMDATA): Ditto.
2005-03-15 Jody Goldberg <jody@gnome.org>
* ms-excel-write.c (excel_write_workbook) : init n when totaling the
......
......@@ -36,6 +36,7 @@
#include "ms-obj.h"
#include <gsf/gsf-utils.h>
#include <glib/gstdio.h>
#include <zlib.h>
#undef G_LOG_DOMAIN
......@@ -1879,11 +1880,12 @@ ms_escher_read_OPT (MSEscherState *state, MSEscherHeader *h)
d (7, {
static int count = 0;
char *name = g_strdup_printf ("gnumeric-complex-opt-[%d]-%d", pid, count++);
FILE *f = fopen (name, "w");
FILE *f = g_fopen (name, "w");
if (f != NULL) {
fwrite (extra, 1, val, f);
fclose (f);
}
g_free (name);
});
if (id & MS_OBJ_ATTR_IS_PTR_MASK) {
ms_escher_header_add_attr (h,
......
......@@ -20,6 +20,7 @@
**/
#include <gnumeric-config.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <gnumeric.h>
#include <string.h>
......@@ -3639,7 +3640,7 @@ excel_read_IMDATA (BiffQuery *q, gboolean keep_image)
from_name, format_name);
file_name = g_strdup_printf ("imdata%d", count++);
f = fopen (file_name, "w");
f = g_fopen (file_name, "w");
fwrite (q->data+8, 1, q->length-8, f);
g_free (file_name);
image_len += 8;
......
2005-03-23 Morten Welinder <terra@gnome.org>
* python-loader.c (gnumeric_fopen_error_info): Use g_fopen, not
fopen.
2005-03-04 Jody Goldberg <jody@gnome.org>
* boot.c (go_plugin_init) : register types dynamicly using the plugin
......
......@@ -33,6 +33,7 @@
#include <goffice/app/module-plugin-defs.h>
#include <gsf/gsf-impl-utils.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <stdlib.h>
#include <glib.h>
......@@ -81,7 +82,7 @@ gnumeric_fopen_error_info (const char *file_name, const char *mode, ErrorInfo **
g_return_val_if_fail (ret_error != NULL, NULL);
*ret_error = NULL;
f = fopen (file_name, mode);
f = g_fopen (file_name, mode);
if (f == NULL) {
if (strchr (mode, 'w') != NULL && strchr (mode, 'r') == NULL) {
*ret_error = error_info_new_printf (
......
2005-03-23 Morten Welinder <terra@gnome.org>
* sample_datasource.c (go_plugin_init): Use g_open, not open. Use
g_build_filename, not concat.
(go_plugin_shutdown): Use g_unlink, not unlink.
2005-02-08 Jody Goldberg <jody@gnome.org>
* Release 1.5.0
......
......@@ -39,6 +39,7 @@
#include <string.h>
#include <fcntl.h>
#include <stdio.h>
#include <glib/gstdio.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "gnumeric:atl"
......@@ -149,13 +150,14 @@ go_plugin_init (GOPlugin *plugin, GOCmdContext *cc)
fprintf (stderr, ">>>>>>>>>>>>>>>>>>>>>>>>>>>> LOAD ATL\n");
g_return_if_fail (atl_fd < 0);
filename = g_strdup_printf ("%s/%s", g_get_home_dir (), "atl");
filename = g_build_filename (g_get_home_dir (), "atl", NULL);
/* NOTE : better to use popen here, but this is fine for testing */
#ifdef HAVE_MKFIFO
#warning "If gstdio.h had g_mkfifo, that's what we should use here"
if (mkfifo (filename, S_IRUSR | S_IWUSR) == 0) {
atl_filename = filename;
atl_fd = open (atl_filename, O_RDWR|O_NONBLOCK);
atl_fd = g_open (atl_filename, O_RDWR|O_NONBLOCK, 0);
} else
#endif /* HAVE_MKFIFO */
g_free (filename);
......@@ -190,7 +192,7 @@ go_plugin_shutdown (GOPlugin *plugin, GOCmdContext *cc)
}
if (atl_filename) {
unlink (atl_filename);
g_unlink (atl_filename);
g_free (atl_filename);
atl_filename = NULL;
}
......
......@@ -35,7 +35,6 @@
#include <gsf/gsf-impl-utils.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
......@@ -122,10 +121,9 @@ category_list_get_from_dir_list (GSList *dir_list)
while ((d_name = g_dir_read_name (dir)) != NULL) {
gchar *full_entry_name;
struct stat entry_info;
full_entry_name = g_build_filename (dir_name, d_name, NULL);
if (d_name[0] != '.' && stat (full_entry_name, &entry_info) == 0 && S_ISDIR(entry_info.st_mode)) {
if (d_name[0] != '.' && g_file_test (full_entry_name, G_FILE_TEST_IS_DIR)) {
FormatTemplateCategory *category;
category = gnumeric_xml_read_format_template_category (full_entry_name);
......
......@@ -11,6 +11,7 @@
*/
#include <gnumeric-config.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include "gnumeric.h"
#include "func.h"
......@@ -190,7 +191,7 @@ function_dump_defs (char const *filename, int dump_type)
g_return_if_fail (filename != NULL);
if ((output_file = fopen (filename, "w")) == NULL){
if ((output_file = g_fopen (filename, "w")) == NULL){
printf (_("Cannot create file %s\n"), filename);
exit (1);
}
......
......@@ -39,7 +39,6 @@
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/stat.h>
typedef struct {
GOCharmapSel *go_charmap_sel;
......
......@@ -33,11 +33,11 @@
#include "gnm-plugin.h"
#include <gtk/gtkmain.h>
#include <glib/gstdio.h>
#include <goffice/utils/go-file.h>
#include <goffice/app/go-cmd-context.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <string.h>
......@@ -113,7 +113,7 @@ warn_about_ancient_gnumerics (const char *binary, IOContext *ioc)
if (binary &&
strchr (binary, '/') != NULL &&
stat (binary, &buf) != -1 &&
g_stat (binary, &buf) != -1 &&
buf.st_mtime != -1 &&
now - buf.st_mtime > days * 24 * 60 * 60) {
handle_paint_events ();
......
......@@ -63,6 +63,7 @@
#include <locale.h>
#include <string.h>
#include <goffice/utils/go-math.h>
#include <glib/gstdio.h>
#if defined (HAVE_IEEEFP_H) || defined (HAVE_IEEE754_H)
/* Make sure we have this symbol defined, since the existance of either
......@@ -6132,7 +6133,7 @@ random_01 (void)
}
if (device_fd == -2) {
device_fd = open (RANDOM_DEVICE, O_RDONLY);
device_fd = g_open (RANDOM_DEVICE, O_RDONLY, 0);
/*
* We could check that we really have a device, but it hard
* to come up with a non-paranoid reason to.
......
......@@ -56,7 +56,6 @@
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#include "mathfunc.h"
#include <goffice/utils/go-file.h>
#ifdef WITH_GNOME
......@@ -740,8 +739,8 @@ static gboolean
cb_cleanup_sendto (gpointer path)
{
char *dir = g_path_get_dirname (path);
unlink (path); g_free (path); /* the attachment */
rmdir (dir); g_free (dir); /* the tempdir */
g_unlink (path); g_free (path); /* the attachment */
g_rmdir (dir); g_free (dir); /* the tempdir */
return FALSE;
}
......@@ -779,17 +778,10 @@ wb_view_sendto (WorkbookView *wbv, GOCmdContext *context)
(int)(1e8 * random_01 ()));
template = g_build_filename (g_get_tmp_dir (), dirname, NULL);
#ifdef G_OS_WIN32
if (mkdir (template) == 0) {
if (g_mkdir (template, 0700) == 0) {
problem = TRUE;
break;
}
#else
if (mkdir (template, 0700) == 0) {
problem = TRUE;
break;
}
#endif
if (errno != EEXIST) {
g_free (template);
......
Markdown is supported
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