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