editeng/source/editeng/editdoc.cxx | 2 +- include/o3tl/cow_wrapper.hxx | 27 ++++++++++----------------- 2 files changed, 11 insertions(+), 18 deletions(-)
New commits: commit cbc1310237d72c080fc03e37dbcc037e2a247925 Author: Mike Kaganski <[email protected]> AuthorDate: Thu Nov 20 07:34:37 2025 +0100 Commit: Mike Kaganski <[email protected]> CommitDate: Fri Nov 21 05:11:41 2025 +0100 Simplify cow_wrapper's refcounting policies implementation ... using a shared template. Also: use size_t in thread-safe policy, at least for consistency. Change-Id: I1342a171103df5db5e156253580e6ef0bfee09d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194233 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> diff --git a/include/o3tl/cow_wrapper.hxx b/include/o3tl/cow_wrapper.hxx index ee071fd3bf16..50adc4f9ca73 100644 --- a/include/o3tl/cow_wrapper.hxx +++ b/include/o3tl/cow_wrapper.hxx @@ -26,35 +26,28 @@ namespace o3tl { + template<typename N> struct RefCountingPolicy_t + { + typedef N ref_count_t; + static void incrementCount(ref_count_t& rCount) { ++rCount; } + static bool decrementCount(ref_count_t& rCount) { return --rCount != 0; } + static std::size_t getCount(const ref_count_t& rCount) { return rCount; } + }; + /** Thread-unsafe refcounting This is the default locking policy for cow_wrapper. No locking/guarding against concurrent access is performed whatsoever. */ - struct UnsafeRefCountingPolicy - { - typedef std::size_t ref_count_t; - static void incrementCount( ref_count_t& rCount ) { ++rCount; } - static bool decrementCount( ref_count_t& rCount ) { return --rCount != 0; } - static std::size_t getCount( ref_count_t rCount) { return rCount; } - }; + using UnsafeRefCountingPolicy = RefCountingPolicy_t<std::size_t>; /** Thread-safe refcounting Use this to have the cow_wrapper refcounting mechanisms employ the thread-safe oslInterlockedCount . */ - struct ThreadSafeRefCountingPolicy - { - typedef std::atomic<int> ref_count_t; - static void incrementCount( ref_count_t& rCount ) { rCount++; } - static bool decrementCount( ref_count_t& rCount ) - { - return (--rCount) != 0; - } - static std::size_t getCount( const ref_count_t& rCount) { return rCount; } - }; + using ThreadSafeRefCountingPolicy = RefCountingPolicy_t<std::atomic<std::size_t>>; /** Copy-on-write wrapper. commit 25ed44c0cd520bea3935db75c219e83ce1bcae62 Author: Mike Kaganski <[email protected]> AuthorDate: Thu Nov 20 10:59:25 2025 +0100 Commit: Mike Kaganski <[email protected]> CommitDate: Fri Nov 21 05:11:27 2025 +0100 A typo in code After commit 69e902d0855d236aa12ec3105d9947ab6cd1d6c7 (tdf#162120 Implement style:writing-mode-automatic, 2025-11-13). The code is in `#if ENABLE_YRS`, so not tested in CI. Change-Id: If8257481a54317b583bba4733231f215016ab322 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194257 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 485b4cfdbe24..5b88a6095575 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -2129,7 +2129,7 @@ void YrsImplInsertAttr(SfxItemSet & rSet, ::std::vector<sal_uInt16> *const pRemo case EE_PARA_AUTOWRITINGDIR: { yvalidate(rValue.tag == Y_JSON_BOOL); - SvxAutoFrameDirectionitem const item{ rValue.value.flag == Y_TRUE, nWhich }; + SvxAutoFrameDirectionItem const item{ rValue.value.flag == Y_TRUE, nWhich }; rSet.Put(item); break; }
