[nautilus-actions] Definitively fix xds_atom_value() return value



commit faf2f2ffde685fa941bb14e0660f1d857923f3cd
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Mar 5 22:14:32 2010 +0100

    Definitively fix xds_atom_value() return value
    
    After validation both on 32 and 64 bit systems, it appears that the return buffer
    almost always contains trailing trash characters. We so have to take the actual
    length value to put a '\0' character at the end of the string.
    Do not too understand the documentation comment which talks about 4bytes chunks...

 ChangeLog                      |    3 +++
 TODO                           |    6 ------
 src/nact/nact-tree-model-dnd.c |   15 ++++-----------
 3 files changed, 7 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c60cd80..c3534b8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-03-05 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/nact-tree-model-dnd.c (get_xds_atom_value):
+	Remove debug traces after validation both on 32 and 64 bits systems.
+
 	* src/api/na-core-utils.h:
 	* src/core/na-core-utils.c
 	(na_core_utils_slist_join_at_end): New function.
diff --git a/TODO b/TODO
index 9194726..401d924 100644
--- a/TODO
+++ b/TODO
@@ -157,18 +157,12 @@
   but path is defined as string in this same spec
   and icon may be a path -> so what to do with this ?
 
-- get_xds_atom_value: test on 64bit platform, then remove debug stuff
-
 - try to restore hierarchy on import
 
 - use NADataDef to automatically generate schemas
   in data/nautilus-actions.schemas.in
   and in src/utils/nautilus-actions-schemas
 
-- should not be able to delete read-only items
-
 - dnd to inside of a menu, by dropping while on the menu itself
   if menu is at path 3, we get a dest of 3:0 which means first child of parent at path 3
   if menu is new (never has been written), dnd says that parent is not writable ????
-
-- implement delete_rec in nact_main_menubar
diff --git a/src/nact/nact-tree-model-dnd.c b/src/nact/nact-tree-model-dnd.c
index 9b8bed5..9f2057a 100644
--- a/src/nact/nact-tree-model-dnd.c
+++ b/src/nact/nact-tree-model-dnd.c
@@ -958,6 +958,8 @@ on_drag_drop( GtkWidget *widget, GdkDragContext *context, gint x, gint y, guint
  * get_xds_atom_value: ret=file:///home/pierre/data/eclipse/nautilus-actions/trash/xds.txt0x8299
  * get_xds_atom_value: dup=file:///home/pierre/data/eclipse/nautilus-actions/trash/xds.txt
  * get_xds_atom_value: ret=file:///home/pi
+ *
+ * idem on a 64bits system.
  */
 static char *
 get_xds_atom_value( GdkDragContext *context )
@@ -979,18 +981,9 @@ get_xds_atom_value( GdkDragContext *context )
 						&actual_length,				/* actual length (in 4 bytes chunks) */
 						( guchar ** ) &ret );		/* data pointer */
 
-	g_debug( "get_xds_atom_value: actual_length=%d, actual_length=%lu", actual_length, ( gulong ) actual_length/sizeof( glong ));
-	g_debug( "get_xds_atom_value: ret=%s", ret );
-
-	gchar *dup = g_strdup( ret );
-	dup[actual_length] = '\0';
-	g_debug( "get_xds_atom_value: dup=%s", dup );
+	ret[actual_length] = '\0';
 
-	ret[actual_length/sizeof( glong )] = '\0';
-	g_debug( "get_xds_atom_value: ret=%s", ret );
-	g_free( ret );
-
-	return( dup );
+	return( ret );
 }
 
 /*



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