Commit b67a3c15e768ed88ea3cdf7525c1ddc649aec2fe

Authored by Jay Berkenbilt
1 parent 734ac1e1

DLL.hh -> DLL.h, move public enumerated types into Constants.h and use them both…

… for C and C++ interfaces

git-svn-id: svn+q:///qpdf/trunk@828 71b93d88-0707-0410-a8cf-f5a4172ac649
examples/pdf-mod-info.cc
... ... @@ -200,7 +200,7 @@ int main(int argc, char* argv[])
200 200 }
201 201 }
202 202 QPDFWriter w(file, fl_tmp.c_str());
203   - w.setStreamDataMode(QPDFWriter::s_preserve);
  203 + w.setStreamDataMode(qpdf_s_preserve);
204 204 w.setLinearization(true);
205 205 w.setStaticID(static_id);
206 206 w.write();
... ...
include/qpdf/Buffer.hh
... ... @@ -8,7 +8,7 @@
8 8 #ifndef __BUFFER_HH__
9 9 #define __BUFFER_HH__
10 10  
11   -#include <qpdf/DLL.hh>
  11 +#include <qpdf/DLL.h>
12 12  
13 13 class DLL_EXPORT Buffer
14 14 {
... ...
include/qpdf/Constants.h 0 → 100644
  1 +#ifndef __QPDFCONSTANTS_H__
  2 +#define __QPDFCONSTANTS_H__
  3 +
  4 +/* Keep this file 'C' compatible so it can be used from the C and C++
  5 + * interfaces.
  6 + */
  7 +
  8 +/* Error Codes */
  9 +
  10 +enum qpdf_error_code_e
  11 +{
  12 + qpdf_e_success = 0,
  13 + qpdf_e_internal, /* logic/programming error -- indicates bug */
  14 + qpdf_e_system, /* I/O error, memory error, etc. */
  15 + qpdf_e_unsupported, /* PDF feature not (yet) supported by qpdf */
  16 + qpdf_e_password, /* incorrect password for encrypted file */
  17 + qpdf_e_damaged_pdf /* syntax errors or other damage in PDF */
  18 +};
  19 +
  20 +/* Write Parameters */
  21 +
  22 +enum qpdf_object_stream_e
  23 +{
  24 + qpdf_o_disable = 0, /* disable object streams */
  25 + qpdf_o_preserve, /* preserve object streams */
  26 + qpdf_o_generate /* generate object streams */
  27 +};
  28 +enum qpdf_stream_data_e
  29 +{
  30 + qpdf_s_uncompress = 0, /* uncompress stream data */
  31 + qpdf_s_preserve, /* preserve stream data compression */
  32 + qpdf_s_compress /* compress stream data */
  33 +};
  34 +
  35 +/* R3 Encryption Parameters */
  36 +
  37 +enum qpdf_r3_print_e
  38 +{
  39 + qpdf_r3p_full = 0, /* allow all printing */
  40 + qpdf_r3p_low, /* allow only low-resolution printing */
  41 + qpdf_r3p_none /* allow no printing */
  42 +};
  43 +enum qpdf_r3_modify_e
  44 +{
  45 + qpdf_r3m_all = 0, /* allow all modification */
  46 + qpdf_r3m_annotate, /* allow comment authoring and form operations */
  47 + qpdf_r3m_form, /* allow form field fill-in or signing */
  48 + qpdf_r3m_assembly, /* allow only document assembly */
  49 + qpdf_r3m_none /* allow no modification */
  50 +};
  51 +
  52 +#endif /* __QPDFCONSTANTS_H__ */
... ...
include/qpdf/DLL.hh renamed to include/qpdf/DLL.h
... ... @@ -7,4 +7,4 @@
7 7 # define DLL_EXPORT
8 8 #endif
9 9  
10   -#endif // __QPDF_DLL_HH__
  10 +#endif /* __QPDF_DLL_HH__ */
... ...
include/qpdf/Pipeline.hh
... ... @@ -30,7 +30,7 @@
30 30 #ifndef __PIPELINE_HH__
31 31 #define __PIPELINE_HH__
32 32  
33   -#include <qpdf/DLL.hh>
  33 +#include <qpdf/DLL.h>
34 34 #include <string>
35 35  
36 36 class DLL_EXPORT Pipeline
... ...
include/qpdf/QPDF.hh
... ... @@ -13,7 +13,7 @@
13 13 #include <map>
14 14 #include <list>
15 15  
16   -#include <qpdf/DLL.hh>
  16 +#include <qpdf/DLL.h>
17 17  
18 18 #include <qpdf/QPDFXRefEntry.hh>
19 19 #include <qpdf/QPDFObjectHandle.hh>
... ...
include/qpdf/QPDFExc.hh
... ... @@ -8,7 +8,7 @@
8 8 #ifndef __QPDFEXC_HH__
9 9 #define __QPDFEXC_HH__
10 10  
11   -#include <qpdf/DLL.hh>
  11 +#include <qpdf/DLL.h>
12 12 #include <stdexcept>
13 13  
14 14 class DLL_EXPORT QPDFExc: public std::runtime_error
... ...
include/qpdf/QPDFObject.hh
... ... @@ -8,7 +8,7 @@
8 8 #ifndef __QPDFOBJECT_HH__
9 9 #define __QPDFOBJECT_HH__
10 10  
11   -#include <qpdf/DLL.hh>
  11 +#include <qpdf/DLL.h>
12 12  
13 13 #include <string>
14 14  
... ...
include/qpdf/QPDFObjectHandle.hh
... ... @@ -13,7 +13,7 @@
13 13 #include <set>
14 14 #include <map>
15 15  
16   -#include <qpdf/DLL.hh>
  16 +#include <qpdf/DLL.h>
17 17  
18 18 #include <qpdf/PointerHolder.hh>
19 19 #include <qpdf/Buffer.hh>
... ...
include/qpdf/QPDFTokenizer.hh
... ... @@ -8,7 +8,7 @@
8 8 #ifndef __QPDFTOKENIZER_HH__
9 9 #define __QPDFTOKENIZER_HH__
10 10  
11   -#include <qpdf/DLL.hh>
  11 +#include <qpdf/DLL.h>
12 12  
13 13 #include <string>
14 14 #include <stdio.h>
... ...
include/qpdf/QPDFWriter.hh
... ... @@ -19,7 +19,8 @@
19 19 #include <set>
20 20 #include <map>
21 21  
22   -#include <qpdf/DLL.hh>
  22 +#include <qpdf/DLL.h>
  23 +#include <qpdf/Constants.h>
23 24  
24 25 #include <qpdf/QPDFXRefEntry.hh>
25 26  
... ... @@ -51,16 +52,14 @@ class DLL_EXPORT QPDFWriter
51 52 // generate a conventional cross-reference table if there are no
52 53 // object streams and a cross-reference stream if there are object
53 54 // streams. The default is o_preserve.
54   - enum object_stream_e { o_disable, o_preserve, o_generate };
55   - void setObjectStreamMode(object_stream_e);
  55 + void setObjectStreamMode(qpdf_object_stream_e);
56 56  
57 57 // Set value of stream data mode. In uncompress mode, we attempt
58 58 // to uncompress any stream that we can. In preserve mode, we
59 59 // preserve any filtering applied to streams. In compress mode,
60 60 // if we can apply all filters and the stream is not already
61 61 // optimally compressed, recompress the stream.
62   - enum stream_data_e { s_uncompress, s_preserve, s_compress };
63   - void setStreamDataMode(stream_data_e);
  62 + void setStreamDataMode(qpdf_stream_data_e);
64 63  
65 64 // Set value of content stream normalization. The default is
66 65 // "false". If true, we attempt to normalize newlines inside of
... ... @@ -137,28 +136,14 @@ class DLL_EXPORT QPDFWriter
137 136 char const* user_password, char const* owner_password,
138 137 bool allow_print, bool allow_modify,
139 138 bool allow_extract, bool allow_annotate);
140   - enum r3_print_e
141   - {
142   - r3p_full, // allow all printing
143   - r3p_low, // allow only low-resolution printing
144   - r3p_none // allow no printing
145   - };
146   - enum r3_modify_e
147   - {
148   - r3m_all, // allow all modification
149   - r3m_annotate, // allow comment authoring and form operations
150   - r3m_form, // allow form field fill-in or signing
151   - r3m_assembly, // allow only document assembly
152   - r3m_none // allow no modification
153   - };
154 139 void setR3EncryptionParameters(
155 140 char const* user_password, char const* owner_password,
156 141 bool allow_accessibility, bool allow_extract,
157   - r3_print_e print, r3_modify_e modify);
  142 + qpdf_r3_print_e print, qpdf_r3_modify_e modify);
158 143 void setR4EncryptionParameters(
159 144 char const* user_password, char const* owner_password,
160 145 bool allow_accessibility, bool allow_extract,
161   - r3_print_e print, r3_modify_e modify,
  146 + qpdf_r3_print_e print, qpdf_r3_modify_e modify,
162 147 bool encrypt_metadata, bool use_aes);
163 148  
164 149 // Create linearized output. Disables qdf mode, content
... ... @@ -203,7 +188,7 @@ class DLL_EXPORT QPDFWriter
203 188 std::set<int>& bits_to_clear,
204 189 char const* user_password, char const* owner_password,
205 190 bool allow_accessibility, bool allow_extract,
206   - r3_print_e print, r3_modify_e modify);
  191 + qpdf_r3_print_e print, qpdf_r3_modify_e modify);
207 192 void disableIncompatbleEncryption(float v);
208 193 void setEncryptionParameters(
209 194 char const* user_password, char const* owner_password,
... ... @@ -265,7 +250,7 @@ class DLL_EXPORT QPDFWriter
265 250 bool normalize_content_set;
266 251 bool normalize_content;
267 252 bool stream_data_mode_set;
268   - stream_data_e stream_data_mode;
  253 + qpdf_stream_data_e stream_data_mode;
269 254 bool qdf_mode;
270 255 bool static_id;
271 256 bool suppress_original_object_ids;
... ... @@ -273,7 +258,7 @@ class DLL_EXPORT QPDFWriter
273 258 bool encrypted;
274 259 bool preserve_encryption;
275 260 bool linearized;
276   - object_stream_e object_stream_mode;
  261 + qpdf_object_stream_e object_stream_mode;
277 262 std::string encryption_key;
278 263 bool encrypt_metadata;
279 264 bool encrypt_use_aes;
... ...
include/qpdf/QPDFXRefEntry.hh
... ... @@ -8,7 +8,7 @@
8 8 #ifndef __QPDFXREFENTRY_HH__
9 9 #define __QPDFXREFENTRY_HH__
10 10  
11   -#include <qpdf/DLL.hh>
  11 +#include <qpdf/DLL.h>
12 12  
13 13 class DLL_EXPORT QPDFXRefEntry
14 14 {
... ...
include/qpdf/QTC.hh
... ... @@ -8,7 +8,7 @@
8 8 #ifndef __QTC_HH__
9 9 #define __QTC_HH__
10 10  
11   -#include <qpdf/DLL.hh>
  11 +#include <qpdf/DLL.h>
12 12  
13 13 namespace QTC
14 14 {
... ...
include/qpdf/QUtil.hh
... ... @@ -8,7 +8,7 @@
8 8 #ifndef __QUTIL_HH__
9 9 #define __QUTIL_HH__
10 10  
11   -#include <qpdf/DLL.hh>
  11 +#include <qpdf/DLL.h>
12 12 #include <string>
13 13 #include <list>
14 14 #include <stdexcept>
... ...
include/qpdf/qpdf-c.h
... ... @@ -61,7 +61,8 @@
61 61 * primarily on differences between the C and C++ API.
62 62 */
63 63  
64   -#include <qpdf/DLL.hh>
  64 +#include <qpdf/DLL.h>
  65 +#include <qpdf/Constants.h>
65 66  
66 67 #ifdef __cplusplus
67 68 extern "C" {
... ... @@ -199,20 +200,13 @@ extern &quot;C&quot; {
199 200 DLL_EXPORT
200 201 QPDF_ERROR_CODE qpdf_init_write(qpdf_data qpdf, char const* filename);
201 202  
202   -# define QPDF_OBJECT_STREAM_DISABLE 0
203   -# define QPDF_OBJECT_STREAM_PRESERVE 1
204   -# define QPDF_OBJECT_STREAM_GENERATE 2
205   -
206   - /* For mode, pass one of the QPDF_OBJECT_STREAM constants. */
207 203 DLL_EXPORT
208   - void qpdf_set_object_stream_mode(qpdf_data qpdf, int mode);
  204 + void qpdf_set_object_stream_mode(qpdf_data qpdf,
  205 + enum qpdf_object_stream_e mode);
209 206  
210   -# define QPDF_STREAM_DATA_UNCOMPRESS 0
211   -# define QPDF_STREAM_DATA_PRESERVE 1
212   -# define QPDF_STREAM_DATA_COMPRESS 2
213   - /* For mode, pass one of the QPDF_STREAM_DATA constants. */
214 207 DLL_EXPORT
215   - void qpdf_set_stream_data_mode(qpdf_data qpdf, int mode);
  208 + void qpdf_set_stream_data_mode(qpdf_data qpdf,
  209 + enum qpdf_stream_data_e mode);
216 210  
217 211 DLL_EXPORT
218 212 void qpdf_set_content_normalization(qpdf_data qpdf, QPDF_BOOL value);
... ... @@ -245,30 +239,17 @@ extern &quot;C&quot; {
245 239 QPDF_BOOL allow_print, QPDF_BOOL allow_modify,
246 240 QPDF_BOOL allow_extract, QPDF_BOOL allow_annotate);
247 241  
248   -# define QPDF_R3_PRINT_FULL 0
249   -# define QPDF_R3_PRINT_LOW 1
250   -# define QPDF_R3_PRINT_NONE 2
251   -
252   -# define QPDF_R3_MODIFY_ALL 0
253   -# define QPDF_R3_MODIFY_ANNOTATE 1
254   -# define QPDF_R3_MODIFY_FORM 2
255   -# define QPDF_R3_MODIFY_ASSEMBLY 3
256   -# define QPDF_R3_MODIFY_NONE 4
257   -
258   - /* Value of print should be one of the QPDF_R3_PRINT constants.
259   - * Value of modify should be one of the QPDF_R3_MODIFY constants.
260   - */
261 242 DLL_EXPORT
262 243 void qpdf_set_r3_encryption_parameters(
263 244 qpdf_data qpdf, char const* user_password, char const* owner_password,
264 245 QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract,
265   - int print, int modify);
  246 + enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify);
266 247  
267 248 DLL_EXPORT
268 249 void qpdf_set_r4_encryption_parameters(
269 250 qpdf_data qpdf, char const* user_password, char const* owner_password,
270 251 QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract,
271   - int print, int modify,
  252 + enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify,
272 253 QPDF_BOOL encrypt_metadata, QPDF_BOOL use_aes);
273 254  
274 255 DLL_EXPORT
... ...
libqpdf/QPDFWriter.cc
... ... @@ -29,7 +29,7 @@ QPDFWriter::QPDFWriter(QPDF&amp; pdf, char const* filename) :
29 29 normalize_content_set(false),
30 30 normalize_content(false),
31 31 stream_data_mode_set(false),
32   - stream_data_mode(s_compress),
  32 + stream_data_mode(qpdf_s_compress),
33 33 qdf_mode(false),
34 34 static_id(false),
35 35 suppress_original_object_ids(false),
... ... @@ -37,7 +37,7 @@ QPDFWriter::QPDFWriter(QPDF&amp; pdf, char const* filename) :
37 37 encrypted(false),
38 38 preserve_encryption(true),
39 39 linearized(false),
40   - object_stream_mode(o_preserve),
  40 + object_stream_mode(qpdf_o_preserve),
41 41 encrypt_metadata(true),
42 42 encrypt_use_aes(false),
43 43 encryption_dict_objid(0),
... ... @@ -77,13 +77,13 @@ QPDFWriter::~QPDFWriter()
77 77 }
78 78  
79 79 void
80   -QPDFWriter::setObjectStreamMode(object_stream_e mode)
  80 +QPDFWriter::setObjectStreamMode(qpdf_object_stream_e mode)
81 81 {
82 82 this->object_stream_mode = mode;
83 83 }
84 84  
85 85 void
86   -QPDFWriter::setStreamDataMode(stream_data_e mode)
  86 +QPDFWriter::setStreamDataMode(qpdf_stream_data_e mode)
87 87 {
88 88 this->stream_data_mode_set = true;
89 89 this->stream_data_mode = mode;
... ... @@ -198,7 +198,7 @@ void
198 198 QPDFWriter::setR3EncryptionParameters(
199 199 char const* user_password, char const* owner_password,
200 200 bool allow_accessibility, bool allow_extract,
201   - r3_print_e print, r3_modify_e modify)
  201 + qpdf_r3_print_e print, qpdf_r3_modify_e modify)
202 202 {
203 203 std::set<int> clear;
204 204 interpretR3EncryptionParameters(
... ... @@ -212,7 +212,7 @@ void
212 212 QPDFWriter::setR4EncryptionParameters(
213 213 char const* user_password, char const* owner_password,
214 214 bool allow_accessibility, bool allow_extract,
215   - r3_print_e print, r3_modify_e modify,
  215 + qpdf_r3_print_e print, qpdf_r3_modify_e modify,
216 216 bool encrypt_metadata, bool use_aes)
217 217 {
218 218 std::set<int> clear;
... ... @@ -230,7 +230,7 @@ QPDFWriter::interpretR3EncryptionParameters(
230 230 std::set<int>& clear,
231 231 char const* user_password, char const* owner_password,
232 232 bool allow_accessibility, bool allow_extract,
233   - r3_print_e print, r3_modify_e modify)
  233 + qpdf_r3_print_e print, qpdf_r3_modify_e modify)
234 234 {
235 235 // Acrobat 5 security options:
236 236  
... ... @@ -263,13 +263,13 @@ QPDFWriter::interpretR3EncryptionParameters(
263 263 // statements). Each option clears successively more access bits.
264 264 switch (print)
265 265 {
266   - case r3p_none:
  266 + case qpdf_r3p_none:
267 267 clear.insert(3); // any printing
268 268  
269   - case r3p_low:
  269 + case qpdf_r3p_low:
270 270 clear.insert(12); // high resolution printing
271 271  
272   - case r3p_full:
  272 + case qpdf_r3p_full:
273 273 break;
274 274  
275 275 // no default so gcc warns for missing cases
... ... @@ -277,19 +277,19 @@ QPDFWriter::interpretR3EncryptionParameters(
277 277  
278 278 switch (modify)
279 279 {
280   - case r3m_none:
  280 + case qpdf_r3m_none:
281 281 clear.insert(11); // document assembly
282 282  
283   - case r3m_assembly:
  283 + case qpdf_r3m_assembly:
284 284 clear.insert(9); // filling in form fields
285 285  
286   - case r3m_form:
  286 + case qpdf_r3m_form:
287 287 clear.insert(6); // modify annotations, fill in form fields
288 288  
289   - case r3m_annotate:
  289 + case qpdf_r3m_annotate:
290 290 clear.insert(4); // other modifications
291 291  
292   - case r3m_all:
  292 + case qpdf_r3m_all:
293 293 break;
294 294  
295 295 // no default so gcc warns for missing cases
... ... @@ -922,8 +922,8 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level,
922 922 {
923 923 is_metadata = true;
924 924 }
925   - bool filter = (this->stream_data_mode != s_preserve);
926   - if (this->stream_data_mode == s_compress)
  925 + bool filter = (this->stream_data_mode != qpdf_s_preserve);
  926 + if (this->stream_data_mode == qpdf_s_compress)
927 927 {
928 928 // Don't filter if the stream is already compressed with
929 929 // FlateDecode. We don't want to make it worse by getting
... ... @@ -952,7 +952,7 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level,
952 952 normalize = true;
953 953 filter = true;
954 954 }
955   - else if (filter && (this->stream_data_mode == s_compress))
  955 + else if (filter && (this->stream_data_mode == qpdf_s_compress))
956 956 {
957 957 compress = true;
958 958 QTC::TC("qpdf", "QPDFWriter compressing uncompressed stream");
... ... @@ -1107,7 +1107,8 @@ QPDFWriter::writeObjectStream(QPDFObjectHandle object)
1107 1107  
1108 1108 // Set up a stream to write the stream data into a buffer.
1109 1109 Pipeline* next = pushPipeline(new Pl_Buffer("object stream"));
1110   - if (! ((this->stream_data_mode == s_uncompress) || this->qdf_mode))
  1110 + if (! ((this->stream_data_mode == qpdf_s_uncompress) ||
  1111 + this->qdf_mode))
1111 1112 {
1112 1113 compressed = true;
1113 1114 next = pushPipeline(
... ... @@ -1455,7 +1456,7 @@ QPDFWriter::write()
1455 1456 }
1456 1457 if (! this->stream_data_mode_set)
1457 1458 {
1458   - this->stream_data_mode = s_uncompress;
  1459 + this->stream_data_mode = qpdf_s_uncompress;
1459 1460 }
1460 1461 }
1461 1462  
... ... @@ -1465,7 +1466,7 @@ QPDFWriter::write()
1465 1466 this->preserve_encryption = false;
1466 1467 }
1467 1468 else if (this->normalize_content ||
1468   - (this->stream_data_mode == s_uncompress) ||
  1469 + (this->stream_data_mode == qpdf_s_uncompress) ||
1469 1470 this->qdf_mode)
1470 1471 {
1471 1472 // Encryption makes looking at contents pretty useless. If
... ... @@ -1485,12 +1486,12 @@ QPDFWriter::write()
1485 1486 if (v < 1.5)
1486 1487 {
1487 1488 QTC::TC("qpdf", "QPDFWriter forcing object stream disable");
1488   - this->object_stream_mode = o_disable;
  1489 + this->object_stream_mode = qpdf_o_disable;
1489 1490 }
1490 1491 }
1491 1492  
1492 1493 if (this->qdf_mode || this->normalize_content ||
1493   - (this->stream_data_mode == s_uncompress))
  1494 + (this->stream_data_mode == qpdf_s_uncompress))
1494 1495 {
1495 1496 initializeSpecialStreams();
1496 1497 }
... ... @@ -1506,15 +1507,15 @@ QPDFWriter::write()
1506 1507  
1507 1508 switch (this->object_stream_mode)
1508 1509 {
1509   - case o_disable:
  1510 + case qpdf_o_disable:
1510 1511 // no action required
1511 1512 break;
1512 1513  
1513   - case o_preserve:
  1514 + case qpdf_o_preserve:
1514 1515 preserveObjectStreams();
1515 1516 break;
1516 1517  
1517   - case o_generate:
  1518 + case qpdf_o_generate:
1518 1519 generateObjectStreams();
1519 1520 break;
1520 1521  
... ... @@ -1760,7 +1761,7 @@ QPDFWriter::writeXRefStream(int xref_id, int max_id, int max_offset,
1760 1761  
1761 1762 Pipeline* p = pushPipeline(new Pl_Buffer("xref stream"));
1762 1763 bool compressed = false;
1763   - if (! ((this->stream_data_mode == s_uncompress) || this->qdf_mode))
  1764 + if (! ((this->stream_data_mode == qpdf_s_uncompress) || this->qdf_mode))
1764 1765 {
1765 1766 compressed = true;
1766 1767 p = pushPipeline(
... ...
libqpdf/QUtil.cc
1   -#include <qpdf/DLL.hh>
2 1 #include <qpdf/QUtil.hh>
3 2 #include <stdio.h>
4 3 #include <errno.h>
... ...
libqpdf/qpdf-c.cc
... ... @@ -251,48 +251,16 @@ QPDF_ERROR_CODE qpdf_init_write(qpdf_data qpdf, char const* filename)
251 251 return status;
252 252 }
253 253  
254   -void qpdf_set_object_stream_mode(qpdf_data qpdf, int mode)
  254 +void qpdf_set_object_stream_mode(qpdf_data qpdf, qpdf_object_stream_e mode)
255 255 {
256 256 QTC::TC("qpdf", "qpdf-c called qpdf_set_object_stream_mode");
257   - QPDFWriter::object_stream_e omode = QPDFWriter::o_preserve;
258   - switch (mode)
259   - {
260   - case QPDF_OBJECT_STREAM_DISABLE:
261   - omode = QPDFWriter::o_disable;
262   - break;
263   -
264   - case QPDF_OBJECT_STREAM_GENERATE:
265   - omode = QPDFWriter::o_generate;
266   - break;
267   -
268   - default:
269   - // already set to o_preserve; treate out of range values as
270   - // the default.
271   - break;
272   - }
273   -
274   - qpdf->qpdf_writer->setObjectStreamMode(omode);
  257 + qpdf->qpdf_writer->setObjectStreamMode(mode);
275 258 }
276 259  
277   -void qpdf_set_stream_data_mode(qpdf_data qpdf, int mode)
  260 +void qpdf_set_stream_data_mode(qpdf_data qpdf, qpdf_stream_data_e mode)
278 261 {
279 262 QTC::TC("qpdf", "qpdf-c called qpdf_set_stream_data_mode");
280   - QPDFWriter::stream_data_e smode = QPDFWriter::s_preserve;
281   - switch (mode)
282   - {
283   - case QPDF_STREAM_DATA_UNCOMPRESS:
284   - smode = QPDFWriter::s_uncompress;
285   - break;
286   -
287   - case QPDF_STREAM_DATA_COMPRESS:
288   - smode = QPDFWriter::s_compress;
289   - break;
290   -
291   - default:
292   - // Treat anything else as default
293   - break;
294   - }
295   - qpdf->qpdf_writer->setStreamDataMode(smode);
  263 + qpdf->qpdf_writer->setStreamDataMode(mode);
296 264 }
297 265  
298 266 void qpdf_set_content_normalization(qpdf_data qpdf, QPDF_BOOL value)
... ... @@ -346,39 +314,24 @@ void qpdf_set_r2_encryption_parameters(
346 314 void qpdf_set_r3_encryption_parameters(
347 315 qpdf_data qpdf, char const* user_password, char const* owner_password,
348 316 QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract,
349   - int print, int modify)
  317 + qpdf_r3_print_e print, qpdf_r3_modify_e modify)
350 318 {
351 319 QTC::TC("qpdf", "qpdf-c called qpdf_set_r3_encryption_parameters");
352 320 qpdf->qpdf_writer->setR3EncryptionParameters(
353 321 user_password, owner_password,
354   - allow_accessibility, allow_extract,
355   - ((print == QPDF_R3_PRINT_LOW) ? QPDFWriter::r3p_low :
356   - (print == QPDF_R3_PRINT_NONE) ? QPDFWriter::r3p_none :
357   - QPDFWriter::r3p_full),
358   - ((modify == QPDF_R3_MODIFY_ANNOTATE) ? QPDFWriter::r3m_annotate :
359   - (modify == QPDF_R3_MODIFY_FORM) ? QPDFWriter::r3m_form :
360   - (modify == QPDF_R3_MODIFY_ASSEMBLY) ? QPDFWriter::r3m_assembly :
361   - (modify == QPDF_R3_MODIFY_NONE) ? QPDFWriter::r3m_none :
362   - QPDFWriter::r3m_all));
  322 + allow_accessibility, allow_extract, print, modify);
363 323 }
364 324  
365 325 void qpdf_set_r4_encryption_parameters(
366 326 qpdf_data qpdf, char const* user_password, char const* owner_password,
367 327 QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract,
368   - int print, int modify, QPDF_BOOL encrypt_metadata, QPDF_BOOL use_aes)
  328 + qpdf_r3_print_e print, qpdf_r3_modify_e modify,
  329 + QPDF_BOOL encrypt_metadata, QPDF_BOOL use_aes)
369 330 {
370 331 QTC::TC("qpdf", "qpdf-c called qpdf_set_r4_encryption_parameters");
371 332 qpdf->qpdf_writer->setR4EncryptionParameters(
372 333 user_password, owner_password,
373   - allow_accessibility, allow_extract,
374   - ((print == QPDF_R3_PRINT_LOW) ? QPDFWriter::r3p_low :
375   - (print == QPDF_R3_PRINT_NONE) ? QPDFWriter::r3p_none :
376   - QPDFWriter::r3p_full),
377   - ((modify == QPDF_R3_MODIFY_ANNOTATE) ? QPDFWriter::r3m_annotate :
378   - (modify == QPDF_R3_MODIFY_FORM) ? QPDFWriter::r3m_form :
379   - (modify == QPDF_R3_MODIFY_ASSEMBLY) ? QPDFWriter::r3m_assembly :
380   - (modify == QPDF_R3_MODIFY_NONE) ? QPDFWriter::r3m_none :
381   - QPDFWriter::r3m_all),
  334 + allow_accessibility, allow_extract, print, modify,
382 335 encrypt_metadata, use_aes);
383 336 }
384 337  
... ...
libqpdf/qpdf/BitStream.hh
... ... @@ -3,7 +3,7 @@
3 3 #ifndef __BITSTREAM_HH__
4 4 #define __BITSTREAM_HH__
5 5  
6   -#include <qpdf/DLL.hh>
  6 +#include <qpdf/DLL.h>
7 7  
8 8 class DLL_EXPORT BitStream
9 9 {
... ...
libqpdf/qpdf/BitWriter.hh
... ... @@ -3,7 +3,7 @@
3 3 #ifndef __BITWRITER_HH__
4 4 #define __BITWRITER_HH__
5 5  
6   -#include <qpdf/DLL.hh>
  6 +#include <qpdf/DLL.h>
7 7  
8 8 class Pipeline;
9 9  
... ...
libqpdf/qpdf/MD5.hh
... ... @@ -2,7 +2,7 @@
2 2 #define __MD5_HH__
3 3  
4 4 #include <string>
5   -#include <qpdf/DLL.hh>
  5 +#include <qpdf/DLL.h>
6 6 #include <qpdf/qpdf-config.h>
7 7 #ifdef HAVE_INTTYPES_H
8 8 # include <inttypes.h>
... ...
libqpdf/qpdf/PCRE.hh
... ... @@ -12,7 +12,7 @@
12 12 #include <string>
13 13 #include <stdexcept>
14 14  
15   -#include <qpdf/DLL.hh>
  15 +#include <qpdf/DLL.h>
16 16  
17 17 // Note: this class does not encapsulate all features of the PCRE
18 18 // package -- only those that I actually need right now are here.
... ...
qpdf/qpdf-ctest.c
... ... @@ -114,7 +114,7 @@ static void test06(char const* infile,
114 114 qpdf_read(qpdf, infile, password);
115 115 qpdf_init_write(qpdf, outfile);
116 116 qpdf_set_static_ID(qpdf, QPDF_TRUE);
117   - qpdf_set_object_stream_mode(qpdf, QPDF_OBJECT_STREAM_GENERATE);
  117 + qpdf_set_object_stream_mode(qpdf, qpdf_o_generate);
118 118 qpdf_write(qpdf);
119 119 report_errors();
120 120 }
... ... @@ -154,7 +154,7 @@ static void test09(char const* infile,
154 154 qpdf_read(qpdf, infile, password);
155 155 qpdf_init_write(qpdf, outfile);
156 156 qpdf_set_static_ID(qpdf, QPDF_TRUE);
157   - qpdf_set_stream_data_mode(qpdf, QPDF_STREAM_DATA_UNCOMPRESS);
  157 + qpdf_set_stream_data_mode(qpdf, qpdf_s_uncompress);
158 158 qpdf_write(qpdf);
159 159 report_errors();
160 160 }
... ... @@ -193,7 +193,7 @@ static void test12(char const* infile,
193 193 qpdf_set_static_ID(qpdf, QPDF_TRUE);
194 194 qpdf_set_r3_encryption_parameters(
195 195 qpdf, "user2", "owner2", QPDF_TRUE, QPDF_TRUE,
196   - QPDF_R3_PRINT_LOW, QPDF_R3_MODIFY_ALL);
  196 + qpdf_r3p_low, qpdf_r3m_all);
197 197 qpdf_write(qpdf);
198 198 report_errors();
199 199 }
... ... @@ -240,7 +240,7 @@ static void test15(char const* infile,
240 240 qpdf_set_static_aes_IV(qpdf, QPDF_TRUE);
241 241 qpdf_set_r4_encryption_parameters(
242 242 qpdf, "user2", "owner2", QPDF_TRUE, QPDF_TRUE,
243   - QPDF_R3_PRINT_LOW, QPDF_R3_MODIFY_ALL, QPDF_TRUE, QPDF_TRUE);
  243 + qpdf_r3p_low, qpdf_r3m_all, QPDF_TRUE, QPDF_TRUE);
244 244 qpdf_write(qpdf);
245 245 report_errors();
246 246 }
... ...
qpdf/qpdf.cc
... ... @@ -233,7 +233,7 @@ parse_encrypt_options(
233 233 std::string& user_password, std::string& owner_password, int& keylen,
234 234 bool& r2_print, bool& r2_modify, bool& r2_extract, bool& r2_annotate,
235 235 bool& r3_accessibility, bool& r3_extract,
236   - QPDFWriter::r3_print_e& r3_print, QPDFWriter::r3_modify_e& r3_modify,
  236 + qpdf_r3_print_e& r3_print, qpdf_r3_modify_e& r3_modify,
237 237 bool& force_V4, bool& cleartext_metadata, bool& use_aes)
238 238 {
239 239 if (cur_arg + 3 >= argc)
... ... @@ -310,15 +310,15 @@ parse_encrypt_options(
310 310 {
311 311 if (val == "full")
312 312 {
313   - r3_print = QPDFWriter::r3p_full;
  313 + r3_print = qpdf_r3p_full;
314 314 }
315 315 else if (val == "low")
316 316 {
317   - r3_print = QPDFWriter::r3p_low;
  317 + r3_print = qpdf_r3p_low;
318 318 }
319 319 else if (val == "none")
320 320 {
321   - r3_print = QPDFWriter::r3p_none;
  321 + r3_print = qpdf_r3p_none;
322 322 }
323 323 else
324 324 {
... ... @@ -352,23 +352,23 @@ parse_encrypt_options(
352 352 {
353 353 if (val == "all")
354 354 {
355   - r3_modify = QPDFWriter::r3m_all;
  355 + r3_modify = qpdf_r3m_all;
356 356 }
357 357 else if (val == "annotate")
358 358 {
359   - r3_modify = QPDFWriter::r3m_annotate;
  359 + r3_modify = qpdf_r3m_annotate;
360 360 }
361 361 else if (val == "form")
362 362 {
363   - r3_modify = QPDFWriter::r3m_form;
  363 + r3_modify = qpdf_r3m_form;
364 364 }
365 365 else if (val == "assembly")
366 366 {
367   - r3_modify = QPDFWriter::r3m_assembly;
  367 + r3_modify = qpdf_r3m_assembly;
368 368 }
369 369 else if (val == "none")
370 370 {
371   - r3_modify = QPDFWriter::r3m_none;
  371 + r3_modify = qpdf_r3m_none;
372 372 }
373 373 else
374 374 {
... ... @@ -587,19 +587,19 @@ int main(int argc, char* argv[])
587 587 bool r2_annotate = true;
588 588 bool r3_accessibility = true;
589 589 bool r3_extract = true;
590   - QPDFWriter::r3_print_e r3_print = QPDFWriter::r3p_full;
591   - QPDFWriter::r3_modify_e r3_modify = QPDFWriter::r3m_all;
  590 + qpdf_r3_print_e r3_print = qpdf_r3p_full;
  591 + qpdf_r3_modify_e r3_modify = qpdf_r3m_all;
592 592 bool force_V4 = false;
593 593 bool cleartext_metadata = false;
594 594 bool use_aes = false;
595 595  
596 596 bool stream_data_set = false;
597   - QPDFWriter::stream_data_e stream_data_mode = QPDFWriter::s_compress;
  597 + qpdf_stream_data_e stream_data_mode = qpdf_s_compress;
598 598 bool normalize_set = false;
599 599 bool normalize = false;
600 600 bool suppress_recovery = false;
601 601 bool object_stream_set = false;
602   - QPDFWriter::object_stream_e object_stream_mode = QPDFWriter::o_preserve;
  602 + qpdf_object_stream_e object_stream_mode = qpdf_o_preserve;
603 603 bool ignore_xref_streams = false;
604 604 bool qdf_mode = false;
605 605 std::string min_version;
... ... @@ -677,15 +677,15 @@ int main(int argc, char* argv[])
677 677 stream_data_set = true;
678 678 if (strcmp(parameter, "compress") == 0)
679 679 {
680   - stream_data_mode = QPDFWriter::s_compress;
  680 + stream_data_mode = qpdf_s_compress;
681 681 }
682 682 else if (strcmp(parameter, "preserve") == 0)
683 683 {
684   - stream_data_mode = QPDFWriter::s_preserve;
  684 + stream_data_mode = qpdf_s_preserve;
685 685 }
686 686 else if (strcmp(parameter, "uncompress") == 0)
687 687 {
688   - stream_data_mode = QPDFWriter::s_uncompress;
  688 + stream_data_mode = qpdf_s_uncompress;
689 689 }
690 690 else
691 691 {
... ... @@ -716,15 +716,15 @@ int main(int argc, char* argv[])
716 716 object_stream_set = true;
717 717 if (strcmp(parameter, "disable") == 0)
718 718 {
719   - object_stream_mode = QPDFWriter::o_disable;
  719 + object_stream_mode = qpdf_o_disable;
720 720 }
721 721 else if (strcmp(parameter, "preserve") == 0)
722 722 {
723   - object_stream_mode = QPDFWriter::o_preserve;
  723 + object_stream_mode = qpdf_o_preserve;
724 724 }
725 725 else if (strcmp(parameter, "generate") == 0)
726 726 {
727   - object_stream_mode = QPDFWriter::o_generate;
  727 + object_stream_mode = qpdf_o_generate;
728 728 }
729 729 else
730 730 {
... ...