aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/png_extractor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/png_extractor.c')
-rw-r--r--src/plugins/png_extractor.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/plugins/png_extractor.c b/src/plugins/png_extractor.c
index 978cd8b..6ffbf90 100644
--- a/src/plugins/png_extractor.c
+++ b/src/plugins/png_extractor.c
@@ -23,6 +23,9 @@
23#include <zlib.h> 23#include <zlib.h>
24#include "convert.h" 24#include "convert.h"
25 25
26#include "extractor_plugins.h"
27
28
26static char * 29static char *
27stndup (const char *str, size_t n) 30stndup (const char *str, size_t n)
28{ 31{
@@ -100,17 +103,17 @@ processtEXt (struct EXTRACTOR_PluginList *plugin,
100 return 1; 103 return 1;
101 104
102 //data += 4; 105 //data += 4;
103 off = stnlen (data, length) + 1; 106 off = stnlen ((char*) data, length) + 1;
104 if (off >= length) 107 if (off >= length)
105 return 0; /* failed to find '\0' */ 108 return 0; /* failed to find '\0' */
106 keyword = EXTRACTOR_common_convert_to_utf8 (&data[off], length - off, "ISO-8859-1"); 109 keyword = EXTRACTOR_common_convert_to_utf8 ( (char*) &data[off], length - off, "ISO-8859-1");
107 if (keyword == NULL) 110 if (keyword == NULL)
108 return 0; 111 return 0;
109 i = 0; 112 i = 0;
110 ret = 0; 113 ret = 0;
111 while (tagmap[i].name != NULL) 114 while (tagmap[i].name != NULL)
112 { 115 {
113 if (0 == strcmp (tagmap[i].name, data)) 116 if (0 == strcmp (tagmap[i].name, (char*) data))
114 { 117 {
115 ADDF (tagmap[i].type, keyword); 118 ADDF (tagmap[i].type, keyword);
116 return 0; 119 return 0;
@@ -145,13 +148,13 @@ processiTXt (struct EXTRACTOR_PluginList *plugin,
145 if (length != pl_read (plugin, &data, length)) 148 if (length != pl_read (plugin, &data, length))
146 return 1; 149 return 1;
147 150
148 pos = stnlen (data, length) + 1; 151 pos = stnlen ( (char*) data, length) + 1;
149 if (pos >= length) 152 if (pos >= length)
150 return 0; 153 return 0;
151 compressed = data[pos++]; 154 compressed = data[pos++];
152 if (compressed && (data[pos++] != 0)) 155 if (compressed && (data[pos++] != 0))
153 return 0; /* bad compression method */ 156 return 0; /* bad compression method */
154 language = &data[pos]; 157 language = (char*) &data[pos];
155 ret = 0; 158 ret = 0;
156 if (stnlen (language, length - pos) > 0) 159 if (stnlen (language, length - pos) > 0)
157 { 160 {
@@ -161,7 +164,7 @@ processiTXt (struct EXTRACTOR_PluginList *plugin,
161 pos += stnlen (language, length - pos) + 1; 164 pos += stnlen (language, length - pos) + 1;
162 if (pos + 1 >= length) 165 if (pos + 1 >= length)
163 return 0; 166 return 0;
164 translated = &data[pos]; /* already in utf-8! */ 167 translated = (char*) &data[pos]; /* already in utf-8! */
165 if (stnlen (translated, length - pos) > 0) 168 if (stnlen (translated, length - pos) > 0)
166 { 169 {
167 lan = stndup (translated, length - pos); 170 lan = stndup (translated, length - pos);
@@ -207,12 +210,12 @@ processiTXt (struct EXTRACTOR_PluginList *plugin,
207 } 210 }
208 else 211 else
209 { 212 {
210 keyword = stndup (&data[pos], length - pos); 213 keyword = stndup ((char*) &data[pos], length - pos);
211 } 214 }
212 i = 0; 215 i = 0;
213 while (tagmap[i].name != NULL) 216 while (tagmap[i].name != NULL)
214 { 217 {
215 if (0 == strcmp (tagmap[i].name, data)) 218 if (0 == strcmp (tagmap[i].name, (char*) data))
216 { 219 {
217 ADDF (tagmap[i].type, keyword /* already in utf8 */); 220 ADDF (tagmap[i].type, keyword /* already in utf8 */);
218 return 0; 221 return 0;
@@ -270,7 +273,7 @@ processzTXt (struct EXTRACTOR_PluginList *plugin,
270 return 1; 273 return 1;
271 274
272 //data += 4; 275 //data += 4;
273 off = stnlen (data, length) + 1; 276 off = stnlen ( (char*) data, length) + 1;
274 if (off >= length) 277 if (off >= length)
275 return 0; /* failed to find '\0' */ 278 return 0; /* failed to find '\0' */
276 if (data[off] != 0) 279 if (data[off] != 0)
@@ -310,7 +313,7 @@ processzTXt (struct EXTRACTOR_PluginList *plugin,
310 i = 0; 313 i = 0;
311 while (tagmap[i].name != NULL) 314 while (tagmap[i].name != NULL)
312 { 315 {
313 if (0 == strcmp (tagmap[i].name, data)) 316 if (0 == strcmp (tagmap[i].name, (char*) data))
314 { 317 {
315 ADDF (tagmap[i].type, keyword); 318 ADDF (tagmap[i].type, keyword);
316 return 0; 319 return 0;
@@ -382,7 +385,7 @@ EXTRACTOR_png_extract_method (struct EXTRACTOR_PluginList *plugin,
382 if (ret != pl_read (plugin, &data, ret)) 385 if (ret != pl_read (plugin, &data, ret))
383 return 1; 386 return 1;
384 387
385 if (0 != strncmp (data, PNG_HEADER, ret)) 388 if (0 != strncmp ((char*) data, PNG_HEADER, ret))
386 return 1; 389 return 1;
387 390
388 ADD (EXTRACTOR_METATYPE_MIMETYPE, "image/png"); 391 ADD (EXTRACTOR_METATYPE_MIMETYPE, "image/png");
@@ -399,15 +402,15 @@ EXTRACTOR_png_extract_method (struct EXTRACTOR_PluginList *plugin,
399 if (pos <= 0) 402 if (pos <= 0)
400 break; 403 break;
401 pos += length + 4; /* Chunk type, data, crc */ 404 pos += length + 4; /* Chunk type, data, crc */
402 if (0 == strncmp (data, "IHDR", 4)) 405 if (0 == strncmp ((char*) data, "IHDR", 4))
403 ret = processIHDR (plugin, length, proc, proc_cls); 406 ret = processIHDR (plugin, length, proc, proc_cls);
404 if (0 == strncmp (data, "iTXt", 4)) 407 if (0 == strncmp ((char*) data, "iTXt", 4))
405 ret = processiTXt (plugin, length, proc, proc_cls); 408 ret = processiTXt (plugin, length, proc, proc_cls);
406 if (0 == strncmp (data, "tEXt", 4)) 409 if (0 == strncmp ((char*)data, "tEXt", 4))
407 ret = processtEXt (plugin, length, proc, proc_cls); 410 ret = processtEXt (plugin, length, proc, proc_cls);
408 if (0 == strncmp (data, "zTXt", 4)) 411 if (0 == strncmp ((char*) data, "zTXt", 4))
409 ret = processzTXt (plugin, length, proc, proc_cls); 412 ret = processzTXt (plugin, length, proc, proc_cls);
410 if (0 == strncmp (data, "tIME", 4)) 413 if (0 == strncmp ((char*) data, "tIME", 4))
411 ret = processtIME (plugin, length, proc, proc_cls); 414 ret = processtIME (plugin, length, proc, proc_cls);
412 if (ret != 0) 415 if (ret != 0)
413 break; 416 break;