Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
Instead of passing by non-const reference. Adjust the override in
CPDF_CIDFont and CPDF_CMap::GetNextChar() as well.
Change-Id: I0ee6dc21077101cbeeb0e334498075fc463a2d65
Reviewed-on: https://pdfium-review.googlesource.com/39492
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
This reverts commit b07deb3fc1f54bd700a66df573bfcbc4bcc1d787.
Reason for revert: Causing https://crbug.com/870467
Original change's description:
> Rework of CPDF_Parser::GetLastObjNum.
>
> Change-Id: I0481774858a9d9823580e1207807e35be8a9eea9
> Reviewed-on: https://pdfium-review.googlesource.com/36270
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
TBR=thestig@chromium.org,art-snake@yandex-team.ru
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: I58e23c752a582c21be8ba45e3538e63c0fa64504
Reviewed-on: https://pdfium-review.googlesource.com/39810
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: 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>
|
|
It is not used in the CPDF_Font base class.
Change-Id: I6033a5dd422179eb95f19a2f2ecf06d007f3223f
Reviewed-on: https://pdfium-review.googlesource.com/39493
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Callers do not actually need the returned handle.
Change-Id: I1b8c0be00809eb7fdae9f6e95b4b325e75f4b847
Reviewed-on: https://pdfium-review.googlesource.com/39491
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Instead of using an out parameter. Fix nits in the only caller as well.
Change-Id: I04eb92705b2fbda001191c36da972eee499acbc7
Reviewed-on: https://pdfium-review.googlesource.com/39490
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
BUG=chromium:865272
Change-Id: I4606bdfd78ebd6553c36b985b4f49d07b579ac40
Reviewed-on: https://pdfium-review.googlesource.com/39438
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
|
|
BUG=chromium:871042
Change-Id: Id4566b29270ab738c69d46cb96fc134485d6ee2f
Reviewed-on: https://pdfium-review.googlesource.com/39510
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
- Use range for-loop to avoid needing "i" and "j".
- Avoid repeatedly calculating "startnum + j".
- Reduce levels of nested ifs.
- Remove variable that is only used once.
Change-Id: I9d08cef1082812fcfaa2699f65720165c52ebcff
Reviewed-on: https://pdfium-review.googlesource.com/39437
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
BUG=chromium:668762
Change-Id: Iaf3fc9bcf68b8da2c947bbd78c5d72f78195b621
Reviewed-on: https://pdfium-review.googlesource.com/35991
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
GetVarInt() returns uint32_t. So assign the results to variables of type
uint32_t. Then make sure those results get passed on as uint32_t, or use
pdfium::base::IsValueInRangeForNumericType<T>() to make sure they can be
converted to type T safely.
Change-Id: I4556f0b89b4e5cdb99ab530119c8051ec8a9411d
Reviewed-on: https://pdfium-review.googlesource.com/39436
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Then we can mark the doc pointer as const because it never changes
again. Also move initialization to headers when possible, add missing
dtors, and fix some nits.
Change-Id: I461affc8dce14d805b935fb4d8b5aaafb058a789
Reviewed-on: https://pdfium-review.googlesource.com/39413
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Move HintTables parsing logic into CPDF_HintTables.
Change-Id: I9748179fe9fc3ac44f88c19c347e30c0e7e3ac67
Reviewed-on: https://pdfium-review.googlesource.com/38771
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
|
|
One check can never fail. The other check can be done earlier, before
creating the CPDF_LinearizedHeader.
Change-Id: I0bccb2a9e19e0d5517daf96684adba6bb3a203bf
Reviewed-on: https://pdfium-review.googlesource.com/39412
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: I0481774858a9d9823580e1207807e35be8a9eea9
Reviewed-on: https://pdfium-review.googlesource.com/36270
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
|
|
Bug: chromium:868477
Change-Id: I5957c5ef051bc4fa8eb51efa6a7fc142996742c5
Reviewed-on: https://pdfium-review.googlesource.com/39130
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
BUG=chromium:828177
NOTRY=true
Change-Id: I30123087bbe11aaaa6175b5f729b7ab55107a975
Reviewed-on: https://pdfium-review.googlesource.com/38902
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
Change-Id: Ib22db6c57d2066ef70c0ef12e44d1e5eee6611a5
Reviewed-on: https://pdfium-review.googlesource.com/36410
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
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>
|
|
Remove |kInvalidHeaderOffset|.
Change-Id: I5978e745e97aa4e13299dd21028721725ac0c996
Reviewed-on: https://pdfium-review.googlesource.com/38853
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
|
|
Replace with CFX_BufferSeekableReadStream, which allows for spans and
const inputs.
Change CXFA_DocumentParser to take IFX_SeekableReadStream instead of
IFX_SeekableStream in the process.
Change-Id: I0168451350c9fc250231f0414c38738a4d86ca42
Reviewed-on: https://pdfium-review.googlesource.com/38852
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
|
|
Clearer that just using indexing off of raw pointers, and makes the
code more closely resemble other functions.
Change-Id: I7cc8363b505e66120bc1c686bb23b2bdf8fc401f
Reviewed-on: https://pdfium-review.googlesource.com/38894
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: Ib9e20fdfc637b2ba0358586e23ad72454b0b8ad1
Reviewed-on: https://pdfium-review.googlesource.com/38851
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
- CPDF_SyntaxParser can no longer be initialized multiple times.
- Make the file length and header offset const.
- Make the header offset type FX_FILESIZE consistently.
- Simplify for the common case where the header offset is 0.
Change-Id: I7138db1fbcec3b7578b0239b92fc1154fa4dc4ce
Reviewed-on: https://pdfium-review.googlesource.com/38850
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Sample PDF:
https://yadi.sk/d/oWLtAEfy3YbEb3
For offsets, equal to the hint stream offset, added hint stream
length to determine the actual offset, because linearization
inserted the hint stream at the original location of the object.
Also the number of bits needed to represent the numerator of
the fractional position for each shared object reference may be
zero, if each shared group contains only one object with obj num,
incremented on 1.
Change-Id: I4754d603f388354821e8d0cac97ad99a7578fe4b
Reviewed-on: https://pdfium-review.googlesource.com/36610
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
We should use document size instead of File size,
because all offsets and sizes was read from document should
take into account of header offset.
Added some tests of parsing of documents with header offset.
Also drop friendship of CPDF_SyntaxParser with CPDF_Parser.
Change-Id: Iebec75ab2ee07fb644a6c653b4ef5c2e09af09fe
Reviewed-on: https://pdfium-review.googlesource.com/35830
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Return encryption dictionary as const reference
from CPDF_Parser.
Create a copy in CPDF_Creator if needed.
Change-Id: I270f71d307d818fba7f65ebe379f5942ae816934
Reviewed-on: https://pdfium-review.googlesource.com/38390
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
|
|
Move writing logic into implementation of related clases.
Change-Id: If70dc418b352b562ee681ea34fa6595d6f52eee3
Reviewed-on: https://pdfium-review.googlesource.com/36350
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: I0743c34f0206f85828570430edb9f62b6b0cdbb5
Reviewed-on: https://pdfium-review.googlesource.com/37315
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
|
|
Use CPDF_SyntaxParser logic to rebuild crossref.
Change-Id: I394f64e76294b97c6a7c2b8984a880712fd193a7
Reviewed-on: https://pdfium-review.googlesource.com/37314
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
|
|
Picks up some enhancements from base/span.h. In turn, also adds
the size_bytes() helper. Differs from base version in that it
works around C++14 enable_if_t<>, and avoids the dynamic_extent
template specialization tricks.
Use it in a few places where appropriate.
Change-Id: I86f72cf0023f2d4317a7afa351fddee601c8f86c
Reviewed-on: https://pdfium-review.googlesource.com/38251
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: Ia5a4e89bff8a1dbc46246f5a734170765b7ee74e
Reviewed-on: https://pdfium-review.googlesource.com/38250
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
BUG=chromium:851994
Change-Id: I2e14401271c70afa204221e0f3d469f0b82ce8cf
Reviewed-on: https://pdfium-review.googlesource.com/37871
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
|
|
Use const_cast for the non-const version to call the const version.
Change-Id: Ibdf5fe53255ee6e983555080336f5d63e683afd1
Reviewed-on: https://pdfium-review.googlesource.com/37490
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: I354e8bed12606abdc67427bbc7928e3b1f11e243
Reviewed-on: https://pdfium-review.googlesource.com/35433
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Use own copy of encryption dictionary within CPDF_Parser,
to prevent modification of original trailer.
Change-Id: I6246b872d431b94411fcec694c5176f8d85dfe26
Reviewed-on: https://pdfium-review.googlesource.com/35450
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
In CPDF_ScaledRenderBuffer::Initialize(), use the existing
CFX_DIBitmap::CalculatePitchAndSize() function to figure out the pitch
and size. Unlike the existing code, CalculatePitchAndSize() does a
better job of checking for integer overflows.
BUG=pdfium:1123
Change-Id: Ic8fe7226bc56fed0456486d88e02a7af2928bc94
Reviewed-on: https://pdfium-review.googlesource.com/38010
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Remove checks for impossible conditions.
Change-Id: I7a6607675899bfde6179e93da0c9139dfec19984
Reviewed-on: https://pdfium-review.googlesource.com/38070
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: I57f89b9f2a8ef3f351e7574a76d6064ffde150d3
Reviewed-on: https://pdfium-review.googlesource.com/37870
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: I3686bd3d28a84aae39c750a371902e1e5d62b365
Reviewed-on: https://pdfium-review.googlesource.com/37050
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Use std::vector<> as a manager for contiguous buffers.
Change-Id: Icaacbd4b7010b928237aa71485411ade7539412a
Reviewed-on: https://pdfium-review.googlesource.com/37012
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: Ibf09905523ae2d80ce48bfe7337733d8dc718669
Reviewed-on: https://pdfium-review.googlesource.com/37850
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
|
|
- FPDFPageObj_RemoveMark()
Bug: pdfium:1037
Change-Id: I7ff320261d64e3ead45375ccc72301e7c64dd6e3
Reviewed-on: https://pdfium-review.googlesource.com/37710
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Bug: pdfium:1037
Change-Id: Ia2cd0d6ef99495dda3289988123489e3a2ad6e82
Reviewed-on: https://pdfium-review.googlesource.com/37750
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>
|
|
Commit {Insert later} removed the last caller to this method.
Change-Id: I1689b33486396cc3a41139f984f819b39ab02b2a
Reviewed-on: https://pdfium-review.googlesource.com/35130
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Merge shared objects related data into CPDF_HintsTable::SharedObjGroupInfo.
Change-Id: I53bb7fc42ea6bcd26b3ebf91b8c6aa402108d086
Reviewed-on: https://pdfium-review.googlesource.com/15830
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
|
|
This is a reland of 77f15f7883638a4ced131d74c053af10a5970ce9
Original change's description:
> Avoid duplicate data buffering in CPDF_SyntaxParser::ReadStream().
>
> Allow sub-streams created from an IFX_SeekableReadStream to provide
> stream data without copying memory.
> The data will only reside in the top-level stream.
>
> For example:
> For file
> http://www.major-landrover.ru/upload/attachments/f/9/f96aab07dab04ae89c8a509ec1ef2b31.pdf
> (18 Mb)
>
> The memory usage is reduced by ~13 Mb.
>
> Change-Id: I2595c014d0fbe1fdd181cc04965cfd7d901c2d88
> Reviewed-on: https://pdfium-review.googlesource.com/35930
> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
> Reviewed-by: dsinclair <dsinclair@chromium.org>
Change-Id: I4c4d5dcf42ff44784468ac7a7c302df509fc804d
Reviewed-on: https://pdfium-review.googlesource.com/37313
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Art Snake <art-snake@yandex-team.ru>
|