diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-12-22 17:55:27 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-12-22 17:55:27 +0000 |
commit | d26a892396ed78f041c23a974ae1b2502004a0f7 (patch) | |
tree | 4be0a608c3a63de855e7f216140dbedcfcbd8df5 | |
parent | 478ea192edad630c802370ae504e363074a8a11c (diff) | |
download | libextractor-d26a892396ed78f041c23a974ae1b2502004a0f7.tar.gz libextractor-d26a892396ed78f041c23a974ae1b2502004a0f7.zip |
-just whitespace
-rw-r--r-- | src/main/extractor.c | 60 | ||||
-rw-r--r-- | src/main/extractor_ipc.c | 10 |
2 files changed, 36 insertions, 34 deletions
diff --git a/src/main/extractor.c b/src/main/extractor.c index 830eac8..74740a2 100644 --- a/src/main/extractor.c +++ b/src/main/extractor.c | |||
@@ -92,7 +92,7 @@ send_update_message (struct EXTRACTOR_PluginList *plugin, | |||
92 | EXTRACTOR_IPC_channel_destroy_ (plugin->channel); | 92 | EXTRACTOR_IPC_channel_destroy_ (plugin->channel); |
93 | plugin->channel = NULL; | 93 | plugin->channel = NULL; |
94 | plugin->round_finished = 1; | 94 | plugin->round_finished = 1; |
95 | } | 95 | } |
96 | } | 96 | } |
97 | 97 | ||
98 | 98 | ||
@@ -166,7 +166,7 @@ process_plugin_reply (void *cls, | |||
166 | if (0 != prp->file_finished) | 166 | if (0 != prp->file_finished) |
167 | { | 167 | { |
168 | /* client already aborted, ignore message, tell plugin about abort */ | 168 | /* client already aborted, ignore message, tell plugin about abort */ |
169 | return; | 169 | return; |
170 | } | 170 | } |
171 | if (0 != prp->proc (prp->proc_cls, | 171 | if (0 != prp->proc (prp->proc_cls, |
172 | plugin->short_libname, | 172 | plugin->short_libname, |
@@ -271,13 +271,13 @@ in_process_read (void *cls, | |||
271 | * Seek in the file. Use 'SEEK_CUR' for whence and 'pos' of 0 to | 271 | * Seek in the file. Use 'SEEK_CUR' for whence and 'pos' of 0 to |
272 | * obtain the current position in the file. | 272 | * obtain the current position in the file. |
273 | * Callback used for in-process plugins. | 273 | * Callback used for in-process plugins. |
274 | * | 274 | * |
275 | * @param cls a 'struct InProcessContext' | 275 | * @param cls a 'struct InProcessContext' |
276 | * @param pos position to seek (see 'man lseek') | 276 | * @param pos position to seek (see 'man lseek') |
277 | * @param whence how to see (absolute to start, relative, absolute to end) | 277 | * @param whence how to see (absolute to start, relative, absolute to end) |
278 | * @return new absolute position, -1 on error (i.e. desired position | 278 | * @return new absolute position, -1 on error (i.e. desired position |
279 | * does not exist) | 279 | * does not exist) |
280 | */ | 280 | */ |
281 | static int64_t | 281 | static int64_t |
282 | in_process_seek (void *cls, | 282 | in_process_seek (void *cls, |
283 | int64_t pos, | 283 | int64_t pos, |
@@ -294,15 +294,15 @@ in_process_seek (void *cls, | |||
294 | /** | 294 | /** |
295 | * Determine the overall size of the file. | 295 | * Determine the overall size of the file. |
296 | * Callback used for in-process plugins. | 296 | * Callback used for in-process plugins. |
297 | * | 297 | * |
298 | * @param cls a 'struct InProcessContext' | 298 | * @param cls a 'struct InProcessContext' |
299 | * @return overall file size, UINT64_MAX on error (i.e. IPC failure) | 299 | * @return overall file size, UINT64_MAX on error (i.e. IPC failure) |
300 | */ | 300 | */ |
301 | static uint64_t | 301 | static uint64_t |
302 | in_process_get_size (void *cls) | 302 | in_process_get_size (void *cls) |
303 | { | 303 | { |
304 | struct InProcessContext *ctx = cls; | 304 | struct InProcessContext *ctx = cls; |
305 | 305 | ||
306 | return (uint64_t) EXTRACTOR_datasource_get_size_ (ctx->ds, 0); | 306 | return (uint64_t) EXTRACTOR_datasource_get_size_ (ctx->ds, 0); |
307 | } | 307 | } |
308 | 308 | ||
@@ -318,13 +318,13 @@ in_process_get_size (void *cls) | |||
318 | * used in the main libextractor library and yielding | 318 | * used in the main libextractor library and yielding |
319 | * meta data). | 319 | * meta data). |
320 | * @param type libextractor-type describing the meta data | 320 | * @param type libextractor-type describing the meta data |
321 | * @param format basic format information about data | 321 | * @param format basic format information about data |
322 | * @param data_mime_type mime-type of data (not of the original file); | 322 | * @param data_mime_type mime-type of data (not of the original file); |
323 | * can be NULL (if mime-type is not known) | 323 | * can be NULL (if mime-type is not known) |
324 | * @param data actual meta-data found | 324 | * @param data actual meta-data found |
325 | * @param data_len number of bytes in data | 325 | * @param data_len number of bytes in data |
326 | * @return 0 to continue extracting, 1 to abort | 326 | * @return 0 to continue extracting, 1 to abort |
327 | */ | 327 | */ |
328 | static int | 328 | static int |
329 | in_process_proc (void *cls, | 329 | in_process_proc (void *cls, |
330 | const char *plugin_name, | 330 | const char *plugin_name, |
@@ -363,7 +363,7 @@ in_process_proc (void *cls, | |||
363 | * @param proc_cls cls argument to proc | 363 | * @param proc_cls cls argument to proc |
364 | */ | 364 | */ |
365 | static void | 365 | static void |
366 | do_extract (struct EXTRACTOR_PluginList *plugins, | 366 | do_extract (struct EXTRACTOR_PluginList *plugins, |
367 | struct EXTRACTOR_SharedMemory *shm, | 367 | struct EXTRACTOR_SharedMemory *shm, |
368 | struct EXTRACTOR_Datasource *ds, | 368 | struct EXTRACTOR_Datasource *ds, |
369 | EXTRACTOR_MetaDataProcessor proc, void *proc_cls) | 369 | EXTRACTOR_MetaDataProcessor proc, void *proc_cls) |
@@ -438,12 +438,12 @@ do_extract (struct EXTRACTOR_PluginList *plugins, | |||
438 | else | 438 | else |
439 | { | 439 | { |
440 | /* not running this round, seeking! */ | 440 | /* not running this round, seeking! */ |
441 | channels[plugin_off] = NULL; | 441 | channels[plugin_off] = NULL; |
442 | } | 442 | } |
443 | plugin_off++; | 443 | plugin_off++; |
444 | } | 444 | } |
445 | /* give plugins chance to send us meta data, seek or finished messages */ | 445 | /* give plugins chance to send us meta data, seek or finished messages */ |
446 | if (-1 == | 446 | if (-1 == |
447 | EXTRACTOR_IPC_channel_recv_ (channels, | 447 | EXTRACTOR_IPC_channel_recv_ (channels, |
448 | plugin_count, | 448 | plugin_count, |
449 | &process_plugin_reply, | 449 | &process_plugin_reply, |
@@ -464,12 +464,14 @@ do_extract (struct EXTRACTOR_PluginList *plugins, | |||
464 | plugin_off++; | 464 | plugin_off++; |
465 | if ( (1 == pos->round_finished) || | 465 | if ( (1 == pos->round_finished) || |
466 | (NULL == pos->channel) ) | 466 | (NULL == pos->channel) ) |
467 | continue; /* inactive plugin */ | 467 | { |
468 | continue; /* inactive plugin */ | ||
469 | } | ||
468 | if (-1 == pos->seek_request) | 470 | if (-1 == pos->seek_request) |
469 | { | 471 | { |
470 | /* possibly more meta data at current position, at least | 472 | /* possibly more meta data at current position, at least |
471 | this plugin is still working on it... */ | 473 | this plugin is still working on it... */ |
472 | done = 0; | 474 | done = 0; |
473 | break; | 475 | break; |
474 | } | 476 | } |
475 | if (-1 != pos->seek_request) | 477 | if (-1 != pos->seek_request) |
@@ -485,14 +487,14 @@ do_extract (struct EXTRACTOR_PluginList *plugins, | |||
485 | pos->seek_request = 0; | 487 | pos->seek_request = 0; |
486 | } | 488 | } |
487 | else | 489 | else |
488 | { | 490 | { |
489 | pos->seek_request = end - pos->seek_request; | 491 | pos->seek_request = end - pos->seek_request; |
490 | } | 492 | } |
491 | } | 493 | } |
492 | if ( (-1 == min_seek) || | 494 | if ( (-1 == min_seek) || |
493 | (min_seek > pos->seek_request) ) | 495 | (min_seek > pos->seek_request) ) |
494 | { | 496 | { |
495 | min_seek = pos->seek_request; | 497 | min_seek = pos->seek_request; |
496 | } | 498 | } |
497 | } | 499 | } |
498 | } | 500 | } |
@@ -521,16 +523,16 @@ do_extract (struct EXTRACTOR_PluginList *plugins, | |||
521 | { | 523 | { |
522 | /* Skipping plugin: channel down */ | 524 | /* Skipping plugin: channel down */ |
523 | continue; | 525 | continue; |
524 | } | 526 | } |
525 | if ( (-1 != pos->seek_request) && | 527 | if ( (-1 != pos->seek_request) && |
526 | (1 == prp.file_finished) ) | 528 | (1 == prp.file_finished) ) |
527 | { | 529 | { |
528 | send_discard_message (pos); | 530 | send_discard_message (pos); |
529 | pos->round_finished = 1; | 531 | pos->round_finished = 1; |
530 | pos->seek_request = -1; | 532 | pos->seek_request = -1; |
531 | } | 533 | } |
532 | if ( (-1 != data_available) && | 534 | if ( (-1 != data_available) && |
533 | (-1 != pos->seek_request) && | 535 | (-1 != pos->seek_request) && |
534 | (min_seek <= pos->seek_request) && | 536 | (min_seek <= pos->seek_request) && |
535 | ( (min_seek + data_available > pos->seek_request) || | 537 | ( (min_seek + data_available > pos->seek_request) || |
536 | (min_seek == EXTRACTOR_datasource_get_size_ (ds, 0))) ) | 538 | (min_seek == EXTRACTOR_datasource_get_size_ (ds, 0))) ) |
@@ -540,10 +542,10 @@ do_extract (struct EXTRACTOR_PluginList *plugins, | |||
540 | min_seek, | 542 | min_seek, |
541 | data_available, | 543 | data_available, |
542 | ds); | 544 | ds); |
543 | pos->seek_request = -1; | 545 | pos->seek_request = -1; |
544 | } | 546 | } |
545 | if (0 == pos->round_finished) | 547 | if (0 == pos->round_finished) |
546 | done = 0; /* can't be done, plugin still active */ | 548 | done = 0; /* can't be done, plugin still active */ |
547 | } | 549 | } |
548 | } | 550 | } |
549 | 551 | ||
@@ -615,7 +617,7 @@ EXTRACTOR_extract (struct EXTRACTOR_PluginList *plugins, | |||
615 | datasource = EXTRACTOR_datasource_create_from_file_ (filename, | 617 | datasource = EXTRACTOR_datasource_create_from_file_ (filename, |
616 | proc, proc_cls); | 618 | proc, proc_cls); |
617 | if (NULL == datasource) | 619 | if (NULL == datasource) |
618 | return; | 620 | return; |
619 | shm = NULL; | 621 | shm = NULL; |
620 | have_oop = 0; | 622 | have_oop = 0; |
621 | for (pos = plugins; NULL != pos; pos = pos->next) | 623 | for (pos = plugins; NULL != pos; pos = pos->next) |
@@ -658,8 +660,8 @@ EXTRACTOR_extract (struct EXTRACTOR_PluginList *plugins, | |||
658 | /** | 660 | /** |
659 | * Initialize gettext and libltdl (and W32 if needed). | 661 | * Initialize gettext and libltdl (and W32 if needed). |
660 | */ | 662 | */ |
661 | void __attribute__ ((constructor)) | 663 | void __attribute__ ((constructor)) |
662 | EXTRACTOR_ltdl_init () | 664 | EXTRACTOR_ltdl_init () |
663 | { | 665 | { |
664 | int err; | 666 | int err; |
665 | 667 | ||
@@ -667,7 +669,7 @@ EXTRACTOR_ltdl_init () | |||
667 | BINDTEXTDOMAIN (PACKAGE, LOCALEDIR); | 669 | BINDTEXTDOMAIN (PACKAGE, LOCALEDIR); |
668 | #endif | 670 | #endif |
669 | err = lt_dlinit (); | 671 | err = lt_dlinit (); |
670 | if (err > 0) | 672 | if (err > 0) |
671 | { | 673 | { |
672 | #if DEBUG | 674 | #if DEBUG |
673 | fprintf (stderr, | 675 | fprintf (stderr, |
@@ -685,7 +687,7 @@ EXTRACTOR_ltdl_init () | |||
685 | /** | 687 | /** |
686 | * Deinit. | 688 | * Deinit. |
687 | */ | 689 | */ |
688 | void __attribute__ ((destructor)) | 690 | void __attribute__ ((destructor)) |
689 | EXTRACTOR_ltdl_fini () { | 691 | EXTRACTOR_ltdl_fini () { |
690 | #if WINDOWS | 692 | #if WINDOWS |
691 | plibc_shutdown (); | 693 | plibc_shutdown (); |
diff --git a/src/main/extractor_ipc.c b/src/main/extractor_ipc.c index 61b0fe9..7f509da 100644 --- a/src/main/extractor_ipc.c +++ b/src/main/extractor_ipc.c | |||
@@ -67,7 +67,7 @@ EXTRACTOR_IPC_process_reply_ (struct EXTRACTOR_PluginList *plugin, | |||
67 | size--; | 67 | size--; |
68 | data++; | 68 | data++; |
69 | continue; | 69 | continue; |
70 | case MESSAGE_SEEK: /* Seek */ | 70 | case MESSAGE_SEEK: /* Seek */ |
71 | if (size < sizeof (struct SeekRequestMessage)) | 71 | if (size < sizeof (struct SeekRequestMessage)) |
72 | { | 72 | { |
73 | plugin->seek_request = -1; | 73 | plugin->seek_request = -1; |
@@ -88,13 +88,13 @@ EXTRACTOR_IPC_process_reply_ (struct EXTRACTOR_PluginList *plugin, | |||
88 | } | 88 | } |
89 | memcpy (&meta, cdata, sizeof (meta)); | 89 | memcpy (&meta, cdata, sizeof (meta)); |
90 | /* check hdr for sanity */ | 90 | /* check hdr for sanity */ |
91 | if (meta.value_size > MAX_META_DATA) | 91 | if (meta.value_size > MAX_META_DATA) |
92 | { | 92 | { |
93 | LOG ("Meta data exceeds size limit\n"); | 93 | LOG ("Meta data exceeds size limit\n"); |
94 | return -1; /* not allowing more than MAX_META_DATA meta data */ | 94 | return -1; /* not allowing more than MAX_META_DATA meta data */ |
95 | } | 95 | } |
96 | if (size < sizeof (meta) + meta.mime_length + meta.value_size) | 96 | if (size < sizeof (meta) + meta.mime_length + meta.value_size) |
97 | { | 97 | { |
98 | plugin->seek_request = -1; | 98 | plugin->seek_request = -1; |
99 | return ret; | 99 | return ret; |
100 | } | 100 | } |
@@ -108,7 +108,7 @@ EXTRACTOR_IPC_process_reply_ (struct EXTRACTOR_PluginList *plugin, | |||
108 | if ('\0' != mime_type[meta.mime_length - 1]) | 108 | if ('\0' != mime_type[meta.mime_length - 1]) |
109 | { | 109 | { |
110 | LOG ("Mime type not 0-terminated\n"); | 110 | LOG ("Mime type not 0-terminated\n"); |
111 | return -1; | 111 | return -1; |
112 | } | 112 | } |
113 | } | 113 | } |
114 | if (0 == meta.value_size) | 114 | if (0 == meta.value_size) |
@@ -117,7 +117,7 @@ EXTRACTOR_IPC_process_reply_ (struct EXTRACTOR_PluginList *plugin, | |||
117 | value = &cdata[sizeof (struct MetaMessage) + meta.mime_length]; | 117 | value = &cdata[sizeof (struct MetaMessage) + meta.mime_length]; |
118 | if (meta.meta_type >= EXTRACTOR_metatype_get_max ()) | 118 | if (meta.meta_type >= EXTRACTOR_metatype_get_max ()) |
119 | meta.meta_type = EXTRACTOR_METATYPE_UNKNOWN; | 119 | meta.meta_type = EXTRACTOR_METATYPE_UNKNOWN; |
120 | proc (proc_cls, | 120 | proc (proc_cls, |
121 | plugin, | 121 | plugin, |
122 | (enum EXTRACTOR_MetaType) meta.meta_type, | 122 | (enum EXTRACTOR_MetaType) meta.meta_type, |
123 | (enum EXTRACTOR_MetaFormat) meta.meta_format, | 123 | (enum EXTRACTOR_MetaFormat) meta.meta_format, |