summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/fx_codec_flate.cpp
AgeCommit message (Collapse)Author
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-07-25Remove some ASSERT (and cast) in favor of checked cases.Tom Sepez
Because it is a stronger pattern at runtime. These were found by essentially: grep -ni '\bassert\b.*type' Change-Id: I913d77139053e8980528597a6633e1859e5204c4 Reviewed-on: https://pdfium-review.googlesource.com/38890 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-06-28Use spans and std::unique_ptrs in fx_codec_flate.cppTom Sepez
Also avoid needless use of void* in place of actual type. Also free context with free function corresponding to its allocator, in case the m_ functions change down the road. Change-Id: I384f6b309c2522eb0faafbe73b94cc3bf582dbb8 Reviewed-on: https://pdfium-review.googlesource.com/36370 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-05-08Split CCodec_FlateScanlineDecoder in two.Lei Zhang
Move the predictor code into the CCodec_FlatePredictorScanlineDecoder sub-class. Change-Id: I5a56ba5e051cf55e8fdd039bd38089684ed257be Reviewed-on: https://pdfium-review.googlesource.com/31272 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-05-08Move CalculatePitch8() to core/fxcodec.Lei Zhang
Use it in more places there. Change-Id: I477670a5946ec9033ad5f2bef0fbcddb52682066 Reviewed-on: https://pdfium-review.googlesource.com/31271 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-25Use PredictorType in more places.Lei Zhang
Change-Id: Ifbacab2868232a5597ef782fb24a749ebb4871bf Reviewed-on: https://pdfium-review.googlesource.com/31270 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-25Clean up CCodec_FlateScanlineDecoder.Lei Zhang
- Merge Create() with the ctor. - Initialize all member variables and mark them const when possible. - Add an enum class for the predictor type. - Move it into an anonymous namespace. Change-Id: If7bb62ddf4a4e00ec2d02355e7c178028a7c187c Reviewed-on: https://pdfium-review.googlesource.com/31233 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-04-25Remove unused PNGEncode() code.Lei Zhang
BUG=pdfium:41 Change-Id: I98070a5a6c88a0769f2b571eae4fe62092f7dfcd Reviewed-on: https://pdfium-review.googlesource.com/31232 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-03Re-arrange so inline vectors come last in structs.Tom Sepez
This might make the memory tools more effective in finding OOBs. Change-Id: Id093bb0a88c37954c80d612ac00b5a168e75bdbf Reviewed-on: https://pdfium-review.googlesource.com/29550 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-02-05Limit dest buffer to 1GB in FlateOrLZWDecode.Henrique Nakashima
Bug: chromium:802094 Change-Id: I99d2d75cd431afe1cdb966e1431143ab43dd9a73 Reviewed-on: https://pdfium-review.googlesource.com/24730 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-12-01Get rid of else after break/continue/return.chromium/3284chromium/3283Lei Zhang
Change-Id: I3efc57cd7325d16e3ca8ebdeeaec06012b2c56e3 Reviewed-on: https://pdfium-review.googlesource.com/20110 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@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-08Fix an off by 1 error in TIFF_PredictLine().chromium/3212Lei Zhang
BUG=chromium:762106 Change-Id: I714d69320cc4fb81d535f811c18d4ef91fec44d3 Reviewed-on: https://pdfium-review.googlesource.com/13212 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-06-20Cleanup fpdf_parser_decodeNicolas Pena
This CL fixes some nits in fpdf_parser_decode, especially avoiding non-const reference parameters. Change-Id: Ibb914850afd924bb398f886ac862f7589519ef7e Reviewed-on: https://pdfium-review.googlesource.com/6750 Commit-Queue: Nicolás Peña <npm@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-04-20Revert "core: allow building against system zlib"dsinclair
This reverts commit 36c5b170e722362d4b5f7cb6e4e0099ed227a307. Reason for revert: This appears to be blocking the roll into Chromium. https://chromium-review.googlesource.com/c/476165/ Original change's description: > core: allow building against system zlib > > In a way similar to the existing USE_SYSTEM_LIBJPEG. The default is of > course still the DEPS-based zlib checkout. > > Change-Id: I649e75beb1a19c4cf7abda42fa10ebe5babfe946 > Reviewed-on: https://pdfium-review.googlesource.com/4070 > Reviewed-by: Lei Zhang <thestig@chromium.org> > Commit-Queue: Lei Zhang <thestig@chromium.org> > TBR=thestig@chromium.org,dsinclair@chromium.org,npm@chromium.org,vmiklos@collabora.co.uk,pdfium-reviews@googlegroups.com # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: I1ee6fb002f444ff9b559ce6a69679e63de7ff9cc Reviewed-on: https://pdfium-review.googlesource.com/4393 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-20Cleanup the fx_extension code.Dan Sinclair
This CL cleans up the fx_extension file. The stream code was moved to fx_stream. IFX_FileAccess was removed and CFX_CRTFileAccess split to its own file. Code shuffled from header to cpp file. Change-Id: I700fdfcc9797cf4e8050cd9ba010ad8854feefbf Reviewed-on: https://pdfium-review.googlesource.com/4371 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-13core: 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. Change-Id: I649e75beb1a19c4cf7abda42fa10ebe5babfe946 Reviewed-on: https://pdfium-review.googlesource.com/4070 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-04-07Remove the "old way" of performing FlateUncompress.Tom Sepez
Repeated looping over Realloc() with a linearly increasing buffer size is going to be O(N^2) which is why it was limited to small cases. But it's wrong to do it anyways, and it kicks out a lurking issue in PartitionAlloc as it turns out. See https://crbug.com/709271, but this doesn't actually fix that issue, it just avoids it. Change-Id: I39d8f8df0d5fc358b7b9caa15c507a8f57e45004 Reviewed-on: https://pdfium-review.googlesource.com/3910 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-04-03Drop FXSYS_ from mem methodsDan Sinclair
This Cl drops the FXSYS_ from mem methods which are the same on all platforms. Bug: pdfium:694 Change-Id: I9d5ae905997dbaaec5aa0b2ae4c07358ed9c6236 Reviewed-on: https://pdfium-review.googlesource.com/3613 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-03Drop FXSYS_ from math methodsDan Sinclair
This Cl drops the FXSYS_ from math methods which are the same on all platforms. Bug: pdfium:694 Change-Id: I85c9ff841fd9095b1434f67319847ba0cd9df7ac Reviewed-on: https://pdfium-review.googlesource.com/3598 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-31Move zlib to a DEPS-based checkout.Lei Zhang
BUG=chromium:541704 Change-Id: I313d8853450ff5940b3baa4054ff441b342c46b7 Reviewed-on: https://pdfium-review.googlesource.com/3350 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-30Add some calls to MakeUniqueDan Sinclair
This CL replaces some new's with pdfium::MakeUnique. Change-Id: I50faf3ed55e7730b094c14a7989a9dd51cf33cbb Reviewed-on: https://pdfium-review.googlesource.com/3430 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-27Update to zlib 1.2.11Adenilson Cavalcanti
This is the same version used by Chromium (as also the latest release of zlib). BUG=687631 Change-Id: Ia4bcdee3c36443ba01914d157ea795d7fb881a45 Reviewed-on: https://pdfium-review.googlesource.com/3096 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-15Refactor some CPDF_ColorSpace code.Lei Zhang
Change-Id: I1e30d68dae3bf70cf3c426f6126d593b7f1c3ba4 Reviewed-on: https://pdfium-review.googlesource.com/2991 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-03-07fx_codec_flate code cleanup.chromium/3035Dan Sinclair
This CL cleans up the namespacing along with some type confusion in the flate codec class. Change-Id: I4772ee571bcd78f1c839b5cefc370860aca06bb3 Reviewed-on: https://pdfium-review.googlesource.com/2917 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-06Check size before writtingchromium/3033dan sinclair
Before writting to the stream buffer make sure that we won't walk off the end of the allocated size. In this specific case the dest_size of the buffer is 0, so we're basically just looping over to free the temp results. BUG=chromium:697847 Change-Id: I229eea96179692216cb2685facbb7d5379c501c7 Reviewed-on: https://pdfium-review.googlesource.com/2903 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-01-09Remove CFX_ArrayTemplate from fpdftext and fxcodec.tsepez
Remove unused m_Segments. Review-Url: https://codereview.chromium.org/2618863004
2016-12-13Return unique_ptr<>s from fxcodec/chromium/2951tsepez
Review-Url: https://codereview.chromium.org/2572843002
2016-11-02Remove FX_BOOL from coretsepez
Review-Url: https://codereview.chromium.org/2477443002
2016-09-29Move core/fxcrt/include to core/fxcrtdsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2382723003
2016-09-29Move core/fxcodec/codec/include and core/fxcodec/include files updsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2381063002
2016-06-16Remove unused code.dsinclair
This cl removes code that exists but is never called. This includes: * cfwl_formtp * cfwl_widgetdelegate * cfwl_scrollbar * cfwl_theme * cfwl_tooltip * PWL_Label * PWL_ListCtrl * PWL_Signature * PWL_IconList * BC_ResultPoint * BC_CommonPerspectiveTransform * BC_CommonBitSource * BC_PDF417Codeword * fx_codec_flate.h (the .cpp file still exists) Review-Url: https://codereview.chromium.org/2071953002
2016-06-07Get rid of NULLs in core/thestig
Review-Url: https://codereview.chromium.org/2032613003
2016-06-06Remove unused PS generation code.thestig
CFX_PSRenderer, IFX_PSOutput, CPSOutput, CPSPrinterDriver. Also reland commit 2d63eaa. Review-Url: https://codereview.chromium.org/2019603002
2016-05-11Replace some calls to Release() with direct delete, part 1.tsepez
Searching for the anti-pattern: void Release() { delete this; } We must be explicit on the ownership model. Add unique_ptrs as a result. Review-Url: https://codereview.chromium.org/1960673003
2016-04-12Remove ICodec_* Interfaces.dsinclair
All of the ICodec_* interfaces had a single implementation. This CL removes the interfaces and uses the concrete classes in their place. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1876023003
2016-04-06Move include/fxcodec to fxcodec/includedsinclair
Review URL: https://codereview.chromium.org/1864153002
2016-04-05Remove dead image decoding/caching code.thestig
Review URL: https://codereview.chromium.org/1860223002
2016-03-28Reduce signed/unsigned comparison warningsWei Li
The warnings generated by Clang. This is part 1 for some simple cases. BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1840483003 .
2016-03-25Remove FX_DWORD from core/ and delete definitionchromium/2695chromium/2694chromium/2693chromium/2692tsepez
Review URL: https://codereview.chromium.org/1832173003
2016-03-21Remove FX_WORD in favor of uint16_t.Tom Sepez
It isn't buying us anthing, and it looks strange in a struct when other uint types are already present. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1821043003 .
2016-03-21Re-enable several MSVC warningsWei Li
Re-enable the following warnings: 4245: signed/unsigned conversion mismatch; 4310: cast may truncate data; 4389: operator on signed/unsigned mismatch; 4701: use potentially uninitialized local variable; 4706: assignment within conditional expression Clean up the code to avoid those warnings. BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1801383002 .
2016-03-14Move core/src/ up to core/.Dan Sinclair
This CL moves the core/src/ files up to core/ and fixes up the include guards, includes and build files. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1800523005 .