summaryrefslogtreecommitdiff
path: root/libre/xarchiver-libre/xarchiver-0.5.2-fix_7z_support.patch
blob: ad5b51b595a564afa48e15763b53e5f3c9fc8927 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
diff -Nur xarchiver-0.5.2.orig/src/7zip.c xarchiver-0.5.2/src/7zip.c
--- xarchiver-0.5.2.orig/src/7zip.c	2008-10-25 00:41:17.000000000 +1300
+++ xarchiver-0.5.2/src/7zip.c	2010-12-15 11:24:26.000000000 +1300
@@ -64,15 +64,14 @@
 	XEntry *entry;
 	gchar *filename;
 	gpointer item[5];
-	gint linesize = 0,n = 0,a = 0;
-	gboolean dir = FALSE;
+	gint linesize = 0,a = 0;
 
 	if (last_line)
 		return;
 
 	if (jump_header == FALSE)
 	{
-		if (line[0] == '-')
+		if ((line[0] == '-') && (line[3] != NULL)) 
 		{
 			jump_header = TRUE;
 			return;
@@ -93,71 +92,42 @@
 	item[4] = line;
 
 	/* Time */
-	for(n=13; n < linesize; ++n)
-		if(line[n] == ' ')
-			break;
-	line[n] = '\0';
+	line[19] = '\0';
 	item[3] = line + 11;
-	a = ++n;
 	
 	/* Permissions */
-	for(; n < linesize; n++)
-		if(line[n] == ' ')
-			break;
-	line[n] = '\0';
-	if ((line+a)[0] == 'D')
-		dir = TRUE;
-	item[2] = line + a;
+	line[25] = '\0';
+	item[2] = line + 20;
 	
 	/* Size */
-	for(++n; n < linesize; ++n)
-		if(line[n] >= '0' && line[n] <= '9')
+	for(a=26; a < linesize; ++a)
+		if(line[a] >= '0' && line[a] <= '9')
 			break;
-	a = n;
 
-	for(; n < linesize; ++n)
-		if(line[n] == ' ')
-			break;
-
-	line[n] = '\0';
+	line[38] = '\0';
 	item[0] = line + a;
 	archive->dummy_size += g_ascii_strtoull(item[0],NULL,0);
 
 	/* Compressed */
-	for(++n; n < linesize; ++n)
-		if(line[n] >= '0' && line[n] <= '9')
-			break;
-	a = n;
-
-	for(; n < linesize; ++n)
-		if(line[n] == ' ')
-			break;
-
-	line[n] = '\0';
-
-	if (line[50] != ' ')
+	/* Is this item solid? */
+	if (line[50] == ' ')
 	{
-		n+=2;
-		item[1] = line + a;
 		line[linesize-1] = '\0';
-		filename = g_strdup(line + n);
+		filename = g_strdup(line + 53);
 	}
-	/* Is this a solid archive? */
+
 	else
 	{
-		item[1] = "0";
-		line[n-1] = '\0';
+		for(a=39; a < linesize; ++a)
+			if(line[a] >= '0' && line[a] <= '9')
+				break;
+
+		line[51] = '\0';
+		item[1] = line + a;
+		line[linesize-1] = '\0';
 		filename = g_strdup(line + 53);
 	}
 
-	/* Work around for 7za which doesn't
-	* output / with directories */
-	if (dir)
-	{
-		gchar *filename_with_slash = g_strconcat (filename,"/",NULL);
-		g_free (filename);
-		filename = filename_with_slash;
-	}
 	entry = xa_set_archive_entries_for_each_row (archive,filename,item);
 	g_free(filename);
 }