aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-07-12 21:22:55 +0200
committerChristian Grothoff <christian@grothoff.org>2018-07-12 21:22:55 +0200
commit856090bb0b29e62eb4da3916cabc4e1ceddb08f8 (patch)
tree0198652d4e6a7ca86e6234a636e32cc5c2be7534
parentf17357203dea2c4feb7f425a529a6a72536ab53b (diff)
downloadlibextractor-856090bb0b29e62eb4da3916cabc4e1ceddb08f8.tar.gz
libextractor-856090bb0b29e62eb4da3916cabc4e1ceddb08f8.zip
fix stylistic issues
-rw-r--r--src/main/extractor.c11
-rw-r--r--src/main/extractor_plugin_main.c69
2 files changed, 40 insertions, 40 deletions
diff --git a/src/main/extractor.c b/src/main/extractor.c
index 11ace46..3755da9 100644
--- a/src/main/extractor.c
+++ b/src/main/extractor.c
@@ -217,7 +217,7 @@ struct InProcessContext
217 EXTRACTOR_MetaDataProcessor proc; 217 EXTRACTOR_MetaDataProcessor proc;
218 218
219 /** 219 /**
220 * Closure for 'proc'. 220 * Closure for @e proc.
221 */ 221 */
222 void *proc_cls; 222 void *proc_cls;
223 223
@@ -234,15 +234,14 @@ struct InProcessContext
234 234
235 235
236/** 236/**
237 * Obtain a pointer to up to 'size' bytes of data from the file to process. 237 * Obtain a pointer to up to @a size bytes of data from the file to process.
238 * Callback used for in-process plugins. 238 * Callback used for in-process plugins.
239 * 239 *
240 * @param cls a 'struct InProcessContext' 240 * @param cls a `struct InProcessContext`
241 * @param data pointer to set to the file data, set to NULL on error 241 * @param data pointer to set to the file data, set to NULL on error
242 * @param size maximum number of bytes requested 242 * @param size maximum number of bytes requested
243 * @return number of bytes now available in data (can be smaller than 'size'), 243 * @return number of bytes now available in data (can be smaller than @a size),
244 * -1 on error 244 * -1 on error
245 *
246 */ 245 */
247static ssize_t 246static ssize_t
248in_process_read (void *cls, 247in_process_read (void *cls,
@@ -268,7 +267,7 @@ in_process_read (void *cls,
268 267
269 268
270/** 269/**
271 * Seek in the file. Use 'SEEK_CUR' for whence and 'pos' of 0 to 270 * Seek in the file. Use 'SEEK_CUR' for @a whence and @a pos of 0 to
272 * obtain the current position in the file. 271 * obtain the current position in the file.
273 * Callback used for in-process plugins. 272 * Callback used for in-process plugins.
274 * 273 *
diff --git a/src/main/extractor_plugin_main.c b/src/main/extractor_plugin_main.c
index 3d20f9c..7b01140 100644
--- a/src/main/extractor_plugin_main.c
+++ b/src/main/extractor_plugin_main.c
@@ -50,7 +50,7 @@
50/** 50/**
51 * Closure we use for processing requests inside the helper process. 51 * Closure we use for processing requests inside the helper process.
52 */ 52 */
53struct ProcessingContext 53struct ProcessingContext
54{ 54{
55 /** 55 /**
56 * Our plugin handle. 56 * Our plugin handle.
@@ -81,7 +81,7 @@ struct ProcessingContext
81 * Handle to the shared memory. 81 * Handle to the shared memory.
82 */ 82 */
83 SHM_ID shm_id; 83 SHM_ID shm_id;
84 84
85 /** 85 /**
86 * Size of the shared memory map. 86 * Size of the shared memory map.
87 */ 87 */
@@ -96,10 +96,10 @@ struct ProcessingContext
96 * Input stream. 96 * Input stream.
97 */ 97 */
98 int in; 98 int in;
99 99
100 /** 100 /**
101 * Output stream. 101 * Output stream.
102 */ 102 */
103 int out; 103 int out;
104}; 104};
105 105
@@ -116,7 +116,7 @@ struct ProcessingContext
116 */ 116 */
117static int64_t 117static int64_t
118plugin_env_seek (void *cls, 118plugin_env_seek (void *cls,
119 int64_t pos, 119 int64_t pos,
120 int whence) 120 int whence)
121{ 121{
122 struct ProcessingContext *pc = cls; 122 struct ProcessingContext *pc = cls;
@@ -205,7 +205,7 @@ plugin_env_seek (void *cls,
205 pc->plugin->short_libname); 205 pc->plugin->short_libname);
206 return -1; 206 return -1;
207 } 207 }
208 if (MESSAGE_UPDATED_SHM != reply) 208 if (MESSAGE_UPDATED_SHM != reply)
209 { 209 {
210 LOG ("Unexpected reply %d to seek\n", reply); 210 LOG ("Unexpected reply %d to seek\n", reply);
211 return -1; /* was likely a MESSAGE_DISCARD_STATE */ 211 return -1; /* was likely a MESSAGE_DISCARD_STATE */
@@ -243,31 +243,32 @@ plugin_env_seek (void *cls,
243 243
244 244
245/** 245/**
246 * Fills 'data' with a pointer to the data buffer. 246 * Fills @a data with a pointer to the data buffer.
247 * 247 *
248 * @param plugin plugin context 248 * @param plugin plugin context
249 * @param data location to store data pointer 249 * @param data location to store data pointer
250 * @param count number of bytes to read 250 * @param count number of bytes to read
251 * @return number of bytes (<= count) avalable in 'data', -1 on error 251 * @return number of bytes (<= count) avalable in @a data, -1 on error
252 */ 252 */
253static ssize_t 253static ssize_t
254plugin_env_read (void *cls, 254plugin_env_read (void *cls,
255 void **data, size_t count) 255 void **data,
256 size_t count)
256{ 257{
257 struct ProcessingContext *pc = cls; 258 struct ProcessingContext *pc = cls;
258 unsigned char *dp; 259 unsigned char *dp;
259 260
260 *data = NULL; 261 *data = NULL;
261 if ( (count + pc->read_position > pc->file_size) || 262 if ( (count + pc->read_position > pc->file_size) ||
262 (count + pc->read_position < pc->read_position) ) 263 (count + pc->read_position < pc->read_position) )
263 count = pc->file_size - pc->read_position; 264 count = pc->file_size - pc->read_position;
264 if ((((pc->read_position >= pc->shm_off + pc->shm_ready_bytes) && 265 if ( ( ( (pc->read_position >= pc->shm_off + pc->shm_ready_bytes) &&
265 (pc->read_position < pc->file_size)) || 266 (pc->read_position < pc->file_size)) ||
266 (pc->read_position < pc->shm_off)) && 267 (pc->read_position < pc->shm_off) ) &&
267 (-1 == plugin_env_seek (pc, pc->read_position, SEEK_SET))) 268 (-1 == plugin_env_seek (pc, pc->read_position, SEEK_SET) ) )
268 { 269 {
269 LOG ("Failed to seek to satisfy read\n"); 270 LOG ("Failed to seek to satisfy read\n");
270 return -1; 271 return -1;
271 } 272 }
272 if (pc->read_position + count > pc->shm_off + pc->shm_ready_bytes) 273 if (pc->read_position + count > pc->shm_off + pc->shm_ready_bytes)
273 count = pc->shm_off + pc->shm_ready_bytes - pc->read_position; 274 count = pc->shm_off + pc->shm_ready_bytes - pc->read_position;
@@ -303,13 +304,13 @@ plugin_env_get_size (void *cls)
303 * used in the main libextractor library and yielding 304 * used in the main libextractor library and yielding
304 * meta data). 305 * meta data).
305 * @param type libextractor-type describing the meta data 306 * @param type libextractor-type describing the meta data
306 * @param format basic format information about data 307 * @param format basic format information about data
307 * @param data_mime_type mime-type of data (not of the original file); 308 * @param data_mime_type mime-type of data (not of the original file);
308 * can be NULL (if mime-type is not known) 309 * can be NULL (if mime-type is not known)
309 * @param data actual meta-data found 310 * @param data actual meta-data found
310 * @param data_len number of bytes in data 311 * @param data_len number of bytes in data
311 * @return 0 to continue extracting, 1 to abort (transmission error) 312 * @return 0 to continue extracting, 1 to abort (transmission error)
312 */ 313 */
313static int 314static int
314plugin_env_send_proc (void *cls, 315plugin_env_send_proc (void *cls,
315 const char *plugin_name, 316 const char *plugin_name,
@@ -338,14 +339,14 @@ plugin_env_send_proc (void *cls,
338 mm.meta_format = (uint16_t) format; 339 mm.meta_format = (uint16_t) format;
339 mm.mime_length = (uint16_t) mime_len; 340 mm.mime_length = (uint16_t) mime_len;
340 mm.value_size = (uint32_t) data_len; 341 mm.value_size = (uint32_t) data_len;
341 if ( (sizeof (mm) != 342 if ( (sizeof (mm) !=
342 EXTRACTOR_write_all_ (pc->out, 343 EXTRACTOR_write_all_ (pc->out,
343 &mm, sizeof (mm))) || 344 &mm, sizeof (mm))) ||
344 (mime_len != 345 (mime_len !=
345 EXTRACTOR_write_all_ (pc->out, 346 EXTRACTOR_write_all_ (pc->out,
346 data_mime_type, mime_len)) || 347 data_mime_type, mime_len)) ||
347 (data_len != 348 (data_len !=
348 EXTRACTOR_write_all_ (pc->out, 349 EXTRACTOR_write_all_ (pc->out,
349 data, data_len)) ) 350 data, data_len)) )
350 { 351 {
351 LOG ("Failed to send meta message\n"); 352 LOG ("Failed to send meta message\n");
@@ -401,7 +402,7 @@ handle_init_message (struct ProcessingContext *pc)
401 { 402 {
402 char shm_name[init.shm_name_length + 1]; 403 char shm_name[init.shm_name_length + 1];
403 404
404 if (init.shm_name_length 405 if (init.shm_name_length
405 != EXTRACTOR_read_all_ (pc->in, 406 != EXTRACTOR_read_all_ (pc->in,
406 shm_name, 407 shm_name,
407 init.shm_name_length)) 408 init.shm_name_length))
@@ -505,7 +506,7 @@ handle_start_message (struct ProcessingContext *pc)
505 * input pipe and acts on it. 506 * input pipe and acts on it.
506 * 507 *
507 * @param pc processing context 508 * @param pc processing context
508 */ 509 */
509static void 510static void
510process_requests (struct ProcessingContext *pc) 511process_requests (struct ProcessingContext *pc)
511{ 512{
@@ -596,7 +597,7 @@ open_dev_null (int target_fd,
596 * @param out stream to write to 597 * @param out stream to write to
597 */ 598 */
598void 599void
599EXTRACTOR_plugin_main_ (struct EXTRACTOR_PluginList *plugin, 600EXTRACTOR_plugin_main_ (struct EXTRACTOR_PluginList *plugin,
600 int in, int out) 601 int in, int out)
601{ 602{
602 struct ProcessingContext pc; 603 struct ProcessingContext pc;
@@ -604,11 +605,11 @@ EXTRACTOR_plugin_main_ (struct EXTRACTOR_PluginList *plugin,
604 if (0 != EXTRACTOR_plugin_load_ (plugin)) 605 if (0 != EXTRACTOR_plugin_load_ (plugin))
605 { 606 {
606#if DEBUG 607#if DEBUG
607 fprintf (stderr, "Plugin `%s' failed to load!\n", 608 fprintf (stderr, "Plugin `%s' failed to load!\n",
608 plugin->short_libname); 609 plugin->short_libname);
609#endif 610#endif
610 return; 611 return;
611 } 612 }
612 if ( (NULL != plugin->specials) && 613 if ( (NULL != plugin->specials) &&
613 (NULL != strstr (plugin->specials, "close-stderr"))) 614 (NULL != strstr (plugin->specials, "close-stderr")))
614 { 615 {
@@ -657,7 +658,7 @@ EXTRACTOR_plugin_main_ (struct EXTRACTOR_PluginList *plugin,
657 * 658 *
658 * @param fd the pipe to read from 659 * @param fd the pipe to read from
659 * @return newly allocated plugin context 660 * @return newly allocated plugin context
660 */ 661 */
661static struct EXTRACTOR_PluginList * 662static struct EXTRACTOR_PluginList *
662read_plugin_data (int fd) 663read_plugin_data (int fd)
663{ 664{
@@ -713,10 +714,10 @@ read_plugin_data (int fd)
713/** 714/**
714 * FIXME: document. 715 * FIXME: document.
715 */ 716 */
716void CALLBACK 717void CALLBACK
717RundllEntryPoint (HWND hwnd, 718RundllEntryPoint (HWND hwnd,
718 HINSTANCE hinst, 719 HINSTANCE hinst,
719 LPSTR lpszCmdLine, 720 LPSTR lpszCmdLine,
720 int nCmdShow) 721 int nCmdShow)
721{ 722{
722 struct EXTRACTOR_PluginList *plugin; 723 struct EXTRACTOR_PluginList *plugin;
@@ -752,10 +753,10 @@ RundllEntryPoint (HWND hwnd,
752/** 753/**
753 * FIXME: document. 754 * FIXME: document.
754 */ 755 */
755void CALLBACK 756void CALLBACK
756RundllEntryPointA (HWND hwnd, 757RundllEntryPointA (HWND hwnd,
757 HINSTANCE hinst, 758 HINSTANCE hinst,
758 LPSTR lpszCmdLine, 759 LPSTR lpszCmdLine,
759 int nCmdShow) 760 int nCmdShow)
760{ 761{
761 return RundllEntryPoint (hwnd, hinst, lpszCmdLine, nCmdShow); 762 return RundllEntryPoint (hwnd, hinst, lpszCmdLine, nCmdShow);