summaryrefslogtreecommitdiff
path: root/core/fxcrt
AgeCommit message (Collapse)Author
2017-09-21Move CFX_SharedCopyOnWrite to SharedCopyOnWriteDan Sinclair
This CL renames CFX_SharedCopyOnWrite to SharedCopyOnWrite and moves to the fxcrt namespace. Bug: pdfium:898 Change-Id: Iced796b9f341407720e2a88f11d1916df56fe68c Reviewed-on: https://pdfium-review.googlesource.com/14617 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-21Rename CFX_RetainPtr to RetainPtrDan Sinclair
This CL renames CFX_RetainPtr to RetainPtr and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I8798a9f79cb0840d3f037e8d04937cedd742914e Reviewed-on: https://pdfium-review.googlesource.com/14616 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Move CFX_Observable to ObservableDan Sinclair
This CL renames CFX_Observable to Observable and moves into the fxcrt namespace. The test suite names were updated to ObservedPtr from fxcrt. Bug: pdfium:898 Change-Id: Ia507482bc0a1d6d8bbf12c0c55c4a88f6c8910e2 Reviewed-on: https://pdfium-review.googlesource.com/14615 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Move CFX_MaybeOwned to fxcrt::MaybeOwnedDan Sinclair
This CL moves CFX_MaybeOwned into the fxcrt namespace and removes the CFX_ prefix. The test names for maybe owned were updated to be in the MaybeOned test suite instead of the fxcrt suite. Bug: pdfium:898 Change-Id: I0c07057d66c8610e7b19133094b4507fff725e76 Reviewed-on: https://pdfium-review.googlesource.com/14470 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-21Move CFX_AutoRestorer to fxcrt::AutoRestorerDan Sinclair
This CL renames CFX_AutoRestorer to just AutoRestorer and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: Id9f36df94e95f3b2a55054bc198ca1bfd249ee3d Reviewed-on: https://pdfium-review.googlesource.com/14450 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-18Convert string class namesRyan Harrison
Automated using git grep & sed. Replace StringC classes with StringView classes. Remove the CFX_ prefix and put string classes in fxcrt namespace. Change AsStringC() to AsStringView(). Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*, Foo). Couple of tests needed to have their names regularlized. BUG=pdfium:894 Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d Reviewed-on: https://pdfium-review.googlesource.com/14151 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-13Add reverse iterators to CFX String classes.Tom Sepez
Reverse iteration with signed lengths and indices is kinda icky without this abstraction, and STL provides this pretty much "for free" given the existing forward iterator. Change-Id: I97c36c8bd23c0aa48195bc17da7c672292b4cde2 Reviewed-on: https://pdfium-review.googlesource.com/13770 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-09-13Rewrite IsHyphen using string operationsRyan Harrison
The existing code did end of range checks by making sure that the value was never less then 0. This isn't correct when using an unsigned type, since 0 - 1 will wrap around to the max possible value, and thus still be less then 0. Additionally the existing code was hard to follow due to the complexity of some of the low level operations being performed. It has been rewritten using higher level string operations to make it clearer and correct. BUG=chromium:763256 Change-Id: Ib8bf5ca0e29e73724c4a1c4781362e8a8fc30149 Reviewed-on: https://pdfium-review.googlesource.com/13690 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-13Avoid double va_list traversal in CFX_WideString::FormatVTom Sepez
Speculative fix for bug. Also remove FX_VA_COPY as va_copy should be fine on all ports nowdays (we think). Bug: 763965 Change-Id: I5c321d5624d00b3b2f262ec599e4382f02b744ff Reviewed-on: https://pdfium-review.googlesource.com/13790 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-09-08Fix one-second spin in fx_random.cppTom Sepez
Take seed generation logic from base's address_space_randomization.cc. One small tweak is to avoid the bottom three bits of a stack address and invert, to make leaking ASLR more difficult along the lines of the freelist masking in base's partition allocator. Another tweak is to mix in some more time-based information. Another tweak is to add in the times called so that rapid successive calls return different results. Bug: pdfium:891 Change-Id: I14238da15cee9c8d4ca72d79e4f7fbb26997c619 Reviewed-on: https://pdfium-review.googlesource.com/13490 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2017-09-07Use std::move so this code compiles properly using gcc.chromium/3210chromium/3209Andrew Weintraub
R=dsinclair@chromium.org Bug: Change-Id: I34f9498f4e5942c5b10ab2848509de935882321d Reviewed-on: https://pdfium-review.googlesource.com/13470 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-09-07Roll DEPS for build to a049c43.Lei Zhang
This enables MSVC by default on Windows again, so fix code that fail to build with MSVC too. Change-Id: I03fb4e3697ad777a4dca88af462b35526d6c1d4d Reviewed-on: https://pdfium-review.googlesource.com/13392 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-06Merge CFX_WordBreak into CFDE_TextEditEngine::Iterator.Dan Sinclair
This CL moves the CFX_WordBreak::FindNextBreakPos into the text edit engine iterator. The word break data was moved to cfde_wordbreak_data. Change-Id: Ie022f5f761479f97b9d4bc7789f890cb2ef99106 Reviewed-on: https://pdfium-review.googlesource.com/13250 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-06Implement word selection in CFDE_TextEditEngineDan Sinclair
This CL implements the needed logic in CFDE_TextEditEngine to handle word selection. Change-Id: I6b388c23655037fec107d68ec07d33638b959374 Reviewed-on: https://pdfium-review.googlesource.com/13211 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-06Convert FX_STRSIZE int->size_tRyan Harrison
Change the underlying type for FX_STRSIZE to size_t from int. This will make the value unsigned and thus all values in the range of the type will be valid. This allows for the final remove of negative length strings, but also introduces a some casting and functional errors, since many parts of the code base assume that FX_STRSIZE is int or another signed type. This also CL fixes these errors. BUG=pdfium:828 Change-Id: I231dca59e96fc9330cbb099eecbdfc41fcf86f5b Reviewed-on: https://pdfium-review.googlesource.com/11830 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-06GUID cleanupDan Sinclair
This CL removes fx_guid and inlines into CXFA_FM2JSContext as needed. Change-Id: I08a1f03fd4be46730eee24ab73b8b5c0daf9cd7d Reviewed-on: https://pdfium-review.googlesource.com/13094 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-06Remove unused CFX_WordBreak::Next methodchromium/3208Dan Sinclair
CFX_WordBreak::Next is never called, removed. This was the only method to pass a different value for the bFromNext param for FindNextBreakPos() so that param was also removed. Change-Id: I14ca0dc65490ec64209ba0b872794f75b3e3104f Reviewed-on: https://pdfium-review.googlesource.com/13210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-05Rename fx_rand to fx_randomDan Sinclair
Match FX_Random method names. Change-Id: I2d178229563881479b80e1f86975f5b165475837 Reviewed-on: https://pdfium-review.googlesource.com/13093 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-05Cleanup CFX_WordBreakDan Sinclair
Remove unused GetWord, make methods only used in the class private. Change-Id: Ia5b63da7f9dc3a918380742213d98f9d1b3651a3 Reviewed-on: https://pdfium-review.googlesource.com/13092 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-05Remove unused CFX_CharIter classDan Sinclair
The CFX_CharIter class was only used in a single Attach call of CFX_WordBreak which is never called. Removed. Change-Id: I8262cbb25d341b976ab85095250357fecba48fbc Reviewed-on: https://pdfium-review.googlesource.com/13091 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-05Split fx_guid from fx_extensionDan Sinclair
This CL splits the GUID code out of fx_extension into an fx_guid.h file. Change-Id: I915538ff98601efb07595264eff6435729193177 Reviewed-on: https://pdfium-review.googlesource.com/13090 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-05Split random code from fx_extension.hDan Sinclair
This CL moves the code invovled in random number generation into fx_rand.h from fx_extension.h. Change-Id: I6c644d7ec0323f32ef6e23c2e2548a9c792e3a72 Reviewed-on: https://pdfium-review.googlesource.com/13070 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-05Split fx_ucd.h into fx_unicode.h and fx_ucddata.h.Tom Sepez
File naming now matches. Fix one usage not going through the accessor function. Change-Id: I5cc4986238764964f2a71807a94bd2facf517263 Reviewed-on: https://pdfium-review.googlesource.com/12930 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-01Cleanup usages of Mid(foo, 1), Right(1), and Left(1)chromium/3203Ryan Harrison
Mid(foo, 1) is equivalent to [foo], if all you want is the character. Similarly Left(1) is [0]. It is faster also, since it does not need to create intermediate strings. Right(1) is a touch more tricky, since it requires something like GetLength() ? [GetLength() - 1] : 0;. A new method, Last() has been added to perform this character extraction. Multiple call sites have been updated to use more efficient/simpler syntax. There are a number of call sites that use on these patterns, but based on the surrounding context we actually need/want a string, so they have not been modified. Change-Id: I485a7f9c7b34c9bdacecada610158f996816afdd Reviewed-on: https://pdfium-review.googlesource.com/12890 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-01Prepare for converting FX_STRSIZE int->size_tRyan Harrison
When turning on this conversion a number of typing issues and other nits where found in the code base that can be merged in without actually changing the underlying type. Landing these changes before the type change CL, since there is a high likelihood that the type change will need to be rolled back, since it is high risk. BUG=pdfium:828 Change-Id: I587443d9090055963446485a1aacb8772eb5ca64 Reviewed-on: https://pdfium-review.googlesource.com/12810 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-01Fix integer overflow in Buffer_itoa when passing INT_MIN.Henrique Nakashima
Bug: chromium:760034 Change-Id: Id0862749b1454e065de4de7d746a27e78ac58e30 Reviewed-on: https://pdfium-review.googlesource.com/12730 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-31Remove unused FXFORMAT_HEX and FXFORMAT_CAPITAL.Henrique Nakashima
Change-Id: I13140ea4242db4b0860f8fdd164f50d1745c0794 Reviewed-on: https://pdfium-review.googlesource.com/12790 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-31Rename fxcrt_ and ifxcrt_ files to better namesDan Sinclair
The CFXCRT and IFXCRT prefix was only used on 3 files. This CL renames them to the more common CFX and IFX. The files were renamed as needed. Change-Id: Iccdaa55c5822adb93af7c58aedfb121413a30223 Reviewed-on: https://pdfium-review.googlesource.com/12675 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-31Move implementations into fx_system.cppDan Sinclair
This CL moves code defined in fx_system.h to be implemented in fx_system.cpp. Change-Id: I0c19066d4497bd208f4560fdcaf57cf04bf9f146 Reviewed-on: https://pdfium-review.googlesource.com/12674 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-31Move fx_extension implementation to cpp fileDan Sinclair
This CL moves the GetBits32 implemenation into fx_extension.cpp. It also moves some of the fx_basic unittests to the correct unittest files. Change-Id: I2cf8657c228375508db0f02baa628d62a3b2ab25 Reviewed-on: https://pdfium-review.googlesource.com/12673 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-31Move stream code into fx_stream.cppDan Sinclair
This CL moves methods defined in fx_stream.h into the fx_stream.cpp file. Change-Id: I32147d18dd7f4a29c228f11d108ac01cb891b290 Reviewed-on: https://pdfium-review.googlesource.com/12672 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-31Move methods string methods to fx_string.cppDan Sinclair
This CL creates an fx_string.cpp and moves any methods defined in fx_string.h into the .cpp file. Change-Id: I64c310b9be6d8f4c3be633a22884023c0b16fc1b Reviewed-on: https://pdfium-review.googlesource.com/12671 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-31Cleanup fx_basic_* filesDan Sinclair
Remove dead code, move code to namespaces where possible, cleanup some single use items. Change-Id: Ia734477ceb2105a1ed272463bd8220f1205a7ce9 Reviewed-on: https://pdfium-review.googlesource.com/12732 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-31More BIDI code shufflingchromium/3206chromium/3205Dan Sinclair
Change-Id: I6df7e7d1283541ea2e6b9bcf3de172f6a886054a Reviewed-on: https://pdfium-review.googlesource.com/12731 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-31Move bidi code to fx_bidiDan Sinclair
This CL moves the BIDI code from fx_arabic to fx_bidi and conditionally compiles based on XFA. Change-Id: Iaba60486f03e48f0816d60e365a58a8622bc8254 Reviewed-on: https://pdfium-review.googlesource.com/12713 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-31Remove fx_basic.hDan Sinclair
This CL removes the fx_basic.h header and fixes up includes as needed. Change-Id: I49af32a8327bdbcda40c50a61ffbd75d06609040 Reviewed-on: https://pdfium-review.googlesource.com/12670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-31Split IFX_Pause out of fx_basicDan Sinclair
This CL moves IFX_Pause out to its own class from fx_basic and updates includes as needed. Change-Id: Iebdd183d8c85aa17570f190f1a7d1602c0af3c8b Reviewed-on: https://pdfium-review.googlesource.com/12491 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-30Split CFX_FixedBufGrow out of fx_basicchromium/3201Dan Sinclair
This CL moves CFX_FixedBufGrow to its own files and updates includes as needed. Change-Id: Ia0cb70569b30acdb3ba9f23d8937ab8f9c17d6e6 Reviewed-on: https://pdfium-review.googlesource.com/12490 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-30Move CFX_WideTextBuf out of fx_basicDan Sinclair
This CL moves CFX_WideTextBuf to its own files and updates includes as needed. Change-Id: Ibe66ecf3e66f8f01dd8e9eaf6b467588be86ad4f Reviewed-on: https://pdfium-review.googlesource.com/12413 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-30Move CFX_BinaryBuf out of fx_basicDan Sinclair
This CL splits the CFX_BinaryBuf out of fx_basic into its own files. The various includes have been updated. Change-Id: I0fa616eeb4df6dd229c02dc3a0597b3dced59425 Reviewed-on: https://pdfium-review.googlesource.com/12412 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-30Move CFX_UTF8Decoder out of fx_basicDan Sinclair
This CL moves CFX_UTF8Decoder out of fx_basic and includes where needed. Change-Id: I1a093a8a77bbefcc90fbb2f81b1da65bfc0512bf Reviewed-on: https://pdfium-review.googlesource.com/12411 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-30Move CFX_UTF8Encoder out of fx_basicDan Sinclair
The CFX_UTF8Encoder is only used in FX_UTF8Encode(). This CL moves the class to the anonymous namespace with that method. The unused AppendStr method has been removed. Change-Id: Ie514686c4b4489bb0b0df83b7eeec14bb1876fcd Reviewed-on: https://pdfium-review.googlesource.com/12410 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-08-30Split auto restorer from fx_basicDan Sinclair
This CL moves CFX_AutoRestorer into its own file, separate from fx_basic.h. Change-Id: I415cb9207416bd4744b8ac8e2d7466852db53f0a Reviewed-on: https://pdfium-review.googlesource.com/12390 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-30Move CFX_BitStream to its own fileDan Sinclair
This CL moves the CFX_BitStream code out of fx_basic and into cfx_bitstream. Bug: pdfium:867 Change-Id: I5b7e6190a7db1fe1d24feb6bd676035a5c73ee92 Reviewed-on: https://pdfium-review.googlesource.com/12350 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-08-30Convert int* references to FX_STRSIZERyan Harrison
Through out the code base there are numerous places where variables are declared using a signed integer type when interacting with the string classes, since they assume that FX_STRSIZE is 'int'. As part of changing the underling type of FX_STRSIZE to be unsigned, these locations are being changed to use FX_STRSIZE. This is necessary as part of converting the type, but has been broken off into a separate CL, since it should be low risk. Some related cleanups that are low risk are included as part of this CL. BUG=pdfium:828 Change-Id: Ifaae54ad195ccde0fe8672f71271d29a6ebd65fd Reviewed-on: https://pdfium-review.googlesource.com/12210 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-08-30Cleanup CFX_SeekableStreamProxyRyan Harrison
Clean up being done in preperation for removal of negative length strings. This means that FX_STRSIZE will become unsigned so the return methods cannot return -1. Other cleanup suggested by reviewers is included. BUG=pdfium:828 Change-Id: I2cfb78c8ab7738516e0c9f8a99caec6f6cb12cde Reviewed-on: https://pdfium-review.googlesource.com/12170 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-08-28Remove unused / rarely used CFX_PTemplate methods.Lei Zhang
CFX_Point and CFX_PointF are derived from CFX_PTemplate. Add a helper function to replace the rarely used method where its used. Change-Id: I28448d44bbae9aa6773d1ad5fd7daf342b67c84c Reviewed-on: https://pdfium-review.googlesource.com/12071 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-25Add help IsValid* methods to string classeschromium/3198chromium/3197Ryan Harrison
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>
2017-08-23Convert string Find methods to return an OptionalRyan Harrison
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>
2017-08-22Bypass asserts in string [] operator for empty stringschromium/3194Ryan Harrison
The previous behaviour of [] on an empty string was to return 0 regardless of the index. We wanted to make this more strict, hence the current behaviour. This has led to a number of crashes due to code depending on the old behaviour. Reverting to the old behaviour until we have time to correct the call sites using empty strings. Bug=chromium:752480, pdfium:828 Change-Id: I511eea4148de85bf7f4694351e7a030b1a37f0de Reviewed-on: https://pdfium-review.googlesource.com/11630 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>