Browse code

pdfdecode: reduced stream dumping conditions to just leave-temps + fix warnings

Kevin Lin authored on 2016/07/27 05:36:44
Showing 1 changed files
... ...
@@ -267,8 +267,7 @@ static int pdf_decodestream_internal(struct pdf_struct *pdf, struct pdf_obj *obj
267 267
         }
268 268
         token->success++;
269 269
 
270
-        if (cl_engine_get_num(pdf->ctx->engine, CL_ENGINE_FORCETODISK, NULL) &&
271
-            cl_engine_get_num(pdf->ctx->engine, CL_ENGINE_KEEPTMP, NULL)) {
270
+        if (pdf->ctx->engine->keeptmp) {
272 271
 
273 272
             if ((rc = pdf_decode_dump(pdf, obj, token, i+1)) != CL_SUCCESS)
274 273
                 return rc;
... ...
@@ -330,7 +329,7 @@ static int filter_ascii85decode(struct pdf_struct *pdf, struct pdf_obj *obj, str
330 330
         return CL_EMEM;
331 331
     }
332 332
 
333
-    if(cli_memstr(ptr, remaining, "~>", 2) == NULL)
333
+    if(cli_memstr((const char *)ptr, remaining, "~>", 2) == NULL)
334 334
         cli_dbgmsg("cli_pdf: no EOF marker found\n");
335 335
 
336 336
     while (remaining > 0) {
... ...
@@ -693,7 +692,7 @@ static int filter_asciihexdecode(struct pdf_struct *pdf, struct pdf_obj *obj, st
693 693
         if (content[i] == '>')
694 694
             break;
695 695
 
696
-        if (cli_hex2str_to(content+i, decoded+j, 2) == -1) {
696
+        if (cli_hex2str_to((const char *)content+i, (char *)decoded+j, 2) == -1) {
697 697
             if (length - i < 4)
698 698
                 continue;
699 699
 
... ...
@@ -753,7 +752,7 @@ static int filter_decrypt(struct pdf_struct *pdf, struct pdf_obj *obj, struct pd
753 753
         }
754 754
     }
755 755
 
756
-    decrypted = decrypt_any(pdf, obj->id, token->content, &length, enc);
756
+    decrypted = decrypt_any(pdf, obj->id, (const char *)token->content, &length, enc);
757 757
     if (!decrypted) {
758 758
         cli_dbgmsg("cli_pdf: failed to decrypt stream\n");
759 759
         return CL_EPARSE; /* TODO: what should this value be? CL_SUCCESS would mirror previous behavior */