mirror of
				https://github.com/simon987/libscan.git
				synced 2025-11-04 03:06:51 +00:00 
			
		
		
		
	Bug fix w/ libmagic & vfile
This commit is contained in:
		
							parent
							
								
									e1ad26d0c6
								
							
						
					
					
						commit
						faa2d8a68c
					
				@ -37,6 +37,10 @@ int arc_read(struct vfile *f, void *buf, size_t size) {
 | 
				
			|||||||
    return archive_read_data(f->arc, buf, size);
 | 
					    return archive_read_data(f->arc, buf, size);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void arc_reset(struct vfile *f) {
 | 
				
			||||||
 | 
					    archive_seek_data(f->arc, 0, SEEK_SET);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct arc_data {
 | 
					typedef struct arc_data {
 | 
				
			||||||
    vfile_t *f;
 | 
					    vfile_t *f;
 | 
				
			||||||
    char buf[ARC_BUF_SIZE];
 | 
					    char buf[ARC_BUF_SIZE];
 | 
				
			||||||
@ -134,6 +138,7 @@ scan_code_t parse_archive(scan_arc_ctx_t *ctx, vfile_t *f, document_t *doc) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        sub_job->vfile.close = NULL;
 | 
					        sub_job->vfile.close = NULL;
 | 
				
			||||||
        sub_job->vfile.read = arc_read;
 | 
					        sub_job->vfile.read = arc_read;
 | 
				
			||||||
 | 
					        sub_job->vfile.reset = arc_reset;
 | 
				
			||||||
        sub_job->vfile.arc = a;
 | 
					        sub_job->vfile.arc = a;
 | 
				
			||||||
        sub_job->vfile.filepath = sub_job->filepath;
 | 
					        sub_job->vfile.filepath = sub_job->filepath;
 | 
				
			||||||
        sub_job->vfile.is_fs_file = FALSE;
 | 
					        sub_job->vfile.is_fs_file = FALSE;
 | 
				
			||||||
 | 
				
			|||||||
@ -108,6 +108,8 @@ typedef int (*read_func_t)(struct vfile *, void *buf, size_t size);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
typedef void (*close_func_t)(struct vfile *);
 | 
					typedef void (*close_func_t)(struct vfile *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef void (*reset_func_t)(struct vfile *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct vfile {
 | 
					typedef struct vfile {
 | 
				
			||||||
    union {
 | 
					    union {
 | 
				
			||||||
        int fd;
 | 
					        int fd;
 | 
				
			||||||
@ -121,6 +123,7 @@ typedef struct vfile {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    read_func_t read;
 | 
					    read_func_t read;
 | 
				
			||||||
    close_func_t close;
 | 
					    close_func_t close;
 | 
				
			||||||
 | 
					    reset_func_t reset;
 | 
				
			||||||
} vfile_t;
 | 
					} vfile_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct parse_job_t {
 | 
					typedef struct parse_job_t {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user