use more subView when converting to Int32

Change-Id: Ia1be48050cca386a6e765aa2229de1bc9e64ffff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132749
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2022-04-09 09:42:26 +02:00
parent 29578ae139
commit 035c9fc7ec
2 changed files with 9 additions and 7 deletions

View file

@ -35,6 +35,7 @@
#include <osl/diagnose.h>
#include <typelib/typedescription.h>
#include <uno/any2.h>
#include <o3tl/string_view.hxx>
#include "typelib.hxx"
using namespace osl;
@ -1984,8 +1985,8 @@ extern "C" void SAL_CALL typelib_typedescription_getByName(
&pInterface, name.copy(i4 + 1).pData);
if (!createDerivedInterfaceMemberDescription(
ppRet, name, pBaseRef, pBase, pInterface,
name.copy(i2, i3 - i2).toInt32(),
name.copy(i3 + 1, i4 - i3 - 1).toInt32()))
o3tl::toInt32(name.subView(i2, i3 - i2)),
o3tl::toInt32(name.subView(i3 + 1, i4 - i3 - 1))))
{
if (pInterface != nullptr) {
typelib_typedescription_release(pInterface);

View file

@ -27,6 +27,7 @@
#include <rtl/string.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <o3tl/string_view.hxx>
#include <com/sun/star/security/RuntimePermission.hpp>
#include <com/sun/star/security/AllPermission.hpp>
@ -148,20 +149,20 @@ SocketPermission::SocketPermission(
sal_Int32 minus = m_host.indexOf( '-', colon +1 );
if (minus < 0)
{
m_lowerPort = m_upperPort = m_host.copy( colon +1 ).toInt32();
m_lowerPort = m_upperPort = o3tl::toInt32(m_host.subView( colon +1 ));
}
else if (minus == (colon +1)) // -N
{
m_upperPort = m_host.copy( minus +1 ).toInt32();
m_upperPort = o3tl::toInt32(m_host.subView( minus +1 ));
}
else if (minus == (m_host.getLength() -1)) // N-
{
m_lowerPort = m_host.copy( colon +1, m_host.getLength() -1 -colon -1 ).toInt32();
m_lowerPort = o3tl::toInt32(m_host.subView( colon +1, m_host.getLength() -1 -colon -1 ));
}
else // A-B
{
m_lowerPort = m_host.copy( colon +1, minus - colon -1 ).toInt32();
m_upperPort = m_host.copy( minus +1 ).toInt32();
m_lowerPort = o3tl::toInt32(m_host.subView( colon +1, minus - colon -1 ));
m_upperPort = o3tl::toInt32(m_host.subView( minus +1 ));
}
m_host = m_host.copy( 0, colon );
}