summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-05-10Fix FPDFImageObj_LoadJpegFile(Inline) to allow NULL to be passed in for ↵chromium/3096Andrew Weintraub
pages, as the documentation explicitly allows this. Bug:pdfium:710 Change-Id: I0535b45c16ae7a53609da3b09ff7d427c52567b5 Reviewed-on: https://pdfium-review.googlesource.com/5270 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-10Simplify CPDF_ImageRenderer::StartRenderDIBSource().Lei Zhang
Change-Id: Ia0a78be3320c5d6c3d0c40d4199cae1473e0e8dc Reviewed-on: https://pdfium-review.googlesource.com/5253 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-10Use FXSYS_IntToTwoHexChars() in more places.Lei Zhang
Change-Id: I84cd8e91a296119ecf80b7a092b886f291bebb45 Reviewed-on: https://pdfium-review.googlesource.com/4953 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-10Fix typos for the word start.Lei Zhang
Change-Id: Ic602126dc5407fcbb56dca5ec43e1824a5ca55b6 Reviewed-on: https://pdfium-review.googlesource.com/5251 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-09Create common CXML_Object base class for CXML_Content and CXML_Element.Tom Sepez
They should each know what they are rather than having an external ChildRecord struct to track the type. Change-Id: Ic647ba45569764073e944d30af1a96dccdc29eb3 Reviewed-on: https://pdfium-review.googlesource.com/5210 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-09Remove FPDFPageObj_NewImgeObj().Lei Zhang
Callers should use FPDFPageObj_NewImageObj() instead. Change-Id: If9f262af771344799a372645e466d3b8e64482ed Reviewed-on: https://pdfium-review.googlesource.com/5153 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-09LibOpenJPEG: restrict l_img_comp->prec to avoid undefined shiftNicolas Pena
The 38 value seems arbitrary, and the prec is used in OPJ_INT32 with 1 << (prec - 1). So limit it to be at most 31, and avoid undefined shifts. Bug: chromium:698498 Change-Id: I840f2e65231ac7847ed26bcaea36471a53be49e8 Reviewed-on: https://pdfium-review.googlesource.com/5173 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-05-09Edit code cleanupDan Sinclair
Minor cleans in the fpdfapi/edit code. Change-Id: I7bb2f4add7c6e84f072501035b1f77c218174cca Reviewed-on: https://pdfium-review.googlesource.com/5152 Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-09Cleanup of CGifDecompressor part 1Nicolas Pena
This CL changes the tag_gif_decompress_struct into CGifDecompressor. It cleans up a bunch of unnecessary function pointers and starts cleaning up the members of the new class. Change-Id: Id49cd8f5377dc8daaa15118551dadad4ddde7931 Reviewed-on: https://pdfium-review.googlesource.com/5170 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-05-09Move FPDF_FILEWRITE adapter to own fileDan Sinclair
This Cl moves the adapater out of the fpdfsave.cpp file into its own h/cpp files. The adapter was renamed for clarity. The CPDF_Creator was modified to take the adapter as a constructor param and the Create methods consolidated. Change-Id: Icb104f195ef532dda053c859aae356a8d4a7a54c Reviewed-on: https://pdfium-review.googlesource.com/5151 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-09Rename fpdf_edit_create.cpp to cpdf_creator.cppDan Sinclair
This Cl renames the fpdf_edit_create file to better match the cpdf_creator content. The CPDF_ObjectStream and CPDF_XRefStream code is moved out to their own .cpp files. Needed anonymous classes are split out as well. Change-Id: Ic83fb319ce28c816db82a4286e22032dc68811bc Reviewed-on: https://pdfium-review.googlesource.com/5171 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-09Use CXFA_TextUserData in place of CFX_Retainable where possible.Tom Sepez
Layering prevents the (newly-moved) CFX_Char from knowing about this class, so some casting is still required. Change-Id: I5b7556fdfa80d09e5116b171b01ab5e707763bf0 Reviewed-on: https://pdfium-review.googlesource.com/5172 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-09No-effect cast in cxfa_layoutitem.cppTom Sepez
Change-Id: I5bc24fb56adfa2ef9b46edd7409e6086093ccf8a Reviewed-on: https://pdfium-review.googlesource.com/5150 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-09Remove downcast in cxfa_layoutpagemgr.cppTom Sepez
The cast is too strict for all of the objects to be processed, however all of the fields in use are present in a parent class to which these objects all belong. Bug: 718498 Change-Id: Ibe1d800c73215c36550e54bf18de90cc9d295ef9 Reviewed-on: https://pdfium-review.googlesource.com/5130 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-09Remove editint.h and create individual headerschromium/3095Dan Sinclair
This Cl creates a cpdf_objectstream and cpdf_xrefstream headers from the editint header. Change-Id: I857981fa055ee9296cbd344860e55c67acf200ce Reviewed-on: https://pdfium-review.googlesource.com/5113 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-09Remove CPDF_Creator friendsDan Sinclair
This CL removes the friend declarations from CPDF_Creator and adds accessor methods instead. Change-Id: I6d8f67b5944aed34af00ff6ea9d23fe7d17cec18 Reviewed-on: https://pdfium-review.googlesource.com/5112 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-09Remove AppendObject from CPDF_CreatorDan Sinclair
The AppendObject method has been removed and the functionality moved to the individual CPDF_Object classes. Change-Id: I5446c6cc3e792d849acf77caed34b63a88f3a2d2 Reviewed-on: https://pdfium-review.googlesource.com/5072 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-09Cleanup CPDF_Creator defines and method namesDan Sinclair
This Cl removes un-needed prefixes from anonymous method names and cleans up various defines. Change-Id: If46a04c80460bb675af68d1e08d3093855d8fb19 Reviewed-on: https://pdfium-review.googlesource.com/5111 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-08[LCMS] Upstream direct leak fixNicolas Pena
This CL applies the following upstream patch: https://github.com/mm2/Little-CMS/commit/02c95fa76bdc4f73113373070278666f47aff82f Bug: chromium:718500 Change-Id: I7898b22e44a5ea5c0d1c301233037fbaabb8e327 Reviewed-on: https://pdfium-review.googlesource.com/5092 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-08Remove default params in CFX_DIBSourceNicolas Pena
Change-Id: I9306afed2747e3b0054adeea1d39916cac47f5c5 Reviewed-on: https://pdfium-review.googlesource.com/5091 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-08[lcms] Verify enough data to service request before allocatingDan Sinclair
If the count of items is large enough, there maybe not enough data in the file to read. This Cl verifies we'll have enough data before attempting to allocate the memory to store the results. Bug: chromium:718504 Change-Id: I82e7df3511e529c4bd72a772e9d6e607a0615927 Reviewed-on: https://pdfium-review.googlesource.com/5110 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-08Check bits to decode will fit before decodingDan Sinclair
When decoding the CPDF_HintTable we read the dwDeltaGroupLen value out of the input stream which is a 16bit number. That value is then passed in to read a uint32_t of the object number. If we have a group length of > 32 bits we'll cause an undefined shift when we attempt to shift right more then 32 bits. This Cl bails out early if the dwDeltaGroupLen value is > 32 in order to stop the undefined shifts. Bug: chromium:718505 Change-Id: I919d6f4cd19826094a5e44d3a65d758029f5c236 Reviewed-on: https://pdfium-review.googlesource.com/5090 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-08fpdfsdk: add minimal FPDFPageObj_GetType() testcasechromium/3094Miklos Vajna
I did not realize it's possible to easily test public API when the function itself was added in commit 1423319f52c5e80253d337ad02b19187c6d66ff1 (Add public method FPDFPageObj_GetType to get type of a page object., 2017-04-03). Change-Id: I4b6f4a18eabbebbebb350e69db2b187b35c38da6 Reviewed-on: https://pdfium-review.googlesource.com/5071 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-08Add raw PostScript output to pdfium_test on Windows.Lei Zhang
Activated by --ps2 and --ps3 for PostScript level 2 and 3, respectively. The raw output is not formatted in a way for most PostScript processing tools to recognize as actually PostScript. Also fix the type of the parameter to FPDF_SetPrintPostscriptLevel() even though it ends up being a no-op. Change-Id: Iaa34fd3dfaedad2b016fefe1227cbed9c974ae2a Reviewed-on: https://pdfium-review.googlesource.com/4996 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-06core: allow building against system zlibMiklos Vajna
In a way similar to the existing USE_SYSTEM_LIBJPEG. The default is of course still the DEPS-based zlib checkout. Changes in v2: 1) Since Chromium doesn't have //third_party:zlib (AKA a "zlib" target in //third_party/BUILD.GN) all the targets that depended on //third_party:zlib now depend on third_party:zlib, which always points to PDFium's third_party/BUILD.GN. The targets that depended on //third_party:zlib in third_party/BUILD.GN just depend on :zlib instead. 2) Move the zlib bits out of !build_with_chromium block. Change-Id: Id73eb07591418ff2ae71b83b87c18af71b49a22a Reviewed-on: https://pdfium-review.googlesource.com/5030 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-06Remove type-unsafe void* / uint8_t* usage in fx_crypt.hTom Sepez
Consolidate all of the sha2 contexts while we're at it, the one with the largest buf is suitable for use by all the others. Change-Id: Iace6cd8ca4405f75f78842a1559c3a2478910218 Reviewed-on: https://pdfium-review.googlesource.com/4994 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-05Roll clang to ae881aa.Lei Zhang
AKA roll clang 299960:300839. TBR=thakis@chromium.org Change-Id: Ifa8c30681897b62f182382eecd3bfdb77d7081ee Reviewed-on: https://pdfium-review.googlesource.com/4993 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-05Split out CPDF_CMap::m_pLeading into separate members.chromium/3093chromium/3092Tom Sepez
Avoid casting willy-nill over uint8_t*s, since there's at least one place where the wrong cast could be applied. Use std::vector<> as well. Use ByteRange struct to avoid the seg[i * 2 + 1] anti-pattern. Change-Id: I9278ccc3a545b2640f0daf101a0c8b1d5c5564f8 Reviewed-on: https://pdfium-review.googlesource.com/5012 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-05Cleanup CStretchEngine and its CWeightTableNicolas Pena
This CL cleans up a bunch of nits and improves ownership in the CStretchEngine class. Change-Id: I6527f29c50dab329ef58d0724cd24b94fca50ee6 Reviewed-on: https://pdfium-review.googlesource.com/4970 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-05Encode unicodes in UTF-16BE in ToUnicode mapNicolas Pena
Bug: pdfium:667 Change-Id: I811571c334ff28162905a65781ca14f03caf2966 Reviewed-on: https://pdfium-review.googlesource.com/4910 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-05Represent 1D barcodes with CFX_PathData internally.Lei Zhang
Change-Id: If90483a8fee2e3a5cd90e7fe4600ff98b2703e5d Reviewed-on: https://pdfium-review.googlesource.com/5010 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-05Make CPDF_CMap::m_pMapping use std::vectorTom Sepez
Use much longer descriptive identifiers while at it. Pack a little tighter while at it, too. Change-Id: I123025f6433a627b5e00ee225efa7dc843b07913 Reviewed-on: https://pdfium-review.googlesource.com/5011 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-05-05Fix undefined shift in opj_bio_readNicolas Pena
Bug: chromium:666683 Change-Id: I1c633d82e9ef75dd99ef032b4fc46fe8d3651cd1 Reviewed-on: https://pdfium-review.googlesource.com/5050 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-05More unused IFX_Pause parameters removedchromium/3091Dan Sinclair
Remove IFX_Pause parameters which are passed but not used. Change-Id: I51a491c7f9a429676d114a387390fac3ae65e187 Reviewed-on: https://pdfium-review.googlesource.com/4950 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-05Fix CPDF_CMap::m_pAddMapping lack of type information.Tom Sepez
Using a ByteBuffer and an array of uint8_t's isn't how one would represent an array of structured data. Packing uint16_t's into a uint32_t via / and % isn't ideal, either. Bug: Change-Id: Ib09ae2659ba2f027724546bb7aef99bdfd2dea25 Reviewed-on: https://pdfium-review.googlesource.com/4951 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-05-04Give a couple of char to int functions better names.chromium/3090Lei Zhang
- FXSYS_toDecimalDigit() becomes FXSYS_DecimalCharToInt(). - FXSYS_toHexDigit() becomes FXSYS_HexCharToInt(). Change-Id: If4683e8f85f05124b92ff075056cbc295442087d Reviewed-on: https://pdfium-review.googlesource.com/4930 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-05-04Reduce 1D barcode DrawPath calls.Lei Zhang
Draw vertical 1D barcodes as segments of lines, instead of as individual pixels. Change-Id: Ic260118660994514ce9023aacf13b16adfc8d362 Reviewed-on: https://pdfium-review.googlesource.com/4595 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-04CPDF_Document::GetPageData() normally does not return NULL.Lei Zhang
Add a comment to clarify and remove some unneeded checks. Change-Id: I8b0492548b245abc45e161085047c9f36d6c8e2b Reviewed-on: https://pdfium-review.googlesource.com/4871 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-04Make CPDF_Font member variables protected.Lei Zhang
Change-Id: I5d452ea907f4d243645ddae3512776096a827522 Reviewed-on: https://pdfium-review.googlesource.com/4872 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-04Remove unused IFX_Pause memberDan Sinclair
The IFX_Pause param is stored but never used. Remove. Change-Id: I9e5298fc05c6d408873b7bee307a76dcf3d2d4da Reviewed-on: https://pdfium-review.googlesource.com/4931 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-04Mention pdfium_all target in README.md.Lei Zhang
Also give an example out directory name and fix a typo. Change-Id: I2d7532ea8c5fcdbd3502fbafcc07fb59dfafe81c Reviewed-on: https://pdfium-review.googlesource.com/4878 Commit-Queue: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-04Fix undefined shift in opj_get_all_encoding_parametersNicolas Pena
The value 1u << (l_pdx + l_level_no) is only used to calculate a minimum, so skip it when the shift doesn't even fit unsigned integer. Also use the uint min version since all values being considered are unsigned anyways. Bug: chromium:666892 Change-Id: I79c6e52022aa894033c5cdabec29c4b8313e293b Reviewed-on: https://pdfium-review.googlesource.com/4891 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-05-04Cleanup CXFA_RenderContextDan Sinclair
Move StartRender into the constructor, remove StopRender as it will be handled by the destructor. Remove RenderOptions as they are always set the same way. Change-Id: Iddbd6849199cbe255a5e1694164de5556a34f57c Reviewed-on: https://pdfium-review.googlesource.com/4876 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-04Cleanup CFX_CharMapDan Sinclair
This CL removes the CFX_CharMap class and moves the two static methods into the files in which they're used. Change-Id: I8ff7cbfd7f1ef3970e39c77ffa3439099f7fec02 Reviewed-on: https://pdfium-review.googlesource.com/4873 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-04Remove CFX_GlyphMapTom Sepez
It's only instantiated in one place, and then nothing is ever put into the map. Change-Id: I8ebee324e0ec63c139309275c8de115d38063dc6 Reviewed-on: https://pdfium-review.googlesource.com/4877 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-05-04Removing unused IFX_Pause parametersDan Sinclair
Remove more IFX_Pause parameters which are not used. Change-Id: I9d10bb6b28d6d4d94ec3c4241b1c5a8a0709264c Reviewed-on: https://pdfium-review.googlesource.com/4875 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-05-04Cleanup more null IFX_Pause parametersDan Sinclair
This Cl cleans up more IFX_Pause parameters which are always null. Change-Id: Ia48600f06216db64a2db8e6e97222a91bd4ba149 Reviewed-on: https://pdfium-review.googlesource.com/4890 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-04Remove some unused IFX_Pause paramsDan Sinclair
This Cl removes IFX_Pause parameters which are always null. Change-Id: I6d36e52380a8f688c5e20f5e19c671f3bcc12868 Reviewed-on: https://pdfium-review.googlesource.com/4874 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-05-04More cleanup in CFX_ScanlineCompositorNicolas Pena
This CL does more cleanup in CFX_ScanlineCompositor: - Use private initization methods instead of passing member refs to namespace. - Own the m_pSrcPalette properly by getting rid of the raw pointer. - Remove members that are unused. - Fix some nits. Change-Id: I2447032f8f92614dc026f62bd0cdcd2204ab37de Reviewed-on: https://pdfium-review.googlesource.com/4851 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-05-04CPDF_DataAvail: avoid reads into stack buffers.Tom Sepez
Not a good practice even with correct bounds checks. Same idea for fpdf_edit_create.cpp Change-Id: I90b869ae4a07eb60d59997b9c5afc14830efc076 Reviewed-on: https://pdfium-review.googlesource.com/4830 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>