diff options
-rw-r--r-- | include/o3tl/char16_t2wchar_t.hxx | 32 | ||||
-rw-r--r-- | solenv/clang-format/excludelist | 1 |
2 files changed, 8 insertions, 25 deletions
diff --git a/include/o3tl/char16_t2wchar_t.hxx b/include/o3tl/char16_t2wchar_t.hxx index 6ffab02e78c9..cf0415343147 100644 --- a/include/o3tl/char16_t2wchar_t.hxx +++ b/include/o3tl/char16_t2wchar_t.hxx @@ -7,18 +7,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef INCLUDED_O3TL_CHAR16_T2WCHAR_T_HXX -#define INCLUDED_O3TL_CHAR16_T2WCHAR_T_HXX +#pragma once #include <sal/config.h> -namespace o3tl { - +namespace o3tl +{ #if defined _WIN32 // Helpers for safe conversion between wchar_t and char16_t in MSVC static_assert(sizeof(char16_t) == sizeof(wchar_t), - "These helper functions are only applicable to implementations with 16-bit wchar_t"); + "These helper functions are only applicable to implementations with 16-bit wchar_t"); // While other implementations define wchar_t as 32-bit integral value, and mostly use // char-based UTF-8 string APIs, in MSVC wchar_t is (non-conformant) 16-bit, and Unicode @@ -34,26 +33,11 @@ static_assert(sizeof(char16_t) == sizeof(wchar_t), // // Use these helpers for wchar_t (WSTR, WCHAR, OLESTR etc) to char16_t (sal_Unicode) string // conversions instead of reinterpret-cast in Windows-specific code. -inline wchar_t * toW(char16_t * p) -{ - return reinterpret_cast<wchar_t *>(p); -} -inline wchar_t const * toW(char16_t const * p) -{ - return reinterpret_cast<wchar_t const *>(p); -} -inline char16_t * toU(wchar_t * p) -{ - return reinterpret_cast<char16_t *>(p); -} -inline char16_t const * toU(wchar_t const * p) -{ - return reinterpret_cast<char16_t const *>(p); -} +inline wchar_t* toW(char16_t* p) { return reinterpret_cast<wchar_t*>(p); } +inline wchar_t const* toW(char16_t const* p) { return reinterpret_cast<wchar_t const*>(p); } +inline char16_t* toU(wchar_t* p) { return reinterpret_cast<char16_t*>(p); } +inline char16_t const* toU(wchar_t const* p) { return reinterpret_cast<char16_t const*>(p); } #endif - } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 211e9ca30c04..35d750b22cc9 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -5296,7 +5296,6 @@ include/linguistic/lngprophelp.hxx include/linguistic/misc.hxx include/linguistic/spelldta.hxx include/o3tl/any.hxx -include/o3tl/char16_t2wchar_t.hxx include/o3tl/cow_wrapper.hxx include/o3tl/enumarray.hxx include/o3tl/enumrange.hxx |