Fix HN dictionary generation.

This commit is contained in:
yzrh 2021-01-11 23:25:30 +00:00
parent 2aab394684
commit f685e91d35

View file

@ -559,7 +559,7 @@ cnki_pdf_hn(cnki_t **param)
if (ret == 0) { if (ret == 0) {
if ((*param)->stat > 2) if ((*param)->stat > 2)
printf("Succeed\n"); printf("Done\n");
pdf_obj_append(&pdf, ids[i], pdf_obj_append(&pdf, ids[i],
NULL, dictionary, stream, stream_size); NULL, dictionary, stream, stream_size);
@ -567,9 +567,6 @@ cnki_pdf_hn(cnki_t **param)
free(dictionary); free(dictionary);
free(stream); free(stream);
} else if (ret == 1) { } else if (ret == 1) {
if ((*param)->stat > 2)
printf("; Failed\n");
free(dictionary); free(dictionary);
pdf_obj_append(&pdf, ids[i], NULL, NULL, NULL, 0); pdf_obj_append(&pdf, ids[i], NULL, NULL, NULL, 0);
@ -860,8 +857,6 @@ cnki_pdf_hn(cnki_t **param)
return 1; return 1;
} }
memset(dictionary, 0, dictionary_size);
pdf_object_t *tmp = NULL; pdf_object_t *tmp = NULL;
/* Add /Parent to page object */ /* Add /Parent to page object */
@ -874,7 +869,7 @@ cnki_pdf_hn(cnki_t **param)
memset(dictionary, 0, dictionary_size); memset(dictionary, 0, dictionary_size);
strcat(dictionary, tmp->dictionary); memcpy(dictionary, tmp->dictionary, tmp->dictionary_size);
snprintf(buf, 64, "/Parent %d 0 R\n>>", root); snprintf(buf, 64, "/Parent %d 0 R\n>>", root);
strcat(dictionary, buf); strcat(dictionary, buf);