From 01baeab99890e5650b3dabc15f8d900490a5a133 Mon Sep 17 00:00:00 2001 From: Philipp Hofer Date: Thu, 12 Nov 2020 13:03:16 +0100 Subject: tdf#123936 Formatting files in module include with clang-format Change-Id: I0507dd797cd5a35e0ae14f4b69ee4e172d08a71a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105681 Reviewed-by: Christian Lohmaier Tested-by: Jenkins --- include/o3tl/deleter.hxx | 11 +++++------ include/o3tl/lru_map.hxx | 21 +++++++-------------- include/o3tl/make_shared.hxx | 10 ++++------ include/o3tl/runtimetooustring.hxx | 17 ++++++++--------- 4 files changed, 24 insertions(+), 35 deletions(-) (limited to 'include/o3tl') diff --git a/include/o3tl/deleter.hxx b/include/o3tl/deleter.hxx index a886acb03d3c..7cb9145eb2a1 100644 --- a/include/o3tl/deleter.hxx +++ b/include/o3tl/deleter.hxx @@ -17,15 +17,15 @@ #include #include -namespace o3tl { - +namespace o3tl +{ /** To markup std::unique_ptr that coverity warns might throw exceptions which won't throw in practice, or where std::terminate is an acceptable response if they do */ -template struct default_delete +template struct default_delete { - void operator() (T* p) noexcept + void operator()(T* p) noexcept { #if defined(__COVERITY__) try @@ -53,7 +53,7 @@ struct free_delete void operator()(void* p) { std::free(p); } }; -template void reset_preserve_ptr_during(uniqueptr& ptr) +template void reset_preserve_ptr_during(uniqueptr& ptr) { // HACK: for the case where the dtor of the obj held by ptr will trigger // functions which expect ptr to still be set during the dtor. @@ -62,7 +62,6 @@ template void reset_preserve_ptr_during(uniqueptr& ptr) delete ptr.get(); (void)ptr.release(); } - } #endif diff --git a/include/o3tl/lru_map.hxx b/include/o3tl/lru_map.hxx index e822fde0294c..c7132fd079c4 100644 --- a/include/o3tl/lru_map.hxx +++ b/include/o3tl/lru_map.hxx @@ -17,7 +17,6 @@ namespace o3tl { - /** LRU map * * Similar to unordered_map (it actually uses it) with additionally functionality @@ -31,7 +30,8 @@ namespace o3tl * for most of the operations with a combination unordered map and linked list. * **/ -template, class KeyEqual = std::equal_to> +template , + class KeyEqual = std::equal_to> class lru_map final { public: @@ -68,7 +68,8 @@ public: // a size of 0 effectively disables the LRU cleanup code lru_map(size_t nMaxSize) : mMaxSize(nMaxSize ? nMaxSize : std::min(mLruMap.max_size(), mLruList.max_size())) - {} + { + } ~lru_map() { // Some code .e.g. SalBitmap likes to remove itself from a cache during it's destructor, which means we @@ -139,8 +140,7 @@ public: } // reverse-iterates the list removing all items matching the predicate - template - void remove_if(UnaryPredicate pred) + template void remove_if(UnaryPredicate pred) { auto it = mLruList.rbegin(); while (it != mLruList.rend()) @@ -155,15 +155,9 @@ public: } } - list_const_iterator_t begin() const - { - return mLruList.cbegin(); - } + list_const_iterator_t begin() const { return mLruList.cbegin(); } - list_const_iterator_t end() const - { - return mLruList.cend(); - } + list_const_iterator_t end() const { return mLruList.cend(); } size_t size() const { @@ -177,7 +171,6 @@ public: mLruList.clear(); } }; - } #endif /* INCLUDED_O3TL_LRU_MAP_HXX */ diff --git a/include/o3tl/make_shared.hxx b/include/o3tl/make_shared.hxx index 9d7998fd5a36..5d4d98e42b3a 100644 --- a/include/o3tl/make_shared.hxx +++ b/include/o3tl/make_shared.hxx @@ -14,14 +14,13 @@ #include #include -namespace o3tl { - +namespace o3tl +{ /** Allocate an array stored in a shared_ptr, calling operator delete[]. Note that this is only allowed for arithmetic types because shared_ptr implicitly converts to sub-types. */ -template -std::shared_ptr make_shared_array(size_t const size) +template std::shared_ptr make_shared_array(size_t const size) { static_assert(std::is_arithmetic::value, "only arrays of arithmetic types allowed"); return std::shared_ptr(new T[size], std::default_delete()); @@ -31,8 +30,7 @@ std::shared_ptr make_shared_array(size_t const size) which won't throw in practice, or where std::terminate is an acceptable response if they do */ -template -std::shared_ptr make_shared(Args&&... args) +template std::shared_ptr make_shared(Args&&... args) { #if defined(__COVERITY__) return std::shared_ptr(new T(std::forward(args)...), o3tl::default_delete()); diff --git a/include/o3tl/runtimetooustring.hxx b/include/o3tl/runtimetooustring.hxx index 7f2015805722..6d6f27ac186e 100644 --- a/include/o3tl/runtimetooustring.hxx +++ b/include/o3tl/runtimetooustring.hxx @@ -20,8 +20,8 @@ #include #include -namespace o3tl { - +namespace o3tl +{ /** Convert an NTBS from the C++ runtime to an OUString. This is used to convert an NTBS as provided by std::exception::what or @@ -29,18 +29,17 @@ namespace o3tl { is done using RTL_TEXTENCODING_ISO_8859_1, so each char in the input maps to one Unicode character in the output. */ -inline OUString runtimeToOUString(char const * runtimeString) { +inline OUString runtimeToOUString(char const* runtimeString) +{ OUString s; bool ok = rtl_convertStringToUString( - &s.pData, runtimeString, std::strlen(runtimeString), - RTL_TEXTENCODING_ISO_8859_1, - (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR - | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR + &s.pData, runtimeString, std::strlen(runtimeString), RTL_TEXTENCODING_ISO_8859_1, + (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)); - assert(ok); (void) ok; + assert(ok); + (void)ok; return s; } - } #endif -- cgit