/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef INCLUDED_O3TL_RUNTIMETOOUSTRING_HXX #define INCLUDED_O3TL_RUNTIMETOOUSTRING_HXX #include #include #include #include #include #include #include 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 std::type_info::name into an OUString in a "lossless" way. The conversion 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) { 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 | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)); assert(ok); (void)ok; return s; } } #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ 2 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-09-16 17:52:53 +0200
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-09-17 21:01:48 +0200
commit4bbe329ef07bb38c939c6bef53ae4aa9928b9a52 (patch)
treea2c3637e0ec72d25a2e8dce98874562467a36dac /icon-themes/sukapura_svg
parent45ffeed6674e4f3c5b92f951094d41a0d0ec8002 (diff)
Avoid -Werror,-Wcast-function-type-mismatch
...as seen when building LOWA (i.e., --disable-dynloading) with a recent Clang with <https://github.com/llvm/llvm-project/commit/999d4f840777bf8de26d45947192aa0728edc0fb> "Split -Wcast-function-type into a separate group (#86131)", where -Wcast-function-type-mismatch generally warns about casts between incompatible function types... > cppuhelper/source/shlib.cxx:294:23: error: cast from 'void *(*)(void *, void *)' to 'ImplementationConstructorFn *' (aka 'css::uno::XInterface *(*)(css::uno::XComponentContext *, const css::uno::Sequence<css::uno::Any> &)') converts to incompatible function type [-Werror,-Wcast-function-type-mismatch] > 294 | = reinterpret_cast<ImplementationConstructorFn *>( > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 295 | map[i].constructor_function); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ...but not for the special case of casting from/to void(*)(void). (Using the correct function type > css::uno::XInterface * (*)(css::uno::XComponentContext *, css::uno::Sequence<css::uno::Any> const &) throughout would be even better, but doesn't easily fit into this C code that is included in low-level places that don't know those UNO types and is shared between LOWA and Android etc.) Change-Id: Ic4dbabbff0f772b34cf692db968c3ad257c37cb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173463 Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Tested-by: Jenkins