mirror of
https://github.com/simon987/sist2.git
synced 2025-12-11 14:38:54 +00:00
Update dependencies
This commit is contained in:
@@ -123,7 +123,7 @@ binaries.
|
||||
libssl-dev uuid-dev python3 libmagic-dev libfreetype6-dev \
|
||||
libcurl4-openssl-dev libbz2-dev yasm libharfbuzz-dev ragel \
|
||||
libarchive-dev libtiff5 libpng16-16 libpango1.0-dev \
|
||||
libxml2-dev
|
||||
libxml2-dev libopenjp2-7-dev
|
||||
```
|
||||
|
||||
2. Build
|
||||
|
||||
2
argparse
2
argparse
Submodule argparse updated: fafc503d23...4ed6099cb3
2
cJSON
2
cJSON
Submodule cJSON updated: 2d4ad84192...e8077d0150
Submodule lib/ffmpeg updated: 8887991a31...e27a35e045
Submodule lib/harfbuzz updated: b28c282585...b7617f6b3c
Submodule lib/leptonica updated: cc03be70fd...320b4bbb02
Submodule lib/libtiff updated: 3db0ff91bc...a6d3c1d64b
Submodule lib/mupdf updated: c50ac19e41...1e1ac03fe4
Submodule lib/onion updated: 73329b61eb...2b3b230b79
Submodule lib/openjpeg updated: ac3737372a...563ecfb55c
Submodule lib/tesseract updated: f268e6615e...90405ad0e3
@@ -238,7 +238,7 @@ int index_args_validate(index_args_t *args, int argc, const char **argv) {
|
||||
|
||||
args->script = malloc(info.st_size + 1);
|
||||
res = read(fd, args->script, info.st_size);
|
||||
if (res == -1) {
|
||||
if (res < 0) {
|
||||
fprintf(stderr, "Error reading script file '%s': %s\n", args->script_path, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ void write_index_descriptor(char *path, index_descriptor_t *desc) {
|
||||
cJSON_AddNumberToObject(json, "timestamp", (double) desc->timestamp);
|
||||
|
||||
int fd = open(path, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
|
||||
if (fd == -1) {
|
||||
perror(path);
|
||||
if (fd < 0) {
|
||||
LOG_FATALF("serialize.c", "Could not write index descriptor: %s", strerror(errno));
|
||||
}
|
||||
char *str = cJSON_Print(json);
|
||||
write(fd, str, strlen(str));
|
||||
@@ -185,7 +185,7 @@ void write_document(document_t *doc) {
|
||||
|
||||
int res = write(index_fd, buf.buf, buf.cur);
|
||||
if (res == -1) {
|
||||
perror("write");
|
||||
LOG_FATALF("serialize.c", "Could not write document: %s", strerror(errno))
|
||||
}
|
||||
ScanCtx.stat_index_size += buf.cur;
|
||||
dyn_buffer_destroy(&buf);
|
||||
@@ -334,7 +334,7 @@ void read_index_json(const char *path, UNUSED(const char *index_id), index_func
|
||||
char *line = NULL;
|
||||
size_t len;
|
||||
size_t read = getline(&line, &len, file);
|
||||
if (read == -1) {
|
||||
if (read < 0) {
|
||||
if (line) {
|
||||
free(line);
|
||||
}
|
||||
|
||||
@@ -6,12 +6,13 @@
|
||||
__thread text_buffer_t thread_buffer;
|
||||
|
||||
|
||||
fz_page *render_cover(fz_context *ctx, document_t *doc, fz_document *fzdoc) {
|
||||
int render_cover(fz_context *ctx, document_t *doc, fz_document *fzdoc) {
|
||||
|
||||
int err = 0;
|
||||
fz_page *cover = NULL;
|
||||
|
||||
fz_var(cover);
|
||||
fz_var(err);
|
||||
fz_try(ctx)
|
||||
cover = fz_load_page(ctx, fzdoc, 0);
|
||||
fz_catch(ctx)
|
||||
@@ -20,7 +21,7 @@ fz_page *render_cover(fz_context *ctx, document_t *doc, fz_document *fzdoc) {
|
||||
if (err != 0) {
|
||||
fz_drop_page(ctx, cover);
|
||||
LOG_WARNINGF(doc->filepath, "fz_load_page() returned error code [%d] %s", err, ctx->error.message)
|
||||
return NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fz_rect bounds = fz_bound_page(ctx, cover);
|
||||
@@ -45,14 +46,14 @@ fz_page *render_cover(fz_context *ctx, document_t *doc, fz_document *fzdoc) {
|
||||
fz_var(err);
|
||||
fz_try(ctx)
|
||||
{
|
||||
pthread_mutex_lock(&ScanCtx.mupdf_mu);
|
||||
// pthread_mutex_lock(&ScanCtx.mupdf_mu);
|
||||
fz_run_page(ctx, cover, dev, fz_identity, NULL);
|
||||
}
|
||||
fz_always(ctx)
|
||||
{
|
||||
fz_close_device(ctx, dev);
|
||||
fz_drop_device(ctx, dev);
|
||||
pthread_mutex_unlock(&ScanCtx.mupdf_mu);
|
||||
// pthread_mutex_unlock(&ScanCtx.mupdf_mu);
|
||||
}
|
||||
fz_catch(ctx)
|
||||
err = ctx->error.errcode;
|
||||
@@ -61,7 +62,7 @@ fz_page *render_cover(fz_context *ctx, document_t *doc, fz_document *fzdoc) {
|
||||
LOG_WARNINGF(doc->filepath, "fz_run_page() returned error code [%d] %s", err, ctx->error.message)
|
||||
fz_drop_page(ctx, cover);
|
||||
fz_drop_pixmap(ctx, pixmap);
|
||||
return NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fz_buffer *fzbuf = NULL;
|
||||
@@ -86,10 +87,11 @@ fz_page *render_cover(fz_context *ctx, document_t *doc, fz_document *fzdoc) {
|
||||
LOG_WARNINGF(doc->filepath, "fz_new_buffer_from_pixmap_as_png() returned error code [%d] %s", err,
|
||||
ctx->error.message)
|
||||
fz_drop_page(ctx, cover);
|
||||
return NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return cover;
|
||||
fz_drop_page(ctx, cover);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void fz_err_callback(void *user, UNUSED(const char *message)) {
|
||||
@@ -232,18 +234,11 @@ void parse_pdf(void *buf, size_t buf_len, document_t *doc) {
|
||||
return;
|
||||
}
|
||||
|
||||
fz_page *cover = NULL;
|
||||
if (ScanCtx.tn_size > 0) {
|
||||
cover = render_cover(ctx, doc, fzdoc);
|
||||
} else {
|
||||
fz_var(cover);
|
||||
fz_try(ctx)
|
||||
cover = fz_load_page(ctx, fzdoc, 0);
|
||||
fz_catch(ctx)
|
||||
cover = NULL;
|
||||
err = render_cover(ctx, doc, fzdoc);
|
||||
}
|
||||
|
||||
if (cover == NULL) {
|
||||
if (err == TRUE) {
|
||||
fz_drop_stream(ctx, stream);
|
||||
fz_drop_document(ctx, fzdoc);
|
||||
fz_drop_context(ctx);
|
||||
@@ -256,23 +251,19 @@ void parse_pdf(void *buf, size_t buf_len, document_t *doc) {
|
||||
|
||||
for (int current_page = 0; current_page < page_count; current_page++) {
|
||||
fz_page *page = NULL;
|
||||
if (current_page == 0) {
|
||||
page = cover;
|
||||
} else {
|
||||
fz_var(err);
|
||||
fz_try(ctx)
|
||||
page = fz_load_page(ctx, fzdoc, current_page);
|
||||
fz_catch(ctx)
|
||||
err = ctx->error.errcode;
|
||||
if (err != 0) {
|
||||
LOG_WARNINGF(doc->filepath, "fz_load_page() returned error code [%d] %s", err, ctx->error.message)
|
||||
text_buffer_destroy(&thread_buffer);
|
||||
fz_drop_page(ctx, page);
|
||||
fz_drop_stream(ctx, stream);
|
||||
fz_drop_document(ctx, fzdoc);
|
||||
fz_drop_context(ctx);
|
||||
return;
|
||||
}
|
||||
fz_var(err);
|
||||
fz_try(ctx)
|
||||
page = fz_load_page(ctx, fzdoc, current_page);
|
||||
fz_catch(ctx)
|
||||
err = ctx->error.errcode;
|
||||
if (err != 0) {
|
||||
LOG_WARNINGF(doc->filepath, "fz_load_page() returned error code [%d] %s", err, ctx->error.message)
|
||||
text_buffer_destroy(&thread_buffer);
|
||||
fz_drop_page(ctx, page);
|
||||
fz_drop_stream(ctx, stream);
|
||||
fz_drop_document(ctx, fzdoc);
|
||||
fz_drop_context(ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
fz_stext_page *stext = fz_new_stext_page(ctx, fz_bound_page(ctx, page));
|
||||
|
||||
Reference in New Issue
Block a user