[Libreoffice-commits] core.git: scaddins/source sdext/source sd/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 15 18:59:58 UTC 2020
scaddins/source/datefunc/datefunc.cxx | 15 +++++-
sd/source/ui/animations/CustomAnimationDialog.cxx | 10 ++--
sd/source/ui/func/fuinsert.cxx | 15 ++++--
sd/source/ui/func/fupoor.cxx | 4 -
sd/source/ui/remotecontrol/BluetoothServer.cxx | 5 --
sd/source/ui/view/drviews2.cxx | 5 +-
sd/source/ui/view/sdview3.cxx | 49 +++++++++++-----------
sdext/source/pdfimport/pdfparse/pdfparse.cxx | 43 ++++++++++---------
sdext/source/pdfimport/wrapper/wrapper.cxx | 21 ++++++---
9 files changed, 98 insertions(+), 69 deletions(-)
New commits:
commit 7baa60a5e9a8c48829f47db8cd98d0f05a30e235
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Apr 15 19:31:24 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Apr 15 20:59:10 2020 +0200
loplugin:buriedassign in scaddins..sdext
Change-Id: I72acfdac5879aa251a1074ea850758f66072b46e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92311
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx
index b924908a2ec6..f47b9b74a3dd 100644
--- a/scaddins/source/datefunc/datefunc.cxx
+++ b/scaddins/source/datefunc/datefunc.cxx
@@ -735,9 +735,18 @@ OUString SAL_CALL ScaDateAddIn::getRot13( const OUString& aSrcString )
for( sal_Int32 nIndex = 0; nIndex < aBuffer.getLength(); nIndex++ )
{
sal_Unicode cChar = aBuffer[nIndex];
- if( ((cChar >= 'a') && (cChar <= 'z') && ((cChar += 13) > 'z')) ||
- ((cChar >= 'A') && (cChar <= 'Z') && ((cChar += 13) > 'Z')) )
- cChar -= 26;
+ if( (cChar >= 'a') && (cChar <= 'z'))
+ {
+ cChar += 13;
+ if (cChar > 'z')
+ cChar -= 26;
+ }
+ else if( (cChar >= 'A') && (cChar <= 'Z') )
+ {
+ cChar += 13;
+ if (cChar > 'Z')
+ cChar -= 26;
+ }
aBuffer[nIndex] = cChar;
}
return aBuffer.makeStringAndClear();
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index 9c5f2a699608..b19e76350c70 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -265,13 +265,15 @@ SdFontPropertyBox::SdFontPropertyBox(weld::Label* pLabel, weld::Container* pPare
pLabel->set_mnemonic_widget(mxControl.get());
SfxObjectShell* pDocSh = SfxObjectShell::Current();
- const SfxPoolItem* pItem;
-
const FontList* pFontList = nullptr;
bool bMustDelete = false;
- if (pDocSh && ( (pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST ) ) != nullptr))
- pFontList = static_cast<const SvxFontListItem*>(pItem)->GetFontList();
+ if (pDocSh)
+ {
+ auto pItem = pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
+ if (pItem)
+ pFontList = static_cast<const SvxFontListItem*>(pItem)->GetFontList();
+ }
if (!pFontList)
{
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 970076977ec2..be254381b54f 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -159,13 +159,16 @@ void FuInsertGraphic::DoExecute( SfxRequest& rReq )
if( dynamic_cast< DrawViewShell *>( mpViewShell ) )
{
sal_Int8 nAction = DND_ACTION_COPY;
- SdrObject* pPickObj;
-
- if( ( ( pPickObj = mpView->GetSelectedSingleObject( mpView->GetPage() ) ) && mbReplaceExistingImage ) || (pPickObj = mpView->GetEmptyPresentationObject( PresObjKind::Graphic ) ) )
- {
+ SdrObject* pPickObj = nullptr;
+ if (mbReplaceExistingImage)
+ pPickObj = mpView->GetSelectedSingleObject( mpView->GetPage() );
+ if (pPickObj)
nAction = DND_ACTION_LINK;
- } else {
- pPickObj = nullptr;
+ else
+ {
+ pPickObj = mpView->GetEmptyPresentationObject( PresObjKind::Graphic );
+ if (pPickObj)
+ nAction = DND_ACTION_LINK;
}
Point aPos = mpWindow->GetVisibleCenter();
diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
index 86d7233d69ea..aa76f72ff3e7 100644
--- a/sd/source/ui/func/fupoor.cxx
+++ b/sd/source/ui/func/fupoor.cxx
@@ -970,8 +970,8 @@ bool FuPoor::MouseButtonUp (const MouseEvent& rMEvt)
SetMouseButtonCode(rMEvt.GetButtons());
aDelayToScrollTimer.Stop ();
- return bScrollable =
- bDelayActive = false;
+ bScrollable = bDelayActive = false;
+ return bScrollable;
}
bool FuPoor::MouseButtonDown(const MouseEvent& rMEvt)
diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx
index 16113f5f709f..0a6d198f1d0b 100644
--- a/sd/source/ui/remotecontrol/BluetoothServer.cxx
+++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx
@@ -1278,10 +1278,9 @@ void SAL_CALL BluetoothServer::run()
sockaddr_rc aRemoteAddr;
socklen_t aRemoteAddrLen = sizeof(aRemoteAddr);
- int nClient;
SAL_INFO( "sdremote.bluetooth", "performing accept" );
- if ( ( nClient = accept( aSocketFD.fd, reinterpret_cast<sockaddr*>(&aRemoteAddr), &aRemoteAddrLen)) < 0 &&
- errno != EAGAIN )
+ int nClient = accept( aSocketFD.fd, reinterpret_cast<sockaddr*>(&aRemoteAddr), &aRemoteAddrLen);
+ if ( nClient < 0 && errno != EAGAIN )
{
SAL_WARN( "sdremote.bluetooth", "accept failed with errno " << errno );
} else {
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 8fb5f662b3ee..fb6f3decca06 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2055,8 +2055,11 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
// test for already existing names
bool bLoop = true;
sal_uInt16 nRet = 0;
- while( bLoop && ( (nRet = pDlg->Execute()) == RET_OK ) )
+ while( bLoop )
{
+ nRet = pDlg->Execute();
+ if (nRet != RET_OK)
+ break;
pDlg->GetAttr( aNewAttr );
aLayerName = static_cast<const SfxStringItem &>( aNewAttr.Get (ATTR_LAYER_NAME)).GetValue ();
if (bDelete)
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index ba876ab75c25..c4ae7621a60c 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -1421,39 +1421,42 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
}
}
- bool bIsRTF = false;
- if(!bReturn && !bLink && (( bIsRTF = CHECK_FORMAT_TRANS(SotClipboardFormatId::RTF) ) || CHECK_FORMAT_TRANS(SotClipboardFormatId::RICHTEXT) ))
+ if(!bReturn && !bLink)
{
- ::tools::SvRef<SotStorageStream> xStm;
-
- if( aDataHelper.GetSotStorageStream( bIsRTF ? SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT, xStm ) )
+ bool bIsRTF = CHECK_FORMAT_TRANS(SotClipboardFormatId::RTF);
+ if (bIsRTF || CHECK_FORMAT_TRANS(SotClipboardFormatId::RICHTEXT))
{
- xStm->Seek( 0 );
+ ::tools::SvRef<SotStorageStream> xStm;
- if( bTable )
- {
- bReturn = PasteRTFTable( xStm, pPage, nPasteOptions );
- }
- else
+ if( aDataHelper.GetSotStorageStream( bIsRTF ? SotClipboardFormatId::RTF : SotClipboardFormatId::RICHTEXT, xStm ) )
{
- OutlinerView* pOLV = GetTextEditOutlinerView();
+ xStm->Seek( 0 );
- if( pOLV )
+ if( bTable )
+ {
+ bReturn = PasteRTFTable( xStm, pPage, nPasteOptions );
+ }
+ else
{
- ::tools::Rectangle aRect( pOLV->GetOutputArea() );
- Point aPos( pOLV->GetWindow()->PixelToLogic( maDropPos ) );
+ OutlinerView* pOLV = GetTextEditOutlinerView();
- if( aRect.IsInside( aPos ) || ( !bDrag && IsTextEdit() ) )
+ if( pOLV )
{
- // mba: clipboard always must contain absolute URLs (could be from alien source)
- pOLV->Read( *xStm, EETextFormat::Rtf, mpDocSh->GetHeaderAttributes() );
- bReturn = true;
+ ::tools::Rectangle aRect( pOLV->GetOutputArea() );
+ Point aPos( pOLV->GetWindow()->PixelToLogic( maDropPos ) );
+
+ if( aRect.IsInside( aPos ) || ( !bDrag && IsTextEdit() ) )
+ {
+ // mba: clipboard always must contain absolute URLs (could be from alien source)
+ pOLV->Read( *xStm, EETextFormat::Rtf, mpDocSh->GetHeaderAttributes() );
+ bReturn = true;
+ }
}
- }
- if( !bReturn )
- // mba: clipboard always must contain absolute URLs (could be from alien source)
- bReturn = SdrView::Paste( *xStm, EETextFormat::Rtf, maDropPos, pPage, nPasteOptions );
+ if( !bReturn )
+ // mba: clipboard always must contain absolute URLs (could be from alien source)
+ bReturn = SdrView::Paste( *xStm, EETextFormat::Rtf, maDropPos, pPage, nPasteOptions );
+ }
}
}
}
diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
index da5daa5bf6c1..e61d900885ea 100644
--- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx
@@ -327,38 +327,41 @@ public:
{
PDFContainer* pContainer = nullptr;
const char* pMsg = nullptr;
- if( ! m_aObjectStack.empty() &&
- (pContainer = dynamic_cast<PDFContainer*>(m_aObjectStack.back())) != nullptr )
+ if( ! m_aObjectStack.empty() )
{
- if( dynamic_cast<PDFDict*>(pContainer) == nullptr &&
- dynamic_cast<PDFArray*>(pContainer) == nullptr )
+ pContainer = dynamic_cast<PDFContainer*>(m_aObjectStack.back());
+ if (pContainer)
{
- PDFObject* pObj = dynamic_cast<PDFObject*>(pContainer);
- if( pObj )
+ if( dynamic_cast<PDFDict*>(pContainer) == nullptr &&
+ dynamic_cast<PDFArray*>(pContainer) == nullptr )
{
- if( pObj->m_pObject == nullptr )
- pObj->m_pObject = pNewValue.get();
- else
+ PDFObject* pObj = dynamic_cast<PDFObject*>(pContainer);
+ if( pObj )
{
- pMsg = "second value for object";
- pContainer = nullptr;
+ if( pObj->m_pObject == nullptr )
+ pObj->m_pObject = pNewValue.get();
+ else
+ {
+ pMsg = "second value for object";
+ pContainer = nullptr;
+ }
}
- }
- else if( dynamic_cast<PDFDict*>(pNewValue.get()) )
- {
- PDFTrailer* pTrailer = dynamic_cast<PDFTrailer*>(pContainer);
- if( pTrailer )
+ else if( dynamic_cast<PDFDict*>(pNewValue.get()) )
{
- if( pTrailer->m_pDict == nullptr )
- pTrailer->m_pDict = dynamic_cast<PDFDict*>(pNewValue.get());
+ PDFTrailer* pTrailer = dynamic_cast<PDFTrailer*>(pContainer);
+ if( pTrailer )
+ {
+ if( pTrailer->m_pDict == nullptr )
+ pTrailer->m_pDict = dynamic_cast<PDFDict*>(pNewValue.get());
+ else
+ pContainer = nullptr;
+ }
else
pContainer = nullptr;
}
else
pContainer = nullptr;
}
- else
- pContainer = nullptr;
}
}
if( pContainer )
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index e8932f16f3b7..e850e5a6c7b8 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -280,9 +280,11 @@ void Parser::readBinaryData( uno::Sequence<sal_Int8>& rBuf )
sal_Int8* pBuf( rBuf.getArray() );
sal_uInt64 nBytesRead(0);
oslFileError nRes=osl_File_E_None;
- while( nFileLen &&
- osl_File_E_None == (nRes=osl_readFile( m_pErr, pBuf, nFileLen, &nBytesRead )) )
+ while( nFileLen )
{
+ nRes = osl_readFile( m_pErr, pBuf, nFileLen, &nBytesRead );
+ if (osl_File_E_None != nRes )
+ break;
pBuf += nBytesRead;
nFileLen -= sal::static_int_cast<sal_Int32>(nBytesRead);
}
@@ -1101,18 +1103,23 @@ bool xpdf_ImportFromFile(const OUString& rURL,
oslFileError nRes;
// skip garbage \r \n at start of line
- while( osl_File_E_None == (nRes = aBuffering.read(&aChar, 1, &nBytesRead)) &&
- nBytesRead == 1 &&
- (aChar == '\n' || aChar == '\r') ) ;
+ for (;;)
+ {
+ nRes = aBuffering.read(&aChar, 1, &nBytesRead);
+ if (osl_File_E_None != nRes || nBytesRead != 1 || !(aChar == '\n' || aChar == '\r') )
+ break;
+ }
if ( osl_File_E_None != nRes )
break;
if( aChar != '\n' && aChar != '\r' )
line.append( aChar );
- while( osl_File_E_None == (nRes = aBuffering.read(&aChar, 1, &nBytesRead)) &&
- nBytesRead == 1 && aChar != '\n' && aChar != '\r' )
+ for (;;)
{
+ nRes = aBuffering.read(&aChar, 1, &nBytesRead);
+ if ( osl_File_E_None != nRes || nBytesRead != 1 || aChar == '\n' || aChar == '\r' )
+ break;
line.append( aChar );
}
if ( osl_File_E_None != nRes )
More information about the Libreoffice-commits
mailing list