Age | Commit message (Collapse) | Author |
|
Make them const, and remove m_nGrowSize which is always the same value.
Also remove unused method and make GetBuffer() non-const.
Change-Id: I272aa4c268c4a887e155800b7c8c10892b343465
Reviewed-on: https://pdfium-review.googlesource.com/39877
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Do all the parsing inside the constructor. Make GetVerticalGlyph() and
related getters const methods.
Change-Id: I21118cf98048cb6bbfc0999604d2434d4acafef6
Reviewed-on: https://pdfium-review.googlesource.com/39496
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
|
|
Given POD members default values, rather than hoping Load() will. Also
reorder members to pack better.
Change-Id: I493db11eb3d115e49f4e914e53a1eb55fa2046f0
Reviewed-on: https://pdfium-review.googlesource.com/39495
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
|
|
Remove parameters that always refer to the same member variables. Also
mark the input object as const since it is only read from.
Change-Id: I136ece1ce5b0c00b02d1a76e1540ff26e6f01858
Reviewed-on: https://pdfium-review.googlesource.com/39494
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
|
|
No need to even bring any .cpp files in line with these headers.
Change-Id: I934169d77ae09adc11f02e5ea92b1f8b078c9477
Reviewed-on: https://pdfium-review.googlesource.com/39876
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Perform indexing via WideString::operator[] which will at least
assert bounds, if not enforce them.
Change-Id: I7b03cfd718c4acd642af910c2ca06f86d178e5fd
Reviewed-on: https://pdfium-review.googlesource.com/39873
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Instead, add a 3-parameter constructor that delegates to the 4-parameter
constructor.
Change-Id: Ied6c55360084ea26b07dbaa449bf155b5db182f0
Reviewed-on: https://pdfium-review.googlesource.com/39872
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Add more asserts and use more constants.
Change-Id: I51f1d9d1b501f4e99d9793b6c803676b7221be17
Reviewed-on: https://pdfium-review.googlesource.com/39871
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Fix some other nits as well.
Change-Id: I837bd49526dd97ce666f8d8743fe5bd7653ae544
Reviewed-on: https://pdfium-review.googlesource.com/39410
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Preferred over const_cast<> to show how that state is used.
Change-Id: Ia6fe6bf46fb7fa8e701481b1604073b5d7f222fa
Reviewed-on: https://pdfium-review.googlesource.com/39870
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
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>
|
|
Replaces them with calles to the proxy function, FXSYS_time, so that
tests may use a stable time value instead of the wall clock value.
BUG=pdfium:1104
Change-Id: I4743c4634f56d4a6cba1f1130c4562a35cee1887
Reviewed-on: https://pdfium-review.googlesource.com/39853
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
|
|
This CL adds a proxy, FXSYS_time, for the time syscall, so that a
testing mechanism can be implemented. Specically there is now a flag
for pdfium_test, --time=, that allows setting the time since the epoch
that will be returned. This plumbed all the way down into the proxy
and allows for stable results for tests that depend on getting the
current time.
There are other places in the code base that will need to be patched
like this, that will be dealt with in follow on CLs.
BUG=pdfium:1104
Change-Id: I2de185f8d47abe46704dd579c13a54948b7f81e0
Reviewed-on: https://pdfium-review.googlesource.com/39750
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@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>
|
|
When trying to sanity check SBNUMINSTANCES for JBIG2 text regions for
https://crbug.com/837192, the check did not take data encoding into
account. Fix this by assuming there is a potential for 16:1 compression
in the lossless encoding.
BUG=chromium:871848
Change-Id: I991dacff9fbefa4e302f5ce92a355902ef94308a
Reviewed-on: https://pdfium-review.googlesource.com/39790
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: I4fac8d0c9a21f4e8703a43afd2864f84f6228319
Reviewed-on: https://pdfium-review.googlesource.com/39834
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Because the argument to Decode() can be const. Part of the ongoing
war against const_cast<>.
Change-Id: I3a8402277dbfc4fd80b1dd60225de57b732713f8
Reviewed-on: https://pdfium-review.googlesource.com/39832
Reviewed-by: Ryan Harrison <rharrison@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>
|
|
Put encoder in cfx_utf8encoder.{h,cpp} to parallel decoder.
Add tests, and fix one corner case involving 0xff.
Change-Id: Ib97540afdc708bcc6280a79c76734ec68ea72690
Reviewed-on: https://pdfium-review.googlesource.com/39770
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>
|
|
Consolidate code into sole caller, which always retrieves a string
from the "default ANSI code page". Add unit test for this code path.
Fix sign extension bug giving bogus 0xffffff80 codepoint uncovered
by unit test on non-windows. Note windows result is different because
the system conversion routine does actually work.
Change-Id: I1c1246b203ee66e9ff0b6fccf97594788bcd0fca
Reviewed-on: https://pdfium-review.googlesource.com/39730
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Prevent stray calls to get time from the system without explicilty
including <time.h> in some .cpp file. This helps to be able to control
all the places where PDFium obtains time more carefully.
Change-Id: I9d52a00b9d4413e18c98f0476fabe7c5f2cd6574
Reviewed-on: https://pdfium-review.googlesource.com/39710
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@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>
|
|
Limits the number of elements that can be added to the expressions
list in the FormCalc parser. This handles cases like long strings of !
repeated, since ! is a valid identifier and identifiers are valid
expression, even though it will be no-op. This is another case of
something that is valid, but stupid.
BUG=chromium:870385
Change-Id: I8e34ce00bcbe4499e0a45bd5dc38541793144481
Reviewed-on: https://pdfium-review.googlesource.com/39630
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@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>
|
|
It is only called ever called from one place with 0 (FX_CODEPAGE_DefANSI),
with more complicated usage being funneled directly into FXSYS_ code.
Next, fold it into ByteString::FromUnicode().
Change-Id: I85aa0dd3a4ca8cddcff22533e0a284ff3f5535ee
Reviewed-on: https://pdfium-review.googlesource.com/39670
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Generalize CPDF_TextPage::GetTextByRect(), so that it's possible to get
the text from a text page using a predicate, that way we can easily
get the text that belongs to single text object as well.
Change-Id: Ia457af0f41184694dc1481709be72b35685bce7f
Reviewed-on: https://pdfium-review.googlesource.com/39530
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
No need for variadic printf-like functions, since callers can cobble
arguments into a string much more simply.
Change-Id: I0e8d6f6a55a3715ef9d5c6940b73ce8bb2220a1a
Reviewed-on: https://pdfium-review.googlesource.com/39611
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Simpler, faster, and avoids platform idiosyncracies of wprintf().
Change-Id: I91676bc38199ca2c30936094ca145239f915bc53
Reviewed-on: https://pdfium-review.googlesource.com/39610
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Precursor to converting some Format() operations to simple string
addition.
Change-Id: I3a159f5ac548ea14586d87e7d56d1ec288898b0d
Reviewed-on: https://pdfium-review.googlesource.com/39590
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Once upon a time, someone cut-n-pasted ~300 lines of code to avoid
creating a default rectangle and to save a couple of additions. Then
one path got one set of fixes (safe ints) and the other path got a
second set of fixes (source bounds checks). Re-unify, picking up all
the fixes, since they are identical otherwise.
Change-Id: I099e854bc8ad027efabd5c2077c4319ee8221256
Reviewed-on: https://pdfium-review.googlesource.com/39550
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Avoid possibility of an unterminated string or nullptr by avoiding
stringviews, since the non-view classes copy and always provide
a suitable result. Always use %ls and widestrings in wprintf()
variants, since that combination is consistent across our platforms
(%s, %S, etc. have idiosyncracies).
Bug: 870952
Change-Id: Ief62a42c3486e8298f9583b56e9333db1a74972a
Reviewed-on: https://pdfium-review.googlesource.com/39551
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: 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>
|
|
We can use the memcpy() path whenever byte aligned.
Split code into helper methods.
Add test for fast path specifically.
Change-Id: I52f6129b0e788eb2da60536cfa6fce12a0609375
Reviewed-on: https://pdfium-review.googlesource.com/39432
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
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>
|
|
Change check to use empty instead of size <= 0. Also added a comment
to the check to make it clear what is being guarded against
BUG=chromium:863098
Change-Id: I993085c04ab66a9e2869c83d8fb48883ec0bbf71
Reviewed-on: https://pdfium-review.googlesource.com/39497
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: 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>
|
|
Change-Id: I705a49198a91b67aa403beea4446095a6a359259
Reviewed-on: https://pdfium-review.googlesource.com/39415
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Currently the parser will accept arbitrary garbage before the first
element begins. This is causing issues with ClusterFuzz since it
generates a lot of trash inputs which take a long time to parse
inspite of being invalid.
This CL adds in a check of how deep the parse is when dealing with
text, and if it is at the top level scope, then only accept the
beginning of the root node.
BUG=chromium:863098
Change-Id: Ie45114ecf488f7e8a68a120d153033c7089d5cdc
Reviewed-on: https://pdfium-review.googlesource.com/39470
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Bundling the test with the accessor is a safer pattern than
performing the check externally.
Add test for CopyLine().
Change-Id: I7056bf33bdca40cb84a89e4928567a389d88ff1c
Reviewed-on: https://pdfium-review.googlesource.com/39431
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>
|