aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--doc/extractor.texi8
-rw-r--r--src/Makefile.am2
-rw-r--r--src/common/Makefile.am30
-rw-r--r--src/common/convert.c (renamed from src/plugins/convert.c)2
-rw-r--r--src/common/convert.h (renamed from src/plugins/convert.h)2
-rw-r--r--src/common/convert_numeric.c (renamed from src/plugins/convert_numeric.c)70
-rw-r--r--src/common/convert_numeric.h (renamed from src/plugins/convert_numeric.h)56
-rw-r--r--src/common/pack.c (renamed from src/plugins/pack.c)4
-rw-r--r--src/common/pack.h (renamed from src/plugins/pack.h)4
-rw-r--r--src/plugins/Makefile-plugins.am2
-rw-r--r--src/plugins/Makefile.am45
-rw-r--r--src/plugins/applefileextractor.c10
-rw-r--r--src/plugins/elfextractor.c8
-rw-r--r--src/plugins/filenameextractor.c2
-rw-r--r--src/plugins/flvextractor.c116
-rw-r--r--src/plugins/gifextractor.c4
-rw-r--r--src/plugins/htmlextractor.c4
-rw-r--r--src/plugins/id3v23extractor.c6
-rw-r--r--src/plugins/id3v24extractor.c8
-rw-r--r--src/plugins/id3v2extractor.c6
-rw-r--r--src/plugins/mp3extractor.c28
-rw-r--r--src/plugins/ole2/ole2extractor.c10
-rw-r--r--src/plugins/pdf/pdfextractor.cc8
-rw-r--r--src/plugins/pdfextractor.c4
-rw-r--r--src/plugins/pngextractor.c4
-rw-r--r--src/plugins/tiffextractor.c4
27 files changed, 230 insertions, 218 deletions
diff --git a/configure.ac b/configure.ac
index 78a8fe8..04f0cde 100644
--- a/configure.ac
+++ b/configure.ac
@@ -527,6 +527,7 @@ contrib/macosx/Info.plist
527doc/Makefile 527doc/Makefile
528src/Makefile 528src/Makefile
529src/include/Makefile 529src/include/Makefile
530src/common/Makefile
530src/main/Makefile 531src/main/Makefile
531src/plugins/Makefile 532src/plugins/Makefile
532src/plugins/ole2/Makefile 533src/plugins/ole2/Makefile
diff --git a/doc/extractor.texi b/doc/extractor.texi
index f13ba68..fad0fdb 100644
--- a/doc/extractor.texi
+++ b/doc/extractor.texi
@@ -648,10 +648,10 @@ file format has been established (beyond reasonable doubt).
648 648
649@cindex UTF-8 649@cindex UTF-8
650@cindex character set 650@cindex character set
651@findex convertToUtf8 651@findex EXTRACTOR_common_convert_to_utf8
652Various @acronym{libextractor} plugins make use of the internal 652Various @acronym{libextractor} plugins make use of the internal
653@file{convert.h} header which defines a function 653@file{convert.h} header which defines a function
654@verb{|convertToUtf8|} which can be used to easily convert text from 654@verb{|EXTRACTOR_common_convert_to_utf8|} which can be used to easily convert text from
655any character set to UTF-8. This conversion is important since the 655any character set to UTF-8. This conversion is important since the
656linked list of keywords that is returned by @acronym{libextractor} is 656linked list of keywords that is returned by @acronym{libextractor} is
657expected to contain only UTF-8 strings. Naturally, proper conversion 657expected to contain only UTF-8 strings. Naturally, proper conversion
@@ -659,12 +659,12 @@ may not always be possible since some file formats fail to specify the
659character set. In that case, it is often better to not convert at 659character set. In that case, it is often better to not convert at
660all. 660all.
661 661
662The arguments to @verb{|convertToUtf8|} are the input string (which 662The arguments to @verb{|EXTRACTOR_common_convert_to_utf8|} are the input string (which
663does @emph{not} have to be zero-terminated), the length of the input 663does @emph{not} have to be zero-terminated), the length of the input
664string, and the character set (which @emph{must} be zero-terminated). 664string, and the character set (which @emph{must} be zero-terminated).
665Which character sets are supported depends on the platform, a list can 665Which character sets are supported depends on the platform, a list can
666generally be obtained using the @command{iconv -l} command. The 666generally be obtained using the @command{iconv -l} command. The
667return value from @verb{|convertToUtf8|} is a zero-terminated string 667return value from @verb{|EXTRACTOR_common_convert_to_utf8|} is a zero-terminated string
668in UTF-8 format. The responsibility to free the string is with the 668in UTF-8 format. The responsibility to free the string is with the
669caller, so storing the string in the keyword list is acceptable. 669caller, so storing the string in the keyword list is acceptable.
670 670
diff --git a/src/Makefile.am b/src/Makefile.am
index fbf1ff0..281d2d8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,3 +1,3 @@
1INCLUDES = -I$(top_srcdir)/src/include 1INCLUDES = -I$(top_srcdir)/src/include
2 2
3SUBDIRS = include main plugins test . 3SUBDIRS = include main common plugins test .
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
new file mode 100644
index 0000000..4ffd5bd
--- /dev/null
+++ b/src/common/Makefile.am
@@ -0,0 +1,30 @@
1INCLUDES = -I$(top_srcdir)/src/include $(LTDLINCL)
2
3LIBS = \
4 @LTLIBINTL@ @LIBS@
5
6lib_LTLIBRARIES = \
7 libextractor_common.la
8
9if !MINGW
10 exportflag=-export-symbols-regex "EXTRACTOR_.*"
11if !SOMEBSD
12 dlflag=-ldl
13endif
14else
15 winexportflag=-export-dynamic
16endif
17
18libextractor_common_la_LDFLAGS = \
19 $(exportflag) $(winexportflag) -version-info @LIB_VERSION_CURRENT@:@LIB_VERSION_REVISION@:@LIB_VERSION_AGE@ $(LIBICONV)
20
21libextractor_common_la_LIBADD = \
22 $(LIBLTDL) $(dlflag)
23
24libextractor_common_la_SOURCES = \
25 pack.c \
26 pack.h \
27 convert.c \
28 convert.h \
29 convert_numeric.c \
30 convert_numeric.h
diff --git a/src/plugins/convert.c b/src/common/convert.c
index b416fa8..fc04db0 100644
--- a/src/plugins/convert.c
+++ b/src/common/convert.c
@@ -31,7 +31,7 @@
31 * string is returned. 31 * string is returned.
32 */ 32 */
33char * 33char *
34convertToUtf8 (const char *input, size_t len, const char *charset) 34EXTRACTOR_common_convert_to_utf8 (const char *input, size_t len, const char *charset)
35{ 35{
36 size_t tmpSize; 36 size_t tmpSize;
37 size_t finSize; 37 size_t finSize;
diff --git a/src/plugins/convert.h b/src/common/convert.h
index 3bb4c06..72e02a5 100644
--- a/src/plugins/convert.h
+++ b/src/common/convert.h
@@ -35,7 +35,7 @@ extern "C" {
35 * to UTF-8. 35 * to UTF-8.
36 * @return the converted string (0-terminated) 36 * @return the converted string (0-terminated)
37 */ 37 */
38char * convertToUtf8(const char * input, 38char * EXTRACTOR_common_convert_to_utf8(const char * input,
39 size_t len, 39 size_t len,
40 const char * charset); 40 const char * charset);
41 41
diff --git a/src/plugins/convert_numeric.c b/src/common/convert_numeric.c
index e41151a..9c86b6f 100644
--- a/src/plugins/convert_numeric.c
+++ b/src/common/convert_numeric.c
@@ -57,15 +57,15 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
57#endif 57#endif
58 58
59static unsigned long get_field (const unsigned char *, 59static unsigned long get_field (const unsigned char *,
60 enum floatformat_byteorders, 60 enum EXTRACTOR_floatformat_byteorders,
61 unsigned int, 61 unsigned int,
62 unsigned int, 62 unsigned int,
63 unsigned int); 63 unsigned int);
64static int floatformat_always_valid (const struct floatformat *fmt, 64static int floatformat_always_valid (const struct EXTRACTOR_floatformat *fmt,
65 const void *from); 65 const void *from);
66 66
67static int 67static int
68floatformat_always_valid (const struct floatformat *fmt /*ATTRIBUTE_UNUSED*/, 68floatformat_always_valid (const struct EXTRACTOR_floatformat *fmt /*ATTRIBUTE_UNUSED*/,
69 const void *from /*ATTRIBUTE_UNUSED*/) 69 const void *from /*ATTRIBUTE_UNUSED*/)
70{ 70{
71 return 1; 71 return 1;
@@ -77,28 +77,28 @@ floatformat_always_valid (const struct floatformat *fmt /*ATTRIBUTE_UNUSED*/,
77#define FLOATFORMAT_CHAR_BIT 8 77#define FLOATFORMAT_CHAR_BIT 8
78 78
79/* floatformats for IEEE single and double, big and little endian. */ 79/* floatformats for IEEE single and double, big and little endian. */
80const struct floatformat floatformat_ieee_single_big = 80const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ieee_single_big =
81{ 81{
82 floatformat_big, 32, 0, 1, 8, 127, 255, 9, 23, 82 floatformat_big, 32, 0, 1, 8, 127, 255, 9, 23,
83 floatformat_intbit_no, 83 floatformat_intbit_no,
84 "floatformat_ieee_single_big", 84 "floatformat_ieee_single_big",
85 floatformat_always_valid 85 floatformat_always_valid
86}; 86};
87const struct floatformat floatformat_ieee_single_little = 87const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ieee_single_little =
88{ 88{
89 floatformat_little, 32, 0, 1, 8, 127, 255, 9, 23, 89 floatformat_little, 32, 0, 1, 8, 127, 255, 9, 23,
90 floatformat_intbit_no, 90 floatformat_intbit_no,
91 "floatformat_ieee_single_little", 91 "floatformat_ieee_single_little",
92 floatformat_always_valid 92 floatformat_always_valid
93}; 93};
94const struct floatformat floatformat_ieee_double_big = 94const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ieee_double_big =
95{ 95{
96 floatformat_big, 64, 0, 1, 11, 1023, 2047, 12, 52, 96 floatformat_big, 64, 0, 1, 11, 1023, 2047, 12, 52,
97 floatformat_intbit_no, 97 floatformat_intbit_no,
98 "floatformat_ieee_double_big", 98 "floatformat_ieee_double_big",
99 floatformat_always_valid 99 floatformat_always_valid
100}; 100};
101const struct floatformat floatformat_ieee_double_little = 101const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ieee_double_little =
102{ 102{
103 floatformat_little, 64, 0, 1, 11, 1023, 2047, 12, 52, 103 floatformat_little, 64, 0, 1, 11, 1023, 2047, 12, 52,
104 floatformat_intbit_no, 104 floatformat_intbit_no,
@@ -109,7 +109,7 @@ const struct floatformat floatformat_ieee_double_little =
109/* floatformat for IEEE double, little endian byte order, with big endian word 109/* floatformat for IEEE double, little endian byte order, with big endian word
110 ordering, as on the ARM. */ 110 ordering, as on the ARM. */
111 111
112const struct floatformat floatformat_ieee_double_littlebyte_bigword = 112const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ieee_double_littlebyte_bigword =
113{ 113{
114 floatformat_littlebyte_bigword, 64, 0, 1, 11, 1023, 2047, 12, 52, 114 floatformat_littlebyte_bigword, 64, 0, 1, 11, 1023, 2047, 12, 52,
115 floatformat_intbit_no, 115 floatformat_intbit_no,
@@ -119,21 +119,21 @@ const struct floatformat floatformat_ieee_double_littlebyte_bigword =
119 119
120/* floatformat for VAX. Not quite IEEE, but close enough. */ 120/* floatformat for VAX. Not quite IEEE, but close enough. */
121 121
122const struct floatformat floatformat_vax_f = 122const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_vax_f =
123{ 123{
124 floatformat_vax, 32, 0, 1, 8, 129, 0, 9, 23, 124 floatformat_vax, 32, 0, 1, 8, 129, 0, 9, 23,
125 floatformat_intbit_no, 125 floatformat_intbit_no,
126 "floatformat_vax_f", 126 "floatformat_vax_f",
127 floatformat_always_valid 127 floatformat_always_valid
128}; 128};
129const struct floatformat floatformat_vax_d = 129const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_vax_d =
130{ 130{
131 floatformat_vax, 64, 0, 1, 8, 129, 0, 9, 55, 131 floatformat_vax, 64, 0, 1, 8, 129, 0, 9, 55,
132 floatformat_intbit_no, 132 floatformat_intbit_no,
133 "floatformat_vax_d", 133 "floatformat_vax_d",
134 floatformat_always_valid 134 floatformat_always_valid
135}; 135};
136const struct floatformat floatformat_vax_g = 136const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_vax_g =
137{ 137{
138 floatformat_vax, 64, 0, 1, 11, 1025, 0, 12, 52, 138 floatformat_vax, 64, 0, 1, 11, 1025, 0, 12, 52,
139 floatformat_intbit_no, 139 floatformat_intbit_no,
@@ -141,11 +141,11 @@ const struct floatformat floatformat_vax_g =
141 floatformat_always_valid 141 floatformat_always_valid
142}; 142};
143 143
144static int floatformat_i387_ext_is_valid (const struct floatformat *fmt, 144static int floatformat_i387_ext_is_valid (const struct EXTRACTOR_floatformat *fmt,
145 const void *from); 145 const void *from);
146 146
147static int 147static int
148floatformat_i387_ext_is_valid (const struct floatformat *fmt, const void *from) 148floatformat_i387_ext_is_valid (const struct EXTRACTOR_floatformat *fmt, const void *from)
149{ 149{
150 /* In the i387 double-extended format, if the exponent is all ones, 150 /* In the i387 double-extended format, if the exponent is all ones,
151 then the integer bit must be set. If the exponent is neither 0 151 then the integer bit must be set. If the exponent is neither 0
@@ -165,14 +165,14 @@ floatformat_i387_ext_is_valid (const struct floatformat *fmt, const void *from)
165 return 1; 165 return 1;
166} 166}
167 167
168const struct floatformat floatformat_i387_ext = 168const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_i387_ext =
169{ 169{
170 floatformat_little, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64, 170 floatformat_little, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
171 floatformat_intbit_yes, 171 floatformat_intbit_yes,
172 "floatformat_i387_ext", 172 "floatformat_i387_ext",
173 floatformat_i387_ext_is_valid 173 floatformat_i387_ext_is_valid
174}; 174};
175const struct floatformat floatformat_m68881_ext = 175const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_m68881_ext =
176{ 176{
177 /* Note that the bits from 16 to 31 are unused. */ 177 /* Note that the bits from 16 to 31 are unused. */
178 floatformat_big, 96, 0, 1, 15, 0x3fff, 0x7fff, 32, 64, 178 floatformat_big, 96, 0, 1, 15, 0x3fff, 0x7fff, 32, 64,
@@ -180,7 +180,7 @@ const struct floatformat floatformat_m68881_ext =
180 "floatformat_m68881_ext", 180 "floatformat_m68881_ext",
181 floatformat_always_valid 181 floatformat_always_valid
182}; 182};
183const struct floatformat floatformat_i960_ext = 183const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_i960_ext =
184{ 184{
185 /* Note that the bits from 0 to 15 are unused. */ 185 /* Note that the bits from 0 to 15 are unused. */
186 floatformat_little, 96, 16, 17, 15, 0x3fff, 0x7fff, 32, 64, 186 floatformat_little, 96, 16, 17, 15, 0x3fff, 0x7fff, 32, 64,
@@ -188,14 +188,14 @@ const struct floatformat floatformat_i960_ext =
188 "floatformat_i960_ext", 188 "floatformat_i960_ext",
189 floatformat_always_valid 189 floatformat_always_valid
190}; 190};
191const struct floatformat floatformat_m88110_ext = 191const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_m88110_ext =
192{ 192{
193 floatformat_big, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64, 193 floatformat_big, 80, 0, 1, 15, 0x3fff, 0x7fff, 16, 64,
194 floatformat_intbit_yes, 194 floatformat_intbit_yes,
195 "floatformat_m88110_ext", 195 "floatformat_m88110_ext",
196 floatformat_always_valid 196 floatformat_always_valid
197}; 197};
198const struct floatformat floatformat_m88110_harris_ext = 198const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_m88110_harris_ext =
199{ 199{
200 /* Harris uses raw format 128 bytes long, but the number is just an ieee 200 /* Harris uses raw format 128 bytes long, but the number is just an ieee
201 double, and the last 64 bits are wasted. */ 201 double, and the last 64 bits are wasted. */
@@ -204,7 +204,7 @@ const struct floatformat floatformat_m88110_harris_ext =
204 "floatformat_m88110_ext_harris", 204 "floatformat_m88110_ext_harris",
205 floatformat_always_valid 205 floatformat_always_valid
206}; 206};
207const struct floatformat floatformat_arm_ext_big = 207const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_arm_ext_big =
208{ 208{
209 /* Bits 1 to 16 are unused. */ 209 /* Bits 1 to 16 are unused. */
210 floatformat_big, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64, 210 floatformat_big, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64,
@@ -212,7 +212,7 @@ const struct floatformat floatformat_arm_ext_big =
212 "floatformat_arm_ext_big", 212 "floatformat_arm_ext_big",
213 floatformat_always_valid 213 floatformat_always_valid
214}; 214};
215const struct floatformat floatformat_arm_ext_littlebyte_bigword = 215const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_arm_ext_littlebyte_bigword =
216{ 216{
217 /* Bits 1 to 16 are unused. */ 217 /* Bits 1 to 16 are unused. */
218 floatformat_littlebyte_bigword, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64, 218 floatformat_littlebyte_bigword, 96, 0, 17, 15, 0x3fff, 0x7fff, 32, 64,
@@ -220,35 +220,35 @@ const struct floatformat floatformat_arm_ext_littlebyte_bigword =
220 "floatformat_arm_ext_littlebyte_bigword", 220 "floatformat_arm_ext_littlebyte_bigword",
221 floatformat_always_valid 221 floatformat_always_valid
222}; 222};
223const struct floatformat floatformat_ia64_spill_big = 223const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ia64_spill_big =
224{ 224{
225 floatformat_big, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64, 225 floatformat_big, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64,
226 floatformat_intbit_yes, 226 floatformat_intbit_yes,
227 "floatformat_ia64_spill_big", 227 "floatformat_ia64_spill_big",
228 floatformat_always_valid 228 floatformat_always_valid
229}; 229};
230const struct floatformat floatformat_ia64_spill_little = 230const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ia64_spill_little =
231{ 231{
232 floatformat_little, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64, 232 floatformat_little, 128, 0, 1, 17, 65535, 0x1ffff, 18, 64,
233 floatformat_intbit_yes, 233 floatformat_intbit_yes,
234 "floatformat_ia64_spill_little", 234 "floatformat_ia64_spill_little",
235 floatformat_always_valid 235 floatformat_always_valid
236}; 236};
237const struct floatformat floatformat_ia64_quad_big = 237const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ia64_quad_big =
238{ 238{
239 floatformat_big, 128, 0, 1, 15, 16383, 0x7fff, 16, 112, 239 floatformat_big, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
240 floatformat_intbit_no, 240 floatformat_intbit_no,
241 "floatformat_ia64_quad_big", 241 "floatformat_ia64_quad_big",
242 floatformat_always_valid 242 floatformat_always_valid
243}; 243};
244const struct floatformat floatformat_ia64_quad_little = 244const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ia64_quad_little =
245{ 245{
246 floatformat_little, 128, 0, 1, 15, 16383, 0x7fff, 16, 112, 246 floatformat_little, 128, 0, 1, 15, 16383, 0x7fff, 16, 112,
247 floatformat_intbit_no, 247 floatformat_intbit_no,
248 "floatformat_ia64_quad_little", 248 "floatformat_ia64_quad_little",
249 floatformat_always_valid 249 floatformat_always_valid
250}; 250};
251 251
252 252
253#ifndef min 253#ifndef min
254#define min(a, b) ((a) < (b) ? (a) : (b)) 254#define min(a, b) ((a) < (b) ? (a) : (b))
@@ -257,7 +257,7 @@ const struct floatformat floatformat_ia64_quad_little =
257/* Extract a field which starts at START and is LEN bits long. DATA and 257/* Extract a field which starts at START and is LEN bits long. DATA and
258 TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */ 258 TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */
259static unsigned long 259static unsigned long
260get_field (const unsigned char *data, enum floatformat_byteorders order, 260get_field (const unsigned char *data, enum EXTRACTOR_floatformat_byteorders order,
261 unsigned int total_len, unsigned int start, unsigned int len) 261 unsigned int total_len, unsigned int start, unsigned int len)
262{ 262{
263 unsigned long result = 0; 263 unsigned long result = 0;
@@ -276,7 +276,7 @@ get_field (const unsigned char *data, enum floatformat_byteorders order,
276 276
277 lo_bit = start % FLOATFORMAT_CHAR_BIT; 277 lo_bit = start % FLOATFORMAT_CHAR_BIT;
278 hi_bit = min (lo_bit + len, FLOATFORMAT_CHAR_BIT); 278 hi_bit = min (lo_bit + len, FLOATFORMAT_CHAR_BIT);
279 279
280 do 280 do
281 { 281 {
282 unsigned int shifted = *(data + cur_byte) >> lo_bit; 282 unsigned int shifted = *(data + cur_byte) >> lo_bit;
@@ -293,13 +293,13 @@ get_field (const unsigned char *data, enum floatformat_byteorders order,
293 293
294 return result; 294 return result;
295} 295}
296 296
297/* Convert from FMT to a double. 297/* Convert from FMT to a double.
298 FROM is the address of the extended float. 298 FROM is the address of the extended float.
299 Store the double in *TO. */ 299 Store the double in *TO. */
300 300
301void 301void
302floatformat_to_double (const struct floatformat *fmt, 302EXTRACTOR_common_floatformat_to_double (const struct EXTRACTOR_floatformat *fmt,
303 const void *from, double *to) 303 const void *from, double *to)
304{ 304{
305 const unsigned char *ufrom = (const unsigned char *) from; 305 const unsigned char *ufrom = (const unsigned char *) from;
@@ -411,8 +411,8 @@ floatformat_to_double (const struct floatformat *fmt,
411 dto = -dto; 411 dto = -dto;
412 *to = dto; 412 *to = dto;
413} 413}
414 414
415static void put_field (unsigned char *, enum floatformat_byteorders, 415static void put_field (unsigned char *, enum EXTRACTOR_floatformat_byteorders,
416 unsigned int, 416 unsigned int,
417 unsigned int, 417 unsigned int,
418 unsigned int, 418 unsigned int,
@@ -421,7 +421,7 @@ static void put_field (unsigned char *, enum floatformat_byteorders,
421/* Set a field which starts at START and is LEN bits long. DATA and 421/* Set a field which starts at START and is LEN bits long. DATA and
422 TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */ 422 TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */
423static void 423static void
424put_field (unsigned char *data, enum floatformat_byteorders order, 424put_field (unsigned char *data, enum EXTRACTOR_floatformat_byteorders order,
425 unsigned int total_len, unsigned int start, unsigned int len, 425 unsigned int total_len, unsigned int start, unsigned int len,
426 unsigned long stuff_to_put) 426 unsigned long stuff_to_put)
427{ 427{
@@ -440,7 +440,7 @@ put_field (unsigned char *data, enum floatformat_byteorders order,
440 440
441 lo_bit = start % FLOATFORMAT_CHAR_BIT; 441 lo_bit = start % FLOATFORMAT_CHAR_BIT;
442 hi_bit = min (lo_bit + len, FLOATFORMAT_CHAR_BIT); 442 hi_bit = min (lo_bit + len, FLOATFORMAT_CHAR_BIT);
443 443
444 do 444 do
445 { 445 {
446 unsigned char *byte_ptr = data + cur_byte; 446 unsigned char *byte_ptr = data + cur_byte;
@@ -461,7 +461,7 @@ put_field (unsigned char *data, enum floatformat_byteorders order,
461 restrictions. */ 461 restrictions. */
462 462
463void 463void
464floatformat_from_double (const struct floatformat *fmt, 464EXTRACTOR_common_floatformat_from_double (const struct EXTRACTOR_floatformat *fmt,
465 const double *from, void *to) 465 const double *from, void *to)
466{ 466{
467 double dfrom; 467 double dfrom;
@@ -557,7 +557,7 @@ floatformat_from_double (const struct floatformat *fmt,
557/* Return non-zero iff the data at FROM is a valid number in format FMT. */ 557/* Return non-zero iff the data at FROM is a valid number in format FMT. */
558 558
559int 559int
560floatformat_is_valid (const struct floatformat *fmt, const void *from) 560EXTRACTOR_common_floatformat_is_valid (const struct EXTRACTOR_floatformat *fmt, const void *from)
561{ 561{
562 return fmt->is_valid (fmt, from); 562 return fmt->is_valid (fmt, from);
563} 563}
diff --git a/src/plugins/convert_numeric.h b/src/common/convert_numeric.h
index 6889fca..cc425f5 100644
--- a/src/plugins/convert_numeric.h
+++ b/src/common/convert_numeric.h
@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
31 31
32/* What is the order of the bytes? */ 32/* What is the order of the bytes? */
33 33
34enum floatformat_byteorders { 34enum EXTRACTOR_floatformat_byteorders {
35 /* Standard little endian byte order. 35 /* Standard little endian byte order.
36 EX: 1.2345678e10 => 00 00 80 c5 e0 fe 06 42 */ 36 EX: 1.2345678e10 => 00 00 80 c5 e0 fe 06 42 */
37 floatformat_little, 37 floatformat_little,
@@ -51,11 +51,11 @@ enum floatformat_byteorders {
51 floatformat_vax 51 floatformat_vax
52}; 52};
53 53
54enum floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no }; 54enum EXTRACTOR_floatformat_intbit { floatformat_intbit_yes, floatformat_intbit_no };
55 55
56struct floatformat 56struct EXTRACTOR_floatformat
57{ 57{
58 enum floatformat_byteorders byteorder; 58 enum EXTRACTOR_floatformat_byteorders byteorder;
59 unsigned int totalsize; /* Total size of number in bits */ 59 unsigned int totalsize; /* Total size of number in bits */
60 60
61 /* Sign bit is always one bit long. 1 means negative, 0 means positive. */ 61 /* Sign bit is always one bit long. 1 means negative, 0 means positive. */
@@ -78,63 +78,63 @@ struct floatformat
78 unsigned int man_len; 78 unsigned int man_len;
79 79
80 /* Is the integer bit explicit or implicit? */ 80 /* Is the integer bit explicit or implicit? */
81 enum floatformat_intbit intbit; 81 enum EXTRACTOR_floatformat_intbit intbit;
82 82
83 /* Internal name for debugging. */ 83 /* Internal name for debugging. */
84 const char *name; 84 const char *name;
85 85
86 /* Validator method. */ 86 /* Validator method. */
87 int (*is_valid) (const struct floatformat *fmt, const void *from); 87 int (*is_valid) (const struct EXTRACTOR_floatformat *fmt, const void *from);
88}; 88};
89 89
90/* floatformats for IEEE single and double, big and little endian. */ 90/* floatformats for IEEE single and double, big and little endian. */
91 91
92extern const struct floatformat floatformat_ieee_single_big; 92extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ieee_single_big;
93extern const struct floatformat floatformat_ieee_single_little; 93extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ieee_single_little;
94extern const struct floatformat floatformat_ieee_double_big; 94extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ieee_double_big;
95extern const struct floatformat floatformat_ieee_double_little; 95extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ieee_double_little;
96 96
97/* floatformat for ARM IEEE double, little endian bytes and big endian words */ 97/* floatformat for ARM IEEE double, little endian bytes and big endian words */
98 98
99extern const struct floatformat floatformat_ieee_double_littlebyte_bigword; 99extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ieee_double_littlebyte_bigword;
100 100
101/* floatformats for VAX. */ 101/* floatformats for VAX. */
102 102
103extern const struct floatformat floatformat_vax_f; 103extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_vax_f;
104extern const struct floatformat floatformat_vax_d; 104extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_vax_d;
105extern const struct floatformat floatformat_vax_g; 105extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_vax_g;
106 106
107/* floatformats for various extendeds. */ 107/* floatformats for various extendeds. */
108 108
109extern const struct floatformat floatformat_i387_ext; 109extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_i387_ext;
110extern const struct floatformat floatformat_m68881_ext; 110extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_m68881_ext;
111extern const struct floatformat floatformat_i960_ext; 111extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_i960_ext;
112extern const struct floatformat floatformat_m88110_ext; 112extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_m88110_ext;
113extern const struct floatformat floatformat_m88110_harris_ext; 113extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_m88110_harris_ext;
114extern const struct floatformat floatformat_arm_ext_big; 114extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_arm_ext_big;
115extern const struct floatformat floatformat_arm_ext_littlebyte_bigword; 115extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_arm_ext_littlebyte_bigword;
116/* IA-64 Floating Point register spilt into memory. */ 116/* IA-64 Floating Point register spilt into memory. */
117extern const struct floatformat floatformat_ia64_spill_big; 117extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ia64_spill_big;
118extern const struct floatformat floatformat_ia64_spill_little; 118extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ia64_spill_little;
119extern const struct floatformat floatformat_ia64_quad_big; 119extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ia64_quad_big;
120extern const struct floatformat floatformat_ia64_quad_little; 120extern const struct EXTRACTOR_floatformat EXTRACTOR_floatformat_ia64_quad_little;
121 121
122/* Convert from FMT to a double. 122/* Convert from FMT to a double.
123 FROM is the address of the extended float. 123 FROM is the address of the extended float.
124 Store the double in *TO. */ 124 Store the double in *TO. */
125 125
126extern void 126extern void
127floatformat_to_double (const struct floatformat *, const void *, double *); 127EXTRACTOR_common_floatformat_to_double (const struct EXTRACTOR_floatformat *, const void *, double *);
128 128
129/* The converse: convert the double *FROM to FMT 129/* The converse: convert the double *FROM to FMT
130 and store where TO points. */ 130 and store where TO points. */
131 131
132extern void 132extern void
133floatformat_from_double (const struct floatformat *, const double *, void *); 133EXTRACTOR_common_floatformat_from_double (const struct EXTRACTOR_floatformat *, const double *, void *);
134 134
135/* Return non-zero iff the data at FROM is a valid number in format FMT. */ 135/* Return non-zero iff the data at FROM is a valid number in format FMT. */
136 136
137extern int 137extern int
138floatformat_is_valid (const struct floatformat *fmt, const void *from); 138EXTRACTOR_common_floatformat_is_valid (const struct EXTRACTOR_floatformat *fmt, const void *from);
139 139
140#endif /* defined (FLOATFORMAT_H) */ 140#endif /* defined (FLOATFORMAT_H) */
diff --git a/src/plugins/pack.c b/src/common/pack.c
index 8b3c3f5..ee0d2ba 100644
--- a/src/plugins/pack.c
+++ b/src/common/pack.c
@@ -56,7 +56,7 @@ typedef signed int sword;
56 */ 56 */
57 57
58int 58int
59cat_pack (void *buf, const char *fmt, ...) 59EXTRACTOR_common_cat_pack (void *buf, const char *fmt, ...)
60{ 60{
61 va_list ap; 61 va_list ap;
62 word blen, val; 62 word blen, val;
@@ -248,7 +248,7 @@ cat_pack (void *buf, const char *fmt, ...)
248 248
249 249
250int 250int
251cat_unpack (const void *buf, const char *fmt, ...) 251EXTRACTOR_common_cat_unpack (const void *buf, const char *fmt, ...)
252{ 252{
253 va_list ap; 253 va_list ap;
254 word maxlen, len, *wordp; 254 word maxlen, len, *wordp;
diff --git a/src/plugins/pack.h b/src/common/pack.h
index 81824f2..3b2c2c5 100644
--- a/src/plugins/pack.h
+++ b/src/common/pack.h
@@ -45,9 +45,9 @@ MODIFICATIONS.
45 to hold the data. 45 to hold the data.
46 */ 46 */
47 47
48int cat_pack(void * buf, const char *fmt, ... ); 48int EXTRACTOR_common_cat_pack(void * buf, const char *fmt, ... );
49 49
50int cat_unpack(const void * buf, const char *fmt, ... ); 50int EXTRACTOR_common_cat_unpack(const void * buf, const char *fmt, ... );
51 51
52struct cat_bvec { 52struct cat_bvec {
53 unsigned long len; 53 unsigned long len;
diff --git a/src/plugins/Makefile-plugins.am b/src/plugins/Makefile-plugins.am
index af0a425..9392798 100644
--- a/src/plugins/Makefile-plugins.am
+++ b/src/plugins/Makefile-plugins.am
@@ -1,4 +1,4 @@
1INCLUDES = -I$(top_srcdir)/src/include 1INCLUDES = -I$(top_srcdir)/src/include -I$(top_srcdir)/src/common
2 2
3# install plugins under: 3# install plugins under:
4plugindir = $(libdir)/@RPLUGINDIR@ 4plugindir = $(libdir)/@RPLUGINDIR@
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index e0d47ec..dd884a8 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -142,11 +142,6 @@ libextractor_flac_la_LDFLAGS = \
142 -lFLAC $(flacoggflag) $(PLUGINFLAGS) $(retaincommand) 142 -lFLAC $(flacoggflag) $(PLUGINFLAGS) $(retaincommand)
143endif 143endif
144 144
145noinst_LTLIBRARIES = \
146 libpack.la \
147 libconvert.la \
148 libconvert_numeric.la
149
150if HAVE_ZLIB 145if HAVE_ZLIB
151libextractor_qt_la_LDFLAGS = \ 146libextractor_qt_la_LDFLAGS = \
152 $(PLUGINFLAGS) $(retaincommand) 147 $(PLUGINFLAGS) $(retaincommand)
@@ -172,35 +167,35 @@ libextractor_pdf_la_SOURCES = \
172libextractor_pdf_la_LDFLAGS = \ 167libextractor_pdf_la_LDFLAGS = \
173 $(PLUGINFLAGS) $(retaincommand) 168 $(PLUGINFLAGS) $(retaincommand)
174libextractor_pdf_la_LIBADD = \ 169libextractor_pdf_la_LIBADD = \
175 libconvert.la 170 $(top_builddir)/src/common/libextractor_common.la
176 171
177libextractor_mp3_la_SOURCES = \ 172libextractor_mp3_la_SOURCES = \
178 mp3extractor.c 173 mp3extractor.c
179libextractor_mp3_la_LDFLAGS = \ 174libextractor_mp3_la_LDFLAGS = \
180 $(PLUGINFLAGS) $(retaincommand) 175 $(PLUGINFLAGS) $(retaincommand)
181libextractor_mp3_la_LIBADD = \ 176libextractor_mp3_la_LIBADD = \
182 libconvert.la 177 $(top_builddir)/src/common/libextractor_common.la
183 178
184libextractor_id3v2_la_SOURCES = \ 179libextractor_id3v2_la_SOURCES = \
185 id3v2extractor.c 180 id3v2extractor.c
186libextractor_id3v2_la_LDFLAGS = \ 181libextractor_id3v2_la_LDFLAGS = \
187 $(PLUGINFLAGS) $(retaincommand) 182 $(PLUGINFLAGS) $(retaincommand)
188libextractor_id3v2_la_LIBADD = \ 183libextractor_id3v2_la_LIBADD = \
189 libconvert.la 184 $(top_builddir)/src/common/libextractor_common.la
190 185
191libextractor_id3v23_la_SOURCES = \ 186libextractor_id3v23_la_SOURCES = \
192 id3v23extractor.c 187 id3v23extractor.c
193libextractor_id3v23_la_LDFLAGS = \ 188libextractor_id3v23_la_LDFLAGS = \
194 $(PLUGINFLAGS) $(retaincommand) 189 $(PLUGINFLAGS) $(retaincommand)
195libextractor_id3v23_la_LIBADD = \ 190libextractor_id3v23_la_LIBADD = \
196 libconvert.la 191 $(top_builddir)/src/common/libextractor_common.la
197 192
198libextractor_id3v24_la_SOURCES = \ 193libextractor_id3v24_la_SOURCES = \
199 id3v24extractor.c 194 id3v24extractor.c
200libextractor_id3v24_la_LDFLAGS = \ 195libextractor_id3v24_la_LDFLAGS = \
201 $(PLUGINFLAGS) $(retaincommand) 196 $(PLUGINFLAGS) $(retaincommand)
202libextractor_id3v24_la_LIBADD = \ 197libextractor_id3v24_la_LIBADD = \
203 libconvert.la 198 $(top_builddir)/src/common/libextractor_common.la
204 199
205libextractor_it_la_SOURCES = \ 200libextractor_it_la_SOURCES = \
206 itextractor.c 201 itextractor.c
@@ -238,42 +233,28 @@ libextractor_gif_la_SOURCES = \
238libextractor_gif_la_LDFLAGS = \ 233libextractor_gif_la_LDFLAGS = \
239 $(PLUGINFLAGS) $(retaincommand) 234 $(PLUGINFLAGS) $(retaincommand)
240libextractor_gif_la_LIBADD = \ 235libextractor_gif_la_LIBADD = \
241 libpack.la 236 $(top_builddir)/src/common/libextractor_common.la
242 237
243libextractor_tiff_la_SOURCES = \ 238libextractor_tiff_la_SOURCES = \
244 tiffextractor.c 239 tiffextractor.c
245libextractor_tiff_la_LDFLAGS = \ 240libextractor_tiff_la_LDFLAGS = \
246 $(PLUGINFLAGS) $(retaincommand) 241 $(PLUGINFLAGS) $(retaincommand)
247libextractor_tiff_la_LIBADD = \ 242libextractor_tiff_la_LIBADD = \
248 libpack.la 243 $(top_builddir)/src/common/libextractor_common.la
249 244
250libextractor_applefile_la_SOURCES = \ 245libextractor_applefile_la_SOURCES = \
251 applefileextractor.c 246 applefileextractor.c
252libextractor_applefile_la_LDFLAGS = \ 247libextractor_applefile_la_LDFLAGS = \
253 $(PLUGINFLAGS) $(retaincommand) 248 $(PLUGINFLAGS) $(retaincommand)
254libextractor_applefile_la_LIBADD = \ 249libextractor_applefile_la_LIBADD = \
255 libpack.la 250 $(top_builddir)/src/common/libextractor_common.la
256 251
257libextractor_elf_la_SOURCES = \ 252libextractor_elf_la_SOURCES = \
258 elfextractor.c 253 elfextractor.c
259libextractor_elf_la_LDFLAGS = \ 254libextractor_elf_la_LDFLAGS = \
260 $(PLUGINFLAGS) $(retaincommand) 255 $(PLUGINFLAGS) $(retaincommand)
261libextractor_elf_la_LIBADD = \ 256libextractor_elf_la_LIBADD = \
262 libpack.la 257 $(top_builddir)/src/common/libextractor_common.la
263
264libpack_la_SOURCES = \
265 pack.c \
266 pack.h
267
268libconvert_la_SOURCES = \
269 convert.c \
270 convert.h
271libconvert_la_LDFLAGS = \
272 $(LIBICONV)
273
274libconvert_numeric_la_SOURCES = \
275 convert_numeric.c \
276 convert_numeric.h
277 258
278libextractor_zip_la_SOURCES = \ 259libextractor_zip_la_SOURCES = \
279 zipextractor.c 260 zipextractor.c
@@ -292,14 +273,14 @@ libextractor_html_la_LDFLAGS = \
292 $(PLUGINFLAGS) $(retaincommand) 273 $(PLUGINFLAGS) $(retaincommand)
293libextractor_html_la_LIBADD = \ 274libextractor_html_la_LIBADD = \
294 $(top_builddir)/src/main/libextractor.la \ 275 $(top_builddir)/src/main/libextractor.la \
295 libconvert.la 276 $(top_builddir)/src/common/libextractor_common.la
296 277
297libextractor_flv_la_SOURCES = \ 278libextractor_flv_la_SOURCES = \
298 flvextractor.c 279 flvextractor.c
299libextractor_flv_la_LDFLAGS = \ 280libextractor_flv_la_LDFLAGS = \
300 $(PLUGINFLAGS) $(retaincommand) 281 $(PLUGINFLAGS) $(retaincommand)
301libextractor_flv_la_LIBADD = \ 282libextractor_flv_la_LIBADD = \
302 libconvert_numeric.la 283 $(top_builddir)/src/common/libextractor_common.la
303 284
304libextractor_real_la_SOURCES = \ 285libextractor_real_la_SOURCES = \
305 realextractor.c 286 realextractor.c
@@ -353,7 +334,7 @@ libextractor_png_la_LDFLAGS = \
353 $(top_builddir)/src/main/libextractor.la \ 334 $(top_builddir)/src/main/libextractor.la \
354 $(PLUGINFLAGS) $(retaincommand) 335 $(PLUGINFLAGS) $(retaincommand)
355libextractor_png_la_LIBADD = \ 336libextractor_png_la_LIBADD = \
356 libconvert.la -lz 337 $(top_builddir)/src/common/libextractor_common.la -lz
357endif 338endif
358 339
359libextractor_filename_la_SOURCES = \ 340libextractor_filename_la_SOURCES = \
@@ -362,7 +343,7 @@ libextractor_filename_la_LDFLAGS = \
362 $(PLUGINFLAGS) $(retaincommand) 343 $(PLUGINFLAGS) $(retaincommand)
363libextractor_filename_la_LIBADD = \ 344libextractor_filename_la_LIBADD = \
364 $(top_builddir)/src/main/libextractor.la \ 345 $(top_builddir)/src/main/libextractor.la \
365 libconvert.la 346 $(top_builddir)/src/common/libextractor_common.la
366 347
367libextractor_sid_la_SOURCES = \ 348libextractor_sid_la_SOURCES = \
368 sidextractor.c 349 sidextractor.c
diff --git a/src/plugins/applefileextractor.c b/src/plugins/applefileextractor.c
index 995b5c1..33685ab 100644
--- a/src/plugins/applefileextractor.c
+++ b/src/plugins/applefileextractor.c
@@ -99,7 +99,7 @@ static int readApplefileHeader(const unsigned char *data,
99 if ((*offset + APPLEFILE_HEADER_SIZE) > size) 99 if ((*offset + APPLEFILE_HEADER_SIZE) > size)
100 return -1; 100 return -1;
101 101
102 cat_unpack(data + *offset, 102 EXTRACTOR_common_cat_unpack(data + *offset,
103 APPLEFILE_HEADER_SPEC, 103 APPLEFILE_HEADER_SPEC,
104 APPLEFILE_HEADER_FIELDS(hdr)); 104 APPLEFILE_HEADER_FIELDS(hdr));
105 *offset += APPLEFILE_HEADER_SIZE; 105 *offset += APPLEFILE_HEADER_SIZE;
@@ -114,8 +114,8 @@ static int readEntryDescriptor(const unsigned char *data,
114 if ((*offset + APPLEFILE_ENTRY_DESCRIPTOR_SIZE) > size) 114 if ((*offset + APPLEFILE_ENTRY_DESCRIPTOR_SIZE) > size)
115 return -1; 115 return -1;
116 116
117 cat_unpack(data + *offset, 117 EXTRACTOR_common_cat_unpack(data + *offset,
118 APPLEFILE_ENTRY_DESCRIPTOR_SPEC, 118 APPLEFILE_ENTRY_DESCRIPTOR_SPEC,
119 APPLEFILE_ENTRY_DESCRIPTOR_FIELDS(dsc)); 119 APPLEFILE_ENTRY_DESCRIPTOR_FIELDS(dsc));
120 *offset += APPLEFILE_ENTRY_DESCRIPTOR_SIZE; 120 *offset += APPLEFILE_ENTRY_DESCRIPTOR_SIZE;
121 return 0; 121 return 0;
@@ -137,7 +137,7 @@ libextractor_applefile_extract (const char *filename,
137 if (readApplefileHeader(data, &offset, size, &header) == -1) 137 if (readApplefileHeader(data, &offset, size, &header) == -1)
138 return prev; 138 return prev;
139 139
140 if ((memcmp(header.magic, APPLESINGLE_SIGNATURE, 4) != 0) && 140 if ((memcmp(header.magic, APPLESINGLE_SIGNATURE, 4) != 0) &&
141 (memcmp(header.magic, APPLEDOUBLE_SIGNATURE, 4) != 0)) 141 (memcmp(header.magic, APPLEDOUBLE_SIGNATURE, 4) != 0))
142 return prev; 142 return prev;
143 143
@@ -175,7 +175,7 @@ libextractor_applefile_extract (const char *filename,
175 else 175 else
176 snprintf (s, 13, "%.2f %s", (double) dsc.length, _("Bytes")); 176 snprintf (s, 13, "%.2f %s", (double) dsc.length, _("Bytes"));
177 177
178 result = addKeyword(EXTRACTOR_FILE_SIZE, s, result); 178 result = addKeyword(EXTRACTOR_FILE_SIZE, s, result);
179 } 179 }
180 break; 180 break;
181 case AED_ID_REAL_NAME: 181 case AED_ID_REAL_NAME:
diff --git a/src/plugins/elfextractor.c b/src/plugins/elfextractor.c
index 535c435..d750de3 100644
--- a/src/plugins/elfextractor.c
+++ b/src/plugins/elfextractor.c
@@ -294,7 +294,7 @@ getSectionHdr (char *data,
294 if (ehdr->e_shnum <= idx) 294 if (ehdr->e_shnum <= idx)
295 return -1; 295 return -1;
296 296
297 cat_unpack (&data[ehdr->e_shoff + ehdr->e_shentsize * idx], 297 EXTRACTOR_common_cat_unpack (&data[ehdr->e_shoff + ehdr->e_shentsize * idx],
298 ELF_SECTION_SPECS[getByteorder (data[EI_CLASS])], 298 ELF_SECTION_SPECS[getByteorder (data[EI_CLASS])],
299 ELF_SECTION_FIELDS (ret)); 299 ELF_SECTION_FIELDS (ret));
300 return 0; 300 return 0;
@@ -312,7 +312,7 @@ getDynTag (char *data,
312{ 312{
313 if ((off + osize > size) || ((idx + 1) * ELF_DYN_SIZE > osize)) 313 if ((off + osize > size) || ((idx + 1) * ELF_DYN_SIZE > osize))
314 return -1; 314 return -1;
315 cat_unpack (&data[off + idx * ELF_DYN_SIZE], 315 EXTRACTOR_common_cat_unpack (&data[off + idx * ELF_DYN_SIZE],
316 ELF_DYN_SPECS[getByteorder (data[EI_CLASS])], 316 ELF_DYN_SPECS[getByteorder (data[EI_CLASS])],
317 ELF_DYN_FIELDS (ret)); 317 ELF_DYN_FIELDS (ret));
318 return 0; 318 return 0;
@@ -330,7 +330,7 @@ getProgramHdr (char *data,
330 if (ehdr->e_phnum <= idx) 330 if (ehdr->e_phnum <= idx)
331 return -1; 331 return -1;
332 332
333 cat_unpack (&data[ehdr->e_phoff + ehdr->e_phensize * idx], 333 EXTRACTOR_common_cat_unpack (&data[ehdr->e_phoff + ehdr->e_phensize * idx],
334 ELF_PHDR_SPECS[getByteorder (data[EI_CLASS])], 334 ELF_PHDR_SPECS[getByteorder (data[EI_CLASS])],
335 ELF_PHDR_FIELDS (ret)); 335 ELF_PHDR_FIELDS (ret));
336 return 0; 336 return 0;
@@ -353,7 +353,7 @@ getELFHdr (char *data, size_t size, Elf32_Ehdr * ehdr)
353 { 353 {
354 case ELFDATA2LSB: 354 case ELFDATA2LSB:
355 case ELFDATA2MSB: 355 case ELFDATA2MSB:
356 cat_unpack (&data[EI_NIDENT], 356 EXTRACTOR_common_cat_unpack (&data[EI_NIDENT],
357 ELF_HEADER_SPECS[getByteorder (data[EI_CLASS])], 357 ELF_HEADER_SPECS[getByteorder (data[EI_CLASS])],
358 ELF_HEADER_FIELDS (ehdr)); 358 ELF_HEADER_FIELDS (ehdr));
359 break; 359 break;
diff --git a/src/plugins/filenameextractor.c b/src/plugins/filenameextractor.c
index ce3ad78..500f9b8 100644
--- a/src/plugins/filenameextractor.c
+++ b/src/plugins/filenameextractor.c
@@ -44,7 +44,7 @@ libextractor_filename_extract (const char *filename,
44 } 44 }
45 keyword = malloc (sizeof (EXTRACTOR_KeywordList)); 45 keyword = malloc (sizeof (EXTRACTOR_KeywordList));
46 keyword->next = prev; 46 keyword->next = prev;
47 keyword->keyword = convertToUtf8 (filenameRoot, 47 keyword->keyword = EXTRACTOR_common_convert_to_utf8 (filenameRoot,
48 strlen (filenameRoot), 48 strlen (filenameRoot),
49 nl_langinfo (CODESET)); 49 nl_langinfo (CODESET));
50 keyword->keywordType = EXTRACTOR_FILENAME; 50 keyword->keywordType = EXTRACTOR_FILENAME;
diff --git a/src/plugins/flvextractor.c b/src/plugins/flvextractor.c
index 60f7979..c22cce5 100644
--- a/src/plugins/flvextractor.c
+++ b/src/plugins/flvextractor.c
@@ -117,8 +117,8 @@ static inline double readDouble(const unsigned char **data)
117 const unsigned char *ptr = *data; 117 const unsigned char *ptr = *data;
118 double val; 118 double val;
119 119
120 floatformat_to_double(&floatformat_ieee_double_big, 120 EXTRACTOR_common_floatformat_to_double(&EXTRACTOR_common_floatformat_ieee_double_big,
121 (const void *)ptr, 121 (const void *)ptr,
122 &val); 122 &val);
123 ptr += 8; 123 ptr += 8;
124 *data = ptr; 124 *data = ptr;
@@ -152,7 +152,7 @@ static int readASBoolean(const unsigned char **data,
152{ 152{
153 const unsigned char *ptr = *data; 153 const unsigned char *ptr = *data;
154 int val; 154 int val;
155 155
156 if (*len < 1) 156 if (*len < 1)
157 return -1; 157 return -1;
158 158
@@ -192,7 +192,7 @@ static int readASString(const unsigned char **data,
192 const unsigned char *ptr = *data; 192 const unsigned char *ptr = *data;
193 char *ret; 193 char *ret;
194 int slen; 194 int slen;
195 195
196 if (*len < 2) 196 if (*len < 2)
197 return -1; 197 return -1;
198 198
@@ -214,9 +214,9 @@ static int readASString(const unsigned char **data,
214 return 0; 214 return 0;
215} 215}
216 216
217static int parse_amf(const unsigned char **data, 217static int parse_amf(const unsigned char **data,
218 size_t *len, 218 size_t *len,
219 AMFParserHandler *handler) 219 AMFParserHandler *handler)
220{ 220{
221 const unsigned char *ptr = *data; 221 const unsigned char *ptr = *data;
222 unsigned char astype; 222 unsigned char astype;
@@ -231,8 +231,8 @@ static int parse_amf(const unsigned char **data,
231 double val; 231 double val;
232 ret = readASNumber(&ptr, len, &val); 232 ret = readASNumber(&ptr, len, &val);
233 if (ret == 0) 233 if (ret == 0)
234 (*(handler->as_end_callback))(astype, 234 (*(handler->as_end_callback))(astype,
235 &val, 235 &val,
236 handler->userdata); 236 handler->userdata);
237 break; 237 break;
238 } 238 }
@@ -241,8 +241,8 @@ static int parse_amf(const unsigned char **data,
241 int val; 241 int val;
242 ret = readASBoolean(&ptr, len, &val); 242 ret = readASBoolean(&ptr, len, &val);
243 if (ret == 0) 243 if (ret == 0)
244 (*(handler->as_end_callback))(astype, 244 (*(handler->as_end_callback))(astype,
245 &val, 245 &val,
246 handler->userdata); 246 handler->userdata);
247 break; 247 break;
248 } 248 }
@@ -251,8 +251,8 @@ static int parse_amf(const unsigned char **data,
251 char *val; 251 char *val;
252 ret = readASString(&ptr, len, &val); 252 ret = readASString(&ptr, len, &val);
253 if (ret == 0) { 253 if (ret == 0) {
254 (*(handler->as_end_callback))(astype, 254 (*(handler->as_end_callback))(astype,
255 val, 255 val,
256 handler->userdata); 256 handler->userdata);
257 free(val); 257 free(val);
258 } 258 }
@@ -267,8 +267,8 @@ static int parse_amf(const unsigned char **data,
267 tmp[0] = &millis; 267 tmp[0] = &millis;
268 tmp[1] = &tz; 268 tmp[1] = &tz;
269 if (ret == 0) 269 if (ret == 0)
270 (*(handler->as_end_callback))(astype, 270 (*(handler->as_end_callback))(astype,
271 &tmp, 271 &tmp,
272 handler->userdata); 272 handler->userdata);
273 break; 273 break;
274 } 274 }
@@ -293,11 +293,11 @@ static int parse_amf(const unsigned char **data,
293 if (ret == -1) 293 if (ret == -1)
294 break; 294 break;
295 } 295 }
296 (*(handler->as_end_callback))(ASTYPE_ARRAY, 296 (*(handler->as_end_callback))(ASTYPE_ARRAY,
297 NULL, 297 NULL,
298 handler->userdata); 298 handler->userdata);
299 break; 299 break;
300 } 300 }
301 case ASTYPE_OBJECT: 301 case ASTYPE_OBJECT:
302 { 302 {
303 char *key; 303 char *key;
@@ -306,7 +306,7 @@ static int parse_amf(const unsigned char **data,
306 ret = readASString(&ptr, len, &key); 306 ret = readASString(&ptr, len, &key);
307 if (ret == -1) 307 if (ret == -1)
308 break; 308 break;
309 (*(handler->as_key_callback))(key, 309 (*(handler->as_key_callback))(key,
310 handler->userdata); 310 handler->userdata);
311 free(key); 311 free(key);
312 type = *ptr; 312 type = *ptr;
@@ -317,17 +317,17 @@ static int parse_amf(const unsigned char **data,
317 ret = readASString(&ptr, len, &key); 317 ret = readASString(&ptr, len, &key);
318 if (ret == -1) 318 if (ret == -1)
319 break; 319 break;
320 (*(handler->as_key_callback))(key, 320 (*(handler->as_key_callback))(key,
321 handler->userdata); 321 handler->userdata);
322 free(key); 322 free(key);
323 type = *ptr; 323 type = *ptr;
324 } 324 }
325 if (ret == 0) 325 if (ret == 0)
326 (*(handler->as_end_callback))(ASTYPE_OBJECT, 326 (*(handler->as_end_callback))(ASTYPE_OBJECT,
327 NULL, 327 NULL,
328 handler->userdata); 328 handler->userdata);
329 break; 329 break;
330 } 330 }
331 case ASTYPE_MIXEDARRAY: 331 case ASTYPE_MIXEDARRAY:
332 { 332 {
333 char *key; 333 char *key;
@@ -343,7 +343,7 @@ static int parse_amf(const unsigned char **data,
343 ret = readASString(&ptr, len, &key); 343 ret = readASString(&ptr, len, &key);
344 if (ret == -1) 344 if (ret == -1)
345 break; 345 break;
346 (*(handler->as_key_callback))(key, 346 (*(handler->as_key_callback))(key,
347 handler->userdata); 347 handler->userdata);
348 free(key); 348 free(key);
349 type = *ptr; 349 type = *ptr;
@@ -354,21 +354,21 @@ static int parse_amf(const unsigned char **data,
354 ret = readASString(&ptr, len, &key); 354 ret = readASString(&ptr, len, &key);
355 if (ret == -1) 355 if (ret == -1)
356 break; 356 break;
357 (*(handler->as_key_callback))(key, 357 (*(handler->as_key_callback))(key,
358 handler->userdata); 358 handler->userdata);
359 free(key); 359 free(key);
360 type = *ptr; 360 type = *ptr;
361 } 361 }
362 if (ret == 0) 362 if (ret == 0)
363 (*(handler->as_end_callback))(astype, 363 (*(handler->as_end_callback))(astype,
364 NULL, 364 NULL,
365 handler->userdata); 365 handler->userdata);
366 break; 366 break;
367 } 367 }
368 default: 368 default:
369 ret = -1; 369 ret = -1;
370 (*(handler->as_end_callback))(astype, 370 (*(handler->as_end_callback))(astype,
371 NULL, 371 NULL,
372 handler->userdata); 372 handler->userdata);
373#if DEBUG 373#if DEBUG
374 printf("parse_amf: Unknown type %02x", astype); 374 printf("parse_amf: Unknown type %02x", astype);
@@ -647,11 +647,11 @@ static void handleASBegin(unsigned char type, void * userdata)
647{ 647{
648 FLVMetaParserState *state = (FLVMetaParserState *)userdata; 648 FLVMetaParserState *state = (FLVMetaParserState *)userdata;
649 649
650 if (state->onMetaData && state->parsingDepth == 0 && 650 if (state->onMetaData && state->parsingDepth == 0 &&
651 type != ASTYPE_MIXEDARRAY) 651 type != ASTYPE_MIXEDARRAY)
652 state->onMetaData = 0; 652 state->onMetaData = 0;
653 653
654 if (type == ASTYPE_ARRAY || type == ASTYPE_MIXEDARRAY || 654 if (type == ASTYPE_ARRAY || type == ASTYPE_MIXEDARRAY ||
655 type == ASTYPE_OBJECT) 655 type == ASTYPE_OBJECT)
656 state->parsingDepth++; 656 state->parsingDepth++;
657} 657}
@@ -665,13 +665,13 @@ static void handleASKey(char * key, void * userdata)
665 return; 665 return;
666 666
667 i = 0; 667 i = 0;
668 while ((key_to_extractor_map[i].key != NULL) && 668 while ((key_to_extractor_map[i].key != NULL) &&
669 (strcasecmp(key, key_to_extractor_map[i].key) != 0)) 669 (strcasecmp(key, key_to_extractor_map[i].key) != 0))
670 i++; 670 i++;
671 state->currentKeyType = key_to_extractor_map[i].type; 671 state->currentKeyType = key_to_extractor_map[i].type;
672 672
673 i = 0; 673 i = 0;
674 while ((key_to_attribute_map[i].key != NULL) && 674 while ((key_to_attribute_map[i].key != NULL) &&
675 (strcasecmp(key, key_to_attribute_map[i].key) != 0)) 675 (strcasecmp(key, key_to_attribute_map[i].key) != 0))
676 i++; 676 i++;
677 state->currentAttribute = key_to_attribute_map[i].attribute; 677 state->currentAttribute = key_to_attribute_map[i].attribute;
@@ -681,7 +681,7 @@ static void handleASEnd(unsigned char type, void * value, void * userdata)
681{ 681{
682 FLVMetaParserState *state = (FLVMetaParserState *)userdata; 682 FLVMetaParserState *state = (FLVMetaParserState *)userdata;
683 char *s; 683 char *s;
684 684
685 if ((state->parsingDepth == 0) && (type == ASTYPE_STRING)) { 685 if ((state->parsingDepth == 0) && (type == ASTYPE_STRING)) {
686 s = (char *)value; 686 s = (char *)value;
687 if (!strcmp(s, "onMetaData")) 687 if (!strcmp(s, "onMetaData"))
@@ -692,8 +692,8 @@ static void handleASEnd(unsigned char type, void * value, void * userdata)
692 * right after a "onMetaData" STRING */ 692 * right after a "onMetaData" STRING */
693 693
694 /* stream info related metadata */ 694 /* stream info related metadata */
695 if (state->onMetaData && (state->parsingDepth == 1) && 695 if (state->onMetaData && (state->parsingDepth == 1) &&
696 (state->currentAttribute != FLV_NONE) && 696 (state->currentAttribute != FLV_NONE) &&
697 (type == ASTYPE_NUMBER)) 697 (type == ASTYPE_NUMBER))
698 { 698 {
699 double n = *((double *)value); 699 double n = *((double *)value);
@@ -711,10 +711,10 @@ static void handleASEnd(unsigned char type, void * value, void * userdata)
711 break; 711 break;
712 case FLV_FRAMERATE: 712 case FLV_FRAMERATE:
713 state->streamInfo->videoFrameRate = n; 713 state->streamInfo->videoFrameRate = n;
714 break; 714 break;
715 case FLV_VDATARATE: 715 case FLV_VDATARATE:
716 state->streamInfo->videoDataRate = n; 716 state->streamInfo->videoDataRate = n;
717 break; 717 break;
718 case FLV_ADATARATE: 718 case FLV_ADATARATE:
719 state->streamInfo->audioDataRate = n; 719 state->streamInfo->audioDataRate = n;
720 break; 720 break;
@@ -729,8 +729,8 @@ static void handleASEnd(unsigned char type, void * value, void * userdata)
729 } 729 }
730 } 730 }
731 731
732 if (state->onMetaData && (state->parsingDepth == 1) && 732 if (state->onMetaData && (state->parsingDepth == 1) &&
733 (state->currentAttribute == FLV_STEREO) && 733 (state->currentAttribute == FLV_STEREO) &&
734 (type == ASTYPE_BOOLEAN)) 734 (type == ASTYPE_BOOLEAN))
735 { 735 {
736 int n = *((int *)value); 736 int n = *((int *)value);
@@ -739,7 +739,7 @@ static void handleASEnd(unsigned char type, void * value, void * userdata)
739 } 739 }
740 740
741 /* metadata that maps straight to extractor keys */ 741 /* metadata that maps straight to extractor keys */
742 if (state->onMetaData && (state->parsingDepth == 1) && 742 if (state->onMetaData && (state->parsingDepth == 1) &&
743 (state->currentKeyType != EXTRACTOR_UNKNOWN)) 743 (state->currentKeyType != EXTRACTOR_UNKNOWN))
744 { 744 {
745 s = NULL; 745 s = NULL;
@@ -779,22 +779,22 @@ static void handleASEnd(unsigned char type, void * value, void * userdata)
779 } 779 }
780 780
781 if (s != NULL) 781 if (s != NULL)
782 state->keywords = addKeyword (state->currentKeyType, 782 state->keywords = addKeyword (state->currentKeyType,
783 s, 783 s,
784 state->keywords); 784 state->keywords);
785 } 785 }
786 state->currentKeyType = EXTRACTOR_UNKNOWN; 786 state->currentKeyType = EXTRACTOR_UNKNOWN;
787 state->currentAttribute = FLV_NONE; 787 state->currentAttribute = FLV_NONE;
788 788
789 if (type == ASTYPE_ARRAY || type == ASTYPE_MIXEDARRAY || 789 if (type == ASTYPE_ARRAY || type == ASTYPE_MIXEDARRAY ||
790 type == ASTYPE_OBJECT) 790 type == ASTYPE_OBJECT)
791 state->parsingDepth--; 791 state->parsingDepth--;
792} 792}
793 793
794static struct EXTRACTOR_Keywords * 794static struct EXTRACTOR_Keywords *
795handleMetaBody(const unsigned char *data, size_t len, 795handleMetaBody(const unsigned char *data, size_t len,
796 FLVStreamInfo *stinfo, 796 FLVStreamInfo *stinfo,
797 struct EXTRACTOR_Keywords *prev) 797 struct EXTRACTOR_Keywords *prev)
798{ 798{
799 AMFParserHandler handler; 799 AMFParserHandler handler;
800 FLVMetaParserState pstate; 800 FLVMetaParserState pstate;
@@ -843,9 +843,9 @@ static char *FLVAudioSampleRates[] = {
843}; 843};
844 844
845static struct EXTRACTOR_Keywords * 845static struct EXTRACTOR_Keywords *
846handleAudioBody(const unsigned char *data, size_t len, 846handleAudioBody(const unsigned char *data, size_t len,
847 FLVStreamInfo *stinfo, 847 FLVStreamInfo *stinfo,
848 struct EXTRACTOR_Keywords *prev) 848 struct EXTRACTOR_Keywords *prev)
849{ 849{
850 stinfo->audioChannels = *data & 0x01; 850 stinfo->audioChannels = *data & 0x01;
851 stinfo->audioSampleBits = (*data & 0x02) >> 1; 851 stinfo->audioSampleBits = (*data & 0x02) >> 1;
@@ -878,9 +878,9 @@ static int sorenson_predefined_res[][2] = {
878}; 878};
879 879
880static struct EXTRACTOR_Keywords * 880static struct EXTRACTOR_Keywords *
881handleVideoBody(const unsigned char *data, size_t len, 881handleVideoBody(const unsigned char *data, size_t len,
882 FLVStreamInfo *stinfo, 882 FLVStreamInfo *stinfo,
883 struct EXTRACTOR_Keywords *prev) 883 struct EXTRACTOR_Keywords *prev)
884{ 884{
885 int codecId, frameType; 885 int codecId, frameType;
886 886
@@ -938,7 +938,7 @@ handleVideoBody(const unsigned char *data, size_t len,
938 if (separated_coeff || !filter_header) { 938 if (separated_coeff || !filter_header) {
939 data += 2; 939 data += 2;
940 } 940 }
941 /* XXX encoded/displayed dimensions might vary, but which are the 941 /* XXX encoded/displayed dimensions might vary, but which are the
942 * right ones? */ 942 * right ones? */
943 stinfo->videoWidth = (data[3]*16) - (dim_adj>>4); 943 stinfo->videoWidth = (data[3]*16) - (dim_adj>>4);
944 stinfo->videoHeight = (data[2]*16) - (dim_adj&0x0F); 944 stinfo->videoHeight = (data[2]*16) - (dim_adj&0x0F);
@@ -968,7 +968,7 @@ static int readFLVTag(const unsigned char **data,
968 if ((ptr + header.bodyLength) > end) 968 if ((ptr + header.bodyLength) > end)
969 return -1; 969 return -1;
970 970
971 switch (header.type) 971 switch (header.type)
972 { 972 {
973 case FLV_TAG_TYPE_AUDIO: 973 case FLV_TAG_TYPE_AUDIO:
974 head = handleAudioBody(ptr, header.bodyLength, stinfo, head); 974 head = handleAudioBody(ptr, header.bodyLength, stinfo, head);
@@ -984,7 +984,7 @@ static int readFLVTag(const unsigned char **data,
984 } 984 }
985 985
986 ptr += header.bodyLength; 986 ptr += header.bodyLength;
987 987
988 *list = head; 988 *list = head;
989 *data = ptr; 989 *data = ptr;
990 return 0; 990 return 0;
@@ -1038,7 +1038,7 @@ static char * printVideoFormat(FLVStreamInfo *stinfo)
1038 n += snprintf(s+n, len-n, "%.4f kbps", stinfo->videoDataRate); 1038 n += snprintf(s+n, len-n, "%.4f kbps", stinfo->videoDataRate);
1039 } 1039 }
1040 1040
1041 if (n == 0) 1041 if (n == 0)
1042 return NULL; 1042 return NULL;
1043 return strdup(s); 1043 return strdup(s);
1044} 1044}
@@ -1058,7 +1058,7 @@ static char * printAudioFormat(FLVStreamInfo *stinfo)
1058 if (n > 0) 1058 if (n > 0)
1059 n += snprintf(s+n, len-n, ", "); 1059 n += snprintf(s+n, len-n, ", ");
1060 if (n < len) 1060 if (n < len)
1061 n += snprintf(s+n, len-n, "%s", 1061 n += snprintf(s+n, len-n, "%s",
1062 FLVAudioSampleSizes[stinfo->audioSampleBits]); 1062 FLVAudioSampleSizes[stinfo->audioSampleBits]);
1063 } 1063 }
1064 1064
@@ -1066,7 +1066,7 @@ static char * printAudioFormat(FLVStreamInfo *stinfo)
1066 if (n > 0) 1066 if (n > 0)
1067 n += snprintf(s+n, len-n, ", "); 1067 n += snprintf(s+n, len-n, ", ");
1068 if (n < len) 1068 if (n < len)
1069 n += snprintf(s+n, len-n, "%s", 1069 n += snprintf(s+n, len-n, "%s",
1070 FLVAudioChannels[stinfo->audioChannels]); 1070 FLVAudioChannels[stinfo->audioChannels]);
1071 } 1071 }
1072 1072
@@ -1085,7 +1085,7 @@ static char * printAudioFormat(FLVStreamInfo *stinfo)
1085 n += snprintf(s+n, len-n, "%.4f kbps", stinfo->audioDataRate); 1085 n += snprintf(s+n, len-n, "%.4f kbps", stinfo->audioDataRate);
1086 } 1086 }
1087 1087
1088 if (n == 0) 1088 if (n == 0)
1089 return NULL; 1089 return NULL;
1090 return strdup(s); 1090 return strdup(s);
1091} 1091}
diff --git a/src/plugins/gifextractor.c b/src/plugins/gifextractor.c
index def9fed..27d9c21 100644
--- a/src/plugins/gifextractor.c
+++ b/src/plugins/gifextractor.c
@@ -201,7 +201,7 @@ libextractor_gif_extract (const char *filename,
201 201
202 if (size < GIF_HEADER_SIZE) 202 if (size < GIF_HEADER_SIZE)
203 return prev; 203 return prev;
204 cat_unpack (data, GIF_HEADER_SPEC, GIF_HEADER_FIELDS (&header)); 204 EXTRACTOR_common_cat_unpack (data, GIF_HEADER_SPEC, GIF_HEADER_FIELDS (&header));
205 if (0 != strncmp (&header.gif[0], "GIF", 3)) 205 if (0 != strncmp (&header.gif[0], "GIF", 3))
206 return prev; 206 return prev;
207 if (0 != strncmp (&header.version[0], "89a", 3)) 207 if (0 != strncmp (&header.version[0], "89a", 3))
@@ -222,7 +222,7 @@ libextractor_gif_extract (const char *filename,
222 { 222 {
223 case ',': /* image descriptor block */ 223 case ',': /* image descriptor block */
224 PRINT ("skipping local color map %d\n", pos); 224 PRINT ("skipping local color map %d\n", pos);
225 cat_unpack (&data[pos], 225 EXTRACTOR_common_cat_unpack (&data[pos],
226 GIF_DESCRIPTOR_SPEC, GIF_DESCRIPTOR_FIELDS (&gd)); 226 GIF_DESCRIPTOR_SPEC, GIF_DESCRIPTOR_FIELDS (&gd));
227 pos = skipLocalColorMap (data, pos, size, &gd); 227 pos = skipLocalColorMap (data, pos, size, &gd);
228 break; 228 break;
diff --git a/src/plugins/htmlextractor.c b/src/plugins/htmlextractor.c
index 397ac47..1dafb31 100644
--- a/src/plugins/htmlextractor.c
+++ b/src/plugins/htmlextractor.c
@@ -421,7 +421,7 @@ libextractor_html_extract (const char *filename,
421 if (tmp != NULL) 421 if (tmp != NULL)
422 { 422 {
423 prev = addKeyword (tagmap[i].type, 423 prev = addKeyword (tagmap[i].type,
424 convertToUtf8 (tmp, 424 EXTRACTOR_common_convert_to_utf8 (tmp,
425 strlen (tmp), charset), prev); 425 strlen (tmp), charset), prev);
426 free (tmp); 426 free (tmp);
427 } 427 }
@@ -434,7 +434,7 @@ libextractor_html_extract (const char *filename,
434 t = tags; 434 t = tags;
435 if (tagMatch ("title", t->tagStart, t->tagEnd)) 435 if (tagMatch ("title", t->tagStart, t->tagEnd))
436 prev = addKeyword (EXTRACTOR_TITLE, 436 prev = addKeyword (EXTRACTOR_TITLE,
437 convertToUtf8 (t->dataStart, 437 EXTRACTOR_common_convert_to_utf8 (t->dataStart,
438 t->dataEnd - t->dataStart, 438 t->dataEnd - t->dataStart,
439 charset), prev); 439 charset), prev);
440 tags = t->next; 440 tags = t->next;
diff --git a/src/plugins/id3v23extractor.c b/src/plugins/id3v23extractor.c
index e02b71d..4f066fe 100644
--- a/src/plugins/id3v23extractor.c
+++ b/src/plugins/id3v23extractor.c
@@ -184,17 +184,17 @@ libextractor_id3v23_extract (const char *filename,
184 switch (data[pos + 10]) 184 switch (data[pos + 10])
185 { 185 {
186 case 0x00: 186 case 0x00:
187 word = convertToUtf8 ((const char *) &data[pos + 11], 187 word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 11],
188 csize, "ISO-8859-1"); 188 csize, "ISO-8859-1");
189 break; 189 break;
190 case 0x01: 190 case 0x01:
191 word = convertToUtf8 ((const char *) &data[pos + 11], 191 word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 11],
192 csize, "UCS-2"); 192 csize, "UCS-2");
193 break; 193 break;
194 default: 194 default:
195 /* bad encoding byte, 195 /* bad encoding byte,
196 try to convert from iso-8859-1 */ 196 try to convert from iso-8859-1 */
197 word = convertToUtf8 ((const char *) &data[pos + 11], 197 word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 11],
198 csize, "ISO-8859-1"); 198 csize, "ISO-8859-1");
199 break; 199 break;
200 } 200 }
diff --git a/src/plugins/id3v24extractor.c b/src/plugins/id3v24extractor.c
index aa35925..aec3031 100644
--- a/src/plugins/id3v24extractor.c
+++ b/src/plugins/id3v24extractor.c
@@ -184,15 +184,15 @@ libextractor_id3v24_extract (const char *filename,
184 switch (data[pos + 10]) 184 switch (data[pos + 10])
185 { 185 {
186 case 0x00: 186 case 0x00:
187 word = convertToUtf8 ((const char *) &data[pos + 11], 187 word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 11],
188 csize, "ISO-8859-1"); 188 csize, "ISO-8859-1");
189 break; 189 break;
190 case 0x01: 190 case 0x01:
191 word = convertToUtf8 ((const char *) &data[pos + 11], 191 word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 11],
192 csize, "UTF-16"); 192 csize, "UTF-16");
193 break; 193 break;
194 case 0x02: 194 case 0x02:
195 word = convertToUtf8 ((const char *) &data[pos + 11], 195 word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 11],
196 csize, "UTF-16BE"); 196 csize, "UTF-16BE");
197 break; 197 break;
198 case 0x03: 198 case 0x03:
@@ -203,7 +203,7 @@ libextractor_id3v24_extract (const char *filename,
203 default: 203 default:
204 /* bad encoding byte, 204 /* bad encoding byte,
205 try to convert from iso-8859-1 */ 205 try to convert from iso-8859-1 */
206 word = convertToUtf8 ((const char *) &data[pos + 11], 206 word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 11],
207 csize, "ISO-8859-1"); 207 csize, "ISO-8859-1");
208 break; 208 break;
209 } 209 }
diff --git a/src/plugins/id3v2extractor.c b/src/plugins/id3v2extractor.c
index 562ca2d..00e353c 100644
--- a/src/plugins/id3v2extractor.c
+++ b/src/plugins/id3v2extractor.c
@@ -131,17 +131,17 @@ libextractor_id3v2_extract (const char *filename,
131 switch (data[pos + 6]) 131 switch (data[pos + 6])
132 { 132 {
133 case 0x00: 133 case 0x00:
134 word = convertToUtf8 ((const char *) &data[pos + 7], 134 word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 7],
135 csize, "ISO-8859-1"); 135 csize, "ISO-8859-1");
136 break; 136 break;
137 case 0x01: 137 case 0x01:
138 word = convertToUtf8 ((const char *) &data[pos + 7], 138 word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 7],
139 csize, "UCS-2"); 139 csize, "UCS-2");
140 break; 140 break;
141 default: 141 default:
142 /* bad encoding byte, 142 /* bad encoding byte,
143 try to convert from iso-8859-1 */ 143 try to convert from iso-8859-1 */
144 word = convertToUtf8 ((const char *) &data[pos + 7], 144 word = EXTRACTOR_common_convert_to_utf8 ((const char *) &data[pos + 7],
145 csize, "ISO-8859-1"); 145 csize, "ISO-8859-1");
146 break; 146 break;
147 } 147 }
diff --git a/src/plugins/mp3extractor.c b/src/plugins/mp3extractor.c
index 201a332..b0b2d0c 100644
--- a/src/plugins/mp3extractor.c
+++ b/src/plugins/mp3extractor.c
@@ -290,19 +290,19 @@ get_id3 (const char *data, size_t size, id3tag * id3)
290 return INVALID_ID3; 290 return INVALID_ID3;
291 pos += 3; 291 pos += 3;
292 292
293 id3->title = convertToUtf8 (pos, 30, "ISO-8859-1"); 293 id3->title = EXTRACTOR_common_convert_to_utf8 (pos, 30, "ISO-8859-1");
294 trim (id3->title); 294 trim (id3->title);
295 pos += 30; 295 pos += 30;
296 id3->artist = convertToUtf8 (pos, 30, "ISO-8859-1"); 296 id3->artist = EXTRACTOR_common_convert_to_utf8 (pos, 30, "ISO-8859-1");
297 trim (id3->artist); 297 trim (id3->artist);
298 pos += 30; 298 pos += 30;
299 id3->album = convertToUtf8 (pos, 30, "ISO-8859-1"); 299 id3->album = EXTRACTOR_common_convert_to_utf8 (pos, 30, "ISO-8859-1");
300 trim (id3->album); 300 trim (id3->album);
301 pos += 30; 301 pos += 30;
302 id3->year = convertToUtf8 (pos, 4, "ISO-8859-1"); 302 id3->year = EXTRACTOR_common_convert_to_utf8 (pos, 4, "ISO-8859-1");
303 trim (id3->year); 303 trim (id3->year);
304 pos += 4; 304 pos += 4;
305 id3->comment = convertToUtf8 (pos, 30, "ISO-8859-1"); 305 id3->comment = EXTRACTOR_common_convert_to_utf8 (pos, 30, "ISO-8859-1");
306 trim (id3->comment); 306 trim (id3->comment);
307 if ( (pos[28] == '\0') && 307 if ( (pos[28] == '\0') &&
308 (pos[29] != '\0') ) 308 (pos[29] != '\0') )
@@ -419,14 +419,14 @@ mp3parse (const unsigned char *data, size_t size, struct EXTRACTOR_Keywords *pre
419 idx_num = (mpeg_ver - 1) * 3 + layer - 1; 419 idx_num = (mpeg_ver - 1) * 3 + layer - 1;
420 else 420 else
421 idx_num = 2 + layer; 421 idx_num = 2 + layer;
422 bitrate = 1000 * bitrate_table[(header >> MPA_BITRATE_SHIFT) & 422 bitrate = 1000 * bitrate_table[(header >> MPA_BITRATE_SHIFT) &
423 MPA_BITRATE_MASK][idx_num]; 423 MPA_BITRATE_MASK][idx_num];
424 if (bitrate < 0) 424 if (bitrate < 0)
425 { 425 {
426 frames--; 426 frames--;
427 break; 427 break;
428 } /*error in header */ 428 } /*error in header */
429 sample_rate = freq_table[(header >> MPA_FREQ_SHIFT) & 429 sample_rate = freq_table[(header >> MPA_FREQ_SHIFT) &
430 MPA_FREQ_MASK][mpeg_ver - 1]; 430 MPA_FREQ_MASK][mpeg_ver - 1];
431 if (sample_rate < 0) 431 if (sample_rate < 0)
432 { 432 {
@@ -468,17 +468,17 @@ mp3parse (const unsigned char *data, size_t size, struct EXTRACTOR_Keywords *pre
468 468
469 prev = addkword (prev, mpeg_versions[mpeg_ver-1], EXTRACTOR_RESOURCE_TYPE); 469 prev = addkword (prev, mpeg_versions[mpeg_ver-1], EXTRACTOR_RESOURCE_TYPE);
470 format = malloc (512); 470 format = malloc (512);
471 snprintf (format, 512, "%s %s audio, %d kbps (%s), %d Hz, %s, %s, %s", 471 snprintf (format, 512, "%s %s audio, %d kbps (%s), %d Hz, %s, %s, %s",
472 mpeg_versions[mpeg_ver-1], 472 mpeg_versions[mpeg_ver-1],
473 layer_names[layer-1], 473 layer_names[layer-1],
474 avg_bps, 474 avg_bps,
475 vbr_flag ? _("VBR") : _("CBR"), 475 vbr_flag ? _("VBR") : _("CBR"),
476 sample_rate, 476 sample_rate,
477 channel_modes[ch], 477 channel_modes[ch],
478 copyright_flag ? _("copyright") : _("no copyright"), 478 copyright_flag ? _("copyright") : _("no copyright"),
479 original_flag ? _("original") : _("copy") ); 479 original_flag ? _("original") : _("copy") );
480 prev = addkword (prev, format, EXTRACTOR_FORMAT); 480 prev = addkword (prev, format, EXTRACTOR_FORMAT);
481 snprintf (format, 512, "%dm%02d", 481 snprintf (format, 512, "%dm%02d",
482 length / 60, length % 60); 482 length / 60, length % 60);
483 prev = addkword (prev, format, EXTRACTOR_DURATION); 483 prev = addkword (prev, format, EXTRACTOR_DURATION);
484 free (format); 484 free (format);
@@ -522,7 +522,7 @@ libextractor_mp3_extract (const char *filename,
522 strlen (info.album) + 6); 522 strlen (info.album) + 6);
523 sprintf (word, "%s: %s (%s)", info.artist, info.title, info.album); 523 sprintf (word, "%s: %s (%s)", info.artist, info.title, info.album);
524 klist = addkword (klist, word, EXTRACTOR_DESCRIPTION); 524 klist = addkword (klist, word, EXTRACTOR_DESCRIPTION);
525 525
526 free (word); 526 free (word);
527 free (info.title); 527 free (info.title);
528 free (info.year); 528 free (info.year);
diff --git a/src/plugins/ole2/ole2extractor.c b/src/plugins/ole2/ole2extractor.c
index 6933986..b3ba87b 100644
--- a/src/plugins/ole2/ole2extractor.c
+++ b/src/plugins/ole2/ole2extractor.c
@@ -27,7 +27,7 @@
27 27
28#include "platform.h" 28#include "platform.h"
29#include "extractor.h" 29#include "extractor.h"
30#include "../convert.h" 30#include "convert.h"
31 31
32#include <glib-object.h> 32#include <glib-object.h>
33#include <string.h> 33#include <string.h>
@@ -394,14 +394,14 @@ history_extract(GsfInput * stream,
394 // there are n strings, so n/2 revisions (author & file) 394 // there are n strings, so n/2 revisions (author & file)
395 nRev = (lbuffer[2] + (lbuffer[3] << 8)) / 2; 395 nRev = (lbuffer[2] + (lbuffer[3] << 8)) / 2;
396 where = 6; 396 where = 6;
397 for (i=0; i < nRev; i++) { 397 for (i=0; i < nRev; i++) {
398 if (where >= lcbSttbSavedBy) 398 if (where >= lcbSttbSavedBy)
399 break; 399 break;
400 length = lbuffer[where++]; 400 length = lbuffer[where++];
401 if ( (where + 2 * length + 2 >= lcbSttbSavedBy) || 401 if ( (where + 2 * length + 2 >= lcbSttbSavedBy) ||
402 (where + 2 * length + 2 <= where) ) 402 (where + 2 * length + 2 <= where) )
403 break; 403 break;
404 author = convertToUtf8((const char*) &lbuffer[where], 404 author = EXTRACTOR_common_convert_to_utf8((const char*) &lbuffer[where],
405 length * 2, 405 length * 2,
406 "UTF-16BE"); 406 "UTF-16BE");
407 where += length * 2 + 1; 407 where += length * 2 + 1;
@@ -411,9 +411,9 @@ history_extract(GsfInput * stream,
411 free(author); 411 free(author);
412 break; 412 break;
413 } 413 }
414 filename = convertToUtf8((const char*) &lbuffer[where], 414 filename = EXTRACTOR_common_convert_to_utf8((const char*) &lbuffer[where],
415 length * 2, 415 length * 2,
416 "UTF-16BE"); 416 "UTF-16BE");
417 where += length * 2 + 1; 417 where += length * 2 + 1;
418 rbuf = malloc(strlen(author) + strlen(filename) + 512); 418 rbuf = malloc(strlen(author) + strlen(filename) + 512);
419 snprintf(rbuf, 512 + strlen(author) + strlen(filename), 419 snprintf(rbuf, 512 + strlen(author) + strlen(filename),
diff --git a/src/plugins/pdf/pdfextractor.cc b/src/plugins/pdf/pdfextractor.cc
index 9ec37a8..01fe7c9 100644
--- a/src/plugins/pdf/pdfextractor.cc
+++ b/src/plugins/pdf/pdfextractor.cc
@@ -24,7 +24,7 @@
24 24
25#include "platform.h" 25#include "platform.h"
26#include "extractor.h" 26#include "extractor.h"
27#include "../convert.h" 27#include "convert.h"
28#include <math.h> 28#include <math.h>
29 29
30#include "parseargs.h" 30#include "parseargs.h"
@@ -74,7 +74,7 @@ extern "C" {
74 (((unsigned char)s[1]) & 0xff) == 0xff) { 74 (((unsigned char)s[1]) & 0xff) == 0xff) {
75 char * result; 75 char * result;
76 76
77 result = convertToUtf8((const char*) &s[2], s1->getLength() - 2, "UTF-16BE"); 77 result = EXTRACTOR_common_convert_to_utf8((const char*) &s[2], s1->getLength() - 2, "UTF-16BE");
78 next = addKeyword(type, 78 next = addKeyword(type,
79 result, 79 result,
80 next); 80 next);
@@ -108,7 +108,7 @@ extern "C" {
108 108
109 if (0 < len) { 109 if (0 < len) {
110 next = addKeyword(type, 110 next = addKeyword(type,
111 convertToUtf8(s, len, 111 EXTRACTOR_common_convert_to_utf8(s, len,
112 "ISO-8859-1"), 112 "ISO-8859-1"),
113 next); 113 next);
114 } 114 }
@@ -135,7 +135,7 @@ extern "C" {
135 /* isUnicode */ 135 /* isUnicode */
136 char * result; 136 char * result;
137 137
138 result = convertToUtf8((const char*)&s[2], s1->getLength() - 2, "UTF-16BE"); 138 result = EXTRACTOR_common_convert_to_utf8((const char*)&s[2], s1->getLength() - 2, "UTF-16BE");
139 next = addKeyword(type, 139 next = addKeyword(type,
140 result, 140 result,
141 next); 141 next);
diff --git a/src/plugins/pdfextractor.c b/src/plugins/pdfextractor.c
index 0ab15d0..e31262d 100644
--- a/src/plugins/pdfextractor.c
+++ b/src/plugins/pdfextractor.c
@@ -206,11 +206,11 @@ charsetDecode (const unsigned char *in, size_t size)
206 /* TODO: extend glibc with 206 /* TODO: extend glibc with
207 character set that corresponds to 207 character set that corresponds to
208 Adobe's extended ISOLATIN1 encoding! */ 208 Adobe's extended ISOLATIN1 encoding! */
209 return convertToUtf8 ((const char *) in, size, "CSISOLATIN1"); 209 return EXTRACTOR_common_convert_to_utf8 ((const char *) in, size, "CSISOLATIN1");
210 } 210 }
211 else 211 else
212 { 212 {
213 return convertToUtf8 ((const char *) &in[2], size - 2, "UTF-16BE"); 213 return EXTRACTOR_common_convert_to_utf8 ((const char *) &in[2], size - 2, "UTF-16BE");
214 } 214 }
215} 215}
216 216
diff --git a/src/plugins/pngextractor.c b/src/plugins/pngextractor.c
index ee3706b..991afa2 100644
--- a/src/plugins/pngextractor.c
+++ b/src/plugins/pngextractor.c
@@ -115,7 +115,7 @@ processtEXt (const char *data,
115 off = stnlen (data, length) + 1; 115 off = stnlen (data, length) + 1;
116 if (off >= length) 116 if (off >= length)
117 return prev; /* failed to find '\0' */ 117 return prev; /* failed to find '\0' */
118 keyword = convertToUtf8 (&data[off], length - off, "ISO-8859-1"); 118 keyword = EXTRACTOR_common_convert_to_utf8 (&data[off], length - off, "ISO-8859-1");
119 i = 0; 119 i = 0;
120 while (tagmap[i].name != NULL) 120 while (tagmap[i].name != NULL)
121 { 121 {
@@ -275,7 +275,7 @@ processzTXt (const char *data,
275 if (ret != Z_BUF_ERROR) 275 if (ret != Z_BUF_ERROR)
276 return prev; /* unknown error, abort */ 276 return prev; /* unknown error, abort */
277 } 277 }
278 keyword = convertToUtf8 (buf, bufLen, "ISO-8859-1"); 278 keyword = EXTRACTOR_common_convert_to_utf8 (buf, bufLen, "ISO-8859-1");
279 free (buf); 279 free (buf);
280 i = 0; 280 i = 0;
281 while (tagmap[i].name != NULL) 281 while (tagmap[i].name != NULL)
diff --git a/src/plugins/tiffextractor.c b/src/plugins/tiffextractor.c
index f845c7f..a9d23da 100644
--- a/src/plugins/tiffextractor.c
+++ b/src/plugins/tiffextractor.c
@@ -129,7 +129,7 @@ libextractor_tiff_extract (char *filename,
129#if __BYTE_ORDER == __BIG_ENDIAN 129#if __BYTE_ORDER == __BIG_ENDIAN
130 byteOrder = 1 - byteOrder; 130 byteOrder = 1 - byteOrder;
131#endif 131#endif
132 cat_unpack (data, TIFF_HEADER_SPECS[byteOrder], TIFF_HEADER_FIELDS (&hdr)); 132 EXTRACTOR_common_cat_unpack (data, TIFF_HEADER_SPECS[byteOrder], TIFF_HEADER_FIELDS (&hdr));
133 if (hdr.fourty_two != 42) 133 if (hdr.fourty_two != 42)
134 return prev; /* can not be tiff */ 134 return prev; /* can not be tiff */
135 if (hdr.ifd_offset + 6 > size) 135 if (hdr.ifd_offset + 6 > size)
@@ -159,7 +159,7 @@ libextractor_tiff_extract (char *filename,
159 DIRECTORY_ENTRY entry; 159 DIRECTORY_ENTRY entry;
160 off = current_ifd + 2 + DIRECTORY_ENTRY_SIZE * i; 160 off = current_ifd + 2 + DIRECTORY_ENTRY_SIZE * i;
161 161
162 cat_unpack (&data[off], 162 EXTRACTOR_common_cat_unpack (&data[off],
163 DIRECTORY_ENTRY_SPECS[byteOrder], 163 DIRECTORY_ENTRY_SPECS[byteOrder],
164 DIRECTORY_ENTRY_FIELDS (&entry)); 164 DIRECTORY_ENTRY_FIELDS (&entry));
165 switch (entry.tag) 165 switch (entry.tag)