summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_object_unittest.cpp
AgeCommit message (Collapse)Author
2018-04-17Add constants for PDF 1.7 spec, table 3.4.Lei Zhang
Add constants/stream_dict_common.h. The header lists all the constants in the table in the same order. Constants that are not used at all are commented out. BUG=pdfium:1049 Change-Id: I6539090e0ad56319ea628883e388aeacef044e52 Reviewed-on: https://pdfium-review.googlesource.com/29090 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-21Move CFX_UnownedPtr to UnownedPtrDan Sinclair
This CL moves CFX_UnownedPtr to UnownedPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I6d1fa463f365e5cb3aafa8c8a7a5f7eff62ed8e0 Reviewed-on: https://pdfium-review.googlesource.com/14620 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-15Make static const char* arrays more const.Lei Zhang
Change-Id: I87b5e6cefe973b82b4868e56fc5285c95c53a12b Reviewed-on: https://pdfium-review.googlesource.com/12550 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-05Fix length field in dictionary on create streamArtem Strygin
The CPDF_stream constructors were not setting the "Length" into the stream dictionary. The "Length" was being set by the SetData methods. This CL fixes the constructor to properly set the "Length" field. Change-Id: Iee1bd7f7a096d415ab01ee3d2f3416e19e87ece9 Reviewed-on: https://pdfium-review.googlesource.com/13010 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-08-31Remove fx_basic.hDan Sinclair
This CL removes the fx_basic.h header and fixes up includes as needed. Change-Id: I49af32a8327bdbcda40c50a61ffbd75d06609040 Reviewed-on: https://pdfium-review.googlesource.com/12670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-07-28Add CPDF_Stream::ReplaceData method.chromium/3170Artem Strygin
Change-Id: I94b2e8f6fd522b97c917037e32fb3bcbeea0cbeb Reviewed-on: https://pdfium-review.googlesource.com/8911 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-07-28Return removed value from dictionary.Artem Strygin
Change-Id: I218179565cd991b71fd9c909b94f967bbf80c74d Reviewed-on: https://pdfium-review.googlesource.com/8912 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-25Mass conversion of remaining class members (non-xfa)Tom Sepez
Change-Id: I8365ba80e3395d59a3cf35dbd9d9162e86e712e3 Reviewed-on: https://pdfium-review.googlesource.com/5970 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-04-03Drop FXSYS_ from mem methodsDan Sinclair
This Cl drops the FXSYS_ from mem methods which are the same on all platforms. Bug: pdfium:694 Change-Id: I9d5ae905997dbaaec5aa0b2ae4c07358ed9c6236 Reviewed-on: https://pdfium-review.googlesource.com/3613 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-30Add some calls to MakeUniqueDan Sinclair
This CL replaces some new's with pdfium::MakeUnique. Change-Id: I50faf3ed55e7730b094c14a7989a9dd51cf33cbb Reviewed-on: https://pdfium-review.googlesource.com/3430 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-23Fix two CloneNonCycle issuesWei Li
CloneNonCycle() tries to detect cyclic object references without copying them. There are two issues: -- for elements in an array or a dictionary, they should be able to refer to the same object, which are not cyclic; -- for cyclic referenced elements in an array or a dictionary, do not clone the element at all. Having nullptr or <key, nullptr> as an element, like we did before, might cause crash when the element being accessed. BUG=chromium:701860 Change-Id: Id0304accde76ed06fa5ce640994c7628359600fb Reviewed-on: https://pdfium-review.googlesource.com/3156 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-14Replace FX_FLOAT with underlying float type.Dan Sinclair
Change-Id: I158b7d80b0ec28b742a9f2d5a96f3dde7fb3ab56 Reviewed-on: https://pdfium-review.googlesource.com/3031 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-02-09Cleanup CFX_Matrix related methodsDan Sinclair
This CL removes unused CFX_Matrix methods and cleans up the implementaion of others. Change-Id: I72d1d10d4a45cc9341a980054df5225e52a0c4f2 Reviewed-on: https://pdfium-review.googlesource.com/2574 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2016-12-15Return unique_ptr from CFX_BinaryBuf::DetachBuffer()tsepez
In turn, make CPDF_Stream() take an unique_ptr. Review-Url: https://codereview.chromium.org/2584683002
2016-11-21Make CPDF_Stream() take unique_ptr's to its dictionary.tsepez
Review-Url: https://codereview.chromium.org/2520493002
2016-11-18Make CPDF_Dictionary use unique pointers.chromium/2926tsepez
Some changes were required to match underlying ctors as invoked by the templated methods. Many release() calls go away, a few WrapUniques() are introduced to avoid going deeper into other code. Review-Url: https://codereview.chromium.org/2510223002
2016-11-16Make CPDF_Object subclass constructors intern stringstsepez
Make CDPF_Arrays intern the object they create. Allow passing nullptr as a CFX_WeakPtr shortcut as well. Review-Url: https://codereview.chromium.org/2509123002
2016-11-16Make CPDF_Array take unique_ptrstsepez
BUG= Review-Url: https://codereview.chromium.org/2498223005
2016-11-15Make AddIndirectObject() take a unique_ptr.tsepez
Add convenience routines to create and add object in one step. Review-Url: https://codereview.chromium.org/2489283003
2016-11-09Return unique_ptr from CPDF_Object::Clone().tsepez
Because that's what clone does. There are numerous release() calls that will go away as more code is converted. Review-Url: https://codereview.chromium.org/2484033002
2016-11-04Pass object to ReplaceIndirectObjectIfHigherGeneration() by unique_ptr.tsepez
Review-Url: https://codereview.chromium.org/2477003002
2016-11-04Reland "Remove CPDF_Object::Release() in favor of direct delete"tsepez
This reverts commit f0d5b6c35fa343108a3ab7a25bc2cc2b3cf105b3. Review-Url: https://codereview.chromium.org/2478303002
2016-11-04Revert of Remove CPDF_Object::Release() in favor of direct delete (patchset ↵dsinclair
#11 id:200001 of https://codereview.chromium.org/2384883003/ ) Reason for revert: Looks like it's blocking the roll. https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_compile_dbg_ng/builds/186619 Original issue's description: > Remove CPDF_Object::Release() in favor of direct delete > > Follow-on once we prove Release always deletes in previous CL. > > Committed: https://pdfium.googlesource.com/pdfium/+/4de3d095c9d9e961f93750cf1ebd489fd515be12 TBR=thestig@chromium.org,tsepez@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/2478253002
2016-11-03Remove CPDF_Object::Release() in favor of direct deletetsepez
Follow-on once we prove Release always deletes in previous CL. Review-Url: https://codereview.chromium.org/2384883003
2016-10-17Revert "Make CPDF_Object containers hold objects via unique pointers."tsepez
This reverts commit 1d023881cd53485303c0fcc0b5878e700dc470fd. Reason for revert -- fuzzers hit issues. TBR=thestig@chromium.org Review-Url: https://codereview.chromium.org/2425783002
2016-10-14Revert "Update CPDF_IndirectObjectHolder APIs for unique objects."Tom Sepez
This reverts commit 3ba098595ae56b64eacc0c25ab76b89a4d78d920. TBR=thestig@chromium.org,weili@chromium.org Review URL: https://codereview.chromium.org/2424533003 .
2016-10-14Update CPDF_IndirectObjectHolder APIs for unique objects.tsepez
Doing so highlights a few places where ownership is dubious. Add convenience functions to return an unowned reference to a newly-created indirect object. Review-Url: https://codereview.chromium.org/2419173002
2016-10-13Make CPDF_Object containers hold objects via unique pointers.tsepez
This tweaks the implementation while leaving the API the same. The API change is more disruptive, so break this part off first. Review-Url: https://codereview.chromium.org/2385293002
2016-10-10Land all the fixes from 5609f39c but don't enable assertchromium/2887tsepez
Split this off so that we don't keep losing this when the assert is reverted again. Review-Url: https://codereview.chromium.org/2401423005
2016-10-10Add method to convert to an indirect object in a dictionary.tsepez
Avoid an assert which previously could only be overcome by removing/re-inserting. Back-fill a unit test for the equivalent Array method. BUG=654387 Review-Url: https://codereview.chromium.org/2403143002
2016-10-10Revert "Re-land "Assert that only 0-numbered objects are Released()""tsepez
This reverts commit b69a98cf50537130f88ce3a799117f2ca8353ac5. Reason for revert: crashes on mac. BUG=654387 TBR=thestig@chromium.org Review-Url: https://codereview.chromium.org/2410483002
2016-10-05Re-land "Assert that only 0-numbered objects are Released()"tsepez
This reverts commit b73c99335bfbd158ad16dd59c9c52396ffd2b54b. TBR=thestig@chromium.org Review-Url: https://codereview.chromium.org/2393783004
2016-10-04Move core/fpdfapi/fpdf_parser to core/fpdfapi/parserdsinclair
BUG=pdfium:603 Review-Url: https://codereview.chromium.org/2392603004