[Xfce4-commits] r23297 - xarchiver/branches/xarchiver-psybsd/libxarchiver

Stephan Arts stephan at xfce.org
Fri Oct 6 12:37:05 UTC 2006


Author: stephan
Date: 2006-10-06 12:37:05 +0000 (Fri, 06 Oct 2006)
New Revision: 23297

Modified:
   xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-zip.c
Log:
Fixed Zip support



Modified: xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-zip.c
===================================================================
--- xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-zip.c	2006-10-06 09:54:42 UTC (rev 23296)
+++ xarchiver/branches/xarchiver-psybsd/libxarchiver/archive-support-zip.c	2006-10-06 12:37:05 UTC (rev 23297)
@@ -18,6 +18,7 @@
 
 #define EXO_API_SUBJECT_TO_CHANGE
 
+#include <string.h>
 #include <glib.h>
 #include <glib-object.h>
 #include <thunar-vfs/thunar-vfs.h>
@@ -180,6 +181,10 @@
 	                       "view-size", TRUE,
 												 "view-time", TRUE,
 												 "view-date", TRUE,
+												 "view-method", TRUE,
+												 "view-ratio", TRUE,
+												 "view-length", TRUE,
+												 "view-crc32", TRUE,
 												 NULL);
 	
 	return LXA_ARCHIVE_SUPPORT(support);
@@ -296,6 +301,8 @@
 			archive->column_number++;
 		if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_ratio) 
 			archive->column_number++;
+		if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_method) 
+			archive->column_number++;
 		if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_crc_32)
 			archive->column_number++;
 		if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_date) 
@@ -308,29 +315,30 @@
 
 		archive->column_types[0] = G_TYPE_STRING;
 		archive->column_names[0] = g_strdup(_("Filename"));
+
+		if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_length) {
+			archive->column_types[i] = G_TYPE_UINT64;
+			archive->column_names[i] = g_strdup(_("Length"));
+			i++;
+			archive->entry_props_size += sizeof(guint64);
+		}
 		if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_method) {
 			archive->column_types[i] = G_TYPE_STRING;
 			archive->column_names[i] = g_strdup(_("Compression method"));
 			i++;
 			archive->entry_props_size += sizeof(gchar *);
 		}
-		if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_ratio) {
-			archive->column_types[i] = G_TYPE_STRING;
-			archive->column_names[i] = g_strdup("Ratio");
-			i++;
-			archive->entry_props_size += sizeof(gchar *);
-		}
 		if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_size) {
 			archive->column_types[i] = G_TYPE_UINT64;
 			archive->column_names[i] = g_strdup(_("Size"));
 			i++;
 			archive->entry_props_size += sizeof(guint64);
 		}
-		if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_length) {
-			archive->column_types[i] = G_TYPE_UINT64;
-			archive->column_names[i] = g_strdup(_("Length"));
+		if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_ratio) {
+			archive->column_types[i] = G_TYPE_STRING;
+			archive->column_names[i] = g_strdup("Ratio");
 			i++;
-			archive->entry_props_size += sizeof(guint64);
+			archive->entry_props_size += sizeof(gchar *);
 		}
 		if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_date) {
 			archive->column_types[i] = G_TYPE_STRING;
@@ -388,39 +396,89 @@
 
 			props = g_malloc0(archive->entry_props_size);
 			props_iter = props;
+			for(n=0; n < strlen(line) && line[n] == ' '; n++);
+			a = n;
+			for(; n < strlen(line) && line[n] != ' '; n++);
 
 			if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_length)
 			{
+				_size = g_strndup(&line[a], n-a);
+				(*((guint64 *)props_iter)) = g_ascii_strtoull( _size, NULL, 0);
+				g_free (_size);
+				props_iter += sizeof(guint64);
+			}
 
-			}
+			for(; n < strlen(line) && line[n] == ' '; n++);
+			a = n;
+			for(; n < strlen(line) && line[n] != ' '; n++);
+
 			if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_method)
 			{
+				(*(gchar **)props_iter) = g_strndup (&line[a], n-a);
+				props_iter += sizeof(gchar *);
+			}
 
-			}
+			for(; n < strlen(line) && line[n] == ' '; n++);
+			a = n;
+			for(; n < strlen(line) && line[n] != ' '; n++);
+
 			if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_size)
 			{
+				_size = g_strndup(&line[a], n-a);
+				(*((guint64 *)props_iter)) = g_ascii_strtoull( _size, NULL, 0);
+				g_free (_size);
+				props_iter += sizeof(guint64);
+			}
 
-			}
+			for(; n < strlen(line) && line[n] == ' '; n++);
+			a = n;
+			for(; n < strlen(line) && line[n] != ' '; n++);
+
 			if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_ratio)
 			{
+				(*(gchar **)props_iter) = g_strndup (&line[a], n-a);
+				props_iter += sizeof(gchar *);
+			}
 
-			}
+			for(; n < strlen(line) && line[n] == ' '; n++);
+			a = n;
+			for(; n < strlen(line) && line[n] != ' '; n++);
+
 			if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_date)
 			{
+				(*(gchar **)props_iter) = g_strndup (&line[a], n-a);
+				props_iter += sizeof(gchar *);
 
 			}
+
+			for(; n < strlen(line) && line[n] == ' '; n++);
+			a = n;
+			for(; n < strlen(line) && line[n] != ' '; n++);
+
 			if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_time)
 			{
+				(*(gchar **)props_iter) = g_strndup (&line[a], n-a);
+				props_iter += sizeof(gchar *);
 
 			}
+
+			for(; n < strlen(line) && line[n] == ' '; n++);
+			a = n;
+			for(; n < strlen(line) && line[n] != ' '; n++);
+
 			if(LXA_ARCHIVE_SUPPORT_ZIP(archive->support)->_view_crc_32)
 			{
-
+				(*(gchar **)props_iter) = g_strndup (&line[a], n-a);
+				props_iter += sizeof(gchar *);
 			}
 
+			for(; n < strlen(line) && line[n] == ' '; n++);
+			temp_filename = g_strstrip(g_strndup(&line[n], strlen(line)-n-1)); 
+
 			entry = lxa_archive_add_file(archive, temp_filename);
 			entry->props = props;
 			g_free(line);
+			g_free(temp_filename);
 		}
 	}
 	if(cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL) )



More information about the Xfce4-commits mailing list