summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2017-11-30Run clang-tidy modernize-use-equals-{delete,default} on //third_party/pdfiumDan Sinclair
See the bugs and cxx post for justification and details: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8 This change was done using clang-tidy as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md In some cases the the tool leaves behind a string of commas where it replaced a member initializer list (https://bugs.llvm.org/show_bug.cgi?id=35051). They were cleaned up with: git diff --name-only | \ xargs sed -E -i 's/(^\s*|\)\s*):[ ,]*= default/\1 = default/' Bug: chromium:778959, chromium:778957 Change-Id: I23e60d3d6c8bc9e8574d425710a0441cb5510d6b Reviewed-on: https://pdfium-review.googlesource.com/19970 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-29Allow building pdfium against the system version of libpng.Andrew Weintraub
Bug: Change-Id: I0c930ca30637f58af3b60ed8f1383bd9234a1723 Reviewed-on: https://pdfium-review.googlesource.com/19850 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-11-29Remove CollectionSize from fx_bidiDan Sinclair
Bug: pdfium:774 Change-Id: I2056583c270f1bb0046250ce2ec53a2cbe46b893 Reviewed-on: https://pdfium-review.googlesource.com/19672 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-29Remove unneded structs from CFX_CTTGSUBTable part 1Nicolas Pena
This CL removes some useless structs from CFX_CTTGSUBTable. Change-Id: Iaf8b58d70b36d77fea73946c6b4279b15f5726e8 Reviewed-on: https://pdfium-review.googlesource.com/19710 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-28Remove CollectionSize from string_view_templateDan Sinclair
Bug: pdfium:774 Change-Id: Id993864c4ae009e686c62e7be13e2db5d8cb4170 Reviewed-on: https://pdfium-review.googlesource.com/19572 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-28Remove CollectionSize from JBig2_ContextDan Sinclair
Bug: pdfium:774 Change-Id: Ie7674ac55dea6284a0d974cef107ef357197a06b Reviewed-on: https://pdfium-review.googlesource.com/19610 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-11-27Make ConvertBuffer_* voidchromium/3279Nicolas Pena
This CL makes the helper methods 'ConvertBuffer_'* in CFX_DIBSource void since they always succeed. Change-Id: I55dd714bec5ccc3695cd0bbebcf978d767acc53a Reviewed-on: https://pdfium-review.googlesource.com/19650 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-27Convert CFX_GifContext::GetFrameNum to size_tDan Sinclair
This CL removes the CollectionSize and updates call locations as needed. Bug: pdfium:774 Change-Id: I813c500b3a17a194407ceb1304252b9b16fe1779 Reviewed-on: https://pdfium-review.googlesource.com/19590 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-11-27Convert CPDF_StructTree to size_tDan Sinclair
This CL removes the use of CollectionSize from CPDF_StructTree and uses size_t in the callers. Bug: pdfium:774 Change-Id: I860a51a533642c949c497ca26e74ba064a8aa9ba Reviewed-on: https://pdfium-review.googlesource.com/19530 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-27Change FPDF_GetText to return "" when asked to get 0 charactersRyan Harrison
BUG=chromium:788103 Change-Id: I8ebdbc78eb14c358d7ac019b96de4828e6071b79 Reviewed-on: https://pdfium-review.googlesource.com/19350 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-27Prepend ++ in CFX_DIBSourceNicolas Pena
In this CL, we do some nit cleanup and change many var++ to ++var in CFX_DIBSource. Change-Id: I2379e6e15688cbde68415adc47b01114ad0785c1 Reviewed-on: https://pdfium-review.googlesource.com/19570 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-27Convert CPDF_StructElement::CountKids to size_tDan Sinclair
This CL changes CountKids to not used CollectionSize and returns size_t directly. Callers updated as needed. Bug: pdfium:774 Change-Id: I8862218e62cd13be9473fa8116afd29cd3afde04 Reviewed-on: https://pdfium-review.googlesource.com/19510 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Remove CollectionSize from CPDF_RenderStatusDan Sinclair
Bug: pdfium:774 Change-Id: I4996f5526884c33d92df964045bd5467c392df5e Reviewed-on: https://pdfium-review.googlesource.com/19490 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Remove CollectionSize from CPDF_CharPosListDan Sinclair
Bug: pdfium:774 Change-Id: I7ebbcb17374b4117f92b94edbd8bcba18efe6313 Reviewed-on: https://pdfium-review.googlesource.com/19470 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Remove CollectionSize from FPDF_DataDecodeDan Sinclair
Bug: pdfium:774 Change-Id: I3fcde6fba46d21affa63d79fab2d83f47c9c5f84 Reviewed-on: https://pdfium-review.googlesource.com/19450 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-27Convert CPDF_TextObject to not use CollectionSizeDan Sinclair
This CL updates various methods in CPDF_TextObject to return or received size_t values. Callers have been updated as needed. Bug: pdfium:774 Change-Id: Id72511bc74637c6261add39f5414c9a4b8390b82 Reviewed-on: https://pdfium-review.googlesource.com/19430 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-11-27Convert CPDF_ClipPath::Get{Path|Text}Count to size_tDan Sinclair
This CL updates the various call sites to use size_t instead of other types. Bug: pdfium:774 Change-Id: Id8b75728b61c0ca1b15bc815831c885d33374f7b Reviewed-on: https://pdfium-review.googlesource.com/19410 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-27Remove use of CollectionSize from CPDF_CMapParserDan Sinclair
Bug: pdfium:774 Change-Id: Ie24d0741f8c8d7988166aeb4b9ce87491993d30c Reviewed-on: https://pdfium-review.googlesource.com/19390 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-22Call FreeLibrary() in CGdiplusExt.chromium/3276Lei Zhang
BUG=pdfium:939 Change-Id: I4204965bd8b81bea3c485fcb27adfa212cce4e69 Reviewed-on: https://pdfium-review.googlesource.com/19190 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-22Change CPDF_ContentMark to return size_t for counts.Lei Zhang
Change-Id: I45468fa7944290fbbe3d2e67f884164ae8d84160 Reviewed-on: https://pdfium-review.googlesource.com/19171 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-22Remove dead CPDF_ContentMark code.Lei Zhang
Change-Id: Ic552a652856ca231f3d2077c76a20d5916adb3c1 Reviewed-on: https://pdfium-review.googlesource.com/19170 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-22Remove some pointless assignments to "".Lei Zhang
Or change them to clear(). Change-Id: Ia9e3e1f0d74b948cec3f8df85d205f830ac9216c Reviewed-on: https://pdfium-review.googlesource.com/19172 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-21Avoid passing pointers by reference in core.Lei Zhang
This gets rid of most core/ non-const ref passing, either by passing by pointer-to-pointer instead, or by returning std::pair. Change-Id: Id7bdc355a1a725a05f9fa2f1e982ca8c975beef1 Reviewed-on: https://pdfium-review.googlesource.com/19030 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-21Add {Byte/Wide}String::Trim().Lei Zhang
So callers no longer have to call str.TrimLeft(); str.TrimRight(); Change-Id: If931eaa8d891f487b9618ebbeee5ee294e807846 Reviewed-on: https://pdfium-review.googlesource.com/18990 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-16Convert CFX_DateTime::Now to be staticchromium/3272Dan Sinclair
This CL converts the CFX_DateTime::Now method to be a static and updates the callers. Change-Id: I26052c6194ed2d43bca5fee2542787ce166eda85 Reviewed-on: https://pdfium-review.googlesource.com/18670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-16Convert ByteString::{Format|FormatV} to static methodsDan Sinclair
This CL moves the Format and FormatV methods of ByteString to be static. Bug: pdfium:934 Change-Id: I9c30455a789aff9f619b9d5bf89c0712644f2d9a Reviewed-on: https://pdfium-review.googlesource.com/18650 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-16Make WideString::{Format|FormatV} staticDan Sinclair
This CL moves the Format and FormatV methods from WideString to be static. Bug: pdfium:934 Change-Id: I9941d6a2a5bbf0a82087cd0ea5d0f8fc42eecd3e Reviewed-on: https://pdfium-review.googlesource.com/18630 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-16Refactor CFGAS_FontMgr's Windows implementationNicolas Pena
This CL unifies a bit the public methods of CFGAS_FontMgr. It does so by replacing the multiple maps on the Windows implementation to a single map from hash to font. Also, cloning CFX_Fonts is avoided with the use of SetLogicalFontStyle. These Windows changes are just mimicking other OS's. As a side-effect, some members of CFX_Fonts are now owned so the raw pointers are replaced with unique_ptrs. Change-Id: I576d438572ccbe6c48f8f5cc434d66fc6adba372 Reviewed-on: https://pdfium-review.googlesource.com/18131 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-14Move CXFA_FileRead out of XFA and renameRyan Harrison
This code doesn't depend on XFA, but is only used by it. Moving it out, so it will be easier for me to write some tools for extracting data out of PDFs. Bug: Change-Id: Ic18613b46abed5124c47f539833b01b12c1c6e56 Reviewed-on: https://pdfium-review.googlesource.com/18410 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-11-13Check first page number in IsLinearizedHeaderValid().Lei Zhang
This should allow https://pdfium-review.googlesource.com/15770 to safely reland. BUG=chromium:781529 Change-Id: Id0c1bde3280fb72125d8e74751b9a1cb35302b6f Reviewed-on: https://pdfium-review.googlesource.com/18170 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-10Check for decoder completeness in CJBig2_GRRDProcNicolas Pena
This CL adds checks in CJBig2_GRRDProc to verify if the decoder is completed before trying to decode. This is currently done in all decoding calls in CJBig2_GRDProc. Bug: chromium:782826 Change-Id: Ifb4ee4d09e8357e969aefa107b4dafbc2284324b Reviewed-on: https://pdfium-review.googlesource.com/18333 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-10Stop using m_SavedPage in embedder tests.chromium/3265Henrique Nakashima
Change-Id: Id53f57085fecfe331c8cbfa6bb372b5ea5044442 Reviewed-on: https://pdfium-review.googlesource.com/18332 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-11-09Rename some methods in CJBig2_Contextchromium/3264Nicolas Pena
This CL improves some method names and does other basic cleanup. Change-Id: I32ea88ff29383e9685d4c686625088c96f73f035 Reviewed-on: https://pdfium-review.googlesource.com/18210 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-08Make most CPDF_LinearizedHeader members const.chromium/3263Lei Zhang
Change-Id: I82907ad725861b9ccd6299f5dfe20ddb9d238178 Reviewed-on: https://pdfium-review.googlesource.com/17796 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-08Prevent cyclic offset on CJBig2_ContextNicolas Pena
This CL changes the type of |m_dwOffset| to safe unsigned integer to prevent the offset from cycling from MAX_UINT32 back to 0. Bug: chromium:778912 Change-Id: Ib93a8392e52eecf2cc223438ac85e9dc529b0f43 Reviewed-on: https://pdfium-review.googlesource.com/18130 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-08Fix FPDF_SaveAsCopy for linearized PDFs.Henrique Nakashima
Only the last trailer was written to the new PDF. In linearized PDFs, this means Info and Root were not copied to the newly written PDF. This CL makes CPDF_Parser remember the Root and provide that to CPDF_Creator. Bug: pdfium:614 Change-Id: Ia61f5f6a337f7de3010ee0ed39b022c1b2732ea2 Reviewed-on: https://pdfium-review.googlesource.com/17987 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-11-08Make sure that iterator stays in bounds during IsHypenRyan Harrison
BUG=chromium:782596,chromium:781804 Change-Id: I020be3cf813221bb8314f045d83014a25cb9a950 Reviewed-on: https://pdfium-review.googlesource.com/18070 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-08Use MaybeOwned in CPDF_ContentParserNicolas Pena
Change-Id: I7e5daeafd70ef29bcc9bdebbae004fa4b946b83d Reviewed-on: https://pdfium-review.googlesource.com/18019 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-07Revert cleanup of IsHyphen and reimplementRyan Harrison
The original version of this code was landed in https://pdfium-review.googlesource.com/c/pdfium/+/13690/. A corner case has been found that breaks. In this CL I have reverted the changes in IsHyphen and implemented a less aggressive cleanup that I have tested works as expected. BUG=chromium:781804 Change-Id: I3b36f420834081fdd9e1ae17efc234b561b4df41 Reviewed-on: https://pdfium-review.googlesource.com/17950 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-07Use MaybeOwned in CJBig2_ImageNicolas Pena
Change-Id: Id53cbb8c95f6eb929f6e4eb57333daa24f1b776f Reviewed-on: https://pdfium-review.googlesource.com/18010 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-07Remove m_bFlagExact from CFX_SubstFontNicolas Pena
This CL removes the single use case from |m_bFlagExact|. This flag allows the PDF viewer to treat a substitute font with a matching name as if it was actually an embedded font, which is wrong. For all substitute fonts, it is important to follow the longer process of first obtaining the unicode from the charcode to then obtain the glyph in the substitute font that corresponds to that unicode. Bug: chromium:781785 Change-Id: Ie5958b43914e0e46334b89b7c2c55c02d0da0c11 Reviewed-on: https://pdfium-review.googlesource.com/17859 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2017-11-07Simplify CPDF_ContentParser.Lei Zhang
Do more work in the ctor instead of a separate Start() method. Adjust callers and member variables accordingly. Change-Id: I310f27b3102a89e8e7b7ad31affd174f1fbbe500 Reviewed-on: https://pdfium-review.googlesource.com/17793 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-07More FX_SAFE_INT32 in CJBig2_TRDProcNicolas Pena
Bug: chromium:781780 Change-Id: Ie92d8b570c37e9b3364d1ff4502f444a275ee6c2 Reviewed-on: https://pdfium-review.googlesource.com/17910 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-07Change CPDF_PSProc::AddOperator() to do binary search.Lei Zhang
Change-Id: If64a8410c992d5c7bd6504367f11ce946c1ef6aa Reviewed-on: https://pdfium-review.googlesource.com/17871 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-07Remove unused parameter from ByteString::FormatFloat().Lei Zhang
Nobody sets |precision| and the method does not read it either. Change-Id: I0f45fe953c005f817d331cbf73e38f7b15a77b81 Reviewed-on: https://pdfium-review.googlesource.com/17890 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-06Add a CPDF_PSEngine test.Lei Zhang
Change-Id: Ia267f40dc4ebe9e1d28b6a333eddcff749414ffa Reviewed-on: https://pdfium-review.googlesource.com/17870 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-06Improve ByteString{View}::operator<().Lei Zhang
Make it possible to compare: 1) const char* < ByteStringView 2) ByteString < const char* 3) ByteString < ByteStringView 4) const char* < ByteString Do the same for WideString{View}. With new unit test cases. Change-Id: I31da526b1ab78b8d51ec1c99bf29046fe13754d5 Reviewed-on: https://pdfium-review.googlesource.com/17872 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-06Mark string pointers as const in string unit tests.Lei Zhang
Change-Id: I4895ee9c0cbe1aaf1fe9913d39ce11e6ad855dd3 Reviewed-on: https://pdfium-review.googlesource.com/17873 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-06Remove C-style casts in CPDF_PSEngine.Lei Zhang
Fix a few other nits. Change-Id: I12f79b3f83d1695957ba067291f2ee03a7d189ca Reviewed-on: https://pdfium-review.googlesource.com/17810 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-06Revert "Simplify CPDF_HintsTable."dsinclair
This reverts commit 33591752d2cb14f2e07726ca52afce6efbdc07c9. Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=781529 Original change's description: > Simplify CPDF_HintsTable. > > Use CPDF_LinearizedHeader directly. > > Change-Id: Id12402ef6e6f92fef68d0932df2e1ccb2dcf06aa > Reviewed-on: https://pdfium-review.googlesource.com/15770 > Reviewed-by: Lei Zhang <thestig@chromium.org> > Commit-Queue: Lei Zhang <thestig@chromium.org> TBR=thestig@chromium.org,tsepez@chromium.org,art-snake@yandex-team.ru # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: Idaf8d4c91e869d92b44211cfe48f162037ed7327 Reviewed-on: https://pdfium-review.googlesource.com/17830 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>