Add back computation of excepinfo.bstrDescription length

...which had been dropped with eebd84b337
"loplugin:stringview (clang-cl)".  But as discussed in the comments at
<https://gerrit.libreoffice.org/c/core/+/116548/2/extensions/source/ole/oleobjw.cxx#b1432>
"loplugin:stringview (clang-cl)", that dropped support for embedded NULs ("not
that this should matter here", though).

Change-Id: Ifdb327cbe8b20b365c8174802622f83b4510d547
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117836
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2021-06-25 17:16:40 +02:00
parent 5da5cb2b5e
commit 5caba6ebf4
+5 -2
View File
@@ -26,6 +26,7 @@
#include <osl/thread.h>
#include <memory>
#include <string_view>
#include <com/sun/star/script/CannotConvertException.hpp>
#include <com/sun/star/script/FailReason.hpp>
#include <com/sun/star/beans/XMaterialHolder.hpp>
@@ -1428,7 +1429,8 @@ uno::Any SAL_CALL IUnknownWrapper::directInvoke( const OUString& aName, const un
break;
case DISP_E_EXCEPTION:
message = OUString::Concat("[automation bridge]: ")
+ o3tl::toU(excepinfo.bstrDescription);
+ std::u16string_view(o3tl::toU(excepinfo.bstrDescription),
::SysStringLen(excepinfo.bstrDescription));
throw InvocationTargetException(message, Reference<XInterface>(), Any());
break;
case DISP_E_MEMBERNOTFOUND:
@@ -2049,7 +2051,8 @@ Any IUnknownWrapper::invokeWithDispIdComTlb(FuncDesc& aFuncDesc,
break;
case DISP_E_EXCEPTION:
message = OUString::Concat("[automation bridge]: ")
+ o3tl::toU(excepinfo.bstrDescription);
+ std::u16string_view(o3tl::toU(excepinfo.bstrDescription),
::SysStringLen(excepinfo.bstrDescription));
throw InvocationTargetException(message, Reference<XInterface>(), Any());
break;