Age | Commit message (Collapse) | Author |
|
The various string classes, CFX_ByteString, CFX_ByteStringC,
CFX_WideString, and CFX_WideStringC, have many conditionals that are
effectively determining if a value is a valid index or length. This CL
refactors the logic into one place per class, so it only needs to be
changed once if its behaviour needs to change. It also make the some
of the methods stricter on the inputs they will accept.
BUG=pdfium:828
Change-Id: Iadcdaa34a6d862a2804485770027179c89dc6956
Reviewed-on: https://pdfium-review.googlesource.com/12030
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
The Find and ReverseFind methods for WideString, WideStringC,
ByteString, and ByteStringC have been converted from returning a raw
FX_STRSIZE, to returning Optional<FX_STRSIZE>, so that success/failure
can be indicated without using FX_STRNPOS.
This allows for removing FX_STRNPOS and by association makes the
conversion of FX_STRSIZE to size_t easier, since it forces checking
the return value of Find to be explictly done as well as taking the
error value out of the range of FX_STRSIZE.
New Contains methods have been added for cases where the success or
failure is all the call site to Find cared about, and the actual
position was ignored.
BUG=pdfium:828
Change-Id: Id827e508c8660affa68cc08a13d96121369364b7
Reviewed-on: https://pdfium-review.googlesource.com/11350
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Currently, all three of CFX_Matrix::TransformRect() take in rect values
and modify them in place.
This CL converts them to take in constant values and return the
transformed values instead, and fixes all the call sites.
Bug=pdfium:874
Change-Id: I9c274df3b14e9d88c100ba0530068e06e8fec32b
Reviewed-on: https://pdfium-review.googlesource.com/11550
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Jane Liu <janeliulwq@google.com>
|
|
This method duplicates the behaviour of the const [] operator and
doesn't offer any additional safety. Folding them into one
implementation.
SetAt is retained, since implementing the non-const [] operator to
replace SetAt has potential performance concerns. Specifically many
non-obvious cases of reading an element using [] will cause a realloc
& copy.
BUG=pdfium:860
Change-Id: I3ef5e5e5a15376f040256b646eb0d90636e24b67
Reviewed-on: https://pdfium-review.googlesource.com/10870
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Since m_pos is passed into GetAt() on the underlying string in
getCurrentChar(), the value of it needs to confirmed to be valid after
decrementing. Some types were changed to reflect the values being
stored.
BUG=chromium:752480
Change-Id: Ib6d6f52326defd31785e70a17049a08b64dbe069
Reviewed-on: https://pdfium-review.googlesource.com/10652
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Specifically the index parameter passed in to GetAt(), SetAt() and
operator[] are now being tested to be in bounds.
BUG=chromium:752480, pdfium:828
Change-Id: I9e94d58c98a8eaaaae53cd0e3ffe2123ea17d8c4
Reviewed-on: https://pdfium-review.googlesource.com/10651
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
The existing behaviour was to clamp the provided index to the valid
bounds. This would lead to programming errors being hidden, since
inserting would still do something even if the index calculation was
wrong. The behaviour of these methods has been changed to instead
early return when this occurs, returning the old length value. The
caller can check if the call to Insert actually did anything by
comparing the returned value to the length before calling insert.
All of the existing calls to Insert have been tested by running all of
the tests with asserts in the Insert method to check the index is in
bounds. Additionally the call sites have been manually inspected. The
majority of them are of the form Insert(0, foo) and the rest tend to
be in a loop advancing from 0 to length.
Convenience methods InsertAtFront/InsertAtBack have been added to
handle calling Insert when the intent is for the character to be added
to the beginning or end of the string. Existing call sites to Insert
that do this have been converted.
This work was originally being performed to check if there would be
any issues in these methods with making FX_STRSIZE unsigned.
BUG=pdfium:828
Change-Id: I60cee5ad45338aa8ed46569de7bcc78a76db18f7
Reviewed-on: https://pdfium-review.googlesource.com/9870
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Currently Find() and other methods that return a FX_STRSIZE return -1
to indicate error/failure. This means that there is a lot of magic
numbers and magic checks floating around. The standard library for
similar operations uses a npos constant. This CL implements
FX_STRNPOS, and replaces usages of magic number checking. It also does
some type cleanup along the way where it was obvious that FX_STRSIZE
should be being used.
Removing the magic numbers should make eventually changing FX_STRSIZE
to be unsigned easier in the future.
BUG=pdfium:828
Change-Id: I67e481e44cf2f75a1698afa8fbee4f375a74c490
Reviewed-on: https://pdfium-review.googlesource.com/9651
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
The various string/byte classes support Mid(), Left(), and Right() for
extracting substrings. Mid() can handle all possible cases, but Left()
and Right() are useful for common cases and more explicit about what
is going on.
Calls like Mid(offset, length - offset) can be converted to
Right(length - offset). Calls like Mid(0, length) can be converted to
Left(length).
If the substring being extracted does not extend all the way to one of
the edges of the string, then Mid() still needs to be used.
BUG=pdfium:828
Change-Id: I2ec46ad3d71aac0f7b513e103c69cbe8c854cf62
Reviewed-on: https://pdfium-review.googlesource.com/9510
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
This is unused except for being a pathway for indirect deps.
Change-Id: I717290235ccbc59429ad24231033382958e2a086
Reviewed-on: https://pdfium-review.googlesource.com/6910
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
|
|
Delete BC_SymbolShapeHint.h since there is nothing left in it.
Change-Id: Ic991064cd396f224966e5f3e8537fc62b5a9908a
Reviewed-on: https://pdfium-review.googlesource.com/5835
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: I8365ba80e3395d59a3cf35dbd9d9162e86e712e3
Reviewed-on: https://pdfium-review.googlesource.com/5970
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Sed + minimal conversions to compile, including moving some
constructors into the .cpp file. Any that caused ASAN issues
during the tests were omitted rather than trying to resolve
the underlying issue.
Change-Id: I00a421f33b253eb4071ffd9af3f2922c7443b335
Reviewed-on: https://pdfium-review.googlesource.com/5891
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
Remove unused variants and simplify the one remaining variant.
Change-Id: I9b6e596b479f95319a3b69f5db2c4d1b2cff4ebf
Reviewed-on: https://pdfium-review.googlesource.com/5834
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Mark some methods as virtual/override in formerly CBC_SymbolShapeHint
derived classes.
Change-Id: Ia6d83e0b2c63c8fb440bc1d5beb258a796e1d42f
Reviewed-on: https://pdfium-review.googlesource.com/5738
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
- Remove rectangular ctor param. It can be derived from dimensions.
- Make members private and add accessors.
- Remove exceptions that cannot occur.
Change-Id: Iec113205241562a0559e594fe257f5b9064ed97e
Reviewed-on: https://pdfium-review.googlesource.com/5737
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
It just returns false. Also make more CBC_HighLevelEncoder members
const.
Change-Id: I0236e84db0d8b5e5fa1a99ebc4a809770a332471
Reviewed-on: https://pdfium-review.googlesource.com/5739
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
More straight forward than CFX_GEModule owning in and CPDF_ModuleMgr
holding a pointer to it.
Remove assumptions that the codec modules may return nullptr, and do
IWYU.
Change-Id: Iba7fc3c7ec223fd6d29a1ab74ed13d35689bc5d5
Reviewed-on: https://pdfium-review.googlesource.com/5654
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
This Cl renames the CFX_RenderDevice subclasses to make their usage
clearer.
Change-Id: Ie820b57df9a3743ce8c6893fb483b398a1f1bdbe
Reviewed-on: https://pdfium-review.googlesource.com/5390
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: If90483a8fee2e3a5cd90e7fe4600ff98b2703e5d
Reviewed-on: https://pdfium-review.googlesource.com/5010
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Draw vertical 1D barcodes as segments of lines, instead of as individual
pixels.
Change-Id: Ic260118660994514ce9023aacf13b16adfc8d362
Reviewed-on: https://pdfium-review.googlesource.com/4595
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
The input wchar_t array is not NUL-terminated.
BUG=chromium:716706
Change-Id: I0a89324fa46a56a39cc3331fcdd1c26b1550828b
Reviewed-on: https://pdfium-review.googlesource.com/4631
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: I0e3f4bd33e66fd48db8371a5cc2f8db964720d08
Reviewed-on: https://pdfium-review.googlesource.com/4731
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|
|
Remove some dead code along the way.
Move some getters to headers and make const.
Change-Id: I14280c247b0cfeff8ad7f606302bc8bba1960f1e
Reviewed-on: https://pdfium-review.googlesource.com/4730
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Many of these are already unique_ptrs.
Change-Id: I3695d4ff5a8f7483ad994ac7657897fd55069cd5
Reviewed-on: https://pdfium-review.googlesource.com/4690
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
Change-Id: I0c33ec81ef9fd3ff7c22f33f5647a923aecd3e77
Reviewed-on: https://pdfium-review.googlesource.com/4594
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Remove more exceptions.
Change-Id: I3b8b8b9837b0010b1e0060ddd56e93c78f9f0fb5
Reviewed-on: https://pdfium-review.googlesource.com/4410
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Individual tests need some more fleshing out.
Fix spelling of "Destroy" while we're at it.
Bug: pdfium:699
Change-Id: I05f1da8654bfdf92cb264adae16e1b3209587a31
Reviewed-on: https://pdfium-review.googlesource.com/4550
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
|
|
It always return a failure.
Change-Id: Ib318bbdb99b3ea38fba8ceb5733c6dcb8f14bbbf
Reviewed-on: https://pdfium-review.googlesource.com/4590
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: I963fcf416f623efd89832f61914df115b443a52c
Reviewed-on: https://pdfium-review.googlesource.com/4494
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Prevent implicit construction of CFX_WideString from non-wchar_t
variables. Similarly prevent implicit construction of CFX_ByteString
from non-char variables.
Fix up CBC_OnedCodaBarWriter which tries to do the above, and simplify
code there using pdfium::ContainsValue(). Same for CPDF_FileSpec.
Change-Id: I3db7125a68ef3f64c2f235d38e974767cd083dc3
Reviewed-on: https://pdfium-review.googlesource.com/4478
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: Ifc6e98af8e9f8505edce8b04836fbe0d6ab5743d
Reviewed-on: https://pdfium-review.googlesource.com/4476
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Make encoding functions return pattern indices instead of pattern
pointers for easier testing. Also remove some dead code.
Change-Id: Ib80d84b2e6828bbc8920b931d77bbcd82427f01a
Reviewed-on: https://pdfium-review.googlesource.com/4474
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Replace other one-off implementations as well.
Change-Id: I2878f3fae479c12b7de5234ee3a26477d602d14d
Reviewed-on: https://pdfium-review.googlesource.com/4398
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: Idcc05fb8c5a1448f552b4db5ae131ad82aef4d59
Reviewed-on: https://pdfium-review.googlesource.com/4258
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: I85c8423c177fd7ecd5da90ef89419efc0f9cf44b
Reviewed-on: https://pdfium-review.googlesource.com/4262
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
|
|
Change-Id: Idb5ef2aed456e84e0781c374b211560ab7d4fa3d
Reviewed-on: https://pdfium-review.googlesource.com/4257
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Change-Id: Iff738c99fb4fe38d35515c280057b489624d734f
Reviewed-on: https://pdfium-review.googlesource.com/3752
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
No caller cares about the exception values anyway. Remove the unused
ones. Also use more std::unique_ptr to stop potential leaks.
Change-Id: Ic5955fb0d879f55e1c6a005c0204df50246dab19
Reviewed-on: https://pdfium-review.googlesource.com/3715
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Use std::vector and return booleans results when possible.
Change-Id: If3ce4559f137fb449fd1ab818750558a1b5f8df0
Reviewed-on: https://pdfium-review.googlesource.com/3561
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
Remove a bunch of unused code, including gotos.
Fix some potential memory leaks.
Change-Id: Ia2775e2ab176f4741b765e259a24a293a5717394
Reviewed-on: https://pdfium-review.googlesource.com/3560
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
After this CL, fx_dib.h only has some definitions used in multiple places.
Definitions that were of restricted usage were moved out to the corresponding
place. Includes in fx_dib were reduced, thus revealing other needed includes.
Change-Id: I3607da0af81c491256d64c0aa085225631efbdcc
Reviewed-on: https://pdfium-review.googlesource.com/3594
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
|
|
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>
|
|
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>
|
|
Change-Id: I327a3f94cf6f00366d7a78ed9f973d00f702f397
Reviewed-on: https://pdfium-review.googlesource.com/3559
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
|
|
Roll DEPS for testing corpus to 2c5a026 to verify.
This regressed in commit c8017b2.
BUG=pdfium:692
Change-Id: Ic09ed53db8b3cc81abb2bdea863b8cf32f614197
Reviewed-on: https://pdfium-review.googlesource.com/3510
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
|
|
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>
|
|
Nothing in fxbarcode/ depends on XFA code. This CL moves xfa/fxbarcode
to be fxbarcode/ and creates a static_library for fxbarcode which is
depend on by the xfa library.
Change-Id: I0b708737b07efb94b769a5238d92af92bc62880d
Reviewed-on: https://pdfium-review.googlesource.com/3291
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
|