Commit Graph

136 Commits

Author SHA1 Message Date
m-holger 8791b5f8d0 In QPDFWriter replace map obj_renumber with a new object table obj 2024-03-08 09:36:22 +00:00
Jay Berkenbilt 7de0b3f3c0 JSONHandler: add fallback handler support 2024-01-11 06:13:57 -05:00
Jay Berkenbilt 070ee710eb Support excluding values from numeric ranges (fixes #564, #790) 2024-01-01 10:48:14 -05:00
Jay Berkenbilt 708ea4ef43 Completely rewrite QUtil::parse_numrange 2024-01-01 10:32:33 -05:00
Jay Berkenbilt a5974a7790 flate test: don't depend on zlib output 2023-12-20 07:07:35 -05:00
Jay Berkenbilt ca189800fa logger test: don't depend on zlib output 2023-12-20 07:07:35 -05:00
Jay Berkenbilt 806922f643 ascii85: ignore whitespace between ~ and > (fixes #973) 2023-09-03 13:56:34 -04:00
m-holger 4ee6ff0a73 Add new procedure QUtil::read_file_into_string 2023-03-08 21:00:26 +00:00
m-holger d3152869b6 In JSONParser::getToken handle structural and space chars early 2023-02-04 15:00:21 +00:00
m-holger ee32235f54 In JSONParser::getToken handle legal control chars early
Also, reject them in strings.
2023-02-04 15:00:21 +00:00
m-holger 5ac6a12e0a In JSONParser::getToken reject illegal control characters 2023-02-04 14:55:49 +00:00
m-holger 0de032bcdd In JSONParser::handleToken simplify setting of start and end 2023-02-04 13:53:22 +00:00
m-holger 83f972ceda Refactor end of input handling in JSONParser 2023-02-01 14:18:57 +00:00
m-holger 6ea543e6c7 In JSONParser add lex_state ls_number_e_sign 2023-02-01 14:12:32 +00:00
m-holger cdd1f0a9f6 In JSONParser add lex_state ls_number_point
Also. remove '.' as  starting char in lsTop.
2023-02-01 14:01:57 +00:00
m-holger 08e768909d In JSONParser add lex_state ls_number_leading_zero 2023-02-01 14:01:57 +00:00
m-holger cba1c352e3 In JSONParser add lex_state ls_number_minus 2023-02-01 14:01:57 +00:00
Jay Berkenbilt b0f054e600 Add ability to initialize Pl_Function with a C-style function 2022-09-08 17:35:27 -04:00
Jay Berkenbilt 0a54247652 Add QUtil::get_max_memory_usage for testing 2022-08-31 14:47:27 -04:00
Jay Berkenbilt 4674c04cb8 JSON schema: support multi-element array validation 2022-07-24 16:44:51 -04:00
Jay Berkenbilt f8d1ab9462 JSON schema -- accept single item in place of array
When the schema wants a variable-length array, allow a single item as
well as allowing an array.
2022-07-24 16:17:03 -04:00
Jay Berkenbilt eae75dbe44 Add Pl_Function -- a generic function pipeline 2022-06-19 09:12:29 -04:00
Jay Berkenbilt 8130d50e3b Add C API to QPDFLogger 2022-06-19 08:46:58 -04:00
Jay Berkenbilt f1f711963b Add and test QPDFLogger class 2022-06-18 09:02:55 -04:00
Jay Berkenbilt 04fc7c4bea Add conversions to ISO-8601 date format 2022-05-30 20:03:08 -04:00
Jay Berkenbilt 3eb77a7004 JSON: detect duplicate dictionary keys while parsing 2022-05-20 10:13:15 -04:00
Jay Berkenbilt 6c7326b290 JSON fix: correctly parse UTF-16 surrogate pairs 2022-05-20 09:16:25 -04:00
Jay Berkenbilt 60ec94a7c3 Add QUtil::is_long_long 2022-05-16 13:39:26 -04:00
Jay Berkenbilt 4c7cfd5cbc JSON reactor: improve handling of nested containers
Call the parent container's item method before calling the child
item's start method so we can easily know the current nesting level
when nested items are added.
2022-05-14 17:35:06 -04:00
Jay Berkenbilt 3d9bac43da Add internal Pl_Base64
Bidirectional base64; will be used by JSON v2.
2022-05-03 18:31:22 -04:00
Jay Berkenbilt 8d2a0eda5a Add reactors to the JSON parser 2022-05-01 19:55:52 -04:00
Jay Berkenbilt f5dd63819d Windows perl workaround 2022-05-01 19:55:52 -04:00
Jay Berkenbilt 72e5c73419 Limit parser depth for json parser 2022-05-01 12:56:22 -04:00
Jay Berkenbilt ae819b5318 Rewrite PointerHolder as derived from std::shared_ptr 2022-04-09 17:33:29 -04:00
Jay Berkenbilt 36794a60cf Allow \/ in a json string 2022-02-25 11:42:50 -05:00
Jay Berkenbilt 3e2109ab37 Remove special case for 0xad for 10.6.2. 2022-02-16 06:52:05 -05:00
Jay Berkenbilt a478cbb6dc Silently/transparently recognize UTF-16LE as UTF-16 (fixes #649)
The PDF spec only allows UTF-16BE, but most readers seem to accept
UTF-16LE as well, so now qpdf does too.
2022-02-15 16:13:12 -05:00
Jay Berkenbilt 1065bbb016 Handle odd PDFDoc codepoints in UTF-8 during transcoding (fixes #650)
There are codepoints in PDFDoc that are not valid UTF-8 but map to
valid UTF-8. We were handling those correctly with bidirectional
mapping.

However, if those same code points appeared in UTF-8, where they have
no meaning, they were left as fixed points when converting to PDFDoc,
where they do have meaning. This change recognizes them as errors.
2022-02-15 08:32:38 -05:00
Jay Berkenbilt 235c89e037 Fix one more PDF doc encoding error for 10.6 release (fixes #637) 2022-02-09 05:47:58 -05:00
Jay Berkenbilt 8082af09be Add PDFVersion class 2022-02-08 12:34:14 -05:00
Jay Berkenbilt cb769c62e5 WHITESPACE ONLY -- expand tabs in source code
This comment expands all tabs using an 8-character tab-width. You
should ignore this commit when using git blame or use git blame -w.

In the early days, I used to use tabs where possible for indentation,
since emacs did this automatically. In recent years, I have switched
to only using spaces, which means qpdf source code has been a mixture
of spaces and tabs. I have avoided cleaning this up because of not
wanting gratuitous whitespaces change to cloud the output of git
blame, but I changed my mind after discussing with users who view qpdf
source code in editors/IDEs that have other tab widths by default and
in light of the fact that I am planning to start applying automatic
code formatting soon.
2022-02-08 11:51:15 -05:00
Jay Berkenbilt 5f3f78822b Improve use of std::unique_ptr
* Use unique_ptr in place of shared_ptr in some cases
* unique_ptr for arrays does not require a custom deleter
* use std::make_unique (c++14) where possible
2022-02-05 11:24:56 -05:00
Jay Berkenbilt f727bc9443 PointerHolder: add get() and use_count() for forward compatibility
PointerHolder will be replaced with shared_ptr, so let people start
moving.
2022-02-04 13:12:37 -05:00
Jay Berkenbilt f76191f0c2 Add array test to PointerHolder 2022-02-04 13:12:37 -05:00
Jay Berkenbilt b02d37bc0a Make QPDFArgParser accept const argv
This makes it much more convention to use the initializeFromArgv
functions since you can use string literals.
2022-02-01 13:50:58 -05:00
Jay Berkenbilt 3b60224bae JSONHandler: pass JSON object to array start function 2022-01-31 15:57:45 -05:00
Jay Berkenbilt ce3406e93f JSONHandler: pass JSON object to dict start function
If some keys depend on others, we have to check up front since there
is no control of what order key handlers will be called. Anyway, keys
are unordered in json, so we don't want to depend on ordering.
2022-01-31 15:57:45 -05:00
Jay Berkenbilt 0e909bab8e Improve top-level help information 2022-01-30 13:11:03 -05:00
Jay Berkenbilt 901e3e4fbf QPDFArgParser: remove unused copyFromOtherTable
This was used, but it no longer is, so let's not keep the extra
complexity around.
2022-01-30 13:11:03 -05:00
Jay Berkenbilt 76c4f78b5c Add QUtil::make_shared_cstr
Replace most of the calls to QUtil::copy_string with this instead.
2022-01-30 13:11:03 -05:00