Commit acd0acf16931ce92bc908e4960c5a1e43d53b550
1 parent
3c5700c2
Fix doc typos
Showing
24 changed files
with
65 additions
and
66 deletions
.git-blame-ignore-revs
| @@ -14,3 +14,4 @@ d740c6ccced02147f84a39d5e5f0984d12bac6cb | @@ -14,3 +14,4 @@ d740c6ccced02147f84a39d5e5f0984d12bac6cb | ||
| 14 | 60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2 | 14 | 60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2 |
| 15 | # Reflow comments and strings to 100 columns | 15 | # Reflow comments and strings to 100 columns |
| 16 | 698a70e6a84cf7c0db667e9d9e021b4c34c85a3e | 16 | 698a70e6a84cf7c0db667e9d9e021b4c34c85a3e |
| 17 | +3c5700c255f4603b5df9c6d183d13dd71a083cc3 |
examples/pdf-invert-images.cc
| @@ -120,9 +120,9 @@ main(int argc, char* argv[]) | @@ -120,9 +120,9 @@ main(int argc, char* argv[]) | ||
| 120 | QPDFObjectHandle color_space = image_dict.getKey("/ColorSpace"); | 120 | QPDFObjectHandle color_space = image_dict.getKey("/ColorSpace"); |
| 121 | QPDFObjectHandle bits_per_component = image_dict.getKey("/BitsPerComponent"); | 121 | QPDFObjectHandle bits_per_component = image_dict.getKey("/BitsPerComponent"); |
| 122 | 122 | ||
| 123 | - // For our example, we can only work with images 8-bit grayscale images that we can | ||
| 124 | - // fully decode. Use pipeStreamData with a null pipeline to determine whether the | ||
| 125 | - // image is filterable. Directly inspect keys to determine the image type. | 123 | + // For our example, we can only work with 8-bit grayscale images that we can fully |
| 124 | + // decode. Use pipeStreamData with a null pipeline to determine whether the image | ||
| 125 | + // is filterable. Directly inspect keys to determine the image type. | ||
| 126 | if (image.pipeStreamData(nullptr, qpdf_ef_compress, qpdf_dl_all) && | 126 | if (image.pipeStreamData(nullptr, qpdf_ef_compress, qpdf_dl_all) && |
| 127 | color_space.isNameAndEquals("/DeviceGray") && bits_per_component.isInteger() && | 127 | color_space.isNameAndEquals("/DeviceGray") && bits_per_component.isInteger() && |
| 128 | (bits_per_component.getIntValue() == 8)) { | 128 | (bits_per_component.getIntValue() == 8)) { |
examples/pdf-name-number-tree.cc
| @@ -41,7 +41,7 @@ main(int argc, char* argv[]) | @@ -41,7 +41,7 @@ main(int argc, char* argv[]) | ||
| 41 | // (root), and write an empty PDF to a file. The PDF will have no pages and won't be viewable, | 41 | // (root), and write an empty PDF to a file. The PDF will have no pages and won't be viewable, |
| 42 | // but you can look at it in a text editor to see the resulting structure of the PDF. | 42 | // but you can look at it in a text editor to see the resulting structure of the PDF. |
| 43 | 43 | ||
| 44 | - // Create a dictionary off the root where we will hang our name and number tree. | 44 | + // Create a dictionary off the root where we will hang our name and number trees. |
| 45 | auto root = qpdf.getRoot(); | 45 | auto root = qpdf.getRoot(); |
| 46 | auto example = QPDFObjectHandle::newDictionary(); | 46 | auto example = QPDFObjectHandle::newDictionary(); |
| 47 | root.replaceKey("/Example", example); | 47 | root.replaceKey("/Example", example); |
examples/pdf-set-form-values.cc
| @@ -38,7 +38,7 @@ main(int argc, char* argv[]) | @@ -38,7 +38,7 @@ main(int argc, char* argv[]) | ||
| 38 | qpdf.processFile(infilename); | 38 | qpdf.processFile(infilename); |
| 39 | 39 | ||
| 40 | // We will iterate through form fields by starting at the page level and looking at each | 40 | // We will iterate through form fields by starting at the page level and looking at each |
| 41 | - // field for each page. We could also called QPDFAcroFormDocumentHelper::getFormFields to | 41 | + // field for each page. We could also call QPDFAcroFormDocumentHelper::getFormFields to |
| 42 | // iterate at the field level, but doing it as below illustrates how we can map from | 42 | // iterate at the field level, but doing it as below illustrates how we can map from |
| 43 | // annotations to fields. | 43 | // annotations to fields. |
| 44 | 44 | ||
| @@ -51,12 +51,12 @@ main(int argc, char* argv[]) | @@ -51,12 +51,12 @@ main(int argc, char* argv[]) | ||
| 51 | // value. | 51 | // value. |
| 52 | QPDFFormFieldObjectHelper ffh = afdh.getFieldForAnnotation(annot); | 52 | QPDFFormFieldObjectHelper ffh = afdh.getFieldForAnnotation(annot); |
| 53 | if (ffh.getFieldType() == "/Tx") { | 53 | if (ffh.getFieldType() == "/Tx") { |
| 54 | - // Set the value. Passing false as the second value prevents qpdf from setting | ||
| 55 | - // /NeedAppearances to true (but will not turn it off if it's already on), so we | ||
| 56 | - // call generateAppearance after setting the value. You may or may not want to | ||
| 57 | - // do this depending on whether the appearance streams generated by qpdf are | ||
| 58 | - // good enough for your purposes. For additional details, please see comments in | ||
| 59 | - // QPDFFormFieldObjectHelper.hh for this method. | 54 | + // Set the value. Passing false as the second parameter prevents qpdf from |
| 55 | + // setting /NeedAppearances to true (but will not turn it off if it's already | ||
| 56 | + // on), so we call generateAppearance after setting the value. You may or may | ||
| 57 | + // not want to do this depending on whether the appearance streams generated by | ||
| 58 | + // qpdf are good enough for your purposes. For additional details, please see | ||
| 59 | + // comments in QPDFFormFieldObjectHelper.hh for this method. | ||
| 60 | ffh.setV(value, false); | 60 | ffh.setV(value, false); |
| 61 | ffh.generateAppearance(annot); | 61 | ffh.generateAppearance(annot); |
| 62 | } | 62 | } |
include/qpdf/ClosedFileInputSource.hh
| @@ -20,9 +20,9 @@ | @@ -20,9 +20,9 @@ | ||
| 20 | #define QPDF_CLOSEDFILEINPUTSOURCE_HH | 20 | #define QPDF_CLOSEDFILEINPUTSOURCE_HH |
| 21 | 21 | ||
| 22 | // This is an input source that reads from files, like FileInputSource, except that it opens and | 22 | // This is an input source that reads from files, like FileInputSource, except that it opens and |
| 23 | -// close the file surrounding every operation. This decreases efficiency, but it allows many more of | ||
| 24 | -// these to exist at once than the maximum number of open file descriptors. This is used for merging | ||
| 25 | -// large numbers of files. | 23 | +// closes the file surrounding every operation. This decreases efficiency, but it allows many more |
| 24 | +// of these to exist at once than the maximum number of open file descriptors. This is used for | ||
| 25 | +// merging large numbers of files. | ||
| 26 | 26 | ||
| 27 | #include <qpdf/InputSource.hh> | 27 | #include <qpdf/InputSource.hh> |
| 28 | #include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785) | 28 | #include <qpdf/PointerHolder.hh> // unused -- remove in qpdf 12 (see #785) |
include/qpdf/JSON.hh
| @@ -69,7 +69,7 @@ class JSON | @@ -69,7 +69,7 @@ class JSON | ||
| 69 | // to pass that `first` through to all the methods that are called to add top-level items to the | 69 | // to pass that `first` through to all the methods that are called to add top-level items to the |
| 70 | // container as well as to close the container. This lets the JSON object use it to keep track | 70 | // container as well as to close the container. This lets the JSON object use it to keep track |
| 71 | // of when it's writing a first object and when it's not. If incrementally writing multiple | 71 | // of when it's writing a first object and when it's not. If incrementally writing multiple |
| 72 | - // levels of depth, a new `first` should used for each new container that is opened. | 72 | + // levels of depth, a new `first` should be used for each new container that is opened. |
| 73 | // | 73 | // |
| 74 | // "depth" -- Indicate the level of depth. This is used for consistent indentation. When writing | 74 | // "depth" -- Indicate the level of depth. This is used for consistent indentation. When writing |
| 75 | // incrementally, whenever you call a method to add an item to a container, the value of `depth` | 75 | // incrementally, whenever you call a method to add an item to a container, the value of `depth` |
| @@ -208,7 +208,7 @@ class JSON | @@ -208,7 +208,7 @@ class JSON | ||
| 208 | QPDF_DLL | 208 | QPDF_DLL |
| 209 | bool checkSchema(JSON schema, std::list<std::string>& errors); | 209 | bool checkSchema(JSON schema, std::list<std::string>& errors); |
| 210 | 210 | ||
| 211 | - // An pointer to a Reactor class can be passed to parse, which will enable the caller to react | 211 | + // A pointer to a Reactor class can be passed to parse, which will enable the caller to react |
| 212 | // to incremental events in the construction of the JSON object. This makes it possible to | 212 | // to incremental events in the construction of the JSON object. This makes it possible to |
| 213 | // implement SAX-like handling of very large JSON objects. | 213 | // implement SAX-like handling of very large JSON objects. |
| 214 | class QPDF_DLL_CLASS Reactor | 214 | class QPDF_DLL_CLASS Reactor |
include/qpdf/PDFVersion.hh
| @@ -16,9 +16,6 @@ | @@ -16,9 +16,6 @@ | ||
| 16 | // License. At your option, you may continue to consider qpdf to be licensed under those terms. | 16 | // License. At your option, you may continue to consider qpdf to be licensed under those terms. |
| 17 | // Please see the manual for additional information. | 17 | // Please see the manual for additional information. |
| 18 | 18 | ||
| 19 | -// This class implements a simple writer for saving QPDF objects to new PDF files. See comments | ||
| 20 | -// through the header file for additional details. | ||
| 21 | - | ||
| 22 | #ifndef PDFVERSION_HH | 19 | #ifndef PDFVERSION_HH |
| 23 | #define PDFVERSION_HH | 20 | #define PDFVERSION_HH |
| 24 | 21 |
include/qpdf/Pl_Concatenate.hh
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | #ifndef PL_CONCATENATE_HH | 19 | #ifndef PL_CONCATENATE_HH |
| 20 | #define PL_CONCATENATE_HH | 20 | #define PL_CONCATENATE_HH |
| 21 | 21 | ||
| 22 | -// This pipeline will drop all regular finished calls rather than passing them onto next. To finish | 22 | +// This pipeline will drop all regular finish calls rather than passing them onto next. To finish |
| 23 | // downstream streams, call manualFinish. This makes it possible to pipe multiple streams (e.g. | 23 | // downstream streams, call manualFinish. This makes it possible to pipe multiple streams (e.g. |
| 24 | // with QPDFObjectHandle::pipeStreamData) to a downstream like Pl_Flate that can't handle multiple | 24 | // with QPDFObjectHandle::pipeStreamData) to a downstream like Pl_Flate that can't handle multiple |
| 25 | // calls to finish(). | 25 | // calls to finish(). |
include/qpdf/QPDFAnnotationObjectHelper.hh
| @@ -40,7 +40,7 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper | @@ -40,7 +40,7 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper | ||
| 40 | // besides widget annotations, but they are implemented with form fields so that they can | 40 | // besides widget annotations, but they are implemented with form fields so that they can |
| 41 | // properly handle form fields when needed. | 41 | // properly handle form fields when needed. |
| 42 | 42 | ||
| 43 | - // Return the subtype of the annotation as a string (e.g. "/Widget"). Returns the empty string | 43 | + // Return the subtype of the annotation as a string (e.g. "/Widget"). Returns an empty string |
| 44 | // if the subtype (which is required by the spec) is missing. | 44 | // if the subtype (which is required by the spec) is missing. |
| 45 | QPDF_DLL | 45 | QPDF_DLL |
| 46 | std::string getSubtype(); | 46 | std::string getSubtype(); |
| @@ -51,7 +51,7 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper | @@ -51,7 +51,7 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper | ||
| 51 | QPDF_DLL | 51 | QPDF_DLL |
| 52 | QPDFObjectHandle getAppearanceDictionary(); | 52 | QPDFObjectHandle getAppearanceDictionary(); |
| 53 | 53 | ||
| 54 | - // Return the appearance state as given in "/AS", or the empty string if none is given. | 54 | + // Return the appearance state as given in "/AS", or an empty string if none is given. |
| 55 | QPDF_DLL | 55 | QPDF_DLL |
| 56 | std::string getAppearanceState(); | 56 | std::string getAppearanceState(); |
| 57 | 57 |
include/qpdf/QPDFDocumentHelper.hh
| @@ -23,12 +23,12 @@ | @@ -23,12 +23,12 @@ | ||
| 23 | #include <qpdf/QPDF.hh> | 23 | #include <qpdf/QPDF.hh> |
| 24 | 24 | ||
| 25 | // This is a base class for QPDF Document Helper classes. Document helpers are classes that provide | 25 | // This is a base class for QPDF Document Helper classes. Document helpers are classes that provide |
| 26 | -// a convenient, higher-level API for accessing document-level structures with a PDF file. Document | ||
| 27 | -// helpers are always initialized with a reference to a QPDF object, and the object can always be | ||
| 28 | -// retrieved. The intention is that you may freely intermix use of document helpers with the | ||
| 29 | -// underlying QPDF object unless there is a specific comment in a specific helper method that says | ||
| 30 | -// otherwise. The pattern of using helper objects was introduced to allow creation of higher level | ||
| 31 | -// helper functions without polluting the public interface of QPDF. | 26 | +// a convenient, higher-level API for accessing document-level structures within a PDF file. |
| 27 | +// Document helpers are always initialized with a reference to a QPDF object, and the object can | ||
| 28 | +// always be retrieved. The intention is that you may freely intermix use of document helpers with | ||
| 29 | +// the underlying QPDF object unless there is a specific comment in a specific helper method that | ||
| 30 | +// says otherwise. The pattern of using helper objects was introduced to allow creation of higher | ||
| 31 | +// level helper functions without polluting the public interface of QPDF. | ||
| 32 | 32 | ||
| 33 | class QPDF_DLL_CLASS QPDFDocumentHelper | 33 | class QPDF_DLL_CLASS QPDFDocumentHelper |
| 34 | { | 34 | { |
include/qpdf/QPDFEFStreamObjectHelper.hh
| @@ -55,7 +55,7 @@ class QPDFEFStreamObjectHelper: public QPDFObjectHelper | @@ -55,7 +55,7 @@ class QPDFEFStreamObjectHelper: public QPDFObjectHelper | ||
| 55 | // Return the checksum as stored in the object as a binary string. This does not check | 55 | // Return the checksum as stored in the object as a binary string. This does not check |
| 56 | // consistency with the data. If not present, return an empty string. The PDF spec specifies | 56 | // consistency with the data. If not present, return an empty string. The PDF spec specifies |
| 57 | // this as an MD5 checksum and notes that it is not to be used for security purposes since MD5 | 57 | // this as an MD5 checksum and notes that it is not to be used for security purposes since MD5 |
| 58 | - // is known not to be secure. | 58 | + // is known to be insecure. |
| 59 | QPDF_DLL | 59 | QPDF_DLL |
| 60 | std::string getChecksum(); | 60 | std::string getChecksum(); |
| 61 | 61 |
include/qpdf/QPDFLogger.hh
| @@ -31,14 +31,14 @@ class QPDFLogger | @@ -31,14 +31,14 @@ class QPDFLogger | ||
| 31 | static std::shared_ptr<QPDFLogger> create(); | 31 | static std::shared_ptr<QPDFLogger> create(); |
| 32 | 32 | ||
| 33 | // Return the default logger. In general, you should use the default logger. You can also create | 33 | // Return the default logger. In general, you should use the default logger. You can also create |
| 34 | - // your own loggers and use them QPDF and QPDFJob objects, but there are few reasons to do so. | ||
| 35 | - // One reason may if you are using multiple QPDF or QPDFJob objects in different threads and | ||
| 36 | - // want to capture output and errors to different streams. (Note that a single QPDF or QPDFJob | ||
| 37 | - // can't be safely used from multiple threads, but it is safe to use separate QPDF and QPDFJob | ||
| 38 | - // objects on separate threads.) Another possible reason would be if you are writing an | ||
| 39 | - // application that uses the qpdf library directly and qpdf is also used by a downstream library | ||
| 40 | - // or if you are using qpdf from a library and don't want to interfere with potential uses of | ||
| 41 | - // qpdf by other libraries or applications. | 34 | + // your own loggers and use them with QPDF and QPDFJob objects, but there are few reasons to do |
| 35 | + // so. One reason may be that you are using multiple QPDF or QPDFJob objects in different | ||
| 36 | + // threads and want to capture output and errors to different streams. (Note that a single QPDF | ||
| 37 | + // or QPDFJob can't be safely used from multiple threads, but it is safe to use separate QPDF | ||
| 38 | + // and QPDFJob objects on separate threads.) Another possible reason would be if you are writing | ||
| 39 | + // an application that uses the qpdf library directly and qpdf is also used by a downstream | ||
| 40 | + // library or if you are using qpdf from a library and don't want to interfere with potential | ||
| 41 | + // uses of qpdf by other libraries or applications. | ||
| 42 | QPDF_DLL | 42 | QPDF_DLL |
| 43 | static std::shared_ptr<QPDFLogger> defaultLogger(); | 43 | static std::shared_ptr<QPDFLogger> defaultLogger(); |
| 44 | 44 |
include/qpdf/QPDFNameTreeObjectHelper.hh
| @@ -52,7 +52,7 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper | @@ -52,7 +52,7 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper | ||
| 52 | QPDF_DLL | 52 | QPDF_DLL |
| 53 | virtual ~QPDFNameTreeObjectHelper(); | 53 | virtual ~QPDFNameTreeObjectHelper(); |
| 54 | 54 | ||
| 55 | - // Return whether the number tree has an explicit entry for this number. | 55 | + // Return whether the name tree has an explicit entry for this name. |
| 56 | QPDF_DLL | 56 | QPDF_DLL |
| 57 | bool hasName(std::string const& utf8); | 57 | bool hasName(std::string const& utf8); |
| 58 | 58 | ||
| @@ -151,7 +151,7 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper | @@ -151,7 +151,7 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper | ||
| 151 | iterator insert(std::string const& key, QPDFObjectHandle value); | 151 | iterator insert(std::string const& key, QPDFObjectHandle value); |
| 152 | 152 | ||
| 153 | // Remove an item. Return true if the item was found and removed; otherwise return false. If | 153 | // Remove an item. Return true if the item was found and removed; otherwise return false. If |
| 154 | - // value is not null, initialize it to the value that was removed. | 154 | + // value is not nullptr, initialize it to the value that was removed. |
| 155 | QPDF_DLL | 155 | QPDF_DLL |
| 156 | bool remove(std::string const& key, QPDFObjectHandle* value = nullptr); | 156 | bool remove(std::string const& key, QPDFObjectHandle* value = nullptr); |
| 157 | 157 |
include/qpdf/QPDFNumberTreeObjectHelper.hh
| @@ -145,7 +145,7 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper | @@ -145,7 +145,7 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper | ||
| 145 | value_type ivalue; | 145 | value_type ivalue; |
| 146 | }; | 146 | }; |
| 147 | 147 | ||
| 148 | - // The iterator looks like map iterator, so i.first is a string and i.second is a | 148 | + // The iterator looks like map iterator, so i.first is a numtree_number and i.second is a |
| 149 | // QPDFObjectHandle. Incrementing end() brings you to the first item. Decrementing end() brings | 149 | // QPDFObjectHandle. Incrementing end() brings you to the first item. Decrementing end() brings |
| 150 | // you to the last item. | 150 | // you to the last item. |
| 151 | QPDF_DLL | 151 | QPDF_DLL |
| @@ -166,7 +166,7 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper | @@ -166,7 +166,7 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper | ||
| 166 | iterator insert(numtree_number key, QPDFObjectHandle value); | 166 | iterator insert(numtree_number key, QPDFObjectHandle value); |
| 167 | 167 | ||
| 168 | // Remove an item. Return true if the item was found and removed; otherwise return false. If | 168 | // Remove an item. Return true if the item was found and removed; otherwise return false. If |
| 169 | - // value is not null, initialize it to the value that was removed. | 169 | + // value is not nullptr, initialize it to the value that was removed. |
| 170 | QPDF_DLL | 170 | QPDF_DLL |
| 171 | bool remove(numtree_number key, QPDFObjectHandle* value = nullptr); | 171 | bool remove(numtree_number key, QPDFObjectHandle* value = nullptr); |
| 172 | 172 |
include/qpdf/QPDFObjectHelper.hh
| @@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
| 26 | // This is a base class for QPDF Object Helper classes. Object helpers are classes that provide a | 26 | // This is a base class for QPDF Object Helper classes. Object helpers are classes that provide a |
| 27 | // convenient, higher-level API for working with specific types of QPDF objects. Object helpers are | 27 | // convenient, higher-level API for working with specific types of QPDF objects. Object helpers are |
| 28 | // always initialized with a QPDFObjectHandle, and the underlying object handle can always be | 28 | // always initialized with a QPDFObjectHandle, and the underlying object handle can always be |
| 29 | -// retrieved. The intention is that you may freely intermix use of document helpers with the | 29 | +// retrieved. The intention is that you may freely intermix use of object helpers with the |
| 30 | // underlying QPDF objects unless there is a specific comment in a specific helper method that says | 30 | // underlying QPDF objects unless there is a specific comment in a specific helper method that says |
| 31 | // otherwise. The pattern of using helper objects was introduced to allow creation of higher level | 31 | // otherwise. The pattern of using helper objects was introduced to allow creation of higher level |
| 32 | // helper functions without polluting the public interface of QPDFObjectHandle. | 32 | // helper functions without polluting the public interface of QPDFObjectHandle. |
include/qpdf/QPDFOutlineDocumentHelper.hh
| @@ -55,7 +55,7 @@ class QPDFOutlineDocumentHelper: public QPDFDocumentHelper | @@ -55,7 +55,7 @@ class QPDFOutlineDocumentHelper: public QPDFDocumentHelper | ||
| 55 | QPDF_DLL | 55 | QPDF_DLL |
| 56 | QPDFObjectHandle resolveNamedDest(QPDFObjectHandle name); | 56 | QPDFObjectHandle resolveNamedDest(QPDFObjectHandle name); |
| 57 | 57 | ||
| 58 | - // Return a list outlines that are known to target the specified page | 58 | + // Return a list outlines that are known to target the specified page. |
| 59 | QPDF_DLL | 59 | QPDF_DLL |
| 60 | std::vector<QPDFOutlineObjectHelper> getOutlinesForPage(QPDFObjGen const&); | 60 | std::vector<QPDFOutlineObjectHelper> getOutlinesForPage(QPDFObjGen const&); |
| 61 | 61 |
include/qpdf/QPDFOutlineObjectHelper.hh
| @@ -37,7 +37,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper | @@ -37,7 +37,7 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper | ||
| 37 | virtual ~QPDFOutlineObjectHelper() | 37 | virtual ~QPDFOutlineObjectHelper() |
| 38 | { | 38 | { |
| 39 | // This must be cleared explicitly to avoid circular references that prevent cleanup of | 39 | // This must be cleared explicitly to avoid circular references that prevent cleanup of |
| 40 | - // pointer holders. | 40 | + // shared pointers. |
| 41 | m->parent = nullptr; | 41 | m->parent = nullptr; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| @@ -66,11 +66,11 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper | @@ -66,11 +66,11 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper | ||
| 66 | 66 | ||
| 67 | // Returns the value of /Count as present in the object, or 0 if not present. If count is | 67 | // Returns the value of /Count as present in the object, or 0 if not present. If count is |
| 68 | // positive, the outline is open. If negative, it is closed. Either way, the absolute value is | 68 | // positive, the outline is open. If negative, it is closed. Either way, the absolute value is |
| 69 | - // the number descendant items that would be visible if this were open. | 69 | + // the number of descendant items that would be visible if this were open. |
| 70 | QPDF_DLL | 70 | QPDF_DLL |
| 71 | int getCount(); | 71 | int getCount(); |
| 72 | 72 | ||
| 73 | - // Returns the title as a UTF-8 string. Returns the empty string if there is no title. | 73 | + // Returns the title as a UTF-8 string. Returns an empty string if there is no title. |
| 74 | QPDF_DLL | 74 | QPDF_DLL |
| 75 | std::string getTitle(); | 75 | std::string getTitle(); |
| 76 | 76 |
include/qpdf/QPDFPageDocumentHelper.hh
| @@ -56,7 +56,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper | @@ -56,7 +56,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper | ||
| 56 | QPDF_DLL | 56 | QPDF_DLL |
| 57 | void removeUnreferencedResources(); | 57 | void removeUnreferencedResources(); |
| 58 | 58 | ||
| 59 | - // Add new page at the beginning or the end of the current pdf. The newpage parameter may be | 59 | + // Add a new page at the beginning or the end of the current pdf. The newpage parameter may be |
| 60 | // either a direct object, an indirect object from this QPDF, or an indirect object from another | 60 | // either a direct object, an indirect object from this QPDF, or an indirect object from another |
| 61 | // QPDF. If it is a direct object, it will be made indirect. If it is an indirect object from | 61 | // QPDF. If it is a direct object, it will be made indirect. If it is an indirect object from |
| 62 | // another QPDF, this method will call pushInheritedAttributesToPage on the other file and then | 62 | // another QPDF, this method will call pushInheritedAttributesToPage on the other file and then |
| @@ -76,7 +76,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper | @@ -76,7 +76,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper | ||
| 76 | // This method does not have any specific awareness of annotations or form fields, so if you | 76 | // This method does not have any specific awareness of annotations or form fields, so if you |
| 77 | // just add a page without thinking about it, you might end up with two pages that share form | 77 | // just add a page without thinking about it, you might end up with two pages that share form |
| 78 | // fields or annotations. While the page may look fine, it will probably not function properly | 78 | // fields or annotations. While the page may look fine, it will probably not function properly |
| 79 | - // with regard to interactive features. To work around this, you should called | 79 | + // with regard to interactive features. To work around this, you should call |
| 80 | // QPDFAcroFormDocumentHelper::fixCopiedAnnotations. A future version of qpdf will likely | 80 | // QPDFAcroFormDocumentHelper::fixCopiedAnnotations. A future version of qpdf will likely |
| 81 | // provide a higher-level interface for copying pages around that will handle document-level | 81 | // provide a higher-level interface for copying pages around that will handle document-level |
| 82 | // constructs in a less error-prone fashion. | 82 | // constructs in a less error-prone fashion. |
include/qpdf/QPDFWriter.hh
| @@ -103,11 +103,11 @@ class QPDFWriter | @@ -103,11 +103,11 @@ class QPDFWriter | ||
| 103 | // Setting Output. Output may be set only one time. If you don't use the filename version of | 103 | // Setting Output. Output may be set only one time. If you don't use the filename version of |
| 104 | // the QPDFWriter constructor, you must call exactly one of these methods. | 104 | // the QPDFWriter constructor, you must call exactly one of these methods. |
| 105 | 105 | ||
| 106 | - // Passing null as filename means write to stdout. QPDFWriter will create a zero-length output | ||
| 107 | - // file upon construction. If write fails, the empty or partially written file will not be | ||
| 108 | - // deleted. This is by design: sometimes the partial file may be useful for tracking down | 106 | + // Passing nullptr as filename means write to stdout. QPDFWriter will create a zero-length |
| 107 | + // output file upon construction. If write fails, the empty or partially written file will not | ||
| 108 | + // be deleted. This is by design: sometimes the partial file may be useful for tracking down | ||
| 109 | // problems. If your application doesn't want the partially written file to be left behind, you | 109 | // problems. If your application doesn't want the partially written file to be left behind, you |
| 110 | - // should delete it the eventual call to write fails. | 110 | + // should delete it if the eventual call to write fails. |
| 111 | QPDF_DLL | 111 | QPDF_DLL |
| 112 | void setOutputFilename(char const* filename); | 112 | void setOutputFilename(char const* filename); |
| 113 | 113 | ||
| @@ -184,8 +184,8 @@ class QPDFWriter | @@ -184,8 +184,8 @@ class QPDFWriter | ||
| 184 | // | 184 | // |
| 185 | // qpdf_dl_generalized: This is the default. QPDFWriter will apply LZWDecode, ASCII85Decode, | 185 | // qpdf_dl_generalized: This is the default. QPDFWriter will apply LZWDecode, ASCII85Decode, |
| 186 | // ASCIIHexDecode, and FlateDecode filters on the input. When combined with | 186 | // ASCIIHexDecode, and FlateDecode filters on the input. When combined with |
| 187 | - // setCompressStreams(true), which the default, the effect of this is that streams filtered with | ||
| 188 | - // these older and less efficient filters will be recompressed with the Flate filter. By | 187 | + // setCompressStreams(true), which is the default, the effect of this is that streams filtered |
| 188 | + // with these older and less efficient filters will be recompressed with the Flate filter. By | ||
| 189 | // default, as a special case, if a stream is already compressed with FlateDecode and | 189 | // default, as a special case, if a stream is already compressed with FlateDecode and |
| 190 | // setCompressStreams is enabled, the original compressed data will be preserved. This behavior | 190 | // setCompressStreams is enabled, the original compressed data will be preserved. This behavior |
| 191 | // can be overridden by calling setRecompressFlate(true). | 191 | // can be overridden by calling setRecompressFlate(true). |
include/qpdf/QUtil.hh
| @@ -224,7 +224,7 @@ namespace QUtil | @@ -224,7 +224,7 @@ namespace QUtil | ||
| 224 | QPDF_DLL | 224 | QPDF_DLL |
| 225 | time_t get_current_time(); | 225 | time_t get_current_time(); |
| 226 | 226 | ||
| 227 | - // Portable structure representing a point in time with second granularity and time zone offset | 227 | + // Portable structure representing a point in time with second granularity and time zone offset. |
| 228 | struct QPDFTime | 228 | struct QPDFTime |
| 229 | { | 229 | { |
| 230 | QPDFTime() = default; | 230 | QPDFTime() = default; |
include/qpdf/qpdfjob-c.h
| @@ -109,7 +109,7 @@ extern "C" { | @@ -109,7 +109,7 @@ extern "C" { | ||
| 109 | #endif /* QPDF_NO_WCHAR_T */ | 109 | #endif /* QPDF_NO_WCHAR_T */ |
| 110 | 110 | ||
| 111 | /* This function wraps QPDFJob::initializeFromJson. The return value is the same as qpdfjob_run. | 111 | /* This function wraps QPDFJob::initializeFromJson. The return value is the same as qpdfjob_run. |
| 112 | - * If this returns an error, it is invalid to call any other functions this job handle. | 112 | + * If this returns an error, it is invalid to call any other functions using this job handle. |
| 113 | */ | 113 | */ |
| 114 | QPDF_DLL | 114 | QPDF_DLL |
| 115 | int qpdfjob_initialize_from_json(qpdfjob_handle j, char const* json); | 115 | int qpdfjob_initialize_from_json(qpdfjob_handle j, char const* json); |
| @@ -135,7 +135,8 @@ extern "C" { | @@ -135,7 +135,8 @@ extern "C" { | ||
| 135 | /* This function wraps QPDFJob::writeQPDF. It returns the error code that qpdf would return with | 135 | /* This function wraps QPDFJob::writeQPDF. It returns the error code that qpdf would return with |
| 136 | * the equivalent command-line invocation. Exit code values are defined in Constants.h in the | 136 | * the equivalent command-line invocation. Exit code values are defined in Constants.h in the |
| 137 | * qpdf_exit_code_e type. NOTE it is the callers responsibility to clean up the resources | 137 | * qpdf_exit_code_e type. NOTE it is the callers responsibility to clean up the resources |
| 138 | - * associated qpdf_data object by calling qpdf_cleanup after the call to qpdfjob_write_qpdf. | 138 | + * associated with the qpdf_data object by calling qpdf_cleanup after the call to |
| 139 | + * qpdfjob_write_qpdf. | ||
| 139 | */ | 140 | */ |
| 140 | QPDF_DLL | 141 | QPDF_DLL |
| 141 | int qpdfjob_write_qpdf(qpdfjob_handle j, qpdf_data qpdf); | 142 | int qpdfjob_write_qpdf(qpdfjob_handle j, qpdf_data qpdf); |
libqpdf/NNTree.cc
| @@ -44,10 +44,10 @@ NNTreeIterator::updateIValue(bool allow_invalid) | @@ -44,10 +44,10 @@ NNTreeIterator::updateIValue(bool allow_invalid) | ||
| 44 | // various cases to ensure we don't introduce that bug in the future, but sadly it's tricky to | 44 | // various cases to ensure we don't introduce that bug in the future, but sadly it's tricky to |
| 45 | // verify by reasoning about the code that this constraint is always satisfied. Whenever we | 45 | // verify by reasoning about the code that this constraint is always satisfied. Whenever we |
| 46 | // update what the iterator points to, we should call setItemNumber, which calls this. If we | 46 | // update what the iterator points to, we should call setItemNumber, which calls this. If we |
| 47 | - // change what the iterator in some other way, such as replacing a value or removing an item and | ||
| 48 | - // making the iterator point at a different item in potentially the same position, we must call | ||
| 49 | - // updateIValue as well. These cases are handled, and for good measure, we also call | ||
| 50 | - // updateIValue in operator* and operator->. | 47 | + // change what the iterator points to in some other way, such as replacing a value or removing |
| 48 | + // an item and making the iterator point at a different item in potentially the same position, | ||
| 49 | + // we must call updateIValue as well. These cases are handled, and for good measure, we also | ||
| 50 | + // call updateIValue in operator* and operator->. | ||
| 51 | 51 | ||
| 52 | bool okay = false; | 52 | bool okay = false; |
| 53 | if ((item_number >= 0) && this->node.isDictionary()) { | 53 | if ((item_number >= 0) && this->node.isDictionary()) { |
| @@ -226,7 +226,7 @@ NNTreeIterator::split(QPDFObjectHandle to_split, std::list<PathElement>::iterato | @@ -226,7 +226,7 @@ NNTreeIterator::split(QPDFObjectHandle to_split, std::list<PathElement>::iterato | ||
| 226 | // Split some node along the path to the item pointed to by this iterator, and adjust the | 226 | // Split some node along the path to the item pointed to by this iterator, and adjust the |
| 227 | // iterator so it points to the same item. | 227 | // iterator so it points to the same item. |
| 228 | 228 | ||
| 229 | - // In examples, for simplicity, /Nums is show to just contain numbers instead of pairs. Imagine | 229 | + // In examples, for simplicity, /Nums is shown to just contain numbers instead of pairs. Imagine |
| 230 | // this tree: | 230 | // this tree: |
| 231 | // | 231 | // |
| 232 | // root: << /Kids [ A B C D ] >> | 232 | // root: << /Kids [ A B C D ] >> |
libqpdf/QPDFArgParser.cc
| @@ -232,7 +232,7 @@ void | @@ -232,7 +232,7 @@ void | ||
| 232 | QPDFArgParser::handleArgFileArguments() | 232 | QPDFArgParser::handleArgFileArguments() |
| 233 | { | 233 | { |
| 234 | // Support reading arguments from files. Create a new argv. Ensure that argv itself as well as | 234 | // Support reading arguments from files. Create a new argv. Ensure that argv itself as well as |
| 235 | - // all its contents are automatically deleted by using shared pointers to back the pointers in | 235 | + // all its contents are automatically deleted by using shared pointers back to the pointers in |
| 236 | // argv. | 236 | // argv. |
| 237 | m->new_argv.push_back(QUtil::make_shared_cstr(m->argv[0])); | 237 | m->new_argv.push_back(QUtil::make_shared_cstr(m->argv[0])); |
| 238 | for (int i = 1; i < m->argc; ++i) { | 238 | for (int i = 1; i < m->argc; ++i) { |
libqpdf/QPDFWriter.cc
| @@ -1346,8 +1346,8 @@ QPDFWriter::unparseObject( | @@ -1346,8 +1346,8 @@ QPDFWriter::unparseObject( | ||
| 1346 | // Make a shallow copy of this object so we can modify it safely without affecting the | 1346 | // Make a shallow copy of this object so we can modify it safely without affecting the |
| 1347 | // original. This code has logic to skip certain keys in agreement with prepareFileForWrite | 1347 | // original. This code has logic to skip certain keys in agreement with prepareFileForWrite |
| 1348 | // and with skip_stream_parameters so that replacing them doesn't leave unreferenced objects | 1348 | // and with skip_stream_parameters so that replacing them doesn't leave unreferenced objects |
| 1349 | - // in the output. We can use unsafeShallowCopy here because we are all we are doing is | ||
| 1350 | - // removing or replacing top-level keys. | 1349 | + // in the output. We can use unsafeShallowCopy here because all we are doing is removing or |
| 1350 | + // replacing top-level keys. | ||
| 1351 | object = object.unsafeShallowCopy(); | 1351 | object = object.unsafeShallowCopy(); |
| 1352 | 1352 | ||
| 1353 | // Handle special cases for specific dictionaries. | 1353 | // Handle special cases for specific dictionaries. |
| @@ -1701,7 +1701,7 @@ QPDFWriter::writeObjectStream(QPDFObjectHandle object) | @@ -1701,7 +1701,7 @@ QPDFWriter::writeObjectStream(QPDFObjectHandle object) | ||
| 1701 | } | 1701 | } |
| 1702 | QPDFObjectHandle obj_to_write = m->pdf.getObject(obj); | 1702 | QPDFObjectHandle obj_to_write = m->pdf.getObject(obj); |
| 1703 | if (obj_to_write.isStream()) { | 1703 | if (obj_to_write.isStream()) { |
| 1704 | - // This condition occurred in a fuzz input. Ideally we should block it at at parse | 1704 | + // This condition occurred in a fuzz input. Ideally we should block it at parse |
| 1705 | // time, but it's not clear to me how to construct a case for this. | 1705 | // time, but it's not clear to me how to construct a case for this. |
| 1706 | QTC::TC("qpdf", "QPDFWriter stream in ostream"); | 1706 | QTC::TC("qpdf", "QPDFWriter stream in ostream"); |
| 1707 | obj_to_write.warnIfPossible("stream found inside object stream; treating as null"); | 1707 | obj_to_write.warnIfPossible("stream found inside object stream; treating as null"); |