summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2018-10-05Add booleans for form flags in CPDF_FormField.Lei Zhang
Add constants/form_flags.h as well. Change-Id: If15deff6bafdf394ed975b767128d65b5d2eb0e9 Reviewed-on: https://pdfium-review.googlesource.com/c/43533 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-05Make CPDF_RenderStatus matrix params const-ref.Lei Zhang
Eliminate the possibility of nullptr. Change-Id: I16c3e442d78e5151330db7227bd1c1630af3d4a3 Reviewed-on: https://pdfium-review.googlesource.com/c/43531 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-05Add methods to read specific field flags in CPDF_FormField.Lei Zhang
Instead of reading the entire field flags value and applying bitmasks. Also read an unused setter and make a member const. Change-Id: I4ad645765ac58864b9c155ee9fe740aca4396d52 Reviewed-on: https://pdfium-review.googlesource.com/c/43532 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-05Remove unreachable null checks in CPDF_ActionFieldsTom Sepez
We always pass &local as the argument to the ctor. Change-Id: I3d6e046b8aed0a2cee3c3c20513e72b85741cabe Reviewed-on: https://pdfium-review.googlesource.com/c/43550 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-04Change |virtual ~Foo(){}| to |virtual ~Foo()=default;|chromium/3571Tom Sepez
Otherwise code coverage flags the empty body as unreachable. Change-Id: Iee1d9a876d68276529c70d9b8c7a28276f271767 Reviewed-on: https://pdfium-review.googlesource.com/c/43514 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-04Remove some unused code in fxcrt strings.Tom Sepez
Unused static method in StringDataTemplate<>. Unused WideString::GetFloat(), which in turn allows us to remove another custom string to float parser. Change-Id: If7ae60a0ba90563598232bad229f97cb74d682ba Reviewed-on: https://pdfium-review.googlesource.com/c/43513 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-04Refer to const smart pointers consistently.Lei Zhang
SmartPtr<T> const m_Ptr, instead of const SmartPtr<T> m_Ptr. Change-Id: I8001b0334543f49d138a24438def62088a15c6e4 Reviewed-on: https://pdfium-review.googlesource.com/c/43512 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-04CPDF_VariableText::m_nHorzScale is always 100Tom Sepez
Remove the member and simplify logic in all the places this is passed. Change-Id: I39b979793fe84f0dc460261223655dd7f50555cc Reviewed-on: https://pdfium-review.googlesource.com/c/43474 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-04Remove more uncalled methods in core/Tom Sepez
Change-Id: I10679c9d28eb495c6bc21fd1355cb3ef330a1209 Reviewed-on: https://pdfium-review.googlesource.com/c/43471 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-04Remove several more unused methods from core/Tom Sepez
Change-Id: I891add4e91c7ee58b34974fed6d73d17c297e759 Reviewed-on: https://pdfium-review.googlesource.com/c/43459 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-03Remove unused method CPDF_ActionFields::GetFieldsCount()Tom Sepez
Change-Id: I0299a5df10facc964d228346a438018bd3c962b4 Reviewed-on: https://pdfium-review.googlesource.com/c/43457 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-03Remove unused method CPDF_Bookmark::GetColorRef.Tom Sepez
Change-Id: I8ad38892eda7c820189924d53dacbb4c5a720e8b Reviewed-on: https://pdfium-review.googlesource.com/c/43458 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-03Remove unused methods in CPDF_DocJSActions.Tom Sepez
Tidy ctor while at it. Change-Id: I33c0751bc37e1aa840033439b4826c76d1597d4c Reviewed-on: https://pdfium-review.googlesource.com/c/43456 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-03Remove some impossible null checks from fx_crypt_sha.cppTom Sepez
We always call CRYPT_SHA*Start() with &ctx, so it can't be null. Found by inspecting code coverage report. Change-Id: Ibdca16e6a1f2d60514270fe386bf555668ec3586 Reviewed-on: https://pdfium-review.googlesource.com/c/43452 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-03Tidy CFX_UTF8Decoder.Tom Sepez
Remove unused method, make ctor/dtor out-of-line. Change-Id: I77bb7c1da8e9d369085072639ca388247f2b9225 Reviewed-on: https://pdfium-review.googlesource.com/c/43455 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-03Remove blocklen argument from CRYPT_AESSetKey()Tom Sepez
We always pass it as 16. In turn, remove some unused code to handle the non-16 cases. Noticed while looking at coverage report. Change-Id: I93f5f0342537284ce6a2b36a8b477425da3cc872 Reviewed-on: https://pdfium-review.googlesource.com/c/43450 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-03Make CCodec_ProgressiveDecoder::ReadMoreData() slightly sanerchromium/3570Tom Sepez
- Fix buffer leak if TryRealloc fails. - Make m_SrcSize always represent the usable bytes in the buffer, even when read the last partial block from the file. - Remove redundant comparisons and use std::min(). - Better naming. Change-Id: Ie7dd79bac21b2f2422f299563a2dd28ed358e3e2 Reviewed-on: https://pdfium-review.googlesource.com/42130 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-03Reland "Make potentially dangerous Actions require a user click."Henrique Nakashima
This is a reland of 9d784c291714b703b16185e69860a3797de85b6c https://chromium-review.googlesource.com/c/chromium/src/+/1244367 was submitted changing the test that broke with this CL to not depend on PDF OpenActions anymore. Original change's description: > Make potentially dangerous Actions require a user click. > > URI and SubmitForm actions are only handled if the event was > ButtonUp or ButtonDown. > > Bug: 851821 > Change-Id: If6eb0ff44f6d62ac6df50b552c0bdc582885ab5d > Reviewed-on: https://pdfium-review.googlesource.com/42731 > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Reviewed-by: Ryan Harrison <rharrison@chromium.org> Bug: 851821 Change-Id: Iaf9c399059590f0f1a050ac450e08ee60a8d5a38 Reviewed-on: https://pdfium-review.googlesource.com/43410 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-10-03Add FxFolderHandleCloser for use with std::unique_ptr.Lei Zhang
Use it in a couple of places. Make the similar code in the two places even more so. Change-Id: I3fc6a567088217e24506cdf7ab927b94cb5a4d52 Reviewed-on: https://pdfium-review.googlesource.com/43330 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-02Consolidate ReadMoreData() calls.Tom Sepez
Extract some dividends from having landed the previous CL. Change-Id: I9ade77c801b51762cab801716b9fd2bc4c634036 Reviewed-on: https://pdfium-review.googlesource.com/c/41990 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-02Use smart pointers in CPDF_PageRenderCache.Lei Zhang
Use std::unique_ptr and MaybeOwned, instead of manual memory management. Change-Id: I5f08abd869245fb55b7e868621369ff3ea34146f Reviewed-on: https://pdfium-review.googlesource.com/43211 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-10-02Remove dead code in CPDF_PageRenderCache::ResetBitmap().Lei Zhang
Callers only ever pass in nullptr for the bitmap parameter. Change-Id: Iefeb72a1268521a38b3d5ab4b03163b67bf35796 Reviewed-on: https://pdfium-review.googlesource.com/43210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-01Fix #include ordering / formatting.Lei Zhang
Change-Id: I996c9b32d767960a5388e44e13180e1f6577ce38 Reviewed-on: https://pdfium-review.googlesource.com/43190 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-27Shading functions should take const matrix pointers.chromium/3568chromium/3567chromium/3566chromium/3565chromium/3564Lei Zhang
Change-Id: If13cc70d3d047f255f5d289f35a8533811523146 Reviewed-on: https://pdfium-review.googlesource.com/43110 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-25Revert "Remove unreachable code in CPDF_DIBBase."Lei Zhang
This reverts commit 214982c4d02a720c3b1b3de121cddc62189b8848. Reason for revert: Turns out it is reachable. Original change's description: > Remove unreachable code in CPDF_DIBBase. > > The colorspace is always available when creating image decoders that use > colorspaces. > > Change-Id: I20ac75edcd614ccc1e83de262c128776e9d03eed > Reviewed-on: https://pdfium-review.googlesource.com/42872 > Commit-Queue: Ryan Harrison <rharrison@chromium.org> > Reviewed-by: Ryan Harrison <rharrison@chromium.org> TBR=thestig@chromium.org,rharrison@chromium.org BUG=chromium:888743 # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: I45903543f0e4bf2785660fb8c1e45c34febb6ecf Reviewed-on: https://pdfium-review.googlesource.com/43050 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-25Add FxAlignToBoundary<>() template helper function.Tom Sepez
Because I nearly botched this trivial calculation in the previous CL. Change-Id: I7438f9d3476d93b7899c2d7d761234769f53f9e3 Reviewed-on: https://pdfium-review.googlesource.com/43010 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-25Introduce CodecModuleIface for progressive decoder modules.Tom Sepez
Another step before trying to fix the memory issue. Forces common APIs on the bunch of decoders, though some methods are unused. Requires adding some arguments/return values to get to a common API which are not used in all cases (yet?). Required converting some args to spans. Required proxying a GetJumpMark() call through the public module API to the private context. Bug: pdfium:1082 Change-Id: I0c0b7415141ff2a6f4f44777ca3d05521f08130d Reviewed-on: https://pdfium-review.googlesource.com/41950 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-24Give CFX_GraphStateData a work-over.chromium/3561Tom Sepez
Use std::vector<float> for dash array. Use compiler-generated default operations. Squeeze some enums. Fix obvious logic botch in DashChanged(). Change-Id: If1d809cc46a3cf2db98a09a3f5a49d22138c0640 Reviewed-on: https://pdfium-review.googlesource.com/42613 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-24Revert "Make potentially dangerous Actions require a user click."Henrique Nakashima
This reverts commit 9d784c291714b703b16185e69860a3797de85b6c. Reason for revert: Roll into chromium is stuck, this is a potential culprit. Original change's description: > Make potentially dangerous Actions require a user click. > > URI and SubmitForm actions are only handled if the event was > ButtonUp or ButtonDown. > > Bug: 851821 > Change-Id: If6eb0ff44f6d62ac6df50b552c0bdc582885ab5d > Reviewed-on: https://pdfium-review.googlesource.com/42731 > Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> > Reviewed-by: Tom Sepez <tsepez@chromium.org> > Reviewed-by: Ryan Harrison <rharrison@chromium.org> TBR=tsepez@chromium.org,hnakashima@chromium.org,rharrison@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 851821 Change-Id: I6f1bc0a02f65a24fbd49d53526b985f8a4ea0b4f Reviewed-on: https://pdfium-review.googlesource.com/42990 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-09-21Cleanup in CCodec_FaxModuleNicolas Pena
This CL moves FaxG4Decode to the class where it's implemented. It should remain there because it calls FaxG4GetRow, declared and used in the cpp file. Do some ++ cleanup while at it. This CL also makes CCodec_FaxModule own some methods that were namespaced since doing so allows removing a bunch of parameters. Change-Id: I24787f5668c7273b9bdb4009c3d0b29590c5552f Reviewed-on: https://pdfium-review.googlesource.com/42950 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-21Replace CPDF_Color::Copy() with honest-to-goodness operator=().Tom Sepez
Change-Id: Ifcce7b1e513c8859752d5248ae686bbe5349e342 Reviewed-on: https://pdfium-review.googlesource.com/42614 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-21Make OutputIndex() a void methodNicolas Pena
The return value is never used, so OutputIndex() can be void. The if statement still helps to stop when the work has failed. Change-Id: I7e9c72db1d1e226bb0466ebb26fd07915e2396bf Reviewed-on: https://pdfium-review.googlesource.com/42930 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-09-21Remove unreachable code in CPDF_DIBBase.Lei Zhang
The colorspace is always available when creating image decoders that use colorspaces. Change-Id: I20ac75edcd614ccc1e83de262c128776e9d03eed Reviewed-on: https://pdfium-review.googlesource.com/42872 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-21Validate more image values in CPDF_DIBBase.Lei Zhang
Change-Id: Ia5f72e6397ee959d897a945c4069f47c494b5511 Reviewed-on: https://pdfium-review.googlesource.com/42870 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-20Make potentially dangerous Actions require a user click.Henrique Nakashima
URI and SubmitForm actions are only handled if the event was ButtonUp or ButtonDown. Bug: 851821 Change-Id: If6eb0ff44f6d62ac6df50b552c0bdc582885ab5d Reviewed-on: https://pdfium-review.googlesource.com/42731 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-20Validate some image data in CPDF_Image::InitJPEG().Lei Zhang
Change-Id: I55e840667acfda831488d75efc97504355813dd1 Reviewed-on: https://pdfium-review.googlesource.com/42850 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-20Change CFX_FixedBufGrow to take a size_t.Lei Zhang
Thanks to Qihoo 360 Vulcan Team for pointing this out. Change-Id: Ib6dd77307b3759e54168127dc0e17aa42698d852 Reviewed-on: https://pdfium-review.googlesource.com/42830 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-20Remove extraneous 'extern "C"' entries.Lei Zhang
Also remove dead code found along the way, and fix lint errors. BUG=pdfium:410 Change-Id: I4cd0ede516483209cf49a6686d909953ab196106 Reviewed-on: https://pdfium-review.googlesource.com/42771 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-20Fix misc lint errors and other cleanups.Lei Zhang
Change-Id: I00ce0109251d1231858e87ffc3889abe6937fa26 Reviewed-on: https://pdfium-review.googlesource.com/42811 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-09-20Remove more unneeded STL #includes from headers.Lei Zhang
Remove some variables named "string" to avoid false positives from the linter. Change-Id: I00a53e6970451fd0cea8ab2f8178183650ca00d2 Reviewed-on: https://pdfium-review.googlesource.com/42810 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-20Remove many unneeded STL #includes from headers.Lei Zhang
Change-Id: I7010cedee8d17d05b2c37a94d767e6f3a9c48f7d Reviewed-on: https://pdfium-review.googlesource.com/42790 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-19Use MaybeOwned in CPDF_StreamAcc.chromium/3557Lei Zhang
Change-Id: Iba886e51cf34ea01ed0d93afc93c8ec0ffed4f52 Reviewed-on: https://pdfium-review.googlesource.com/42594 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-19Consolidate raw data processing path in CPDF_StreamAcc.Lei Zhang
Add ProcessRawData() and ProcessFilteredData() helper methods for the consolidated branches. Change-Id: I88fb0ffb76e5d354bc311490a9d995e07fbc2174 Reviewed-on: https://pdfium-review.googlesource.com/42593 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-09-19Initialize CPDF_ImageRenderer in the header.Lei Zhang
Also add a GetRenderOptions() helper method. Change-Id: I47db7a21f55f396e08775575f6b2a48e440c2f91 Reviewed-on: https://pdfium-review.googlesource.com/42750 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-19Encapsulate CPDF_ImageLoader.Lei Zhang
Change-Id: Iee7ce04630fed86f651cd382a19e46b2f7ab6d61 Reviewed-on: https://pdfium-review.googlesource.com/42672 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-19Validate decoder pipelines.Lei Zhang
PDF decoders, AKA filters, can be chained together. There can be an arbitrary number of decoding / decompressing filters in the pipeline, but there should be at most 1 image decoder, and the image decoder should only be at the end of the chain. BUG=chromium:880675 Change-Id: Iffa27c70ec1ed7574e38e0de23413840ee900959 Reviewed-on: https://pdfium-review.googlesource.com/42711 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-18Transfer ownership of nodes to top-level XML docRyan Harrison
For XFA, XML nodes are owned by the XML doc that they were created by, but references to them are stored elsewhere. For a PDF document there is one top-level XML document created and retained when the initial XFA XML is parsed. Another can be created if loadXML is called by JS. In the existing code the XML doc that owns the newly created nodes is local to loadXML. So the nodes are destroyed right after putting refernces to them into the main XFA data structures. This CL adds in a method to transfer ownership of the XML nodes from one doc to another, and uses it to correctly retain the newly created nodes, by having them owned by the top-level XML doc. BUG=chromium:884664 Change-Id: Id29b4edbfe44aefb9713328e4e217e830f7e9e14 Reviewed-on: https://pdfium-review.googlesource.com/42690 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-09-18Encode mark names when writing to file.Henrique Nakashima
Bug: pdfium:1150 Change-Id: I7e589fb3d164dfc9b39a7a3f6e782c09331cc32d Reviewed-on: https://pdfium-review.googlesource.com/42630 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-09-17Make fxcrt::Retainable non-copyable.Tom Sepez
Because copying ref-counts from one object to another is a bad idea and sure to leak. Change-Id: I5f2c0891d08c893eb1ac8fb8a5908d975295ae2e Reviewed-on: https://pdfium-review.googlesource.com/42670 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-17Check for empty streams earlier in CPDF_StreamAcc::LoadAllData().Lei Zhang
Change-Id: I91c8d7d837e4c2104d56d725c16a28d49399aaca Reviewed-on: https://pdfium-review.googlesource.com/42592 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>