Browse code

Check to make sure we should be adding properties

Shawn Webb authored on 2014/07/01 23:50:08
Showing 1 changed files
... ...
@@ -2947,6 +2947,9 @@ static void JBIG2Decode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct p
2947 2947
     if (!(pdf))
2948 2948
         return;
2949 2949
 
2950
+    if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES))
2951
+        return;
2952
+
2950 2953
     if (!(pdf->ctx->wrkproperty))
2951 2954
         return;
2952 2955
 
... ...
@@ -3012,6 +3015,9 @@ static void JavaScript_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pd
3012 3012
     if (!(pdf))
3013 3013
         return;
3014 3014
 
3015
+    if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES))
3016
+        return;
3017
+
3015 3018
     if (!(pdf->ctx->wrkproperty))
3016 3019
         return;
3017 3020
 
... ...
@@ -3059,6 +3065,9 @@ static void Author_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfnam
3059 3059
     if (!(pdf))
3060 3060
         return;
3061 3061
 
3062
+    if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES))
3063
+        return;
3064
+
3062 3065
     if (!(pdf->stats.author))
3063 3066
         pdf->stats.author = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/Author", NULL);
3064 3067
 #endif
... ...
@@ -3070,6 +3079,9 @@ static void Creator_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfna
3070 3070
     if (!(pdf))
3071 3071
         return;
3072 3072
 
3073
+    if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES))
3074
+        return;
3075
+
3073 3076
     if (!(pdf->stats.creator))
3074 3077
         pdf->stats.creator = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/Creator", NULL);
3075 3078
 #endif
... ...
@@ -3081,6 +3093,9 @@ static void ModificationDate_cb(struct pdf_struct *pdf, struct pdf_obj *obj, str
3081 3081
     if (!(pdf))
3082 3082
         return;
3083 3083
 
3084
+    if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES))
3085
+        return;
3086
+
3084 3087
     if (!(pdf->stats.modificationdate))
3085 3088
         pdf->stats.modificationdate = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/ModDate", NULL);
3086 3089
 #endif
... ...
@@ -3092,6 +3107,9 @@ static void CreationDate_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct
3092 3092
     if (!(pdf))
3093 3093
         return;
3094 3094
 
3095
+    if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES))
3096
+        return;
3097
+
3095 3098
     if (!(pdf->stats.creationdate))
3096 3099
         pdf->stats.creationdate = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/CreationDate", NULL);
3097 3100
 #endif
... ...
@@ -3103,6 +3121,9 @@ static void Producer_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfn
3103 3103
     if (!(pdf))
3104 3104
         return;
3105 3105
 
3106
+    if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES))
3107
+        return;
3108
+
3106 3109
     if (!(pdf->stats.producer))
3107 3110
         pdf->stats.producer = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/Producer", NULL);
3108 3111
 #endif
... ...
@@ -3114,6 +3135,9 @@ static void Title_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname
3114 3114
     if (!(pdf))
3115 3115
         return;
3116 3116
 
3117
+    if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES))
3118
+        return;
3119
+
3117 3120
     if (!(pdf->stats.title))
3118 3121
         pdf->stats.title = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/Title", NULL);
3119 3122
 #endif
... ...
@@ -3125,6 +3149,9 @@ static void Keywords_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfn
3125 3125
     if (!(pdf))
3126 3126
         return;
3127 3127
 
3128
+    if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES))
3129
+        return;
3130
+
3128 3131
     if (!(pdf->stats.keywords))
3129 3132
         pdf->stats.keywords = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/Keywords", NULL);
3130 3133
 #endif
... ...
@@ -3136,6 +3163,9 @@ static void Subject_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfna
3136 3136
     if (!(pdf))
3137 3137
         return;
3138 3138
 
3139
+    if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES))
3140
+        return;
3141
+
3139 3142
     if (!(pdf->stats.subject))
3140 3143
         pdf->stats.subject = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/Subject", NULL);
3141 3144
 #endif
... ...
@@ -3180,6 +3210,9 @@ static void Pages_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname
3180 3180
     if (!(pdf) || !(pdf->ctx->wrkproperty))
3181 3181
         return;
3182 3182
 
3183
+    if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES))
3184
+        return;
3185
+
3183 3186
     pdfobj = cli_jsonobj(pdf->ctx->wrkproperty, "PDFStats");
3184 3187
     if (!(pdfobj))
3185 3188
         return;
... ...
@@ -3235,6 +3268,9 @@ static void Colors_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfnam
3235 3235
     if (!(pdf) || !(pdf->ctx) || !(pdf->ctx->wrkproperty))
3236 3236
         return;
3237 3237
 
3238
+    if (!(pdf->ctx->options & CL_SCAN_FILE_PROPERTIES))
3239
+        return;
3240
+
3238 3241
     start = obj->start + pdf->map;
3239 3242
 
3240 3243
     p1 = cli_memstr(start, objsz, "/Colors", 7);