diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-22 10:25:57 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-04-22 12:45:38 +0200 |
commit | ab55c7bffddc1a4c8f3d971d24bae297a15f3346 (patch) | |
tree | 2716bcd933b912136e5254138a46f45d404ae76a /include | |
parent | 8e89ca42f3748e31fb600e6d69f96a6451e8240e (diff) |
clang-format char16_t2wchar_t.hxx
Change-Id: I5b86fb372702e3a6fdb3e4aa6846c4bc2e754307
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150778
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/o3tl/char16_t2wchar_t.hxx | 32 |
1 files changed, 8 insertions, 24 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: */ |