summaryrefslogtreecommitdiff
path: root/core/fxcrt/widestring.cpp
AgeCommit message (Collapse)Author
2018-04-17Re-land "Return pdfium::span<char> from ByteString::GetBuffer().""Tom Sepez
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>
2018-04-17Reland "Return pdfium::span<wchar_t> from WideString::GetBuffer().""Tom Sepez
This reverts commit 0d32b8fda53e02c1036d39f7290d4f59f2b58ca4. Restore behaviour on trunk. TBR: dsinclair@chromium.org Change-Id: Ia867f09ae9d2885595c4d9b300a058431dfd84f2 Reviewed-on: https://pdfium-review.googlesource.com/30811 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-16Revert "Return pdfium::span<wchar_t> from WideString::GetBuffer()."Tom Sepez
This reverts commit 154e18f9a862975abecebe77b8f5fb418418d14c. Reason for revert: Generate CL to merge to beta branch Original change's description: > Return pdfium::span<wchar_t> from WideString::GetBuffer(). > > Adds bounds checking "for free", but beware of span outliving > a ReleaseBuffer() call. Scoping as such avoids the possibility > of using an invalid span (and it is flagged as a lifetime issue). > > Change-Id: Ica63f4b1429823d0254ec6951aeaeb08160cb93c > Reviewed-on: https://pdfium-review.googlesource.com/30310 > Reviewed-by: dsinclair <dsinclair@chromium.org> > Commit-Queue: Tom Sepez <tsepez@chromium.org> TBR=tsepez@chromium.org,dsinclair@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: Ie1ec9434215584a024538ca8edeb59dea555af48 Reviewed-on: https://pdfium-review.googlesource.com/30830 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-04-16Revert "Return pdfium::span<char> from ByteString::GetBuffer()."Tom Sepez
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>
2018-04-12Return pdfium::span<char> from ByteString::GetBuffer().Tom Sepez
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>
2018-04-12Return pdfium::span<wchar_t> from WideString::GetBuffer().Tom Sepez
Adds bounds checking "for free", but beware of span outliving a ReleaseBuffer() call. Scoping as such avoids the possibility of using an invalid span (and it is flagged as a lifetime issue). Change-Id: Ica63f4b1429823d0254ec6951aeaeb08160cb93c Reviewed-on: https://pdfium-review.googlesource.com/30310 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-03-14Fix bad return value in WideString::Compare().chromium/3371Lei Zhang
When comparing L"a" vs L"ab", the return value should be -1 or 1, not 0 or 1. Add a regression test for this case. BUG=chromium:821454 Change-Id: I38e2d7ca62319b7a62f8d8afeb231b8ed3bd9e86 Reviewed-on: https://pdfium-review.googlesource.com/28570 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-01-11Add jumbo build support for fdrm, fpdfdoc and fxcrt.Lei Zhang
BUG=pdfium:964 Change-Id: Ifde885861aeafac803948bd537de826e2a3fddca Reviewed-on: https://pdfium-review.googlesource.com/22732 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-04Convert usages of pdfium::Optional to OptionalRyan Harrison
Change-Id: I29769f78eaad10c6a8b79e27524336c4f330377e Reviewed-on: https://pdfium-review.googlesource.com/22258 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-12-12Combine WideString::operator< and Compare().Lei Zhang
Change-Id: I3ea13ace6290e8fab41a3f65c9ac047407a74e4d Reviewed-on: https://pdfium-review.googlesource.com/20852 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-21Add {Byte/Wide}String::Trim().Lei Zhang
So callers no longer have to call str.TrimLeft(); str.TrimRight(); Change-Id: If931eaa8d891f487b9618ebbeee5ee294e807846 Reviewed-on: https://pdfium-review.googlesource.com/18990 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-16Make WideString::{Format|FormatV} staticDan Sinclair
This CL moves the Format and FormatV methods from WideString to be static. Bug: pdfium:934 Change-Id: I9941d6a2a5bbf0a82087cd0ea5d0f8fc42eecd3e Reviewed-on: https://pdfium-review.googlesource.com/18630 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-06Improve ByteString{View}::operator<().Lei Zhang
Make it possible to compare: 1) const char* < ByteStringView 2) ByteString < const char* 3) ByteString < ByteStringView 4) const char* < ByteString Do the same for WideString{View}. With new unit test cases. Change-Id: I31da526b1ab78b8d51ec1c99bf29046fe13754d5 Reviewed-on: https://pdfium-review.googlesource.com/17872 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-09-27Remove FXSYS_strlen and FXSYS_wcslenchromium/3226Ryan Harrison
With the conversion of internal string sizes to size_t, these wrappers are no longer needed. Replacing them with strlen and wcslen respectively. BUG=pdfium:828 Change-Id: Ia087ca2ddaf688a57ec9bd9ddfb8533cbe41510d Reviewed-on: https://pdfium-review.googlesource.com/14890 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-09-27Replace FX_SAFE_STRSIZE with FX_SAFE_SIZE_TRyan Harrison
BUG=pdfium:828 Change-Id: If9560338c456b28f968e743a90a3629791d87df0 Reviewed-on: https://pdfium-review.googlesource.com/14832 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-09-27Remove FX_STRSIZE and replace with size_tRyan Harrison
BUG=pdfium:828 Change-Id: I5c40237433ebabaeabdb43aec9cdf783e41dfe16 Reviewed-on: https://pdfium-review.googlesource.com/13230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-09-21Move CFX_StringPoolTemplate to StringPoolTemplateDan Sinclair
This CL moves CFX_StringPoolTemplate to StringPoolTemplate and places in the fxcrt namespace. Bug: pdfium:898 Change-Id: I41c8f23d6ad814d65cd154092143efaa630a96d1 Reviewed-on: https://pdfium-review.googlesource.com/14619 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-21Move CFX_StringDataTemplate to StringDataTemplateDan Sinclair
This CL renames CFX_StringDataTemplate to StringDataTemplate and moves into the fxcrt namespace. Bug: pdfium:898 Change-Id: I1c1e5ae674c3cca34fd595272e9eebc9346ed6ac Reviewed-on: https://pdfium-review.googlesource.com/14618 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@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-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>