[Xfce4-commits] <thunar-vfs:master> Use xdt 4.7.2 macros and fix compiler warnings.

Nick Schermer noreply at xfce.org
Fri Nov 5 11:46:02 CET 2010


Updating branch refs/heads/master
         to 97796b91b7c106f39a9e2d29b5f581de11fd0501 (commit)
       from 9cd90cb636ee0980a239d0067e25629fdcfc6608 (commit)

commit 97796b91b7c106f39a9e2d29b5f581de11fd0501
Author: Nick Schermer <nick at xfce.org>
Date:   Fri Nov 5 11:44:09 2010 +0100

    Use xdt 4.7.2 macros and fix compiler warnings.

 autogen.sh                                        |    2 +-
 configure.in.in                                   |   79 ++-------------------
 thunar-vfs/thunar-vfs-exec.c                      |    9 ++-
 thunar-vfs/thunar-vfs-io-trash.c                  |    8 +-
 thunar-vfs/thunar-vfs-mime-cache.c                |   12 ++--
 thunar-vfs/thunar-vfs-mime-database.c             |   24 +++---
 thunar-vfs/thunar-vfs-path.c                      |    6 +-
 thunar-vfs/thunar-vfs-thumb-jpeg.c                |    2 +-
 thunar-vfs/thunar-vfs-thumb.c                     |    2 +-
 thunar-vfs/thunar-vfs-update-thumbnailers-cache.c |    2 +-
 thunar-vfs/thunar-vfs-util.c                      |    6 +-
 thunar-vfs/thunar-vfs-volume-hal.c                |    8 +-
 thunar-vfs/thunar-vfs.c                           |    4 +-
 13 files changed, 51 insertions(+), 113 deletions(-)

diff --git a/autogen.sh b/autogen.sh
index daed9b6..fd9f4e3 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -18,4 +18,4 @@ EOF
   exit 1
 }
 
-XDT_AUTOGEN_REQUIRED_VERSION="4.7.0" exec xdt-autogen $@
+XDT_AUTOGEN_REQUIRED_VERSION="4.7.2" exec xdt-autogen $@
diff --git a/configure.in.in b/configure.in.in
index 906b991..f3bc968 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -113,12 +113,13 @@ dnl ************************************
 dnl *** Check for standard functions ***
 dnl ************************************
 AC_FUNC_MMAP()
+AC_CHECK_DECLS([environ])
 AC_CHECK_FUNCS([attropen extattr_get_fd fgetxattr futimes getdents getfsspec \
                 getfsstat lchmod localeconv localtime_r mbrtowc mkdtemp mkfifo \
                 posix_madvise pread pwrite readdir_r sched_yield setgroupent \
                 setmntent setpassent setpriority statfs statvfs statvfs1 \
                 strcoll strlcpy strptime symlink syslog posix_fadvise \
-                setfsent getvfsstat getmntent])
+                setfsent getvfsstat getmntent _NSGetEnviron])
 
 dnl ******************************************
 dnl *** Linux/glibc specified work-arounds ***
@@ -274,87 +275,17 @@ BM_THUNAR_VFS_VOLUME_IMPL()
 dnl ***********************************
 dnl *** Check for debugging support ***
 dnl ***********************************
-AC_ARG_ENABLE([debug],
-AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes/full@:>@], [Turn on debugging @<:@default=thunar_vfs_debug_default@:>@]),
-  [], [enable_debug=thunar_vfs_debug_default])
-AC_MSG_CHECKING([whether to enable debugging support])
-if test x"$enable_debug" = x"full" -o x"$enable_debug" = x"yes"; then
-  dnl Print the result
-  AC_MSG_RESULT([$enable_debug])
-
-  dnl Make sure we detect possible errors (if supported)
-  save_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -Wall -Werror"
-  AC_MSG_CHECKING([whether $CC accepts -Wall -Werror])
-  AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]), [
-    AC_MSG_RESULT([yes])
-    PLATFORM_CFLAGS="$PLATFORM_CFLAGS -Wall -Werror"
-  ], [
-    AC_MSG_RESULT([no])
-  ])
-  CFLAGS="$save_CFLAGS"
-
-  dnl Paranoia for --enable-debug=full
-  if test x"$enable_debug" = x"full"; then
-    dnl Enable extensive debugging
-    PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_ENABLE_DEBUG"
-
-    dnl Use -O0 -g3 if the compiler supports it
-    save_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS -O0 -g3"
-    AC_MSG_CHECKING([whether $CC accepts -O0 -g3])
-    AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]), [
-      AC_MSG_RESULT([yes])
-      PLATFORM_CFLAGS="$PLATFORM_CFLAGS -O0 -g3"
-    ], [
-      AC_MSG_RESULT([no])
-    ])
-    CFLAGS="$save_CFLAGS"
-  fi
-else
-  dnl Print the result
-  AC_MSG_RESULT([$enable_debug])
-
-  dnl Disable debugging (release build)
-  PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DNDEBUG"
-
-  dnl Disable object cast checks
-  PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_CAST_CHECKS"
-
-  dnl Disable all checks for --enable-debug=no
-  if test x"$enable_debug" = x"no"; then
-    PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
-  fi
-fi
+XDT_FEATURE_DEBUG([thunar_vfs_debug_default])
 
 dnl **************************************
 dnl *** Check for linker optimizations ***
 dnl **************************************
-AC_MSG_CHECKING([whether $LD accepts --as-needed])
-case `$LD --as-needed -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  LDFLAGS="$LDFLAGS -Wl,--as-needed"
-  AC_MSG_RESULT([yes])
-  ;;
-*)
-  AC_MSG_RESULT([no])
-  ;;
-esac
-AC_MSG_CHECKING([whether $LD accepts -O1])
-case `$LD -O1 -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -Wl,-O1"
-  AC_MSG_RESULT([yes])
-  ;;
-*)
-  AC_MSG_RESULT([no])
-  ;;
-esac
+XDT_FEATURE_LINKER_OPTS()
 
 dnl ****************************************
 dnl *** Check for ELF visibility support ***
 dnl ****************************************
-AC_ARG_ENABLE([visibility], AC_HELP_STRING([--disable-visibility], [Don't use ELF visibility attributes]), [], [enable_visibility=yes])
+AC_ARG_ENABLE([visibility], AC_HELP_STRING([--disable-visibility], [Do not use ELF visibility attributes]), [], [enable_visibility=yes])
 have_gnuc_visibility=no
 if test x"$enable_visibility" != x"no"; then
   dnl Check whether the compiler supports the visibility attribute
diff --git a/thunar-vfs/thunar-vfs-exec.c b/thunar-vfs/thunar-vfs-exec.c
index 9578121..1ac4e7c 100644
--- a/thunar-vfs/thunar-vfs-exec.c
+++ b/thunar-vfs/thunar-vfs-exec.c
@@ -49,6 +49,14 @@
 #include <gdk/gdkx.h>
 #endif
 
+#ifdef HAVE__NSGETENVIRON
+/* for support under apple/darwin */
+#define environ (*_NSGetEnviron())
+#elif !HAVE_DECL_ENVIRON
+/* try extern if environ is not defined in unistd.h */
+extern gchar **environ;
+#endif
+
 
 
 static void     tve_string_append_quoted      (GString             *string,
@@ -439,7 +447,6 @@ thunar_vfs_exec_on_screen (GdkScreen   *screen,
   SnDisplay         *sn_display = NULL;
   gint               sn_workspace;
 #endif
-  extern gchar     **environ;
   gboolean           succeed;
   gchar             *display_name;
   gchar            **cenvp = envp;
diff --git a/thunar-vfs/thunar-vfs-io-trash.c b/thunar-vfs/thunar-vfs-io-trash.c
index 72c7da7..a712db3 100644
--- a/thunar-vfs/thunar-vfs-io-trash.c
+++ b/thunar-vfs/thunar-vfs-io-trash.c
@@ -127,7 +127,7 @@ tvit_initialize_trash_dir (const gchar *trash_dir)
   gboolean     result = FALSE;
   gchar       *files_dir;
   gchar       *info_dir;
-  gchar       *basename;
+  gchar       *base_name;
   gchar       *dirname;
   GDir        *dp;
 
@@ -151,16 +151,16 @@ tvit_initialize_trash_dir (const gchar *trash_dir)
               if (G_LIKELY (dp != NULL))
                 {
                   /* determine the basename to look for */
-                  basename = g_path_get_basename (trash_dir);
+                  base_name = g_path_get_basename (trash_dir);
                   do
                     {
                       /* compare the next entry */
                       name = g_dir_read_name (dp);
                       if (G_LIKELY (name != NULL))
-                        result = (strcmp (name, basename) == 0);
+                        result = (strcmp (name, base_name) == 0);
                     }
                   while (name != NULL && !result);
-                  g_free (basename);
+                  g_free (base_name);
                 }
               g_free (dirname);
 
diff --git a/thunar-vfs/thunar-vfs-mime-cache.c b/thunar-vfs/thunar-vfs-mime-cache.c
index 27854aa..f71240e 100644
--- a/thunar-vfs/thunar-vfs-mime-cache.c
+++ b/thunar-vfs/thunar-vfs-mime-cache.c
@@ -529,7 +529,7 @@ thunar_vfs_mime_cache_new (const gchar *directory)
   ThunarVfsMimeCache *cache = NULL;
 
 #ifdef HAVE_MMAP
-  struct stat         stat;
+  struct stat         mstat;
   gchar              *buffer;
   gchar              *path;
   gint                fd;
@@ -543,29 +543,29 @@ thunar_vfs_mime_cache_new (const gchar *directory)
     return NULL;
 
   /* stat the file to get proper size info */
-  if (fstat (fd, &stat) < 0 || stat.st_size < 4)
+  if (fstat (fd, &mstat) < 0 || mstat.st_size < 4)
     goto done;
 
   /* try to map the file into memory */
-  buffer = (gchar *) mmap (NULL, stat.st_size, PROT_READ, MAP_SHARED, fd, 0);
+  buffer = (gchar *) mmap (NULL, mstat.st_size, PROT_READ, MAP_SHARED, fd, 0);
   if (G_UNLIKELY (buffer == MAP_FAILED))
     goto done;
 
   /* check that we actually support the file version */
   if (CACHE_READ16 (buffer, 0) != CACHE_MAJOR_VERSION || CACHE_READ16 (buffer, 2) != CACHE_MINOR_VERSION)
     {
-      munmap (buffer, stat.st_size);
+      munmap (buffer, mstat.st_size);
       goto done;
     }
 
   /* allocate a new cache provider */
   cache = g_object_new (THUNAR_VFS_TYPE_MIME_CACHE, NULL);
   cache->buffer = buffer;
-  cache->bufsize = stat.st_size;
+  cache->bufsize = mstat.st_size;
 
   /* tell the system that we'll use this buffer quite often */
 #ifdef HAVE_POSIX_MADVISE
-  posix_madvise (buffer, stat.st_size, POSIX_MADV_WILLNEED);
+  posix_madvise (buffer, mstat.st_size, POSIX_MADV_WILLNEED);
 #endif
 
   /* cleanup */
diff --git a/thunar-vfs/thunar-vfs-mime-database.c b/thunar-vfs/thunar-vfs-mime-database.c
index 3844156..2f097d8 100644
--- a/thunar-vfs/thunar-vfs-mime-database.c
+++ b/thunar-vfs/thunar-vfs-mime-database.c
@@ -1049,10 +1049,10 @@ thunar_vfs_mime_database_get_info_for_file (ThunarVfsMimeDatabase *database,
                                             const gchar           *name)
 {
   ThunarVfsMimeInfo *info;
-  struct stat        stat;
+  struct stat        mstat;
   const gchar       *p;
   gssize             nbytes;
-  gchar             *basename;
+  gchar             *base_name;
   gchar             *buffer;
   gchar             *type;
   gsize              buflen;
@@ -1066,12 +1066,12 @@ thunar_vfs_mime_database_get_info_for_file (ThunarVfsMimeDatabase *database,
   if (G_UNLIKELY (name == NULL))
     {
       buffer = g_path_get_basename (path);
-      name = basename = g_filename_display_name (buffer);
+      name = base_name = g_filename_display_name (buffer);
       g_free (buffer);
     }
   else
     {
-      basename = NULL;
+      base_name = NULL;
     }
 
   /* try to determine the type from the name first */
@@ -1086,10 +1086,10 @@ thunar_vfs_mime_database_get_info_for_file (ThunarVfsMimeDatabase *database,
       fd = attropen (path, "user.mime_type", O_RDONLY);
       if (G_UNLIKELY (fd >= 0))
         {
-          if (fstat (fd, &stat) == 0)
+          if (fstat (fd, &mstat) == 0)
             {
-              buffer = g_newa (gchar, stat.st_size + 1);
-              nbytes = read (fd, buffer, stat.st_size);
+              buffer = g_newa (gchar, mstat.st_size + 1);
+              nbytes = read (fd, buffer, mstat.st_size);
               if (G_LIKELY (nbytes >= 3))
                 {
                   buffer[nbytes] = '\0';
@@ -1145,10 +1145,10 @@ thunar_vfs_mime_database_get_info_for_file (ThunarVfsMimeDatabase *database,
 #endif
 
           /* stat the file and verify that we have a regular file */
-          if (G_LIKELY (info == NULL && fstat (fd, &stat) == 0 && S_ISREG (stat.st_mode)))
+          if (G_LIKELY (info == NULL && fstat (fd, &mstat) == 0 && S_ISREG (mstat.st_mode)))
             {
               /* read the beginning from the file */
-              buflen = MIN (stat.st_size, database->max_buffer_extents);
+              buflen = MIN ((gsize) mstat.st_size, database->max_buffer_extents);
               buffer = g_newa (gchar, buflen);
               nbytes = read (fd, buffer, buflen);
 
@@ -1164,7 +1164,7 @@ thunar_vfs_mime_database_get_info_for_file (ThunarVfsMimeDatabase *database,
                    * as executable, we just guess "application/x-executable", which
                    * is atleast more precise than "application/octet-stream".
                    */
-                  if (G_UNLIKELY (info == NULL && (stat.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0))
+                  if (G_UNLIKELY (info == NULL && (mstat.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0))
                     info = thunar_vfs_mime_database_get_info_locked (database, "application/x-executable");
 
                   g_mutex_unlock (database->lock);
@@ -1204,8 +1204,8 @@ thunar_vfs_mime_database_get_info_for_file (ThunarVfsMimeDatabase *database,
     }
 
   /* cleanup */
-  if (G_UNLIKELY (basename != NULL))
-    g_free (basename);
+  if (G_UNLIKELY (base_name != NULL))
+    g_free (base_name);
 
   /* we got it */
   return info;
diff --git a/thunar-vfs/thunar-vfs-path.c b/thunar-vfs/thunar-vfs-path.c
index d4d6994..880b51d 100644
--- a/thunar-vfs/thunar-vfs-path.c
+++ b/thunar-vfs/thunar-vfs-path.c
@@ -112,14 +112,14 @@ G_STMT_START{
     {                                                                                             \
       GList *lp;                                                                                  \
       gchar *uri;                                                                                 \
-      gint   n;                                                                                   \
+      gint   ref_count;                                                                           \
       G_LOCK (debug_paths);                                                                       \
       g_print ("--- Leaked a total of %u ThunarVfsPath objects:\n", g_list_length (debug_paths)); \
       for (lp = debug_paths; lp != NULL; lp = lp->next)                                           \
         {                                                                                         \
           uri = thunar_vfs_path_dup_string (lp->data);                                            \
-          n = ((ThunarVfsPath *) lp->data)->ref_count;                                            \
-          g_print ("--> %s (%d)\n", uri, (n & ~THUNAR_VFS_PATH_SCHEME_MASK));                     \
+          ref_count = ((ThunarVfsPath *) lp->data)->ref_count;                                    \
+          g_print ("--> %s (%d)\n", uri, (ref_count & ~THUNAR_VFS_PATH_SCHEME_MASK));             \
           g_free (uri);                                                                           \
         }                                                                                         \
       G_UNLOCK (debug_paths);                                                                     \
diff --git a/thunar-vfs/thunar-vfs-thumb-jpeg.c b/thunar-vfs/thunar-vfs-thumb-jpeg.c
index deff157..f5a19bb 100644
--- a/thunar-vfs/thunar-vfs-thumb-jpeg.c
+++ b/thunar-vfs/thunar-vfs-thumb-jpeg.c
@@ -75,7 +75,7 @@ typedef struct
 
 
 
-static void
+G_GNUC_NORETURN static void
 fatal_error_handler (j_common_ptr cinfo)
 {
   TvtjErrorHandler *handler = (TvtjErrorHandler *) cinfo->err;
diff --git a/thunar-vfs/thunar-vfs-thumb.c b/thunar-vfs/thunar-vfs-thumb.c
index a679067..3aa8ed2 100644
--- a/thunar-vfs/thunar-vfs-thumb.c
+++ b/thunar-vfs/thunar-vfs-thumb.c
@@ -412,7 +412,7 @@ thunar_vfs_thumb_factory_cache_load (ThunarVfsThumbFactory *factory,
 {
   struct stat statb;
   gssize      m;
-  gsize       n;
+  gssize      n;
   gint        fd;
 
   _thunar_vfs_return_if_fail (THUNAR_VFS_IS_THUMB_FACTORY (factory));
diff --git a/thunar-vfs/thunar-vfs-update-thumbnailers-cache.c b/thunar-vfs/thunar-vfs-update-thumbnailers-cache.c
index 4f31833..2ef6bde 100644
--- a/thunar-vfs/thunar-vfs-update-thumbnailers-cache.c
+++ b/thunar-vfs/thunar-vfs-update-thumbnailers-cache.c
@@ -458,7 +458,7 @@ thumbnailers_needs_update (const gchar  *filename,
   gboolean    needs_update;
   gssize      m;
   gchar      *contents;
-  gsize       n;
+  gssize      n;
   gint        fd;
 
   /* try to open the file */
diff --git a/thunar-vfs/thunar-vfs-util.c b/thunar-vfs/thunar-vfs-util.c
index c645ac0..735d6b2 100644
--- a/thunar-vfs/thunar-vfs-util.c
+++ b/thunar-vfs/thunar-vfs-util.c
@@ -323,11 +323,11 @@ thunar_vfs_humanize_size (ThunarVfsFileSize size,
       buflen = 32;
     }
 
-  if (G_UNLIKELY (size > 1024ul * 1024ul * 1024ul))
+  if (G_UNLIKELY (size > 1024 * 1024 * 1024))
     g_snprintf (buffer, buflen, "%0.1f GB", size / (1024.0 * 1024.0 * 1024.0));
-  else if (size > 1024ul * 1024ul)
+  else if (size > 1024 * 1024)
     g_snprintf (buffer, buflen, "%0.1f MB", size / (1024.0 * 1024.0));
-  else if (size > 1024ul)
+  else if (size > 1024)
     g_snprintf (buffer, buflen, "%0.1f kB", size / 1024.0);
   else
     g_snprintf (buffer, buflen, "%lu B", (gulong) size);
diff --git a/thunar-vfs/thunar-vfs-volume-hal.c b/thunar-vfs/thunar-vfs-volume-hal.c
index 9973020..23cc676 100644
--- a/thunar-vfs/thunar-vfs-volume-hal.c
+++ b/thunar-vfs/thunar-vfs-volume-hal.c
@@ -398,7 +398,7 @@ thunar_vfs_volume_hal_update (ThunarVfsVolumeHal *volume_hal,
 {
   gchar *desired_mount_point;
   gchar *mount_root;
-  gchar *basename;
+  gchar *base_name;
   gchar *filename;
 
   _thunar_vfs_return_if_fail (THUNAR_VFS_IS_VOLUME_HAL (volume_hal));
@@ -594,11 +594,11 @@ thunar_vfs_volume_hal_update (ThunarVfsVolumeHal *volume_hal,
       if (G_UNLIKELY (volume_hal->mount_point == NULL))
         {
           /* <mount-root>/<device> looks like a good idea */
-          basename = g_path_get_basename (volume_hal->device_file);
-          filename = g_build_filename (mount_root, basename, NULL);
+          base_name = g_path_get_basename (volume_hal->device_file);
+          filename = g_build_filename (mount_root, base_name, NULL);
           volume_hal->mount_point = thunar_vfs_path_new (filename, NULL);
           g_free (filename);
-          g_free (basename);
+          g_free (base_name);
         }
 
       /* release the mount root */
diff --git a/thunar-vfs/thunar-vfs.c b/thunar-vfs/thunar-vfs.c
index dc96da5..4de3365 100644
--- a/thunar-vfs/thunar-vfs.c
+++ b/thunar-vfs/thunar-vfs.c
@@ -694,7 +694,7 @@ thunar_vfs_change_group (ThunarVfsPath   *path,
 {
   GList path_list;
 
-  g_return_val_if_fail (gid >= 0, NULL);
+  g_return_val_if_fail ((gint) gid >= 0, NULL);
   g_return_val_if_fail (path != NULL, NULL);
   g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
@@ -744,7 +744,7 @@ thunar_vfs_change_owner (ThunarVfsPath  *path,
 {
   GList path_list;
 
-  g_return_val_if_fail (uid >= 0, NULL);
+  g_return_val_if_fail ((gint) uid >= 0, NULL);
   g_return_val_if_fail (path != NULL, NULL);
   g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 



More information about the Xfce4-commits mailing list