From 7b221f607dac9a65b7211845952b35a0cb49e5a1 Mon Sep 17 00:00:00 2001 From: Benedikt Meurer <benny@xfce.org> Date: Tue, 22 May 2007 13:34:13 +0000 Subject: [PATCH] 2007-05-22 Benedikt Meurer <benny@xfce.org> * thunar-vfs/thunar-vfs-path.c: Fix unaligned access in ThunarVfsPath on sparc64. Bug #2815. * docs/reference/: Update reference manual. (Old svn revision: 25738) --- ChangeLog | 6 +++ .../thunar-vfs/tmpl/thunar-vfs-info.sgml | 2 - .../tmpl/thunar-vfs-mime-application.sgml | 10 ----- .../thunar-vfs/tmpl/thunar-vfs-monitor.sgml | 9 ----- .../thunar-vfs/tmpl/thunar-vfs-volume.sgml | 1 + .../thunarx/tmpl/thunarx-provider-plugin.sgml | 4 +- thunar-vfs/thunar-vfs-path.c | 40 +++++++++---------- 7 files changed, 29 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index afda4fa74..a38201f6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-05-22 Benedikt Meurer <benny@xfce.org> + + * thunar-vfs/thunar-vfs-path.c: Fix unaligned access in ThunarVfsPath + on sparc64. Bug #2815. + * docs/reference/: Update reference manual. + 2007-05-20 Benedikt Meurer <benny@xfce.org> * thunar/thunar-preferences.c(thunar_preferences_set_property): diff --git a/docs/reference/thunar-vfs/tmpl/thunar-vfs-info.sgml b/docs/reference/thunar-vfs/tmpl/thunar-vfs-info.sgml index 72bc627d3..8ee24e273 100644 --- a/docs/reference/thunar-vfs/tmpl/thunar-vfs-info.sgml +++ b/docs/reference/thunar-vfs/tmpl/thunar-vfs-info.sgml @@ -125,8 +125,6 @@ Stores information about files. @working_directory: @error: @Returns: -<!-- # Unused Parameters # --> -@uris: <!-- ##### FUNCTION thunar_vfs_info_rename ##### --> diff --git a/docs/reference/thunar-vfs/tmpl/thunar-vfs-mime-application.sgml b/docs/reference/thunar-vfs/tmpl/thunar-vfs-mime-application.sgml index 803447947..54f197fd0 100644 --- a/docs/reference/thunar-vfs/tmpl/thunar-vfs-mime-application.sgml +++ b/docs/reference/thunar-vfs/tmpl/thunar-vfs-mime-application.sgml @@ -69,8 +69,6 @@ Registered Applications for MIME types. @mime_application: @Returns: -<!-- # Unused Parameters # --> -@application: <!-- ##### FUNCTION thunar_vfs_mime_application_get_desktop_id ##### --> @@ -80,8 +78,6 @@ Registered Applications for MIME types. @mime_application: @Returns: -<!-- # Unused Parameters # --> -@application: <!-- ##### MACRO thunar_vfs_mime_application_get_flags ##### --> @@ -91,8 +87,6 @@ Registered Applications for MIME types. @mime_application: @Returns: -<!-- # Unused Parameters # --> -@application: <!-- ##### MACRO thunar_vfs_mime_application_get_name ##### --> @@ -102,8 +96,6 @@ Registered Applications for MIME types. @mime_application: @Returns: -<!-- # Unused Parameters # --> -@application: <!-- ##### FUNCTION thunar_vfs_mime_application_hash ##### --> @@ -113,8 +105,6 @@ Registered Applications for MIME types. @mime_application: @Returns: -<!-- # Unused Parameters # --> -@application: <!-- ##### FUNCTION thunar_vfs_mime_application_equal ##### --> diff --git a/docs/reference/thunar-vfs/tmpl/thunar-vfs-monitor.sgml b/docs/reference/thunar-vfs/tmpl/thunar-vfs-monitor.sgml index 426ba44ee..16bf9c7c1 100644 --- a/docs/reference/thunar-vfs/tmpl/thunar-vfs-monitor.sgml +++ b/docs/reference/thunar-vfs/tmpl/thunar-vfs-monitor.sgml @@ -50,9 +50,6 @@ Portable file system monitoring class. @handle_path: @event_path: @user_data: -<!-- # Unused Parameters # --> -@handle_uri: -@event_uri: <!-- ##### FUNCTION thunar_vfs_monitor_get_default ##### --> @@ -73,8 +70,6 @@ Portable file system monitoring class. @callback: @user_data: @Returns: -<!-- # Unused Parameters # --> -@uri: <!-- ##### FUNCTION thunar_vfs_monitor_add_file ##### --> @@ -87,8 +82,6 @@ Portable file system monitoring class. @callback: @user_data: @Returns: -<!-- # Unused Parameters # --> -@uri: <!-- ##### FUNCTION thunar_vfs_monitor_remove ##### --> @@ -108,8 +101,6 @@ Portable file system monitoring class. @monitor: @event: @path: -<!-- # Unused Parameters # --> -@uri: <!-- ##### FUNCTION thunar_vfs_monitor_wait ##### --> diff --git a/docs/reference/thunar-vfs/tmpl/thunar-vfs-volume.sgml b/docs/reference/thunar-vfs/tmpl/thunar-vfs-volume.sgml index e05a86420..67041b754 100644 --- a/docs/reference/thunar-vfs/tmpl/thunar-vfs-volume.sgml +++ b/docs/reference/thunar-vfs/tmpl/thunar-vfs-volume.sgml @@ -47,6 +47,7 @@ ThunarVfsVolume @THUNAR_VFS_VOLUME_STATUS_MOUNTED: @THUNAR_VFS_VOLUME_STATUS_PRESENT: +@THUNAR_VFS_VOLUME_STATUS_MOUNTABLE: <!-- ##### STRUCT ThunarVfsVolume ##### --> <para> diff --git a/docs/reference/thunarx/tmpl/thunarx-provider-plugin.sgml b/docs/reference/thunarx/tmpl/thunarx-provider-plugin.sgml index 2dbab0de6..09589c5f6 100644 --- a/docs/reference/thunarx/tmpl/thunarx-provider-plugin.sgml +++ b/docs/reference/thunarx/tmpl/thunarx-provider-plugin.sgml @@ -93,7 +93,7 @@ Stable @plugin: @name: -@const_static_values: +@_static_values: @Returns: @@ -104,7 +104,7 @@ Stable @plugin: @name: -@const_static_values: +@_static_values: @Returns: diff --git a/thunar-vfs/thunar-vfs-path.c b/thunar-vfs/thunar-vfs-path.c index ad3886076..35c9d42df 100644 --- a/thunar-vfs/thunar-vfs-path.c +++ b/thunar-vfs/thunar-vfs-path.c @@ -1,6 +1,6 @@ /* $Id$ */ /*- - * Copyright (c) 2005-2006 Benedikt Meurer <benny@xfce.org> + * Copyright (c) 2005-2007 Benedikt Meurer <benny@xfce.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -46,11 +46,11 @@ /* Masks to handle the 4-byte aligned path names */ #if G_BYTE_ORDER == G_LITTLE_ENDIAN -#define THUNAR_VFS_PATH_MASK (0xffu << ((sizeof (guint) - 1) * 8)) +#define THUNAR_VFS_PATH_MASK (0xffu << ((sizeof (gsize) - 1) * 8)) #define THUNAR_VFS_PATH_ROOT (0x2fu) #elif G_BYTE_ORDER == G_BIG_ENDIAN #define THUNAR_VFS_PATH_MASK (0xffu) -#define THUNAR_VFS_PATH_ROOT (0x2fu << ((sizeof (guint) - 1) * 8)) +#define THUNAR_VFS_PATH_ROOT (0x2fu << ((sizeof (gsize) - 1) * 8)) #else #error "Unsupported endianess" #endif @@ -484,7 +484,7 @@ void thunar_vfs_path_unref (ThunarVfsPath *path) { ThunarVfsPath *parent; - const guint *p; + const gsize *p; while (path != NULL && (g_atomic_int_exchange_and_add (&path->ref_count, -1) & ~THUNAR_VFS_PATH_SCHEME_MASK) == 1) { @@ -519,7 +519,7 @@ thunar_vfs_path_unref (ThunarVfsPath *path) THUNAR_VFS_PATH_DEBUG_REMOVE (path); /* release the path resources (we need to determine the size for the slice allocator) */ - for (p = (const guint *) thunar_vfs_path_get_name (path); (*p & THUNAR_VFS_PATH_MASK) != 0u; ++p) + for (p = (const gsize *) thunar_vfs_path_get_name (path); (*p & THUNAR_VFS_PATH_MASK) != 0u; ++p) ; _thunar_vfs_slice_free1 (((const guint8 *) (p + 1)) - ((const guint8 *) path), path); @@ -570,8 +570,8 @@ thunar_vfs_path_equal (gconstpointer path_ptr_a, { const ThunarVfsPath *path_a = path_ptr_a; const ThunarVfsPath *path_b = path_ptr_b; - const guint *a; - const guint *b; + const gsize *a; + const gsize *b; /* compare the schemes */ if (thunar_vfs_path_get_scheme (path_a) != thunar_vfs_path_get_scheme (path_b)) @@ -583,8 +583,8 @@ again: return TRUE; /* compare the last path component */ - a = (const guint *) thunar_vfs_path_get_name (path_a); - b = (const guint *) thunar_vfs_path_get_name (path_b); + a = (const gsize *) thunar_vfs_path_get_name (path_a); + b = (const gsize *) thunar_vfs_path_get_name (path_b); for (;;) { if (*a != *b) @@ -1120,7 +1120,7 @@ _thunar_vfs_path_init (void) _thunar_vfs_return_if_fail (n_home_components == 0); /* include the root element */ - n_bytes = sizeof (ThunarVfsPath) + sizeof (guint); + n_bytes = sizeof (ThunarVfsPath) + sizeof (gsize); n_home_components = 1; /* split the home path into its components */ @@ -1128,7 +1128,7 @@ _thunar_vfs_path_init (void) for (component = components; *component != NULL; ++component) if (G_LIKELY (**component != '\0')) { - n_bytes += sizeof (ThunarVfsPath) + ((strlen (*component) + sizeof (guint)) / sizeof (guint)) * sizeof (guint); + n_bytes += sizeof (ThunarVfsPath) + ((strlen (*component) + sizeof (gsize)) / sizeof (gsize)) * sizeof (gsize); n_home_components += 1; } @@ -1141,8 +1141,8 @@ _thunar_vfs_path_init (void) path->ref_count = 1; path->parent = NULL; home_components[0] = path; - *((guint *) thunar_vfs_path_get_name (path)) = THUNAR_VFS_PATH_ROOT; - offset += sizeof (ThunarVfsPath) + sizeof (guint); + *((gsize *) thunar_vfs_path_get_name (path)) = THUNAR_VFS_PATH_ROOT; + offset += sizeof (ThunarVfsPath) + sizeof (gsize); /* add the remaining path components */ for (component = components; *component != NULL; ++component) @@ -1155,7 +1155,7 @@ _thunar_vfs_path_init (void) home_components[++n] = path; /* calculate the offset for the next home path component */ - offset += sizeof (ThunarVfsPath) + ((strlen (*component) + sizeof (guint)) / sizeof (guint)) * sizeof (guint); + offset += sizeof (ThunarVfsPath) + ((strlen (*component) + sizeof (gsize)) / sizeof (gsize)) * sizeof (gsize); /* copy the path */ for (s = *component, t = (gchar *) thunar_vfs_path_get_name (path); *s != '\0'; ) @@ -1170,10 +1170,10 @@ _thunar_vfs_path_init (void) g_assert (n_home_components == n + 1); /* allocate the trash root path */ - _thunar_vfs_path_trash_root = g_malloc (sizeof (ThunarVfsPath) + sizeof (guint)); + _thunar_vfs_path_trash_root = g_malloc (sizeof (ThunarVfsPath) + sizeof (gsize)); _thunar_vfs_path_trash_root->ref_count = 1 | THUNAR_VFS_PATH_SCHEME_TRASH; _thunar_vfs_path_trash_root->parent = NULL; - *((guint *) thunar_vfs_path_get_name (_thunar_vfs_path_trash_root)) = THUNAR_VFS_PATH_ROOT; + *((gsize *) thunar_vfs_path_get_name (_thunar_vfs_path_trash_root)) = THUNAR_VFS_PATH_ROOT; /* cleanup */ g_strfreev (components); @@ -1252,7 +1252,7 @@ _thunar_vfs_path_new_relative (ThunarVfsPath *parent, /* determine the length of the path component in bytes */ for (s1 = s + 1; *s1 != '\0' && *s1 != G_DIR_SEPARATOR; ++s1) ; - n = (((s1 - s) + sizeof (guint)) / sizeof (guint)) * sizeof (guint) + n = (((s1 - s) + sizeof (gsize)) / sizeof (gsize)) * sizeof (gsize) + sizeof (ThunarVfsPath); /* allocate memory for the new path component */ @@ -1264,7 +1264,7 @@ _thunar_vfs_path_new_relative (ThunarVfsPath *parent, THUNAR_VFS_PATH_DEBUG_INSERT (path); /* zero out the last word to have the name zero-terminated */ - *(((guint *) (((gchar *) path) + n)) - 1) = 0; + *(((gsize *) (((gchar *) path) + n)) - 1) = 0; /* copy the path component name */ for (t = (gchar *) thunar_vfs_path_get_name (path); *s != '\0' && *s != G_DIR_SEPARATOR; ) @@ -1325,7 +1325,7 @@ _thunar_vfs_path_child (ThunarVfsPath *parent, /* determine the length of the name in bytes */ for (s = name + 1; *s != '\0'; ++s) ; - n = (((s - name) + sizeof (guint)) / sizeof (guint)) * sizeof (guint) + n = (((s - name) + sizeof (gsize)) / sizeof (gsize)) * sizeof (gsize) + sizeof (ThunarVfsPath); /* allocate memory for the new path component */ @@ -1337,7 +1337,7 @@ _thunar_vfs_path_child (ThunarVfsPath *parent, THUNAR_VFS_PATH_DEBUG_INSERT (path); /* zero out the last word to have the name zero-terminated */ - *(((guint *) (((gchar *) path) + n)) - 1) = 0; + *(((gsize *) (((gchar *) path) + n)) - 1) = 0; /* copy the path component name */ for (s = name, t = (gchar *) thunar_vfs_path_get_name (path); *s != '\0'; ) -- GitLab