mirror of
				https://github.com/simon987/sist2.git
				synced 2025-11-04 01:36:51 +00:00 
			
		
		
		
	Add .doc support
This commit is contained in:
		
							parent
							
								
									50a1ed43fe
								
							
						
					
					
						commit
						7fce56da03
					
				@ -5,6 +5,7 @@ project(sist2 C)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
option(SIST_DEBUG "Build a debug executable" on)
 | 
					option(SIST_DEBUG "Build a debug executable" on)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set(BUILD_TESTS on)
 | 
				
			||||||
add_subdirectory(third-party/libscan)
 | 
					add_subdirectory(third-party/libscan)
 | 
				
			||||||
set(ARGPARSE_SHARED off)
 | 
					set(ARGPARSE_SHARED off)
 | 
				
			||||||
add_subdirectory(third-party/argparse)
 | 
					add_subdirectory(third-party/argparse)
 | 
				
			||||||
 | 
				
			|||||||
@ -13,6 +13,7 @@
 | 
				
			|||||||
#include "libscan/text/text.h"
 | 
					#include "libscan/text/text.h"
 | 
				
			||||||
#include "libscan/mobi/scan_mobi.h"
 | 
					#include "libscan/mobi/scan_mobi.h"
 | 
				
			||||||
#include "libscan/raw/raw.h"
 | 
					#include "libscan/raw/raw.h"
 | 
				
			||||||
 | 
					#include "libscan/msdoc/msdoc.h"
 | 
				
			||||||
#include "src/io/store.h"
 | 
					#include "src/io/store.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <glib.h>
 | 
					#include <glib.h>
 | 
				
			||||||
@ -48,6 +49,7 @@ typedef struct {
 | 
				
			|||||||
    scan_text_ctx_t text_ctx;
 | 
					    scan_text_ctx_t text_ctx;
 | 
				
			||||||
    scan_mobi_ctx_t mobi_ctx;
 | 
					    scan_mobi_ctx_t mobi_ctx;
 | 
				
			||||||
    scan_raw_ctx_t raw_ctx;
 | 
					    scan_raw_ctx_t raw_ctx;
 | 
				
			||||||
 | 
					    scan_msdoc_ctx_t msdoc_ctx;
 | 
				
			||||||
} ScanCtx_t;
 | 
					} ScanCtx_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct {
 | 
					typedef struct {
 | 
				
			||||||
 | 
				
			|||||||
@ -149,6 +149,14 @@ void initialize_scan_context(scan_args_t *args) {
 | 
				
			|||||||
    ScanCtx.text_ctx.log = _log;
 | 
					    ScanCtx.text_ctx.log = _log;
 | 
				
			||||||
    ScanCtx.text_ctx.logf = _logf;
 | 
					    ScanCtx.text_ctx.logf = _logf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // MSDOC
 | 
				
			||||||
 | 
					    ScanCtx.msdoc_ctx.tn_size = args->size;
 | 
				
			||||||
 | 
					    ScanCtx.msdoc_ctx.content_size = args->content_size;
 | 
				
			||||||
 | 
					    ScanCtx.msdoc_ctx.log = _log;
 | 
				
			||||||
 | 
					    ScanCtx.msdoc_ctx.logf = _logf;
 | 
				
			||||||
 | 
					    ScanCtx.msdoc_ctx.store = _store;
 | 
				
			||||||
 | 
					    ScanCtx.msdoc_ctx.msdoc_mime = mime_get_mime_by_string(ScanCtx.mime_table, "application/msword");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ScanCtx.threads = args->threads;
 | 
					    ScanCtx.threads = args->threads;
 | 
				
			||||||
    ScanCtx.depth = args->depth;
 | 
					    ScanCtx.depth = args->depth;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -162,6 +162,8 @@ void parse(void *arg) {
 | 
				
			|||||||
        parse_sidecar(&job->vfile, &doc);
 | 
					        parse_sidecar(&job->vfile, &doc);
 | 
				
			||||||
        CLOSE_FILE(job->vfile)
 | 
					        CLOSE_FILE(job->vfile)
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					    } else if (is_msdoc(&ScanCtx.msdoc_ctx, doc.mime)) {
 | 
				
			||||||
 | 
					        parse_msdoc(&ScanCtx.msdoc_ctx, &job->vfile, &doc);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    abort:
 | 
					    abort:
 | 
				
			||||||
 | 
				
			|||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								third-party/argparse
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										2
									
								
								third-party/argparse
									
									
									
									
										vendored
									
									
								
							@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 4ed6099cb33245b06343518b9f3c45ac56e8283c
 | 
					Subproject commit d94b1bce1591d1d1a92b9b8c5d175cd8b81fcfa1
 | 
				
			||||||
							
								
								
									
										2
									
								
								third-party/libscan
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
								
									
									
								
							
						
						
									
										2
									
								
								third-party/libscan
									
									
									
									
										vendored
									
									
								
							@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 101fbbfbf0b75fb368bd9116f46adfd0d3d1f853
 | 
					Subproject commit 070186fea07883bf4984831470158c2f68263e5d
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user