diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-02-04 09:13:52 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-02-04 15:02:03 +0100 |
commit | e00032ba6a2ddd4c08ae6f03b1982d3c099d288e (patch) | |
tree | 33f52e795971fd330922e21857b12c6097727ca8 /xmlsecurity | |
parent | 8d3f658aa58ddee8c7bc32ddea070c1bb3bf19b8 (diff) |
add toId/fromId to tidy up some ugly casting
Change-Id: I70f34ac5e9b5d2f2d6c0375e823908eaa2e540b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129487
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/dialogs/certificatechooser.cxx | 10 | ||||
-rw-r--r-- | xmlsecurity/source/dialogs/certificateviewer.cxx | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index 3d130d01887f..3ac503521e72 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -215,7 +215,7 @@ void CertificateChooser::ImplInitialize() m_xCertLB->set_text(nRow, xmlsec::GetCertificateKind(xCert->getCertificateKind()), 2); m_xCertLB->set_text(nRow, utl::GetDateString(xCert->getNotValidAfter()), 3); m_xCertLB->set_text(nRow, UsageInClearText(xCert->getCertificateUsage()), 4); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(userData.get()))); + OUString sId(weld::toId(userData.get())); m_xCertLB->set_id(nRow, sId); #if HAVE_FEATURE_GPGME @@ -246,7 +246,7 @@ uno::Sequence<uno::Reference< css::security::XCertificate > > CertificateChooser { // for encryption, multiselection is enabled m_xCertLB->selected_foreach([this, &aRet](weld::TreeIter& rEntry){ - UserData* userData = reinterpret_cast<UserData*>(m_xCertLB->get_id(rEntry).toInt64()); + UserData* userData = weld::fromId<UserData*>(m_xCertLB->get_id(rEntry)); aRet.push_back( userData->xCertificate ); return false; }); @@ -257,7 +257,7 @@ uno::Sequence<uno::Reference< css::security::XCertificate > > CertificateChooser int nSel = m_xCertLB->get_selected_index(); if (nSel != -1) { - UserData* userData = reinterpret_cast<UserData*>(m_xCertLB->get_id(nSel).toInt64()); + UserData* userData = weld::fromId<UserData*>(m_xCertLB->get_id(nSel)); xCert = userData->xCertificate; } aRet.push_back( xCert ); @@ -277,7 +277,7 @@ uno::Reference<xml::crypto::XXMLSecurityContext> CertificateChooser::GetSelected if (nSel == -1) return uno::Reference<xml::crypto::XXMLSecurityContext>(); - UserData* userData = reinterpret_cast<UserData*>(m_xCertLB->get_id(nSel).toInt64()); + UserData* userData = weld::fromId<UserData*>(m_xCertLB->get_id(nSel)); uno::Reference<xml::crypto::XXMLSecurityContext> xCert = userData->xSecurityContext; return xCert; } @@ -320,7 +320,7 @@ void CertificateChooser::ImplShowCertificateDetails() if (nSel == -1) return; - UserData* userData = reinterpret_cast<UserData*>(m_xCertLB->get_id(nSel).toInt64()); + UserData* userData = weld::fromId<UserData*>(m_xCertLB->get_id(nSel)); if (!userData->xSecurityEnvironment.is() || !userData->xCertificate.is()) return; diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 3e0480b9317b..1801cdf53192 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -151,7 +151,7 @@ void CertificateViewerDetailsTP::InsertElement(const OUString& rField, const OUS const OUString& rDetails, bool bFixedWidthFont) { m_aUserData.emplace_back(std::make_unique<Details_UserDatat>(rDetails, bFixedWidthFont)); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(m_aUserData.back().get()))); + OUString sId(weld::toId(m_aUserData.back().get())); m_xElementsLB->append(sId, rField); m_xElementsLB->set_text(m_xElementsLB->n_children() -1, rValue, 1); } @@ -240,7 +240,7 @@ IMPL_LINK_NOARG(CertificateViewerDetailsTP, ElementSelectHdl, weld::TreeView&, v bool bFixedWidthFont; if (nEntry != -1) { - const Details_UserDatat* p = reinterpret_cast<Details_UserDatat*>(m_xElementsLB->get_id(nEntry).toInt64()); + const Details_UserDatat* p = weld::fromId<Details_UserDatat*>(m_xElementsLB->get_id(nEntry)); aElementText = p->maTxt; bFixedWidthFont = p->mbFixedWidthFont; } @@ -331,7 +331,7 @@ IMPL_LINK_NOARG(CertificateViewerCertPathTP, ViewCertHdl, weld::Button&, void) if (mxCertificateViewer) mxCertificateViewer->response(RET_OK); - CertPath_UserData* pData = reinterpret_cast<CertPath_UserData*>(mxCertPathLB->get_id(*xIter).toInt64()); + CertPath_UserData* pData = weld::fromId<CertPath_UserData*>(mxCertPathLB->get_id(*xIter)); mxCertificateViewer = std::make_shared<CertificateViewer>(mpDlg->getDialog(), mpDlg->mxSecurityEnvironment, pData->mxCert, false, nullptr); weld::DialogController::runAsync(mxCertificateViewer, [this] (sal_Int32) { mxCertificateViewer = nullptr; }); @@ -346,7 +346,7 @@ IMPL_LINK_NOARG(CertificateViewerCertPathTP, CertSelectHdl, weld::TreeView&, voi bool bEntry = mxCertPathLB->get_selected(xIter.get()); if (bEntry) { - CertPath_UserData* pData = reinterpret_cast<CertPath_UserData*>(mxCertPathLB->get_id(*xIter).toInt64()); + CertPath_UserData* pData = weld::fromId<CertPath_UserData*>(mxCertPathLB->get_id(*xIter)); if (pData) sStatus = pData->mbValid ? mxCertOK->get_label() : mxCertNotValidated->get_label(); } @@ -369,7 +369,7 @@ void CertificateViewerCertPathTP::InsertCert(const weld::TreeIter* pParent, cons { auto const sImage = bValid ? std::u16string_view(u"" BMP_CERT_OK) : std::u16string_view(u"" BMP_CERT_NOT_OK); maUserData.emplace_back(std::make_unique<CertPath_UserData>(rxCert, bValid)); - OUString sId(OUString::number(reinterpret_cast<sal_Int64>(maUserData.back().get()))); + OUString sId(weld::toId(maUserData.back().get())); mxCertPathLB->insert(pParent, -1, &rName, &sId, nullptr, nullptr, false, mxScratchIter.get()); mxCertPathLB->set_image(*mxScratchIter, OUString(sImage)); } |