From bf6fc5cbf8caf123fc75bd5fe3ab1e9efb3ec259 Mon Sep 17 00:00:00 2001
From: Benedikt Meurer <benny@xfce.org>
Date: Sat, 8 Jul 2006 13:25:32 +0000
Subject: [PATCH] 2006-07-08	Benedikt Meurer <benny@xfce.org>

	* thunar-vfs/thunar-vfs-path.c(thunar_vfs_path_escape_uri): Fix
	  alignment issues for Linux/sparc. Bug #1983.




(Old svn revision: 22294)
---
 ChangeLog                    |  5 +++++
 thunar-vfs/thunar-vfs-path.c | 13 +++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f9bfbe0b9..1b001b1af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-07-08	Benedikt Meurer <benny@xfce.org>
+
+	* thunar-vfs/thunar-vfs-path.c(thunar_vfs_path_escape_uri): Fix
+	  alignment issues for Linux/sparc. Bug #1983.
+
 2006-07-06	Benedikt Meurer <benny@xfce.org>
 
 	* thunar/thunar-list-model.c(thunar_list_model_get_sort_column_id):
diff --git a/thunar-vfs/thunar-vfs-path.c b/thunar-vfs/thunar-vfs-path.c
index b00cb53c2..a418d093a 100644
--- a/thunar-vfs/thunar-vfs-path.c
+++ b/thunar-vfs/thunar-vfs-path.c
@@ -122,13 +122,22 @@ thunar_vfs_path_escape_uri (const ThunarVfsPath *path,
 
   ThunarVfsPathItem *item;
   ThunarVfsPathItem *root = NULL;
-  const gchar       *s = "file:///";
+  const gchar       *s;
   guchar             c;
   gchar             *t = buffer + 8;
 
-  /* prepend the 'file:///' string */
+  /* prepend the 'file:///' string (using a simple optimization on i386/ppc) */
+#if defined(__GNUC__) && (defined(__i386__) || defined(__ppc__))
+  s = "file:///";
   ((guint32 *) buffer)[0] = ((const guint32 *) s)[0];
   ((guint32 *) buffer)[1] = ((const guint32 *) s)[1];
+#else
+  /* hopefully the compiler will be able to optimize this */
+  buffer[0] = 'f'; buffer[1] = 'i';
+  buffer[2] = 'l'; buffer[3] = 'e';
+  buffer[4] = ':'; buffer[5] = '/';
+  buffer[6] = '/'; buffer[7] = '/';
+#endif
 
   /* generate the path item list (reverse parent relation) */
   for (; path->parent != NULL; path = path->parent)
-- 
GitLab