summaryrefslogtreecommitdiff
path: root/core/fpdfapi
AgeCommit message (Collapse)Author
2017-10-04Simplify CPDF_DataAvail::ParseIndirectObjectAtArtem Strygin
Change-Id: I072df58730f323bb5d77d180382ea209cf47f930 Reviewed-on: https://pdfium-review.googlesource.com/13832 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-03Unify CPDF_HintsTable.chromium/3232Artem Strygin
Break relationship from CPDF_DataAvail for CPDF_HintsTable. Change-Id: If3e6d4910dd368742f095c05adb122ab08c0d804 Reviewed-on: https://pdfium-review.googlesource.com/15270 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-03Improve CPDF_SecurityHandler code style.Artem Strygin
Make m_pEncryptDict as constant value. Change-Id: I4f65578e936eae5bd6afe9bfed20da3ab8e20de3 Reviewed-on: https://pdfium-review.googlesource.com/15350 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-03Simplify CPDF_Parser::GetIDArrayArtem Strygin
Change-Id: Idbd205edcf7400ffc46edf4d9f09be6ace6d0e7f Reviewed-on: https://pdfium-review.googlesource.com/13734 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-03Move initialization of CPDF_CryptoHandler into CPDF_SytnaxParser initialization.Artem Strygin
Change-Id: I70d04f38767f2c17c41407fc9b4fc25519ba32f4 Reviewed-on: https://pdfium-review.googlesource.com/15330 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-03Use ByteString instead raw string for password in CPDF_SecurityHandler.Artem Strygin
Change-Id: I598d42027d033b250134429dfdf92ba043a523a3 Reviewed-on: https://pdfium-review.googlesource.com/15310 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-03Move the CryptoHandler into the SecurityHandlerArtem Strygin
Change-Id: Idb5928e65833641d0443d955e4f2866d0f94cf5f Reviewed-on: https://pdfium-review.googlesource.com/15291 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-03Remove the parser from the CPDF_SecurityHandler .Artem Strygin
Change-Id: I9fb651285c158e0f61d19e1aaf0d8bcfd302a22f Reviewed-on: https://pdfium-review.googlesource.com/15290 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-03Change the ownership of the CPDF_CryptoHandler.Artem Strygin
Change-Id: I3ae8337c1a77063470eb5baa97db62ea2e90688b Reviewed-on: https://pdfium-review.googlesource.com/15230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-03Reduce calls of external API within CPDF_ReadVaildatorArtem Strygin
Change-Id: Ib5aac82213138c1b3f99a458894329265d1e1b05 Reviewed-on: https://pdfium-review.googlesource.com/13731 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-03Improve CPDF_ReadVaildatorArtem Strygin
Merge CPDF_ReadValidator::IsXXXAvailable and CPDF_ReadValidator::SheduleXXXDowload methods into one CheckXXXAndRequestIfUnavailable. Change-Id: Ib108d5bc3589df17269c841b0024dd4690909304 Reviewed-on: https://pdfium-review.googlesource.com/13730 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-10-02Remove useless code.Artem Strygin
Change-Id: I521d6e83f392820c40f6be930ff3bf160b766b52 Reviewed-on: https://pdfium-review.googlesource.com/15150 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-02Move CPDF_Parser::ObjectType into protected sectionArtem Strygin
Change-Id: I2a26647359a7d14d7d1269fe2835e0b3184f2ca8 Reviewed-on: https://pdfium-review.googlesource.com/13732 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-02Implement CPDF_CryptoHandler::DecryptObjectArtem Strygin
Decryption logic has been extracted from CPDF_SyntaxParser::GetObjectBody into CPDF_CryptoHandler::DecryptObject Performance comparison results: https://pdfium-review.googlesource.com/c/pdfium/+/12970 Change-Id: Iaeaed56b7f96166bbbcf6db162192d2ba9af4698 Reviewed-on: https://pdfium-review.googlesource.com/12971 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-10-02Removing unused definesDan Sinclair
Remove unused defines. Change-Id: Ibf10d8470f19cbf4528fe1342398a39ef15c1d12 Reviewed-on: https://pdfium-review.googlesource.com/15110 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-09-29Extract test subclasses of IFX_SeekableReadStreamRyan Harrison
There are multiple instances of subclasses that either act as an invalid stream or one backed by a memory buffer. Merging all of these into two shared stream classes and removing the others. BUG=pdfium:911 Change-Id: I264602808c6dc0e5c878da462a5e00883fe43e51 Reviewed-on: https://pdfium-review.googlesource.com/15093 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-28Cleanup font definesDan Sinclair
Use methods to match font information; cleanup some font code. Change-Id: Ib99c1e466e56723cb5d264d49e1caf9bbbc0daed Reviewed-on: https://pdfium-review.googlesource.com/15072 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-28Cleanup font definesDan Sinclair
This CL removes duplicate defines between XFA and core. Several OR'd values have been coverted into individual booleans to make the code clearer. Change-Id: Ic32a71c711cffd9a0cf1136e5a22f0502e085c39 Reviewed-on: https://pdfium-review.googlesource.com/15071 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-28Implement FakeFileAccess.Artem Strygin
Update embedder tests to simulate unavailable data and download requests. Change-Id: I634fa89d2a0c859243e849752936da87568909f4 Reviewed-on: https://pdfium-review.googlesource.com/11890 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-28Fix load non first pages in linearized document with hints table.Artem Strygin
Tha problem was, that when we use hints tables, we do not check pages tree availability, but currently for receiving page object in CPDF_Document, the pages tree should be available anyway. Change-Id: I908d00027fd8727f074a38e47fea095229ef5147 Reviewed-on: https://pdfium-review.googlesource.com/11892 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-28Fix infinite loop on form availability check.Artem Strygin
The problem was, that the CPDF_SyntaxParser read last block not from requested position. In this case It move down requested position to fill whole buffer. As result this additional data was not requested by DownloadHints. To fix this allow resize data buffer in CPDF_SyntaxParser, to store more small block, and always read from requsted position. Also add reading check into CPDF_Parser::LoadLinearizedMainXRefTable to prevent infinite loops. Change-Id: I14d3f4457393025dca390aa3ceaa940716463534 Reviewed-on: https://pdfium-review.googlesource.com/11891 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-28Remove no-op castRyan Harrison
Change-Id: I2427e29291218a7b004591673bd5281f23f1284a Reviewed-on: https://pdfium-review.googlesource.com/15091 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-27Move CFX_Font definition to cfx_font.hDan Sinclair
This CL moves the CFX_Font definition out of fx_font.h and into cfx_font.h to match the cfx_font.cpp implementation. Change-Id: Icc2fc7463fa4b9d0bec925e80b60a638136a83a1 Reviewed-on: https://pdfium-review.googlesource.com/14951 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-09-27Remove FXSYS_strlen and FXSYS_wcslenchromium/3226Ryan Harrison
With the conversion of internal string sizes to size_t, these wrappers are no longer needed. Replacing them with strlen and wcslen respectively. BUG=pdfium:828 Change-Id: Ia087ca2ddaf688a57ec9bd9ddfb8533cbe41510d Reviewed-on: https://pdfium-review.googlesource.com/14890 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-27Remove FX_STRSIZE and replace with size_tRyan Harrison
BUG=pdfium:828 Change-Id: I5c40237433ebabaeabdb43aec9cdf783e41dfe16 Reviewed-on: https://pdfium-review.googlesource.com/13230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-27Cleanup FX macrosDan Sinclair
This CL renames the FX_OS defines to have _OS_ in their names and drops the _DESKTOP suffix. The FXM defines have been changed to just FX. Change-Id: Iab172fba541713b5f6d14fb8098baf68e3364c74 Reviewed-on: https://pdfium-review.googlesource.com/14833 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Rename CPDF_SyntaxParser::GetObject to GetObjectBodyArtem Strygin
Change-Id: Ia8fd1893f862391fbada396f505ac16985b59cd6 Reviewed-on: https://pdfium-review.googlesource.com/12850 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-21Move CFX_WeakPtr to WeakPtrDan Sinclair
This CL renames CFX_WeakPtr to WeakPtr and moves into the fxcrt namespace. Bug: pdfium:898 Change-Id: Ide50a8afeb1e987c48c8fbd103898745c9199d6a Reviewed-on: https://pdfium-review.googlesource.com/14621 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Tom Sepez <tsepez@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-21Move CFX_StringPoolTemplate to StringPoolTemplateDan Sinclair
This CL moves CFX_StringPoolTemplate to StringPoolTemplate and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I41c8f23d6ad814d65cd154092143efaa630a96d1 Reviewed-on: https://pdfium-review.googlesource.com/14619 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Move CFX_SharedCopyOnWrite to SharedCopyOnWriteDan Sinclair
This CL renames CFX_SharedCopyOnWrite to SharedCopyOnWrite and moves to the fxcrt namespace. Bug: pdfium:898 Change-Id: Iced796b9f341407720e2a88f11d1916df56fe68c Reviewed-on: https://pdfium-review.googlesource.com/14617 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-21Rename CFX_RetainPtr to RetainPtrDan Sinclair
This CL renames CFX_RetainPtr to RetainPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I8798a9f79cb0840d3f037e8d04937cedd742914e Reviewed-on: https://pdfium-review.googlesource.com/14616 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Move CFX_MaybeOwned to fxcrt::MaybeOwnedDan Sinclair
This CL moves CFX_MaybeOwned into the fxcrt namespace and removes the CFX_ prefix. The test names for maybe owned were updated to be in the MaybeOned test suite instead of the fxcrt suite. Bug: pdfium:898 Change-Id: I0c07057d66c8610e7b19133094b4507fff725e76 Reviewed-on: https://pdfium-review.googlesource.com/14470 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-21Move CFX_AutoRestorer to fxcrt::AutoRestorerDan Sinclair
This CL renames CFX_AutoRestorer to just AutoRestorer and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: Id9f36df94e95f3b2a55054bc198ca1bfd249ee3d Reviewed-on: https://pdfium-review.googlesource.com/14450 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-20Isolate lcms2 usage to a few files.Lei Zhang
Then set up the right dependencies for them. BUG=chromium:765914 Change-Id: I036cd888c741927d5efe0d020c6676f169e7cbb1 Reviewed-on: https://pdfium-review.googlesource.com/14410 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-20Forward declare codec modules in fx_codec.h.Lei Zhang
Change-Id: I020b862619f3f93f71dbb027b9e799d78744f686 Reviewed-on: https://pdfium-review.googlesource.com/14391 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-20Move CCodec_ScanlineDecoder to its own file.Lei Zhang
Change-Id: Icacf877e2b66ca7d49637dcf9eaec0f99bcdd8bb Reviewed-on: https://pdfium-review.googlesource.com/14390 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-19Remove unneeded core/fxcodec/fx_codec.h includes.chromium/3220Lei Zhang
Change-Id: I703321108712e8c4a11a8343ecf8b1a8804c1d1a Reviewed-on: https://pdfium-review.googlesource.com/14352 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-09-19Use CPDF_ReadValidator to request linearized hint tables.Artem Strygin
Change-Id: I9ecf08c5cabfeb7b354abeb46b94918ae0b4539a Reviewed-on: https://pdfium-review.googlesource.com/13590 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-19Simplify CPDF_Parser::LoadCrossRefV4Artem Strygin
Change-Id: Ie1170e71fb2d8f87857e68620f27e478a0801d21 Reviewed-on: https://pdfium-review.googlesource.com/13670 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-09-18Use CPDF_ReadValidator to request linearized first page.Artem Strygin
Change-Id: I416e636d90c63679e2dd0b109c6594fc02663c89 Reviewed-on: https://pdfium-review.googlesource.com/13572 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-09-18Remove useless code.chromium/3219Artem Strygin
Change-Id: Idbde2714eb5a3fd5a76c77ce968f790f3c5dfa07 Reviewed-on: https://pdfium-review.googlesource.com/13571 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-09-18Use CPDF_ReadValidator to request linearized data.Artem Strygin
Change-Id: I5c0fccc74a9f103d91c95fd72dc6683d991eadec Reviewed-on: https://pdfium-review.googlesource.com/13570 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
2017-09-18Convert string class namesRyan Harrison
Automated using git grep & sed. Replace StringC classes with StringView classes. Remove the CFX_ prefix and put string classes in fxcrt namespace. Change AsStringC() to AsStringView(). Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*, Foo). Couple of tests needed to have their names regularlized. BUG=pdfium:894 Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d Reviewed-on: https://pdfium-review.googlesource.com/14151 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@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-13Change behaviour of FPDF_RenderPageBitmapWithMatrixNicolas Pena
This CL changes the behavior of FPDF_RenderPageBitmapWithMatrix so it transforms the bitmap. Before, the page would be transformed and the assumption was that it would be drawn on a bitmap with the same dimensions as the original page. This does not work well because a transformation generally changes the dimensions of the page. The rectangles test is modified to include small rectangles in the corner of the page, so that it's clear that the whole original page is being displayed. Bug: pdfium:849 Change-Id: Ie89f959a1605fea59a15d239ca871ccd939ec92b Reviewed-on: https://pdfium-review.googlesource.com/13510 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-12Don't attempt to decrypt AES streams that are too shortchromium/3214Ryan Harrison
When reading a stream, if it is encrypted using an AES cipher it must be atleast 16 bytes long aka 128 bits, other wise it is malformed. BUG=chromium:763585 Change-Id: Ied7c36978f1eb24aeda93a184527b6d6a191e5c3 Reviewed-on: https://pdfium-review.googlesource.com/13751 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-07Implement CPDF_SyntaxParser::PeekNextWord.Artem Strygin
Change-Id: I92c0bd417d9c5be59c36401efae89406e482756a Reviewed-on: https://pdfium-review.googlesource.com/12650 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-07Simplify CPDF_SyntaxParser::GetNextWordInternal.Artem Strygin
Use CPDF_SyntaxParser::ToNextWord to move position on word start. Change-Id: I6b63efc9027b2a4eb4749561bf8ce2b95527d03b Reviewed-on: https://pdfium-review.googlesource.com/12830 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-06Convert FX_STRSIZE int->size_tRyan Harrison
Change the underlying type for FX_STRSIZE to size_t from int. This will make the value unsigned and thus all values in the range of the type will be valid. This allows for the final remove of negative length strings, but also introduces a some casting and functional errors, since many parts of the code base assume that FX_STRSIZE is int or another signed type. This also CL fixes these errors. BUG=pdfium:828 Change-Id: I231dca59e96fc9330cbb099eecbdfc41fcf86f5b Reviewed-on: https://pdfium-review.googlesource.com/11830 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>