aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
AgeCommit message (Collapse)Author
2022-05-20JSON: detect duplicate dictionary keys while parsingJay Berkenbilt
2022-05-20Test (and fix) handling of dangling referencesJay Berkenbilt
2022-05-20Bug fix: isReserved() true for indirect reference to reserved objectJay Berkenbilt
2022-05-20Explicitly test ignoring unknown keys in JSON inputJay Berkenbilt
2022-05-20Make version default to latest for --json-output (like --json)Jay Berkenbilt
2022-05-20JSON fix: correctly parse UTF-16 surrogate pairsJay Berkenbilt
2022-05-20Major rework -- see long commentsJay Berkenbilt
* Replace --create-from-json=file with --json-input, which causes the regular input to be treated as json. * Eliminate --to-json * In --json=2, bring back "objects" and eliminate "objectinfo". Stream data is never present. * In --json-output=2, write "qpdf-v2" with "objects" and include stream data.
2022-05-20Add QUtil::FileCloser to the public APIJay Berkenbilt
2022-05-20Support stream data -- not testedJay Berkenbilt
There are no automated tests yet, but committing work so far in preparation for some refactoring.
2022-05-20replaceStreamData: accept uninitialized filter/decode_parmsJay Berkenbilt
These mean to leave the original values alone. This is needed for reconstructing streams from JSON given that the stream data and stream dictionary may appear in any order in the JSON.
2022-05-20Back out fluent QPDFObjectHandle methods. Keep the andGet methods.Jay Berkenbilt
I decided these were confusing and inconsistent with how JSON works. They muddle the API rather than improving it.
2022-05-20Parse objects; stream data is not yet handledJay Berkenbilt
2022-05-20Add private methods for reserving specific objectsJay Berkenbilt
2022-05-16Implement top-level qpdf json parsingJay Berkenbilt
2022-05-16Add scaffolding for QPDF JSON reactorJay Berkenbilt
2022-05-16Add --create-from-json and --update-from-json argumentsJay Berkenbilt
Also add stubs for top-level QPDF methods (createFromJSON, updateFromJSON)
2022-05-16Remove offset from missing /Root errorJay Berkenbilt
The last offset is irrelevant to not being able to find /Root.
2022-05-16Improve handling of replacing stream data with empty stringsJay Berkenbilt
When an empty string was passed to replaceStreamData, the code was passing a null pointer to memcpy. Since a 0 size was also passed, this was harmless, but it triggers sanitizer errors. The code properly handles a null pointer as the buffer in other places.
2022-05-16Add QUtil::is_long_longJay Berkenbilt
2022-05-14JSON reactor: improve handling of nested containersJay Berkenbilt
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-08Add maxobjectid to JSONJay Berkenbilt
2022-05-08Add --to-json optionJay Berkenbilt
2022-05-08Implement JSON v2 outputJay Berkenbilt
2022-05-08Fix typo in json output key nameJay Berkenbilt
moddify -> modify. Also carefully spell checked all remaining keys by splitting them into words and running a spell checker, not just relying on visual proofreading. That was the only one.
2022-05-08Implement JSON v2 for StreamJay Berkenbilt
Not fully exercised in this commit
2022-05-08Implement JSON v2 for StringJay Berkenbilt
Also refine the herustic for deciding whether to use hexadecimal notation for a string.
2022-05-07Prepare code for JSON v2Jay Berkenbilt
Update getJSON() methods and calls to them
2022-05-07Objectinfo json: write incrementally and in numeric orderJay Berkenbilt
This script was used on test data: ---------- #!/usr/bin/env python3 import json import sys import re def json_dumps(data): return json.dumps(data, ensure_ascii=False, indent=2, separators=(',', ': ')) for filename in sys.argv[1:]: with open(filename, 'r') as f: data = json.loads(f.read()) if 'objectinfo' not in data: continue trailer = None to_sort = [] for k, v in data['objectinfo'].items(): if k == 'trailer': trailer = v else: m = re.match(r'^(\d+) \d+ R', k) if m: to_sort.append([int(m.group(1)), k, v]) newobjectinfo = {x[1]: x[2] for x in sorted(to_sort)} if trailer is not None: newobjectinfo['trailer'] = trailer data['objectinfo'] = newobjectinfo print(json_dumps(data)) ----------
2022-05-07Objects json: write incrementally and in numeric orderJay Berkenbilt
The following script was used to adjust test data: ---------- #!/usr/bin/env python3 import json import sys import re def json_dumps(data): return json.dumps(data, ensure_ascii=False, indent=2, separators=(',', ': ')) for filename in sys.argv[1:]: with open(filename, 'r') as f: data = json.loads(f.read()) if 'objects' not in data: continue trailer = None to_sort = [] for k, v in data['objects'].items(): if k == 'trailer': trailer = v else: m = re.match(r'^(\d+) \d+ R', k) if m: to_sort.append([int(m.group(1)), k, v]) newobjects = {x[1]: x[2] for x in sorted(to_sort)} if trailer is not None: newobjects['trailer'] = trailer data['objects'] = newobjects print(json_dumps(data)) ----------
2022-05-07Pages json: write each page incrementallyJay Berkenbilt
2022-05-07Top-level json: write incrementallyJay Berkenbilt
This commit just changes the order in which fields are written to the json without changing their content. All the json files in the test suite were modified with this script to ensure that we didn't get any changes other than ordering. ---------- #!/usr/bin/env python3 import json import sys def json_dumps(data): return json.dumps(data, ensure_ascii=False, indent=2, separators=(',', ': ')) for filename in sys.argv[1:]: with open(filename, 'r') as f: data = json.loads(f.read()) newdata = {} for i in ('version', 'parameters', 'pages', 'pagelabels', 'acroform', 'attachments', 'encrypt', 'outlines', 'objects', 'objectinfo'): if i in data: newdata[i] = data[i] print(json_dumps(newdata)) ----------
2022-05-07Test json against schema only on demandJay Berkenbilt
Testing json against schema requires an in-memory copy, so do it only when requested by the test suite.
2022-05-07Add next to Pl_String and fix commentsJay Berkenbilt
2022-05-07Add --test-json-schema command-line optionJay Berkenbilt
2022-05-07QPDFJob: have doJSON write to a pipelineJay Berkenbilt
2022-05-07JSON: add blob type that generates base64-encoded binary dataJay Berkenbilt
2022-05-04Change JSON parser to parse from an InputSourceJay Berkenbilt
2022-05-04Add new FileInputSource constructorsJay Berkenbilt
2022-05-04JSON: add write methods and implement unparse() in terms of thoseJay Berkenbilt
2022-05-04Make "objects" and "pages" consistent in JSON outputJay Berkenbilt
2022-05-04Don't call pushInheritedAttributesToPage in json modeJay Berkenbilt
We used to have to do that, but for quite some time, the code that gets images has no longer required it.
2022-05-04Add new Pl_String PipelineJay Berkenbilt
2022-05-04Add new Pl_OStream PipelineJay Berkenbilt
2022-05-04Make use of the new Pipeline methods in some placesJay Berkenbilt
2022-05-04Add new Pipeline convenience methodsJay Berkenbilt
2022-05-04Make Pipeline::write take an unsigned char const* (API change)Jay Berkenbilt
2022-05-04Make assert handling less error-proneJay Berkenbilt
Prevent my future self or other contributors from using assert in tests and then having that assert not do anything because of the NDEBUG macro.
2022-05-04Remove remaining incorrect assert calls from implementationJay Berkenbilt
2022-05-04Add internal Pl_Base64Jay Berkenbilt
Bidirectional base64; will be used by JSON v2.
2022-05-03Move generate_auto_job to the top-level CMakeLists.txtJay Berkenbilt