summaryrefslogtreecommitdiff
path: root/core/fxcrt
AgeCommit message (Collapse)Author
2018-01-09Fix death tests for UnownedPtr + MSAN.Lei Zhang
They should only expect death in ASAN builds. BUG=pdfium:958 Change-Id: I62bd51151238bc57abb5fe700985c33d7fde3e28 Reviewed-on: https://pdfium-review.googlesource.com/21930 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-01-08Make SharedCopyOnWrite use RetainablesDan Sinclair
This CL removes the CountedObject from SharedCopyOnWrite and instead converts the items being shared into Retainable subclasses. BUG: chromium:792372 Change-Id: I9570a521f2fc2434013c3ccb103273bdd2440bb8 Reviewed-on: https://pdfium-review.googlesource.com/22010 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-01-05Convert CXML_Parser::GetAttrValue out param to returnRyan Harrison
Change-Id: I92420cb9333ad79246a855b0af9a27348b27ceb0 Reviewed-on: https://pdfium-review.googlesource.com/22312 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@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-20Combine operator< and ByteString::Compare().Lei Zhang
Fix or optimize some ByteString::Compare() callers. Change-Id: I0fde91afc3d17fe160b46d00a441ad05e56377e7 Reviewed-on: https://pdfium-review.googlesource.com/20851 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-19Remove some dead code.Lei Zhang
Change-Id: I8edb14c024860c66b5e6c014136393e71e38387d Reviewed-on: https://pdfium-review.googlesource.com/21570 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-13Get rid of CXML_AttrMap.Lei Zhang
BUG=pdfium:541 Change-Id: Id401af00e4cffebb49e187bf3a445439ce8c1082 Reviewed-on: https://pdfium-review.googlesource.com/21074 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-13Fix some nits in CXML_Element.Lei Zhang
Move FX_XML_SplitQualifiedName() out of CXML_Parser, and add CXML_Element::MatchesElement(). Change-Id: I34adc6f3b19e745ae33db0edf65184346cc1c13f Reviewed-on: https://pdfium-review.googlesource.com/21073 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-13Use size_t in CXML_Element and callers.Lei Zhang
Change-Id: I9ebacd18252a837f1f5f13ccaec19b196bacc3ae Reviewed-on: https://pdfium-review.googlesource.com/21072 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-13Simplify CXML_Element::GetTagName().Lei Zhang
It has an unused parameter. Change-Id: Iae92b8f84bc560055cb0cd730a0fe52c8bd9dd79 Reviewed-on: https://pdfium-review.googlesource.com/21071 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-13Inline CXML_Element private methods.Lei Zhang
Bug: 541 Change-Id: I43bb09312b0d7312207e5c235ba80a2593877d07 Reviewed-on: https://pdfium-review.googlesource.com/21070 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-12-13Remove dead CXML_Element code.Lei Zhang
Move non-trivial implementations into the .cpp file as well. Change-Id: Iebe7d7284e453c6405cddfe880e2c85aa0c804ab Reviewed-on: https://pdfium-review.googlesource.com/21050 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@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-12-11Remove default arguments to CPDF_StreamAcc::LoadAllData().Lei Zhang
Add LoadAllDataFiltered() and LoadAllDataRaw() and update callers. Change-Id: I9b80ee34a358db204968acdc8b1adc9db0b6b83f Reviewed-on: https://pdfium-review.googlesource.com/20810 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-12-07Add WARN_UNUSED_RESULT to more static methods in (Byte|Wide)String.Henrique Nakashima
Also fixes some usages that were not working as intended after the conversion to static. Change-Id: I18c18369754f6ca165f98999b5b80eecf6c76973 Reviewed-on: https://pdfium-review.googlesource.com/20590 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-12-07Add WARN_UNUSED_RESULT to ByteString::Format* methods.Henrique Nakashima
Change-Id: I0caba99cb8e99ea5af49d906b576f580275620bb Reviewed-on: https://pdfium-review.googlesource.com/20570 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-12-07Fix WideString::Format instances that should use %lsRyan Harrison
BUG=pdfium:951 Change-Id: I4b82ce81c8db3f00fa2341c6fb853ed84814e5e5 Reviewed-on: https://pdfium-review.googlesource.com/20510 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-12-04Simplify some CFX_FloatRect methods.chromium/3285Lei Zhang
Also add a comment about the various CFX_FloatRect to FX_RECT conversion methods. Change-Id: Ia9984797dc513cdc487fe9972b32c216c9f99ec1 Reviewed-on: https://pdfium-review.googlesource.com/20217 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-12-01Get rid of else after break/continue/return.chromium/3284chromium/3283Lei Zhang
Change-Id: I3efc57cd7325d16e3ca8ebdeeaec06012b2c56e3 Reviewed-on: https://pdfium-review.googlesource.com/20110 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-01Add CFX_FloatRect::ToRoundedFxRect().Lei Zhang
Unlike ToFxRect(), which floors the LBRT values. Also fix some nits. Change-Id: I0680eebb09031807a14402ca30b13558ea5b56d9 Reviewed-on: https://pdfium-review.googlesource.com/20213 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-12-01Add CFX_FloatRect::Scale().Lei Zhang
Unlike ScaleFromCenterPoint(), Scale() just scales the LBRT values. Also add unit tests for CFX_FloatRect::Normalize(). Change-Id: Iebf48fa9adcf47adff3255b157d3e3056f3687fc Reviewed-on: https://pdfium-review.googlesource.com/20212 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-12-01Rename CFX_FloatRect::Scale() to ScaleFromCenterPoint().Lei Zhang
Change-Id: I6baab14c989e8ae692ed1c846b135af95c09ce37 Reviewed-on: https://pdfium-review.googlesource.com/20210 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-12-01Remove unused CFX_FloatRect::Substract4().Lei Zhang
Change-Id: I08706f53bf3960cbea60b09a1702bf0ba371f1ce Reviewed-on: https://pdfium-review.googlesource.com/20211 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-01Add some CFX_FloatRect unit tests.Lei Zhang
Change-Id: I32cc3cb0a8a987980b900a5650cc051cb50dd1cc Reviewed-on: https://pdfium-review.googlesource.com/20190 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-11-30Run clang-tidy modernize-use-auto on //third_party/pdfiumDan Sinclair
See the bugs and cxx post for justification and details: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8 This change was done using clang-tidy as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md Bug: chromium:776257 Change-Id: I1f6637cde8b3e41825993a736bed6763dd7beacb Reviewed-on: https://pdfium-review.googlesource.com/19971 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-30Run clang-tidy modernize-use-equals-{delete,default} on //third_party/pdfiumDan Sinclair
See the bugs and cxx post for justification and details: https://groups.google.com/a/chromium.org/forum/#!topic/cxx/RkOHzIK6Tq8 This change was done using clang-tidy as described here: https://chromium.googlesource.com/chromium/src/+/lkcr/docs/clang_tidy.md In some cases the the tool leaves behind a string of commas where it replaced a member initializer list (https://bugs.llvm.org/show_bug.cgi?id=35051). They were cleaned up with: git diff --name-only | \ xargs sed -E -i 's/(^\s*|\)\s*):[ ,]*= default/\1 = default/' Bug: chromium:778959, chromium:778957 Change-Id: I23e60d3d6c8bc9e8574d425710a0441cb5510d6b Reviewed-on: https://pdfium-review.googlesource.com/19970 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-29Remove CollectionSize from fx_bidiDan Sinclair
Bug: pdfium:774 Change-Id: I2056583c270f1bb0046250ce2ec53a2cbe46b893 Reviewed-on: https://pdfium-review.googlesource.com/19672 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-11-28Remove CollectionSize from string_view_templateDan Sinclair
Bug: pdfium:774 Change-Id: Id993864c4ae009e686c62e7be13e2db5d8cb4170 Reviewed-on: https://pdfium-review.googlesource.com/19572 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-27Change FPDF_GetText to return "" when asked to get 0 charactersRyan Harrison
BUG=chromium:788103 Change-Id: I8ebdbc78eb14c358d7ac019b96de4828e6071b79 Reviewed-on: https://pdfium-review.googlesource.com/19350 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-11-21Avoid passing pointers by reference in core.Lei Zhang
This gets rid of most core/ non-const ref passing, either by passing by pointer-to-pointer instead, or by returning std::pair. Change-Id: Id7bdc355a1a725a05f9fa2f1e982ca8c975beef1 Reviewed-on: https://pdfium-review.googlesource.com/19030 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@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-16Convert CFX_DateTime::Now to be staticchromium/3272Dan Sinclair
This CL converts the CFX_DateTime::Now method to be a static and updates the callers. Change-Id: I26052c6194ed2d43bca5fee2542787ce166eda85 Reviewed-on: https://pdfium-review.googlesource.com/18670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-11-16Convert ByteString::{Format|FormatV} to static methodsDan Sinclair
This CL moves the Format and FormatV methods of ByteString to be static. Bug: pdfium:934 Change-Id: I9c30455a789aff9f619b9d5bf89c0712644f2d9a Reviewed-on: https://pdfium-review.googlesource.com/18650 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@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-14Move CXFA_FileRead out of XFA and renameRyan Harrison
This code doesn't depend on XFA, but is only used by it. Moving it out, so it will be easier for me to write some tools for extracting data out of PDFs. Bug: Change-Id: Ic18613b46abed5124c47f539833b01b12c1c6e56 Reviewed-on: https://pdfium-review.googlesource.com/18410 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-11-07Remove unused parameter from ByteString::FormatFloat().Lei Zhang
Nobody sets |precision| and the method does not read it either. Change-Id: I0f45fe953c005f817d331cbf73e38f7b15a77b81 Reviewed-on: https://pdfium-review.googlesource.com/17890 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: 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-11-06Mark string pointers as const in string unit tests.Lei Zhang
Change-Id: I4895ee9c0cbe1aaf1fe9913d39ce11e6ad855dd3 Reviewed-on: https://pdfium-review.googlesource.com/17873 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-11-03Remove flags param from FXMEM_DefaultAlloc() and friends.Lei Zhang
Change-Id: I24404be0065156a1cfdec31bafdf72c27fa70142 Reviewed-on: https://pdfium-review.googlesource.com/17792 Reviewed-by: Chris Palmer <palmer@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-10-05Remove friends from CXML_ElementDan Sinclair
This CL removes the friends from CXML_Element and adds accessors as needed. Change-Id: I4f76935caa753a063bef4ff2d043273ae4e14e14 Reviewed-on: https://pdfium-review.googlesource.com/15535 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-04Remove CFX_CRTFileAccessDan Sinclair
The CFX_CRTFileAccess class was only used in one place and only provided one method. That method was folded back into the caller and the class removed. Change-Id: I5e670474244a9ec037b6d099d67bd5091cac7ff4 Reviewed-on: https://pdfium-review.googlesource.com/15410 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-02Replace GetWord_LSBFirst with FXWORD_GET_LSBFIRSTchromium/3231Ryan Harrison
The existing implementation of a LSB first word method was incorrect, in addition it was implemented to the BMP code, but also used in the GIF code. Thus is should be moved to a common location. Also added in an implementation for FXWORD_GET_MSBFIRST, since the GIF code will need this. BUG=pdfium:914 Change-Id: I0e84813356fbd456b293a190da3c2cde01a6580b Reviewed-on: https://pdfium-review.googlesource.com/15210 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-10-02Remove extraneous ;sDan Sinclair
Bug: pdfium:912 Change-Id: Iea61260ccc972627950b470a44ab21dbd2b4045b Reviewed-on: https://pdfium-review.googlesource.com/15170 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-10-02Removing unused definesDan Sinclair
Remove unused defines. Change-Id: Ibf10d8470f19cbf4528fe1342398a39ef15c1d12 Reviewed-on: https://pdfium-review.googlesource.com/15110 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-09-28Simplify some OS checks to PLATFORM checksDan Sinclair
This CL simplifies the OS == WIN{32|64} checks to be PLATFORM == WINDOWS checks. Change-Id: I1493d316dd457b0228e4ef39db4cf1d2b8abf97d Reviewed-on: https://pdfium-review.googlesource.com/14870 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@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-27Cleanup FX macrosDan Sinclair
This CL renames the FX_OS defines to have _OS_ in their names and drops the _DESKTOP suffix. The FXM defines have been changed to just FX. Change-Id: Iab172fba541713b5f6d14fb8098baf68e3364c74 Reviewed-on: https://pdfium-review.googlesource.com/14833 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-09-26Remove _FX_IOS_chromium/3225Dan Sinclair
The _FX_IOS_ define is never defined, so it isn't useful to check _FX_OS_ against. Remove. Change-Id: I90b50a1a0dc165073ed223cbfe861b9a227818dd Reviewed-on: https://pdfium-review.googlesource.com/14831 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>