aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/JSON.cc
AgeCommit message (Collapse)Author
2022-08-07Code tidy: remove redundant calls to smart_ptrs get() methodm-holger
2022-07-31Fix/clarify meaning of depth parameter to json write methodsJay Berkenbilt
2022-07-31Merge pull request #734 from m-holger/nullptrJay Berkenbilt
Code tidy : replace 0 with nullptr or true
2022-07-26Code tidy : replace 0 with nullptr or truem-holger
2022-07-24JSON schema: support multi-element array validationJay Berkenbilt
2022-07-24JSON schema -- accept single item in place of arrayJay Berkenbilt
When the schema wants a variable-length array, allow a single item as well as allowing an array.
2022-05-21JSON: Fix large file supportJay Berkenbilt
2022-05-20JSON: detect duplicate dictionary keys while parsingJay Berkenbilt
2022-05-20JSON fix: correctly parse UTF-16 surrogate pairsJay 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-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-07Add next to Pl_String and fix commentsJay 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-04JSON: add write methods and implement unparse() in terms of thoseJay Berkenbilt
2022-05-02Add reactors to the JSON parserJay Berkenbilt
2022-05-01Limit parser depth for json parserJay Berkenbilt
2022-04-30Formatting: remove space in range-style for loopsJay Berkenbilt
Change .clang-format and commit automated changes from a fresh run of format-code
2022-04-16Use = default and = delete where possible in classesJay Berkenbilt
2022-04-04Programmatically apply new formatting to codeJay Berkenbilt
Run this: for i in **/*.cc **/*.c **/*.h **/*.hh; do clang-format < $i >| $i.new && mv $i.new $i done
2022-02-25Allow \/ in a json stringJay Berkenbilt
2022-02-04Add a blank line after the first header included in each sourceJay Berkenbilt
2022-02-04JSON: use std::shared_ptr internallyJay Berkenbilt
2022-02-04PointerHolder: deprecate getPointer() and getRefcount()Jay Berkenbilt
Use get() and use_count() instead. Add #define NO_POINTERHOLDER_DEPRECATION to remove deprecation markers for these only. This commit also removes all deprecated PointerHolder API calls from qpdf's code except in PointerHolder's test suite, which must continue to test the deprecated APIs.
2022-01-30More editorial changes from m-holger + spell checkJay Berkenbilt
2022-01-30Allow optional fields in json "schema" checksJay Berkenbilt
2022-01-30Implement JSONHandler for recursively processing JSONJay Berkenbilt
2022-01-30Add JSON::parseJay Berkenbilt
2022-01-30Add missing \f support for JSON string encoderJay Berkenbilt
2022-01-30Add JSON::isDictionary and JSON::isArrayJay Berkenbilt
2020-04-09Fix unnecessary copies in auto iter (fixes #426)Jay Berkenbilt
Also switch to colon-style iteration in some cases. Thanks to Dean Scarff for drawing this to my attention after detecting some unnecessary copies with https://clang.llvm.org/extra/clang-tidy/checks/performance-for-range-copy.html
2020-04-05JSON: implement pattern keys in schemaJay Berkenbilt
2019-06-21Fix sign and conversion warnings (major)Jay Berkenbilt
This makes all integer type conversions that have potential data loss explicit with calls that do range checks and raise an exception. After this commit, qpdf builds with no warnings when -Wsign-conversion -Wconversion is used with gcc or clang or when -W3 -Wd4800 is used with MSVC. This significantly reduces the likelihood of potential crashes from bogus integer values. There are some parts of the code that take int when they should take size_t or an offset. Such places would make qpdf not support files with more than 2^31 of something that usually wouldn't be so large. In the event that such a file shows up and is valid, at least qpdf would raise an error in the right spot so the issue could be legitimately addressed rather than failing in some weird way because of a silent overflow condition.
2018-12-25JSON::serialize -> unparseJay Berkenbilt
Unparse is admittedly strange, but I'd rather be strange and consistent, and everything else in the qpdf library uses unparse to serialize. (If you're reading this, the convention of using "unparse" comes from the "clu" programming language.)
2018-12-22Add simple JSON serializerJay Berkenbilt