Age | Commit message (Collapse) | Author |
|
Introduce const/non-const versions of method where required.
Part of the war on const_cast<>. Tidy one expression to use []
instead of .data().
Change-Id: I41e45669c79eee242ff2244c7dc3afcf6386a433
Reviewed-on: https://pdfium-review.googlesource.com/39852
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Because I saw one in some other code and decided to hunt them all.
These are all defined in C++ context, so no chance of C compatiblity.
Note that such a declaration without a struct tag will bypass the
[chromium-style] out-of-line constructor/destructor warnings, so
add constructors/destructors where required.
Change-Id: Ib821d8bc2f68ccf7028b0f73432e8e7c93a953ba
Reviewed-on: https://pdfium-review.googlesource.com/39851
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
There's a missing const in a qualifier in the third party FT library
header, so rather than casting on every invocation, consolidate these
into our wrapper macro. This may be easier to remove should the API
ever get corrected.
Part of the war on const_cast<>.
Change-Id: I80cdb220730f40297e54aee10acc8bbd2c983b6d
Reviewed-on: https://pdfium-review.googlesource.com/39850
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: I1d5e3e73804efb0a8ed467d29777d017935a8824
Reviewed-on: https://pdfium-review.googlesource.com/39833
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Remove a bunch of const_cast<uint8_t*> or equivalent. This will also
help when we convert to span<>, since casting spans is a nuisance.
Change-Id: I330e5041cbaf33a84425fc4242a3dfacf5ca8011
Reviewed-on: https://pdfium-review.googlesource.com/39831
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Turns out that "FromUnicode" is misleading in that, on linux, it simply
removes any characters beyond 0xFF and passes the rest unchanged, so
no unicode decoding actually takes place. On Windows, it passes it into
the system function specifying FX_CODEPAGE_DefANSI, converting it into
the so-called "default ANSI code plane", passing some characters,
converting others to '?' and still others to 'A'. Either way, nothing
resembling UTF8 comes out of this, so pick a better name.
These now immediately look suspicious, so a follow-up CL will see
which ones should really be WideString::UTF8Encode() instead.
Making this a normal method on a widestring rather than a static
method on a bytestring feels more natural; this is parallel to
the UTF8Encode and UTF16LE_Encode functions.
Add a test that shows these conversions.
Change-Id: Ia7551b47199eba61b5c328a97bfe9176ac8e583c
Reviewed-on: https://pdfium-review.googlesource.com/39690
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: Id52bb57efea2a6a46bea645e4f3e54957982a40b
Reviewed-on: https://pdfium-review.googlesource.com/39154
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
BUG=chromium:751423
Change-Id: I2fcc46b80e89cb651e255bd1fd2d6883a05cf9c7
Reviewed-on: https://pdfium-review.googlesource.com/39153
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
The SkColorSetARGBInline alias was removed, use simply SkColorSetARGB
instead.
Bug: pdfium:11
Change-Id: I8636e305cf938df9427d01a6ca63b3d492a087f3
Reviewed-on: https://pdfium-review.googlesource.com/38252
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Change-Id: I6fa3fd93638bc3aeaaef854676fe31476888433b
Reviewed-on: https://pdfium-review.googlesource.com/37671
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Fix some {} along the way.
Change-Id: I5277c03328b63e0cead058fc07dc65311d7b97b0
Reviewed-on: https://pdfium-review.googlesource.com/36791
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
These appear in compile-time const data. Adding the comment makes
it easier to see what work remains when using grep.
Change-Id: Ibb5fe920dc9fc99dd4c866f9ddf800a58f6a67a8
Reviewed-on: https://pdfium-review.googlesource.com/36690
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Bug: chromium:853430
Change-Id: I1c42de1e3db10dfb6399cd8abdd13c56addc8827
Reviewed-on: https://pdfium-review.googlesource.com/35850
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Skia is moving to normalize on std::swap instead of its own SkTSwap.
This removes the use of SkTSwap from PDFium so that Skia can remove it.
Change-Id: If77708c1f363f4fd82a4c7905c7fbb2060900532
Reviewed-on: https://pdfium-review.googlesource.com/35470
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Bug: pdfium:177
Change-Id: I63f2e7579de37f52fd67f02988d72de7e1b3c7ba
Reviewed-on: https://pdfium-review.googlesource.com/35111
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
The callers are all in blocks controlled by the same ifdef.
Change-Id: I2bf1dfd8725eefcfab5b05460fc31b0e7e08c75e
Reviewed-on: https://pdfium-review.googlesource.com/35090
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
This landed earlier as part of a larger change that got reverted for
unrelated reasons. Now re-land it by itself. See
https://pdfium-review.googlesource.com/c/pdfium/+/33370
The current code could cause FT to try to free memory allocated by the
caller, with potentially a different allocator. It appears that this may
have been added ages ago as a way to kludge around a leak. If we're
leaking, msan will find it, and we can deal with it properly rather
than trying to force FT to tidy after us.
Change-Id: I20abf4cd35d465de1f435ebe6d94b10c3ff74002
Reviewed-on: https://pdfium-review.googlesource.com/34930
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
This reverts commit 38cb7263a0923dd5613da24b18d3d7ef052ff5e3.
Reason for revert: Blocking prior revert.
Original change's description:
> Remove more ifndef XFA cases
>
> Remove FXFT_Clear_Face_External_Stream() calls, period. This would cause
> FT to try to free memory allocated by the caller, with potentially a
> different allocator. If we're leaking, msan will find it, and we can
> deal with it properly rather than trying to force FT to tidy after us.
>
> Always call SetView(), if we have a PDF page. At worst, the link won't
> be used in the XFA case.
>
> Always return 0 for the null document permissions. If we don't have a
> document, then we can't dynamically tell if its an XFA doc, so there's
> no reason to believe it should have all permissions. If there is an
> XFA doc under the covers, then the extension will give us the value.
>
>
> Change-Id: I6e3fb589eda722786567d96288cb35f43643437b
> Reviewed-on: https://pdfium-review.googlesource.com/33370
> Commit-Queue: Tom Sepez <tsepez@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
TBR=thestig@chromium.org,tsepez@chromium.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I68b6a50ef28fb3d6ab9d8494c4486ca9fb66589e
Reviewed-on: https://pdfium-review.googlesource.com/33734
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Remove FXFT_Clear_Face_External_Stream() calls, period. This would cause
FT to try to free memory allocated by the caller, with potentially a
different allocator. If we're leaking, msan will find it, and we can
deal with it properly rather than trying to force FT to tidy after us.
Always call SetView(), if we have a PDF page. At worst, the link won't
be used in the XFA case.
Always return 0 for the null document permissions. If we don't have a
document, then we can't dynamically tell if its an XFA doc, so there's
no reason to believe it should have all permissions. If there is an
XFA doc under the covers, then the extension will give us the value.
Change-Id: I6e3fb589eda722786567d96288cb35f43643437b
Reviewed-on: https://pdfium-review.googlesource.com/33370
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: I71417cc5b1bd00f77d42740198cc17487ebd686e
Reviewed-on: https://pdfium-review.googlesource.com/33330
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
|
|
Commit 2334660 changed the |dest_width| in CFX_Font::AdjustMMParams to
unsigned, but this means that dest_width - min_width becomes unsigned,
which is wrong because the subtraction could be negative. This CL fixes
this bug.
Bug: chromium:845697
Change-Id: I88fb2f3ee3837d80ff5fa70a08309d9e0fec50e0
Reviewed-on: https://pdfium-review.googlesource.com/33150
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Currently the value passed in via the flag is ignored on Mac. This
implements the needed logic to use the given path instead of the
standard system font directories.
BUG=pdfium:1094
Change-Id: I2a0599ce8c784add75d36089dee5e4b5476c3d3d
Reviewed-on: https://pdfium-review.googlesource.com/33090
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
The callers always pass in a valid CFX_Matrix, so eliminate the
possibility of a nullptr.
Change-Id: Id7d8b731ed60d5f66517b50c56efeca343e897c4
Reviewed-on: https://pdfium-review.googlesource.com/33152
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
ArgbEncode() does the same thing.
Change-Id: Ibb05ed4aae720c0a5ba66771699c0d7e11230921
Reviewed-on: https://pdfium-review.googlesource.com/32230
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
This is a manual revert of the CL at:
https://pdfium-review.googlesource.com/c/pdfium/+/32159
The only file manually changed was cpdf_renderstatus.cpp
Reason for revert: the bug below shows that sometimes the vector size
used is larger than the parameter given to CFX_FixedBufGrow. Thus, we
will revert, then add vectors using std::max unless it's clear from the
code that the code will never access indices outside.
Bug: chromium:847247
Change-Id: Iee54af023c8564824418a7d34a6385b0bc418ff0
Reviewed-on: https://pdfium-review.googlesource.com/33050
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
Abstract GetUserPermissions() differences via new virtual method.
Abstract GetPageCount() differences via existing virtual method.
Remove unused ReadHeader() form for non-xfa.
Remove unused FindSubstFontByUnicode() for xfa.
Remove unused FXFONT_EXACTMATCH
Change-Id: I0a3de01a9841db86fcbc96991d3fa2682393b9ad
Reviewed-on: https://pdfium-review.googlesource.com/32831
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
BUG=pdfium:234
Change-Id: I5c900aa0547afef0c60de35422b4ee489daa6cfb
Reviewed-on: https://pdfium-review.googlesource.com/32913
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: Id7bf252ebe25c92d26065d1138a445ebb2f78d0b
Reviewed-on: https://pdfium-review.googlesource.com/32187
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Replace it with CFX_BitStream.
Change-Id: Ib74657f888b8dec8b6fdad7b49e28d250991c590
Reviewed-on: https://pdfium-review.googlesource.com/32852
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Also make destructors private for RetainPtr sub-classes, and add missing
destructors.
Change-Id: I451bf0aae2dae943b1f450d0aa4ca5124dc578fd
Reviewed-on: https://pdfium-review.googlesource.com/32853
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Commit 10e1f05a incorrectly removed a font weight sanitizing step in the
font substitution code.
BUG=chromium:820345
Change-Id: I876f65a5649270648616f561eaad17ee333b9a9e
Reviewed-on: https://pdfium-review.googlesource.com/32832
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I06ca9eb7e8bb19f75ee75937a44e4ae548a7a92c
Reviewed-on: https://pdfium-review.googlesource.com/32791
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Doing this in the inner loops gets us another small performance
improvement.
Change-Id: I61fdf4bf8363a66123b3be3bc7ca9b5370f451fc
Reviewed-on: https://pdfium-review.googlesource.com/32710
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
This class is used heavily by CFX_ImageTransformer and fmodf()
calculations are expensive.
Change-Id: If2b9037eb2e90ae377ffb490483a7e7e4faf63b2
Reviewed-on: https://pdfium-review.googlesource.com/23176
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Tested by running safetynet_compare.py on this patch vs master. The
results were 0 regressions and 0 improvements. The two remaining usages
cannot be replaced because they would cause a regression.
Bug: pdfium:177
Change-Id: I43eddf4ffaac2eb063f2004d6606bc3cd6e627ac
Reviewed-on: https://pdfium-review.googlesource.com/32159
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
|
|
This existing code has the potential for an integer overflow in it.
When overflow occurs in this function scaling may partially succeed.
This is due to how out of range values are being clamped, which
implicitly swallows the overflow.
This CL changes the calculation to be performed in a 64-bit space and
then attempts to down cast it back to 32-bit space at the end. Because
there are multiple steps it is possible for an intermediate value to
cause an overflow in 32 bit space, but the final value to be valid. If
the downcast is not possible then the stretch operation is failed.
An existing test case has been updated, since it encoded an incorrect
result.
BUG=chromium:839245
Change-Id: I637cc1e2d6c6c2d5394599104f76352c20ead021
Reviewed-on: https://pdfium-review.googlesource.com/32056
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
Rather than messing with actual inheritence, add type-checking wrappers
and just blatantly cast to incomplete types. Along the way, this points
out places where we would downcast without checking, which I fix.
Change-Id: Ieb303eb46ad8522dfe082454f1f10f247ffd52d5
Reviewed-on: https://pdfium-review.googlesource.com/32030
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
A subsequent patch will tackle the ad-hoc ref counting, but we
can tidy this before going down that hole.
Decouple CTTFontDesc creation from face setting.
Remove union and treat single-entry case as vector's first element.
Pass unique_ptr to prove memory ownership.
Change-Id: Ic427798da04f3afbb65a56ee10045b9f22457a73
Reviewed-on: https://pdfium-review.googlesource.com/31730
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Bug: pdfium:243
Change-Id: I36ebe64daa042b998878ffacfca9846b5303450b
Reviewed-on: https://pdfium-review.googlesource.com/31652
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
The existing PostScript modes write data into EMF comments. This
satisfies Chromium's use case, but other embedders want to write data
out via ExtEscape() in PASSTHROUGH mode.
BUG=pdfium:1068
Change-Id: I998035e99fbb84b16dcd244b750b476cecc3bd22
Reviewed-on: https://pdfium-review.googlesource.com/31299
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
|
|
Applies std::remove_ptr to the public API types so that we can
deduce a correct unique ptr type no matter how that API might
change away from void* usage.
Creates shorter names for std::unique_ptr<std::remove_pointer<>, ...>
Change-Id: I04a0ff43cb7d5a4d3867939a53a54c9cef00db86
Reviewed-on: https://pdfium-review.googlesource.com/31292
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Move WindowsPrintMode assertion into CPSPrinterDriver.
Change-Id: I570076b43751e052c5396e89a6674b83a4ad1a1e
Reviewed-on: https://pdfium-review.googlesource.com/31298
Reviewed-by: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
It is never used.
Change-Id: I09220eb16a4679c8499079c3c1375574f6fc0450
Reviewed-on: https://pdfium-review.googlesource.com/31300
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
When parsing UTF16-LE, the default trailing "\0" from a single-byte
character literal isn't suffucient.
Bug: 835184
Change-Id: Ie7db53262adbec0ebccb5d0b22752b8c9f5e6229
Reviewed-on: https://pdfium-review.googlesource.com/31191
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Get bounds checking "for free".
Change-Id: Ic60d63836f6c223e2ee1262649d47da54bb30ecc
Reviewed-on: https://pdfium-review.googlesource.com/30876
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
This reverts commit 3d523e3cf89440e2ffc6571b1c687ad5e3f0318f.
Fixes bounding errors now caught by tests.
Change-Id: I4d0f1791bdcc45a10615a62abf7a4d20e7e538f2
Reviewed-on: https://pdfium-review.googlesource.com/30799
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This CL changes CFX_DIBitmap::TransferBitmap so that the exception cases
are handled before, and early returns are used to reduce nesting.
Change-Id: I733adce5de15d345ee160a8b250133836e9d2873
Reviewed-on: https://pdfium-review.googlesource.com/30770
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This reverts commit 80a6cbe0a427e155de8555bc867af745d10f9777.
Reason for revert: too many abrts in beta branch.
TBR: dsinclair@chromium.org
Bug: 832557, 832978, 832992, 833062, 833097
Change-Id: I7d511dbb224ddc644be96ea2f3770ad6f73debf5
Reviewed-on: https://pdfium-review.googlesource.com/30792
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Get bounds checking "for free".
Change-Id: I7b14cacbc7130ced7b5cb1869b82c96ccff8e642
Reviewed-on: https://pdfium-review.googlesource.com/30451
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I6643aaf66bf3e9d53d5afab5c99a5cb7deab3661
Reviewed-on: https://pdfium-review.googlesource.com/30054
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|