mirror of
				https://github.com/simon987/sist2.git
				synced 2025-11-04 01:36:51 +00:00 
			
		
		
		
	#8 Skip PDF scan when content-size is 0
This commit is contained in:
		
							parent
							
								
									d089601dc5
								
							
						
					
					
						commit
						4ab2ba1a02
					
				@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					#include <src/ctx.h>
 | 
				
			||||||
#include "pdf.h"
 | 
					#include "pdf.h"
 | 
				
			||||||
#include "src/ctx.h"
 | 
					#include "src/ctx.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -185,6 +186,7 @@ void parse_pdf(void *buf, size_t buf_len, document_t *doc) {
 | 
				
			|||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (ScanCtx.content_size > 0) {
 | 
				
			||||||
        fz_stext_options opts = {0};
 | 
					        fz_stext_options opts = {0};
 | 
				
			||||||
        text_buffer_t text_buf = text_buffer_create(ScanCtx.content_size);
 | 
					        text_buffer_t text_buf = text_buffer_create(ScanCtx.content_size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -254,10 +256,11 @@ void parse_pdf(void *buf, size_t buf_len, document_t *doc) {
 | 
				
			|||||||
        memcpy(meta_content->strval, text_buf.dyn_buffer.buf, text_buf.dyn_buffer.cur);
 | 
					        memcpy(meta_content->strval, text_buf.dyn_buffer.buf, text_buf.dyn_buffer.cur);
 | 
				
			||||||
        APPEND_META(doc, meta_content)
 | 
					        APPEND_META(doc, meta_content)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        text_buffer_destroy(&text_buf);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fz_drop_stream(ctx, stream);
 | 
					    fz_drop_stream(ctx, stream);
 | 
				
			||||||
    fz_drop_document(ctx, fzdoc);
 | 
					    fz_drop_document(ctx, fzdoc);
 | 
				
			||||||
    fz_drop_context(ctx);
 | 
					    fz_drop_context(ctx);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    text_buffer_destroy(&text_buf);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user