Browse code

Get rid of some harmless compiler warnings with the PDF code

Shawn Webb authored on 2014/07/09 08:53:41
Showing 1 changed files
... ...
@@ -77,6 +77,7 @@ static	const	char	*pdf_nextobject(const char *ptr, size_t len);
77 77
 /* PDF statistics callbacks and related */
78 78
 struct pdfname_action;
79 79
 
80
+#if HAVE_JSON
80 81
 static void pdf_export_json(struct pdf_struct *);
81 82
 
82 83
 static void ASCIIHexDecode_cb(struct pdf_struct *, struct pdf_obj *, struct pdfname_action *);
... ...
@@ -110,6 +111,7 @@ static void Colors_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfnam
110 110
 static void RichMedia_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act);
111 111
 static void AcroForm_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act);
112 112
 static void XFA_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act);
113
+#endif
113 114
 /* End PDF statistics callbacks and related */
114 115
 
115 116
 static int xrefCheck(const char *xref, const char *eof)
... ...
@@ -1293,9 +1295,12 @@ struct pdfname_action {
1293 1293
     enum pdf_objflags set_objflag;/* OBJ_DICT is noop */
1294 1294
     enum objstate from_state;/* STATE_NONE is noop */
1295 1295
     enum objstate to_state;
1296
+#if HAVE_JSON
1296 1297
     void (*pdf_stats_cb)(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act);
1298
+#endif
1297 1299
 };
1298 1300
 
1301
+#if HAVE_JSON
1299 1302
 static struct pdfname_action pdfname_actions[] = {
1300 1303
     {"ASCIIHexDecode", OBJ_FILTER_AH, STATE_FILTER, STATE_FILTER, ASCIIHexDecode_cb},
1301 1304
     {"ASCII85Decode", OBJ_FILTER_A85, STATE_FILTER, STATE_FILTER, ASCII85Decode_cb},
... ...
@@ -1344,6 +1349,43 @@ static struct pdfname_action pdfname_actions[] = {
1344 1344
     {"AcroForm", OBJ_DICT, STATE_NONE, STATE_NONE, AcroForm_cb},
1345 1345
     {"XFA", OBJ_DICT, STATE_NONE, STATE_NONE, XFA_cb}
1346 1346
 };
1347
+#else
1348
+static struct pdfname_action pdfname_actions[] = {
1349
+    {"ASCIIHexDecode", OBJ_FILTER_AH, STATE_FILTER, STATE_FILTER},
1350
+    {"ASCII85Decode", OBJ_FILTER_A85, STATE_FILTER, STATE_FILTER},
1351
+    {"A85", OBJ_FILTER_A85, STATE_FILTER, STATE_FILTER},
1352
+    {"AHx", OBJ_FILTER_AH, STATE_FILTER, STATE_FILTER},
1353
+    {"EmbeddedFile", OBJ_EMBEDDED_FILE, STATE_NONE, STATE_NONE},
1354
+    {"FlateDecode", OBJ_FILTER_FLATE, STATE_FILTER, STATE_FILTER},
1355
+    {"Fl", OBJ_FILTER_FLATE, STATE_FILTER, STATE_FILTER},
1356
+    {"Image", OBJ_IMAGE, STATE_NONE, STATE_NONE},
1357
+    {"LZWDecode", OBJ_FILTER_LZW, STATE_FILTER, STATE_FILTER},
1358
+    {"LZW", OBJ_FILTER_LZW, STATE_FILTER, STATE_FILTER},
1359
+    {"RunLengthDecode", OBJ_FILTER_RL, STATE_FILTER, STATE_FILTER},
1360
+    {"RL", OBJ_FILTER_RL, STATE_FILTER, STATE_FILTER},
1361
+    {"CCITTFaxDecode", OBJ_FILTER_FAX, STATE_FILTER, STATE_FILTER},
1362
+    {"CCF", OBJ_FILTER_FAX, STATE_FILTER, STATE_FILTER},
1363
+    {"JBIG2Decode", OBJ_FILTER_DCT, STATE_FILTER, STATE_FILTER},
1364
+    {"DCTDecode", OBJ_FILTER_DCT, STATE_FILTER, STATE_FILTER},
1365
+    {"DCT", OBJ_FILTER_DCT, STATE_FILTER, STATE_FILTER},
1366
+    {"JPXDecode", OBJ_FILTER_JPX, STATE_FILTER, STATE_FILTER},
1367
+    {"Crypt",  OBJ_FILTER_CRYPT, STATE_FILTER, STATE_NONE},
1368
+    {"Standard", OBJ_FILTER_STANDARD, STATE_FILTER, STATE_FILTER},
1369
+    {"Sig",    OBJ_SIGNED, STATE_ANY, STATE_NONE},
1370
+    {"V",     OBJ_SIGNED, STATE_ANY, STATE_NONE},
1371
+    {"R",     OBJ_SIGNED, STATE_ANY, STATE_NONE},
1372
+    {"Linearized", OBJ_DICT, STATE_NONE, STATE_LINEARIZED},
1373
+    {"Filter", OBJ_HASFILTERS, STATE_ANY, STATE_FILTER},
1374
+    {"JavaScript", OBJ_JAVASCRIPT, STATE_S, STATE_JAVASCRIPT},
1375
+    {"Length", OBJ_DICT, STATE_FILTER, STATE_NONE},
1376
+    {"S", OBJ_DICT, STATE_NONE, STATE_S},
1377
+    {"Type", OBJ_DICT, STATE_NONE, STATE_NONE},
1378
+    {"OpenAction", OBJ_OPENACTION, STATE_ANY, STATE_OPENACTION},
1379
+    {"Launch", OBJ_LAUNCHACTION, STATE_ANY, STATE_LAUNCHACTION},
1380
+    {"Page", OBJ_PAGE, STATE_NONE, STATE_NONE},
1381
+    {"Contents", OBJ_CONTENTS, STATE_NONE, STATE_CONTENTS}
1382
+};
1383
+#endif
1347 1384
 
1348 1385
 #define KNOWN_FILTERS ((1 << OBJ_FILTER_AH) | (1 << OBJ_FILTER_RL) | (1 << OBJ_FILTER_A85) | (1 << OBJ_FILTER_FLATE) | (1 << OBJ_FILTER_LZW) | (1 << OBJ_FILTER_FAX) | (1 << OBJ_FILTER_DCT) | (1 << OBJ_FILTER_JPX) | (1 << OBJ_FILTER_CRYPT))
1349 1386
 
... ...
@@ -1372,8 +1414,10 @@ static void handle_pdfname(struct pdf_struct *pdf, struct pdf_obj *obj, const ch
1372 1372
         return;
1373 1373
     }
1374 1374
 
1375
+#if HAVE_JSON
1375 1376
     if ((act->pdf_stats_cb))
1376 1377
         act->pdf_stats_cb(pdf, obj, act);
1378
+#endif
1377 1379
 
1378 1380
     if (escapes) {
1379 1381
         /* if a commonly used PDF name is escaped that is certainly
... ...
@@ -2406,7 +2450,9 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
2406 2406
     if (!pdfver) {
2407 2407
         cli_dbgmsg("cli_pdf: no PDF- header found\n");
2408 2408
         noisy_warnmsg("cli_pdf: no PDF- header found\n");
2409
+#if HAVE_JSON
2409 2410
         pdf_export_json(&pdf);
2411
+#endif
2410 2412
         return CL_SUCCESS;
2411 2413
     }
2412 2414
 
... ...
@@ -2457,7 +2503,9 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
2457 2457
     eofmap = fmap_need_off_once(map, map_off, bytesleft);
2458 2458
     if (!eofmap) {
2459 2459
         cli_errmsg("cli_pdf: mmap() failed (2)\n");
2460
+#if HAVE_JSON
2460 2461
         pdf_export_json(&pdf);
2462
+#endif
2461 2463
         return CL_EMAP;
2462 2464
     }
2463 2465
 
... ...
@@ -2520,7 +2568,9 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
2520 2520
     pdf.map = fmap_need_off(map, offset, size);
2521 2521
     if (!pdf.map) {
2522 2522
         cli_errmsg("cli_pdf: mmap() failed (3)\n");
2523
+#if HAVE_JSON
2523 2524
         pdf_export_json(&pdf);
2525
+#endif
2524 2526
         return CL_EMAP;
2525 2527
     }
2526 2528
 
... ...
@@ -2533,7 +2583,9 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
2533 2533
         rc = CL_CLEAN;
2534 2534
     } else if (rc) {
2535 2535
         cli_dbgmsg("cli_pdf: (pre hooks) returning %d\n", rc);
2536
+#if HAVE_JSON
2536 2537
         pdf_export_json(&pdf);
2538
+#endif
2537 2539
         return rc == CL_BREAK ? CL_CLEAN : rc;
2538 2540
     }
2539 2541
 
... ...
@@ -2556,7 +2608,9 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
2556 2556
 
2557 2557
         if (cli_checktimelimit(ctx) != CL_SUCCESS) {
2558 2558
             cli_errmsg("Timeout reached in the PDF parser\n");
2559
+#if HAVE_JSON
2559 2560
             pdf_export_json(&pdf);
2561
+#endif
2560 2562
             free(pdf.objs);
2561 2563
             if (pdf.fileID)
2562 2564
                 free(pdf.fileID);
... ...
@@ -2603,7 +2657,9 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
2603 2603
 
2604 2604
         if (cli_checktimelimit(ctx) != CL_SUCCESS) {
2605 2605
             cli_errmsg("Timeout reached in the PDF parser\n");
2606
+#if HAVE_JSON
2606 2607
             pdf_export_json(&pdf);
2608
+#endif
2607 2609
             free(pdf.objs);
2608 2610
             if (pdf.fileID)
2609 2611
                 free(pdf.fileID);
... ...
@@ -2675,7 +2731,9 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
2675 2675
         rc = CL_EFORMAT;
2676 2676
     }
2677 2677
 
2678
+#if HAVE_JSON
2678 2679
     pdf_export_json(&pdf);
2680
+#endif
2679 2681
 
2680 2682
     cli_dbgmsg("cli_pdf: returning %d\n", rc);
2681 2683
     free(pdf.objs);
... ...
@@ -2866,6 +2924,7 @@ pdf_nextobject(const char *ptr, size_t len)
2866 2866
 }
2867 2867
 
2868 2868
 /* PDF statistics */
2869
+#if HAVE_JSON
2869 2870
 static void ASCIIHexDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2870 2871
 {
2871 2872
     if (!(pdf))
... ...
@@ -2873,7 +2932,9 @@ static void ASCIIHexDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struc
2873 2873
 
2874 2874
     pdf->stats.nasciihexdecode++;
2875 2875
 }
2876
+#endif
2876 2877
 
2878
+#if HAVE_JSON
2877 2879
 static void ASCII85Decode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2878 2880
 {
2879 2881
     if (!(pdf))
... ...
@@ -2881,7 +2942,9 @@ static void ASCII85Decode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct
2881 2881
 
2882 2882
     pdf->stats.nascii85decode++;
2883 2883
 }
2884
+#endif
2884 2885
 
2886
+#if HAVE_JSON
2885 2887
 static void EmbeddedFile_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2886 2888
 {
2887 2889
     if (!(pdf))
... ...
@@ -2889,7 +2952,9 @@ static void EmbeddedFile_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct
2889 2889
 
2890 2890
     pdf->stats.nembeddedfile++;
2891 2891
 }
2892
+#endif
2892 2893
 
2894
+#if HAVE_JSON
2893 2895
 static void FlateDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2894 2896
 {
2895 2897
     if (!(pdf))
... ...
@@ -2897,7 +2962,9 @@ static void FlateDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct p
2897 2897
 
2898 2898
     pdf->stats.nflate++;
2899 2899
 }
2900
+#endif
2900 2901
 
2902
+#if HAVE_JSON
2901 2903
 static void Image_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2902 2904
 {
2903 2905
     if (!(pdf))
... ...
@@ -2905,7 +2972,9 @@ static void Image_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname
2905 2905
 
2906 2906
     pdf->stats.nimage++;
2907 2907
 }
2908
+#endif
2908 2909
 
2910
+#if HAVE_JSON
2909 2911
 static void LZWDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2910 2912
 {
2911 2913
     if (!(pdf))
... ...
@@ -2913,7 +2982,9 @@ static void LZWDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdf
2913 2913
 
2914 2914
     pdf->stats.nlzw++;
2915 2915
 }
2916
+#endif
2916 2917
 
2918
+#if HAVE_JSON
2917 2919
 static void RunLengthDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2918 2920
 {
2919 2921
     if (!(pdf))
... ...
@@ -2921,7 +2992,9 @@ static void RunLengthDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, stru
2921 2921
 
2922 2922
     pdf->stats.nrunlengthdecode++;
2923 2923
 }
2924
+#endif
2924 2925
 
2926
+#if HAVE_JSON
2925 2927
 static void CCITTFaxDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2926 2928
 {
2927 2929
     if (!(pdf))
... ...
@@ -2929,10 +3002,11 @@ static void CCITTFaxDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struc
2929 2929
 
2930 2930
     pdf->stats.nfaxdecode++;
2931 2931
 }
2932
+#endif
2932 2933
 
2934
+#if HAVE_JSON
2933 2935
 static void JBIG2Decode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2934 2936
 {
2935
-#if HAVE_JSON
2936 2937
     struct json_object *pdfobj, *jbig2arr, *jbig2obj;
2937 2938
 
2938 2939
     if (!(pdf))
... ...
@@ -2955,9 +3029,10 @@ static void JBIG2Decode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct p
2955 2955
     cli_jsonint_array(jbig2arr, obj->id>>8);
2956 2956
 
2957 2957
     pdf->stats.njbig2decode++;
2958
-#endif
2959 2958
 }
2959
+#endif
2960 2960
 
2961
+#if HAVE_JSON
2961 2962
 static void DCTDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2962 2963
 {
2963 2964
     if (!(pdf))
... ...
@@ -2965,7 +3040,9 @@ static void DCTDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdf
2965 2965
 
2966 2966
     pdf->stats.ndctdecode++;
2967 2967
 }
2968
+#endif
2968 2969
 
2970
+#if HAVE_JSON
2969 2971
 static void JPXDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2970 2972
 {
2971 2973
     if (!(pdf))
... ...
@@ -2973,7 +3050,9 @@ static void JPXDecode_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdf
2973 2973
 
2974 2974
     pdf->stats.njpxdecode++;
2975 2975
 }
2976
+#endif
2976 2977
 
2978
+#if HAVE_JSON
2977 2979
 static void Crypt_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2978 2980
 {
2979 2981
     if (!(pdf))
... ...
@@ -2981,7 +3060,9 @@ static void Crypt_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname
2981 2981
 
2982 2982
     pdf->stats.ncrypt++;
2983 2983
 }
2984
+#endif
2984 2985
 
2986
+#if HAVE_JSON
2985 2987
 static void Standard_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2986 2988
 {
2987 2989
     if (!(pdf))
... ...
@@ -2989,7 +3070,9 @@ static void Standard_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfn
2989 2989
 
2990 2990
     pdf->stats.nstandard++;
2991 2991
 }
2992
+#endif
2992 2993
 
2994
+#if HAVE_JSON
2993 2995
 static void Sig_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
2994 2996
 {
2995 2997
     if (!(pdf))
... ...
@@ -2997,10 +3080,11 @@ static void Sig_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_a
2997 2997
 
2998 2998
     pdf->stats.nsigned++;
2999 2999
 }
3000
+#endif
3000 3001
 
3002
+#if HAVE_JSON
3001 3003
 static void JavaScript_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3002 3004
 {
3003
-#if HAVE_JSON
3004 3005
     struct json_object *pdfobj, *jbig2arr, *jbig2obj;
3005 3006
 
3006 3007
     if (!(pdf))
... ...
@@ -3023,9 +3107,10 @@ static void JavaScript_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pd
3023 3023
     cli_jsonint_array(jbig2arr, obj->id>>8);
3024 3024
 
3025 3025
     pdf->stats.njs++;
3026
-#endif
3027 3026
 }
3027
+#endif
3028 3028
 
3029
+#if HAVE_JSON
3029 3030
 static void OpenAction_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3030 3031
 {
3031 3032
     if (!(pdf))
... ...
@@ -3033,7 +3118,9 @@ static void OpenAction_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pd
3033 3033
 
3034 3034
     pdf->stats.nopenaction++;
3035 3035
 }
3036
+#endif
3036 3037
 
3038
+#if HAVE_JSON
3037 3039
 static void Launch_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3038 3040
 {
3039 3041
     if (!(pdf))
... ...
@@ -3041,7 +3128,9 @@ static void Launch_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfnam
3041 3041
 
3042 3042
     pdf->stats.nlaunch++;
3043 3043
 }
3044
+#endif
3044 3045
 
3046
+#if HAVE_JSON
3045 3047
 static void Page_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3046 3048
 {
3047 3049
     if (!(pdf))
... ...
@@ -3049,10 +3138,11 @@ static void Page_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_
3049 3049
 
3050 3050
     pdf->stats.npage++;
3051 3051
 }
3052
+#endif
3052 3053
 
3054
+#if HAVE_JSON
3053 3055
 static void Author_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3054 3056
 {
3055
-#if HAVE_JSON
3056 3057
     if (!(pdf))
3057 3058
         return;
3058 3059
 
... ...
@@ -3061,12 +3151,12 @@ static void Author_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfnam
3061 3061
 
3062 3062
     if (!(pdf->stats.author))
3063 3063
         pdf->stats.author = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/Author", NULL);
3064
-#endif
3065 3064
 }
3065
+#endif
3066 3066
 
3067
+#if HAVE_JSON
3067 3068
 static void Creator_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3068 3069
 {
3069
-#if HAVE_JSON
3070 3070
     if (!(pdf))
3071 3071
         return;
3072 3072
 
... ...
@@ -3075,12 +3165,12 @@ static void Creator_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfna
3075 3075
 
3076 3076
     if (!(pdf->stats.creator))
3077 3077
         pdf->stats.creator = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/Creator", NULL);
3078
-#endif
3079 3078
 }
3079
+#endif
3080 3080
 
3081
+#if HAVE_JSON
3081 3082
 static void ModificationDate_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3082 3083
 {
3083
-#if HAVE_JSON
3084 3084
     if (!(pdf))
3085 3085
         return;
3086 3086
 
... ...
@@ -3089,12 +3179,12 @@ static void ModificationDate_cb(struct pdf_struct *pdf, struct pdf_obj *obj, str
3089 3089
 
3090 3090
     if (!(pdf->stats.modificationdate))
3091 3091
         pdf->stats.modificationdate = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/ModDate", NULL);
3092
-#endif
3093 3092
 }
3093
+#endif
3094 3094
 
3095
+#if HAVE_JSON
3095 3096
 static void CreationDate_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3096 3097
 {
3097
-#if HAVE_JSON
3098 3098
     if (!(pdf))
3099 3099
         return;
3100 3100
 
... ...
@@ -3103,12 +3193,12 @@ static void CreationDate_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct
3103 3103
 
3104 3104
     if (!(pdf->stats.creationdate))
3105 3105
         pdf->stats.creationdate = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/CreationDate", NULL);
3106
-#endif
3107 3106
 }
3107
+#endif
3108 3108
 
3109
+#if HAVE_JSON
3109 3110
 static void Producer_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3110 3111
 {
3111
-#if HAVE_JSON
3112 3112
     if (!(pdf))
3113 3113
         return;
3114 3114
 
... ...
@@ -3117,12 +3207,12 @@ static void Producer_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfn
3117 3117
 
3118 3118
     if (!(pdf->stats.producer))
3119 3119
         pdf->stats.producer = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/Producer", NULL);
3120
-#endif
3121 3120
 }
3121
+#endif
3122 3122
 
3123
+#if HAVE_JSON
3123 3124
 static void Title_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3124 3125
 {
3125
-#if HAVE_JSON
3126 3126
     if (!(pdf))
3127 3127
         return;
3128 3128
 
... ...
@@ -3131,12 +3221,12 @@ static void Title_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname
3131 3131
 
3132 3132
     if (!(pdf->stats.title))
3133 3133
         pdf->stats.title = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/Title", NULL);
3134
-#endif
3135 3134
 }
3135
+#endif
3136 3136
 
3137
+#if HAVE_JSON
3137 3138
 static void Keywords_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3138 3139
 {
3139
-#if HAVE_JSON
3140 3140
     if (!(pdf))
3141 3141
         return;
3142 3142
 
... ...
@@ -3145,12 +3235,12 @@ static void Keywords_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfn
3145 3145
 
3146 3146
     if (!(pdf->stats.keywords))
3147 3147
         pdf->stats.keywords = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/Keywords", NULL);
3148
-#endif
3149 3148
 }
3149
+#endif
3150 3150
 
3151
+#if HAVE_JSON
3151 3152
 static void Subject_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3152 3153
 {
3153
-#if HAVE_JSON
3154 3154
     if (!(pdf))
3155 3155
         return;
3156 3156
 
... ...
@@ -3159,9 +3249,10 @@ static void Subject_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfna
3159 3159
 
3160 3160
     if (!(pdf->stats.subject))
3161 3161
         pdf->stats.subject = pdf_parse_string(pdf, obj, obj->start + pdf->map, obj_size(pdf, obj, 1), "/Subject", NULL);
3162
-#endif
3163 3162
 }
3163
+#endif
3164 3164
 
3165
+#if HAVE_JSON
3165 3166
 static void RichMedia_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3166 3167
 {
3167 3168
     if (!(pdf))
... ...
@@ -3169,7 +3260,9 @@ static void RichMedia_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdf
3169 3169
 
3170 3170
     pdf->stats.nrichmedia++;
3171 3171
 }
3172
+#endif
3172 3173
 
3174
+#if HAVE_JSON
3173 3175
 static void AcroForm_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3174 3176
 {
3175 3177
     if (!(pdf))
... ...
@@ -3177,7 +3270,9 @@ static void AcroForm_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfn
3177 3177
 
3178 3178
     pdf->stats.nacroform++;
3179 3179
 }
3180
+#endif
3180 3181
 
3182
+#if HAVE_JSON
3181 3183
 static void XFA_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3182 3184
 {
3183 3185
     if (!(pdf))
... ...
@@ -3185,10 +3280,11 @@ static void XFA_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_a
3185 3185
 
3186 3186
     pdf->stats.nxfa++;
3187 3187
 }
3188
+#endif
3188 3189
 
3190
+#if HAVE_JSON
3189 3191
 static void Pages_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3190 3192
 {
3191
-#if HAVE_JSON
3192 3193
     struct pdf_array *array;
3193 3194
     const char *objstart = (const char *)(obj->start + pdf->map);
3194 3195
     const char *begin;
... ...
@@ -3245,12 +3341,12 @@ static void Pages_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname
3245 3245
 
3246 3246
 cleanup:
3247 3247
     pdf_free_array(array);
3248
-#endif
3249 3248
 }
3249
+#endif
3250 3250
 
3251
+#if HAVE_JSON
3251 3252
 static void Colors_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfname_action *act)
3252 3253
 {
3253
-#if HAVE_JSON
3254 3254
     json_object *colorsobj, *pdfobj;
3255 3255
     unsigned long ncolors;
3256 3256
     char *start, *p1;
... ...
@@ -3295,12 +3391,12 @@ static void Colors_cb(struct pdf_struct *pdf, struct pdf_obj *obj, struct pdfnam
3295 3295
         return;
3296 3296
 
3297 3297
     cli_jsonint_array(colorsobj, obj->id>>8);
3298
-#endif
3299 3298
 }
3299
+#endif
3300 3300
 
3301
+#if HAVE_JSON
3301 3302
 static void pdf_export_json(struct pdf_struct *pdf)
3302 3303
 {
3303
-#if HAVE_JSON
3304 3304
     json_object *pdfobj;
3305 3305
     unsigned long i;
3306 3306
 
... ...
@@ -3452,5 +3548,5 @@ cleanup:
3452 3452
         free(pdf->stats.keywords);
3453 3453
         pdf->stats.keywords = NULL;
3454 3454
     }
3455
-#endif
3456 3455
 }
3456
+#endif