[goffice] Portability: don't use stat(2).



commit 1ba766f6ac77c8291fe0433add73f08ae97fa53e
Author: Morten Welinder <terra gnome org>
Date:   Tue Apr 15 15:22:56 2014 -0400

    Portability: don't use stat(2).
    
    Use glib's wrapper.

 ChangeLog                      |    6 ++++++
 NEWS                           |    2 +-
 goffice/app/go-plugin.c        |    6 +++---
 goffice/utils/go-file.c        |    2 +-
 goffice/utils/go-glib-extras.c |    1 -
 5 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c3c04fc..b552ece 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2014-04-15  Morten Welinder  <terra gnome org>
 
+       * goffice/utils/go-file.c (go_filename_simplify): Fix argument
+       type for g_lstat.
+
+       * goffice/app/go-plugin.c (get_file_state_as_string): Use g_stat,
+       not raw stat.
+
        * goffice/utils/go-style.c (go_style_marker_sax_save): Don't
        output (meaningless) values for things that are "auto".
        (go_style_line_sax_save): Ditto.
diff --git a/NEWS b/NEWS
index 167e8e0..7cf3c14 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,7 @@ Jean:
        * Explicitly allow manual charts size. [#728134]
 
 Morten:
-       * Portability improvement.
+       * Portability improvements.
 
 --------------------------------------------------------------------------
 goffice 0.10.14:
diff --git a/goffice/app/go-plugin.c b/goffice/app/go-plugin.c
index 41350a1..453f88b 100644
--- a/goffice/app/go-plugin.c
+++ b/goffice/app/go-plugin.c
@@ -45,12 +45,12 @@
 
 #include <glib-object.h>
 #include <glib/gi18n-lib.h>
+#include <glib/gstdio.h>
 #include <gmodule.h>
 
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
@@ -291,9 +291,9 @@ static GHashTable *plugin_file_state_dir_hash;
 static gchar *
 get_file_state_as_string (gchar const *file_name)
 {
-       struct stat st;
+       GStatBuf st;
 
-       if (stat (file_name, &st) == -1) {
+       if (g_stat (file_name, &st) == -1) {
                return NULL;
        }
 
diff --git a/goffice/utils/go-file.c b/goffice/utils/go-file.c
index 6213950..f45c36c 100644
--- a/goffice/utils/go-file.c
+++ b/goffice/utils/go-file.c
@@ -185,7 +185,7 @@ go_filename_simplify (char const *filename, GODotDot dotdot,
                                        isdir = TRUE;
                                        break;
                                case GO_DOTDOT_TEST: {
-                                       struct stat statbuf;
+                                       GStatBuf statbuf;
                                        char savec = *q;
                                        /*
                                         * Terminate the path so far so we can
diff --git a/goffice/utils/go-glib-extras.c b/goffice/utils/go-glib-extras.c
index 30f64e5..e129c93 100644
--- a/goffice/utils/go-glib-extras.c
+++ b/goffice/utils/go-glib-extras.c
@@ -36,7 +36,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]