Browse code

pdf: open abi for pdfdecode usage

Kevin Lin authored on 2016/04/01 01:29:16
Showing 3 changed files
... ...
@@ -298,7 +298,7 @@ static int filter_writen(struct pdf_struct *pdf, struct pdf_obj *obj, int fout,
298 298
     return cli_writen(fout, buf, len);
299 299
 }
300 300
 
301
-static void pdfobj_flag(struct pdf_struct *pdf, struct pdf_obj *obj, enum pdf_flag flag)
301
+void pdfobj_flag(struct pdf_struct *pdf, struct pdf_obj *obj, enum pdf_flag flag)
302 302
 {
303 303
     const char *s= "";
304 304
     pdf->flags |= 1 << flag;
... ...
@@ -950,7 +950,6 @@ static int pdf_scan_contents(int fd, struct pdf_struct *pdf)
950 950
 
951 951
 static const char *pdf_getdict(const char *q0, int* len, const char *key);
952 952
 static char *pdf_readval(const char *q, int len, const char *key);
953
-static enum enc_method parse_enc_method(const char *dict, unsigned len, const char *key, enum enc_method def);
954 953
 static char *pdf_readstring(const char *q0, int len, const char *key, unsigned *slen, const char **qend, int noescape);
955 954
 
956 955
 int pdf_extract_obj(struct pdf_struct *pdf, struct pdf_obj *obj, uint32_t flags)
... ...
@@ -2220,7 +2219,7 @@ static void check_user_password(struct pdf_struct *pdf, int R, const char *O,
2220 2220
     }
2221 2221
 }
2222 2222
 
2223
-static enum enc_method parse_enc_method(const char *dict, unsigned len, const char *key, enum enc_method def)
2223
+enum enc_method parse_enc_method(const char *dict, unsigned len, const char *key, enum enc_method def)
2224 2224
 {
2225 2225
     const char *q;
2226 2226
     char *CFM = NULL;
... ...
@@ -161,7 +161,9 @@ struct pdf_obj *find_obj(struct pdf_struct *pdf, struct pdf_obj *obj, uint32_t o
161 161
 void pdf_handle_enc(struct pdf_struct *pdf);
162 162
 char *decrypt_any(struct pdf_struct *pdf, uint32_t id, const char *in, off_t *length, enum enc_method enc_method);
163 163
 enum enc_method get_enc_method(struct pdf_struct *pdf, struct pdf_obj *obj);
164
+enum enc_method parse_enc_method(const char *dict, unsigned len, const char *key, enum enc_method def);
164 165
 
166
+void pdfobj_flag(struct pdf_struct *pdf, struct pdf_obj *obj, enum pdf_flag flag);
165 167
 char *pdf_finalize_string(struct pdf_struct *pdf, struct pdf_obj *obj, const char *in, size_t len);
166 168
 char *pdf_parse_string(struct pdf_struct *pdf, struct pdf_obj *obj, const char *objstart, size_t objsize, const char *str, char **endchar, struct pdf_stats_metadata *stats);
167 169
 struct pdf_array *pdf_parse_array(struct pdf_struct *pdf, struct pdf_obj *obj, size_t objsz, char *begin, char **endchar);
... ...
@@ -679,7 +679,7 @@ static int filter_decrypt(struct pdf_struct *pdf, struct pdf_obj *obj, struct pd
679 679
                 } else if (!strncmp(node->key, "/Name", 6)) { /* optional field - Name */
680 680
                     /* overrides document and default encryption method */
681 681
                     cli_dbgmsg("cli_pdf: Name: %s\n", (char *)(node->value));
682
-                    //enc = parse_enc_method(pdf->CF, pdf->CF_n, (char *)(node->value), enc);
682
+                    enc = parse_enc_method(pdf->CF, pdf->CF_n, (char *)(node->value), enc);
683 683
                 }
684 684
             }
685 685
             node = node->next;