aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/archive_extractor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/archive_extractor.c')
-rw-r--r--src/plugins/archive_extractor.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/plugins/archive_extractor.c b/src/plugins/archive_extractor.c
index 7a80ac5..6d413de 100644
--- a/src/plugins/archive_extractor.c
+++ b/src/plugins/archive_extractor.c
@@ -36,9 +36,9 @@
36 * @return number of bytes read 36 * @return number of bytes read
37 */ 37 */
38static ssize_t 38static ssize_t
39read_cb (struct archive *a, 39read_cb (struct archive *a,
40 void *client_data, 40 void *client_data,
41 const void **buff) 41 const void **buff)
42{ 42{
43 struct EXTRACTOR_ExtractContext *ec = client_data; 43 struct EXTRACTOR_ExtractContext *ec = client_data;
44 ssize_t ret; 44 ssize_t ret;
@@ -71,9 +71,9 @@ read_cb (struct archive *a,
71 * @return number of bytes skipped 71 * @return number of bytes skipped
72 */ 72 */
73static __LA_INT64_T 73static __LA_INT64_T
74skip_cb (struct archive *a, 74skip_cb (struct archive *a,
75 void *client_data, 75 void *client_data,
76 __LA_INT64_T request) 76 __LA_INT64_T request)
77{ 77{
78 struct EXTRACTOR_ExtractContext *ec = client_data; 78 struct EXTRACTOR_ExtractContext *ec = client_data;
79 79
@@ -84,11 +84,11 @@ skip_cb (struct archive *a,
84 84
85 85
86/** 86/**
87 * Main entry method for the ARCHIVE extraction plugin. 87 * Main entry method for the ARCHIVE extraction plugin.
88 * 88 *
89 * @param ec extraction context provided to the plugin 89 * @param ec extraction context provided to the plugin
90 */ 90 */
91void 91void
92EXTRACTOR_archive_extract_method (struct EXTRACTOR_ExtractContext *ec) 92EXTRACTOR_archive_extract_method (struct EXTRACTOR_ExtractContext *ec)
93{ 93{
94 struct archive *a; 94 struct archive *a;
@@ -105,41 +105,41 @@ EXTRACTOR_archive_extract_method (struct EXTRACTOR_ExtractContext *ec)
105 archive_read_support_compression_all (a); 105 archive_read_support_compression_all (a);
106#endif 106#endif
107 archive_read_support_format_all (a); 107 archive_read_support_format_all (a);
108 if(archive_read_open2 (a, ec, NULL, &read_cb, &skip_cb, NULL)!= ARCHIVE_OK) 108 if (archive_read_open2 (a, ec, NULL, &read_cb, &skip_cb, NULL)!= ARCHIVE_OK)
109 return; 109 return;
110 110
111 while (ARCHIVE_OK == archive_read_next_header(a, &entry)) 111 while (ARCHIVE_OK == archive_read_next_header (a, &entry))
112 { 112 {
113 if ( (NULL == format) && 113 if ( (NULL == format) &&
114 (NULL != (fname = archive_format_name (a))) ) 114 (NULL != (fname = archive_format_name (a))) )
115 format = strdup (fname); 115 format = strdup (fname);
116 s = archive_entry_pathname (entry); 116 s = archive_entry_pathname (entry);
117 if (0 != ec->proc (ec->cls, 117 if (0 != ec->proc (ec->cls,
118 "tar", 118 "tar",
119 EXTRACTOR_METATYPE_FILENAME, 119 EXTRACTOR_METATYPE_FILENAME,
120 EXTRACTOR_METAFORMAT_UTF8, 120 EXTRACTOR_METAFORMAT_UTF8,
121 "text/plain", 121 "text/plain",
122 s, strlen (s) + 1)) 122 s, strlen (s) + 1))
123 break; 123 break;
124 } 124 }
125#if ARCHIVE_VERSION_NUMBER >= 3000000 125#if ARCHIVE_VERSION_NUMBER >= 3000000
126 archive_read_free (a); 126 archive_read_free (a);
127#else 127#else
128 archive_read_finish (a); 128 archive_read_finish (a);
129#endif 129#endif
130 if (NULL != format) 130 if (NULL != format)
131 {
132 if (0 != ec->proc (ec->cls,
133 "tar",
134 EXTRACTOR_METATYPE_FORMAT,
135 EXTRACTOR_METAFORMAT_UTF8,
136 "text/plain", format, strlen (format) + 1))
131 { 137 {
132 if (0 != ec->proc (ec->cls,
133 "tar",
134 EXTRACTOR_METATYPE_FORMAT,
135 EXTRACTOR_METAFORMAT_UTF8,
136 "text/plain", format, strlen (format) + 1))
137 {
138 free (format);
139 return;
140 }
141 free (format); 138 free (format);
139 return;
142 } 140 }
141 free (format);
142 }
143} 143}
144 144
145 145