summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2018-08-29Remove FPDFAPI_ prefix from internal cid/encoder functionsTom Sepez
These look too much like public/ FPDF functions otherwise and yet they are not exposed anywhere beyond core/fpdfapi. Disambiguate one method vs. top-level function usage as a result. Bug: pdfium:1141 Change-Id: I9cfdfced90386bb9ef6b2b86f568f2e6f8ee6a5a Reviewed-on: https://pdfium-review.googlesource.com/41530 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-28Use pdfium::span<> in more image modulesTom Sepez
Change-Id: Ie344bb37abf7dde158d03cc2897dca3588f1a5e3 Reviewed-on: https://pdfium-review.googlesource.com/41550 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-28Rename remaining fx_codec*.cpp to match class and .h file nameTom Sepez
Then include headers in the proper order per standards, since it will no longer trigger a presubmit warning. Change-Id: I6bb86ac90e8fd9aed30b66dac61726f0dea8222c Reviewed-on: https://pdfium-review.googlesource.com/41535 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-28Use std::span<> in CCodec_JPEGModuleTom Sepez
Also rename .cpp file to match class name and .h file. Modify some helper functions to operate on spans. Move some initializations to member declarations. Change-Id: Ie0889bda91daaef80fae6f5681f8ce068e92453b Reviewed-on: https://pdfium-review.googlesource.com/41534 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-28Handle non-printing characters at beginning of extraction regionRyan Harrison
Currently if a text extraction region begins on a non-printing character then "" will be returned. This is the incorrect behaviour, instead the call should scan ahead until a printing character is found and start extracting from there. Also proactively adds a similar check and scan for the end of the extraction region. BUG=pdfium:1139 Change-Id: Ia2001ac89740f3d31d2bb69e8000773f8b01091b Reviewed-on: https://pdfium-review.googlesource.com/41532 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-08-28Let CCodec_ProgressiveDecoder::m_pSrcBuf outlive contextsTom Sepez
This requires making some members unique_ptr<> to preserve the destruction order. Bug: 877766 Change-Id: I69e0173fdde7e9cd0d24017d6c829b9b9cf600c0 Reviewed-on: https://pdfium-review.googlesource.com/41490 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-27Rework CCODEC_ProgressiveDecoder.Tom Sepez
Rename .cpp file to match class and .h file (!!!) Put initialziations into header. Change-Id: I2cbc7608287f8df887ce186d122dcd3db2aef19b Reviewed-on: https://pdfium-review.googlesource.com/41511 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-27Use pdfium::span<> in CCodec_RLScanlineDecoderTom Sepez
Change-Id: I3dc2dd54d89858722c2aea4b9e694308796b8274 Reviewed-on: https://pdfium-review.googlesource.com/41510 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-27The final game: mark everything final.Tom Sepez
Then revert the ones that break compilation. Fix one IWYU noticed during presubmit. Change-Id: I881a8a72818e55dbc4816247e35ff5e3015194e7 Reviewed-on: https://pdfium-review.googlesource.com/41470 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-27Remove unnecessary ToArray() calls and locals in CPDF_Dest.chromium/3535Lei Zhang
Rename GetObject() to GetArray() and remove more ToArray() calls. Change-Id: I754ca72b32c085e1801d3cedcd291ce4d2682359 Reviewed-on: https://pdfium-review.googlesource.com/41353 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-08-25More cleanup in CPDF_TextPagechromium/3534chromium/3533Nicolas Pena
Change-Id: I6630ccdcce795c2f4767f5403303b5cd670c93ea Reviewed-on: https://pdfium-review.googlesource.com/41351 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-08-24Rename CFX_DIBSource to CFX_DIBBase.Tom Sepez
It is not a source from which you can get CFX_DIBs, but rather a base class from which all DIBs inherit. Do the same thing for the CPDF_DIBSource wrapper class. Mechanical change apart from adding a one-line comment in cfx_dibbase.h Change-Id: Id2bde87813ca301d9fafc55ce08d703dfc6a7184 Reviewed-on: https://pdfium-review.googlesource.com/41352 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-24Use span<uint8_t> in more fxcodec code.Tom Sepez
There are also small tweaks in tests to ensure strict order of stack variable lifetimes. Change-Id: Ic9d5c6a2bdd378b517be627f8e29f725bafdc2ad Reviewed-on: https://pdfium-review.googlesource.com/41310 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-24Cleanup CalculateBaseSpace in CPDF_TextPageNicolas Pena
Change-Id: Iaa3e8d88083d7ac15762ff2d5d74a378f626483c Reviewed-on: https://pdfium-review.googlesource.com/41350 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-08-24Change CPDF_MetadataTest test data to static const char data[].Lei Zhang
Change-Id: Ifdc931fbaecf42249351bbc78760ed2c1b6566c1 Reviewed-on: https://pdfium-review.googlesource.com/41291 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-23Use pdfium::span<> in CPDF_Stream::SetData().Tom Sepez
Conversion to span makes this more elegant in a number of places, owing to std::vector directly converting to span, and the bytestring's ToRawSpan(). Disambiguate single-argument forms to allow passing {} as an argument. Change-Id: Ibd5eaadca8d8cbbd589338f375c7ee8439fd3eb2 Reviewed-on: https://pdfium-review.googlesource.com/41272 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Pass unique_ptr<> to CFX_MemoryStream constructorTom Sepez
Proves we own the memory that the class will eventually free. Change-Id: Ie9523da8db738e7478a1c73e3e1a6b24aed38442 Reviewed-on: https://pdfium-review.googlesource.com/41290 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Fix GCC build with V8 disabled.Lei Zhang
- Remove set, but otherwise unused variables. - Mark some pdfium_test code as V8-enabled only. - Do not build one unit test with GCC. Change-Id: I3f04273a7731086e08386478a62769bf06f6d8a4 Reviewed-on: https://pdfium-review.googlesource.com/41271 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-23Fix shadowed variablesRyan Harrison
This CL fixes instances of variable shadowing that are discovered by turning on -Wshadow. BUG=pdfium:1137 Change-Id: I418d50de89ecbeb12e85b23a358bc61e8f16e888 Reviewed-on: https://pdfium-review.googlesource.com/41150 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-08-23Remove deprecated FPDFDest_GetPageIndex() API.Lei Zhang
Use FPDFDest_GetDestPageIndex() instead. BUG=pdfium:1041 Change-Id: I8e91ef46456a60ebd873068765b7c3ff1a991fa4 Reviewed-on: https://pdfium-review.googlesource.com/41230 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-23Cleanup CPDF_TextPage::GetRectArrayNicolas Pena
Change-Id: I12b418b06b097af87f1143dbda3b6e304ba437c6 Reviewed-on: https://pdfium-review.googlesource.com/41210 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-08-23Remove bool bPromptCJK argument (several places)Tom Sepez
It gets computed, and passed around, but in the end no decisions are made because of it. Change-Id: If67f6f0cd0c37e52993832be1fb83498fd851914 Reviewed-on: https://pdfium-review.googlesource.com/41190 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Fold CPDF_Document::LoadDocInternal() into caller.Tom Sepez
It is only called in one place. It also has a superfluous test and return as it is currently written introduced in https://pdfium-review.googlesource.com/c/pdfium/+/35490 Change-Id: Iba1aaac6e93c261f71729f39e51741f19c5dbb57 Reviewed-on: https://pdfium-review.googlesource.com/41071 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-22Properly handle language markers in decoded textRyan Harrison
In text like document title 0x001B is used as a marker for the beginning/end of a language metadata section. Currently PDFium does nothing with this data, but when returning the 'decoded' text it needs to be stripped out. The existing code assumed that the two bytes following a marker would be the data to be removed and did nothing to track if it was in/out of one of these regions. This led to a situation where it would always strip the two bytes following the region, since it assumed the end marker was the beginning of a new region. This CL corrects the detection and handling of these regions, and adds a regression test for the reported bug. BUG=pdfium:182 Change-Id: I92ddba5666274a8986fed03f502a0331f150f7ac Reviewed-on: https://pdfium-review.googlesource.com/41070 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-08-22Use UnownedPtr<> in JBig2_TrdProc, part 2.Tom Sepez
Re-order some locals to obey strict lifetime constraint. Pack a little tighter. Change-Id: Iae011d21b934fac865cf10ac20c046c8917d3a98 Reviewed-on: https://pdfium-review.googlesource.com/40915 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-22Mark CFX_XMLNode pointers as const in various places.Lei Zhang
Change-Id: I86c6f7526e2ef4c3e8de30ebaff223095ee70fc4 Reviewed-on: https://pdfium-review.googlesource.com/40811 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-08-22Fix integer overflow in CPDF_CIDFont::GetCharBBoxNicolas Pena
Bug: chromium:875924 Change-Id: I85c86d3f90ee62b5593b0b20e44283c5056702ff Reviewed-on: https://pdfium-review.googlesource.com/40730 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-08-22Simplify GetEmbeddedObj() methods.Lei Zhang
Change-Id: I976a8841f1519310cbf934103336dc050a7c293d Reviewed-on: https://pdfium-review.googlesource.com/40773 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-08-21Use UnownedPtr in CPDF_VariableTextTom Sepez
Re-arrange order of some variables so that the lifetime constraints are not violated, even temporarilly. Change-Id: I859f1217d5af0f4c703a3d8ed742c1f144cc1c61 Reviewed-on: https://pdfium-review.googlesource.com/40950 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-21Use UnownedPtr<> in JBIG2_SDDProc.Tom Sepez
Pack a little tighter while at it. Change-Id: If7cbb324ebf828a4bb60eb364fc3e0f31625e57f Reviewed-on: https://pdfium-review.googlesource.com/40913 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-21Use UnownedPtr<> in JBig2_GrrdProc.h.Tom Sepez
Change-Id: Ie3502443b801ae4af6e4c9e533f28d102703104c Reviewed-on: https://pdfium-review.googlesource.com/40912 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-21Use UnownedPtr<> in CJBig2_TRDProc.Tom Sepez
First real use case of assigning Unowned to MaybeOwned. Change-Id: Ia5bc7102012f7a09120ba02d38cf751547d5c005 Reviewed-on: https://pdfium-review.googlesource.com/40914 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-21Avoid copying some big vectors in JBIG2_SymbolDictTom Sepez
Change-Id: I662f65b53a1a17be0062c92452d82acbbe157477 Reviewed-on: https://pdfium-review.googlesource.com/40910 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-21Fix lifetime issue in CJBig2_GRDProc::ProgressiveArithDecodeStateTom Sepez
Bug: 876222 Change-Id: I56c20c006ee26650f32b9ec90f3c7f91466b7470 Reviewed-on: https://pdfium-review.googlesource.com/40890 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-21Allow creation of a MaybeOwned<T> from UnownedPtr<T>.Tom Sepez
Small test to show these forms compile and do not transfer ownership. Change-Id: I1787a57d4d0bf70da7b6101c1f958cfe9a8f9dda Reviewed-on: https://pdfium-review.googlesource.com/40830 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-20Use UnownedPtr<> in JBig2_GrdProc.hTom Sepez
Pack a little tighter while we're at it. Change-Id: I8cbefe5df1b4340cb55ea14a5ae00ebc1ad07114 Reviewed-on: https://pdfium-review.googlesource.com/40774 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-20Use UnownedPtr<> in CPDF_ObjectWalker.Tom Sepez
Change-Id: I99eed369f4d44f92607a0a58ba24e8b62ee348f7 Reviewed-on: https://pdfium-review.googlesource.com/40671 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-20Fix reversed arguments to GenerateResourceDict().Lei Zhang
GeneratePopupAP() passes [Font Dict, ExtGState Dict] to GenerateResourceDict(), but GenerateResourceDict() is expecting the dictionaries to be the other way around. Change-Id: I2ed21e47edda7979f177be3b6a1030512348c448 Reviewed-on: https://pdfium-review.googlesource.com/37411 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-20Simplify CPDF_InterForm::GenerateNewResourceName().Lei Zhang
It only has one caller, so remove all the checks that will never be true for this caller. Also make it an anonymous function. Change-Id: I06e6a04e2f6b8741b6beb83534502a626564b592 Reviewed-on: https://pdfium-review.googlesource.com/37410 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-20Remove refcounting from CFPF_SkiaFont.chromium/3529Lei Zhang
The refcounting is useless, since CFPF_SkiaFontMgr always has a reference to the fonts anyway. Just make CFPF_SkiaFontMgr own the fonts, like on other platforms. Change-Id: Ifadb5c4e09f151ada4a0a68e0588166c2f2974d4 Reviewed-on: https://pdfium-review.googlesource.com/40610 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-17Ger rid of some #defines in Android font code.chromium/3528chromium/3527Lei Zhang
Change-Id: Ia3f98fb166743c2a38954b279e3bbf96e5e09073 Reviewed-on: https://pdfium-review.googlesource.com/40591 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-17Get rid of CFPF_SkiaFont::InitFont().Lei Zhang
Initialize via the ctor instead. Also fix refcounting for the class, so the refcount does not go negative for invalid fonts. Change-Id: I5cf51ae9051f5fc5e0204193d18f8eb37b34c244 Reviewed-on: https://pdfium-review.googlesource.com/40590 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-08-17Encapsulate CFPF_SkiaPathFont members.Lei Zhang
Use ByteString instead of char* for string data. Change-Id: I28dee8f3544b8b85ea46f2e8bc84249f32e368a0 Reviewed-on: https://pdfium-review.googlesource.com/40570 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-17Use more UnownedPtr<> in cpdf_renderstatus.h.chromium/3526Tom Sepez
This immediately flags a case where a pointer from a heap object to a caller's stack object is persisted past the caller's lifetime. Fix it the simplest way via AutoRestorer<> so we'll get a nice safe segv should it be used. Change-Id: I554304b235e73c279fa0cd79c9e3ee0138be45f9 Reviewed-on: https://pdfium-review.googlesource.com/40592 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-17Change CFPF_SkiaFontMgr::m_FontFaces to store unique_ptrs.Lei Zhang
Instead of raw pointers. Change-Id: Ie46af37bbe3fe287bdff25249afaeb90589c85b3 Reviewed-on: https://pdfium-review.googlesource.com/40552 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-08-17Remove CFPF_SkiaFontDescriptor.Lei Zhang
CFPF_SkiaFontDescriptor only has a single subclass. Merge it with the subclass. Change-Id: I26d19ee527c010d2d69acd820d8acc9634b12239 Reviewed-on: https://pdfium-review.googlesource.com/40551 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-17Add FPDFText_GetFontInfoNicolas Pena
Bug: pdfium:929 Change-Id: I9da03a1e317cff69ec4c76b69289cfa753b6bb77 Reviewed-on: https://pdfium-review.googlesource.com/40531 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-08-17Remove CFPF_SkiaBufferFont and CFPF_SkiaFileFont.Lei Zhang
The classes are never instantiated. Change-Id: I108d3c397464e50b337bc46702d4adbc263e8814 Reviewed-on: https://pdfium-review.googlesource.com/40550 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-17Remove default arguments from CFPF_SkiaFontMgr.Lei Zhang
Fix some nits as well. Change-Id: Idfe3e737bc737fe4ad42581aa735398fdc0ebab5 Reviewed-on: https://pdfium-review.googlesource.com/40510 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-16Remove optional bool bType from GetFillArgb()Tom Sepez
Two variants make the intention much clearer. Change-Id: Ied0d8e6fa8c5524c19cafe8036d7c1b470fda86d Reviewed-on: https://pdfium-review.googlesource.com/40352 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>