summaryrefslogtreecommitdiff
path: root/core/fxcrt
AgeCommit message (Collapse)Author
2017-01-25Remove last usage of IFX_Retainable.chromium/2993Tom Sepez
Change-Id: Id2ece818c80e8cce4748b9a237871131a7acd6d1 Reviewed-on: https://pdfium-review.googlesource.com/2354 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-01-24Use std::vector for fx_ucd.h arrays.chromium/2992tsepez
Review-Url: https://codereview.chromium.org/2650773003
2017-01-24Use std::vector for CFX_RectF arraystsepez
Review-Url: https://codereview.chromium.org/2653743002
2017-01-23Update safe numerics package to get bitwise opstsepez
Fix callers conventions to avoid ambiguity. Fix bad bounds check unmasked by change. Directly include headers no longer pulled in by numerics itself. Review-Url: https://codereview.chromium.org/2640143003
2017-01-20Replace CFX_ByteArray with CFX_ArrayTemplate<uint8_t>chromium/2990chromium/2989chromium/2988tsepez
Also replace CFX_Int32Array typedef with CFX_ArrayTemplate<int32_t>. Removing the typedefs makes subsequent conversion to std::vector<> easier on a case-by-case basis. Review-Url: https://codereview.chromium.org/2649563003
2017-01-20Remove CFX_Points, CFX_PointsF in favor of std::vectortsepez
CFX_Points was unused. Review-Url: https://codereview.chromium.org/2645523006
2017-01-17Avoid endless loop deleting CFGAS_GEFont.tsepez
It's a ref-counted class, so if we're in the destructor, the ref count has hit zero. We can't make a new ref pointer to itself here, as it will re-invoke the destructor when it goes out of scope. This should have been an obvious anti-pattern in hindsight. The object in question can't be in the m_pFontManager, since the font manager retains a reference, and we wouldn't get to this destructor while that is present. So the cleanup isn't required. Fixing this revealed a free-delete mismatch in cxfa_textlayout.cpp. I also converted to use unique_ptrs in a few places near this issue. Fixing this revealed a UAF in CFGAS_GEFont, memcpy'ing a RetainPtr is not a good idea as it doesn't bump the ref count. Also protect and friend the CFGAS_GEFont destructor, to make sure random deletes don't happen. Also kill off a const cast, and remove unnecessary conversion to retain_ptr when we already have one. TEST=look for absence of -11 in XFA corpus test logs, bots not currently noticing the segv. Argh. Review-Url: https://codereview.chromium.org/2631703003
2017-01-10Remove more _LP* typedefs.tsepez
Code is much clearer when we use the actual types rather than this convention. Review-Url: https://codereview.chromium.org/2618993002
2017-01-09Tidy cfgas_fontmgr, remove custom sorting code.tsepez
Review-Url: https://codereview.chromium.org/2610813010
2017-01-06Remove CFX_MapPtrToPtr and templates.chromium/2976chromium/2975tsepez
All usage is now replaced with stl equivalents. Move one definition from fx_basic.h to where it's actually needed. Review-Url: https://codereview.chromium.org/2612773007
2017-01-05Banish CFX_Points, CFX_PointsF, and CFX_RectFArray to XFA-side only.tsepez
Removes more array template usage fron non-XFA code. Review-Url: https://codereview.chromium.org/2614013002
2017-01-04Add missing operator<() to CFX_RetainPtr.tsepez
Use std::less<>() rather than a direct ptr1 < ptr2 comparison to be strictly correct in face of unspecified behaviour when ptr1 and ptr2 don't point within the same "object" (e.g. segment of memory on a brain-dead segmented architecture). This will allow their use as keys in maps. Review-Url: https://codereview.chromium.org/2616683002
2017-01-03Add CFX_RetainPtr Leak() and Unleak() methodstsepez
Required to pass pointers across C-APIs. Need this to clean up CPDFXFA_Page and retain ptrs. Review-Url: https://codereview.chromium.org/2583093003
2017-01-03Kill last use of CFX_PtrList.tsepez
I'd been waiting on this hoping the code would be refactored out of existence, but it looks to be used. Use tests against x.end() in place of a "null position". This is greatly complicated by the use of "tail position", which now calcluated by std::prev(x.end()) unless the list is empty. Review-Url: https://codereview.chromium.org/2592163002
2016-12-28Make CFX_Observable copy constructable.chromium/2969chromium/2968chromium/2967chromium/2966tsepez
Fix some naming to make things clearer. Review-Url: https://codereview.chromium.org/2587233002
2016-12-15Return unique_ptr from CFX_BinaryBuf::DetachBuffer()tsepez
In turn, make CPDF_Stream() take an unique_ptr. Review-Url: https://codereview.chromium.org/2584683002
2016-12-14Remove unused m_OtfFontData.chromium/2953tsepez
In turn, this makes CFX_BinaryBuf::AttachData() unused. Review-Url: https://codereview.chromium.org/2578793002
2016-12-13Replace CFX_FloatArray with std::vectortsepez
Review-Url: https://codereview.chromium.org/2567503002
2016-12-08Replace CFX_WideStringCArray with std::vector.chromium/2946tsepez
Review-Url: https://codereview.chromium.org/2562833002
2016-12-08Remove last usage of CFX_ObjectArray.tsepez
Review-Url: https://codereview.chromium.org/2558373002
2016-12-08Replace CFX_WideStringArray with std::vectortsepez
Minimalist changes with the tidying of the code to use better loop iterators as a follow-up. Review-Url: https://codereview.chromium.org/2556963004
2016-12-07Replace CFX_ByteStringArray with std::vector.tsepez
Also convernt one nearby array to vector as well. Review-Url: https://codereview.chromium.org/2559903002
2016-12-07Properly ref count IFX_FileAccess.tsepez
Review-Url: https://codereview.chromium.org/2562563002
2016-12-07Catch stray Retains() and Releases() outside of RetainPtr<>.tsepez
The previous CLs made the code clean, so now we can mark more things private, and add friends as appropriate. Review-Url: https://codereview.chromium.org/2560783003
2016-12-07Refcount all the IFX_ stream classes all the time.tsepez
We can remove a lot of "bOwnsStream" logic in the process. Always pass these by const reference, in case the called method wants to hang on to the stream (one exception is where we stick a raw pointer into a void* slot in a context from another layer). Review-Url: https://codereview.chromium.org/2451493002
2016-12-02Tidy fx_stream.htsepez
Group related IFX_ classes. Move #defines to .cpp file that uses them. Replace loose function with static method. Review-Url: https://codereview.chromium.org/2548583004
2016-12-01Make concrete stream classes private to .cpp, part 2tsepez
Fix naming to say "Stream" Review-Url: https://codereview.chromium.org/2543043002
2016-12-01Make more concrete stream classes private to .cpp filestsepez
Review-Url: https://codereview.chromium.org/2545653003
2016-11-30Convert loose FX_Create* functions into static methodstsepez
Also remove a bool that is always false. Review-Url: https://codereview.chromium.org/2539203002
2016-11-29Add pdfium::MakeRetain<>() helper function.tsepez
Part of the work to get rid of |new|s. Stripped from a forthcoming CL. Review-Url: https://codereview.chromium.org/2536973003
2016-11-28Use CFX_MaybeOwned<> in fpdf_edit_create.cppchromium/2936tsepez
Fix missing second template parameter in cfx_maybe_owned.h Review-Url: https://codereview.chromium.org/2522313002
2016-11-23Add CFX_MaybeOwned<> template.tsepez
This will allow us to get rid of more .release()s of unique_ptrs, as shown by the changed cpdf_colorspace usage. Review-Url: https://codereview.chromium.org/2526903002
2016-11-21Fixup lint flags.Dan Sinclair
The -build/include setting was masking out build/include_what_you_use. This CL restores them, fixes any build errors, and adds NOLINT as needed. As well, the runtime/explicit and runtime/printf flags are aslo enabled and NOLINT'd. lint cleanups Change-Id: Ib013b3eb29c8d0e48cad74c5df9028684130719f Reviewed-on: https://pdfium-review.googlesource.com/2030 Reviewed-by: Tom Sepez <tsepez@chromium.org>
2016-11-16Make CPDF_Object subclass constructors intern stringstsepez
Make CDPF_Arrays intern the object they create. Allow passing nullptr as a CFX_WeakPtr shortcut as well. Review-Url: https://codereview.chromium.org/2509123002
2016-11-08Define IsFloatEqual macro properly.thestig
BUG=chromium:663253 Review-Url: https://codereview.chromium.org/2482373002
2016-11-03Remove FX_BOOL entirely.tsepez
FX_BOOL was a type just like a regular C++ bool, except that it took 4x the space and frequently was used to hold values besides true or false. Review-Url: https://codereview.chromium.org/2471353002
2016-11-02Remove FX_BOOL from coretsepez
Review-Url: https://codereview.chromium.org/2477443002
2016-10-31Re-land "Change FX_BOOL definition from int to bool."chromium/2906tsepez
This reverts commit 747dcf7 Review-Url: https://codereview.chromium.org/2468723002
2016-10-29Revert of Change FX_BOOL definition from int to bool. (patchset #15 ↵dsinclair
id:250001 of https://codereview.chromium.org/2453473003/ ) Reason for revert: Potentially blocking the roll, speculative revert. See: https://codereview.chromium.org/2464643002/ Original issue's description: > Change FX_BOOL definition from int to bool. > > If this CL sticks, we can then remove it entirely. > > Committed: https://pdfium.googlesource.com/pdfium/+/dd65283408d9137e2f142e78dff2a1826baab5fd TBR=thestig@chromium.org,tsepez@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/2461893002
2016-10-28Change FX_BOOL definition from int to bool.tsepez
If this CL sticks, we can then remove it entirely. Review-Url: https://codereview.chromium.org/2453473003
2016-10-26Fix some FX_BOOL / int noise in fxcrt.chromium/2902tsepez
Review-Url: https://codereview.chromium.org/2450183003
2016-10-24Rename IFX_ stream nameschromium/2900tsepez
It's been troubling for some time that an IFX_FileStream might actually be an in-memory buffer with no backing file. Review-Url: https://codereview.chromium.org/2443723002
2016-10-17Rename CFX_CountRef to CFX_SharedCopyOnWritetsepez
Avoid confusing this class with other ref-counted objects. Review-Url: https://codereview.chromium.org/2426673002
2016-10-13Clean up fx_basic_util a littlenpm
- Nit fixes. - Remove unused methods. - Replace FX_BOOL with bool. Review-Url: https://codereview.chromium.org/2419433004
2016-10-03Add ptr_util.h from base until std::make_unique<> availabletsepez
Review-Url: https://codereview.chromium.org/2386273004
2016-10-03Rename CFX_WeakPtr::Clear() to DestroyObject()tsepez
|Clear| is too easily mistaken for "clear this pointer only." Review-Url: https://codereview.chromium.org/2385303002
2016-09-29Move core/fxcrt/include to core/fxcrtdsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2382723003
2016-09-28Replace a few more std::unique_ptr.reset() with WrapUnique assignments.thestig
And fix a typo. TBR=tsepez@chromium.org Review-Url: https://codereview.chromium.org/2382443004
2016-09-28Implement weak pointerschromium/2876chromium/2875tsepez
These will be a replacement for CFX_CountRef in future CLs, since CFX_CountRef is manually incremented and error-prone. Review-Url: https://codereview.chromium.org/2377143002
2016-09-28Revert "Rename CPDF_CountedObject to CFX_WeakPtr::Handle"tsepez
This reverts commit fe0179ded8202939ea4f2b92a879b8dede7821ea. This is blocking incremental revision, will try again. Review-Url: https://codereview.chromium.org/2377033003