summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-04-11 12:21:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-04-12 10:10:57 +0200
commit9e06c1b69c8d13c93c94428218c84c437422463e (patch)
tree9b2bf3b67a75222d1e6a5f6360e9374d49ce2c8b
parent4b57c28302def4dd56b2dc8ffb73f21b688a6534 (diff)
add SAL_WARN_UNUSED to sw::Ring and friends
Change-Id: Ic90e4357089c1f487dd5738f9c14862ce95d611d Reviewed-on: https://gerrit.libreoffice.org/36408 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/inc/index.hxx4
-rw-r--r--sw/inc/pam.hxx4
-rw-r--r--sw/inc/ring.hxx4
-rw-r--r--sw/qa/core/uwriter.cxx1
-rw-r--r--sw/source/core/access/accpara.cxx2
-rw-r--r--sw/source/core/doc/doc.cxx9
-rw-r--r--sw/source/core/doc/docredln.cxx1
-rw-r--r--sw/source/core/frmedt/fecopy.cxx3
-rw-r--r--sw/source/core/unocore/unoftn.cxx1
9 files changed, 9 insertions, 20 deletions
diff --git a/sw/inc/index.hxx b/sw/inc/index.hxx
index fecfa983b6b9..84320219cd07 100644
--- a/sw/inc/index.hxx
+++ b/sw/inc/index.hxx
@@ -34,7 +34,7 @@ class IMark;
}
/// Marks a character position inside a document model node.
-class SW_DLLPUBLIC SwIndex
+class SAL_WARN_UNUSED SW_DLLPUBLIC SwIndex
{
private:
friend class SwIndexReg;
@@ -107,7 +107,7 @@ public:
SW_DLLPUBLIC std::ostream& operator <<(std::ostream& s, const SwIndex& index);
-class SwIndexReg
+class SAL_WARN_UNUSED SwIndexReg
{
friend class SwIndex;
friend bool sw_PosOk(const SwPosition & aPos);
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index 2fe0e6acb310..380cc878ed72 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -46,7 +46,7 @@ namespace utl {
}
/// Marks a position in the document model.
-struct SW_DLLPUBLIC SwPosition
+struct SAL_WARN_UNUSED SW_DLLPUBLIC SwPosition
{
SwNodeIndex nNode;
SwIndex nContent;
@@ -147,7 +147,7 @@ SW_DLLPUBLIC bool GoInContentSkipHidden( SwPaM&, SwMoveFnCollection const &);
SW_DLLPUBLIC bool GoInContentCellsSkipHidden( SwPaM&, SwMoveFnCollection const &);
/// PaM is Point and Mark: a selection of the document model.
-class SW_DLLPUBLIC SwPaM : public sw::Ring<SwPaM>
+class SAL_WARN_UNUSED SW_DLLPUBLIC SwPaM : public sw::Ring<SwPaM>
{
SwPosition m_Bound1;
SwPosition m_Bound2;
diff --git a/sw/inc/ring.hxx b/sw/inc/ring.hxx
index ad9cce5c796f..a03db4c68cee 100644
--- a/sw/inc/ring.hxx
+++ b/sw/inc/ring.hxx
@@ -36,7 +36,7 @@ namespace sw
* @example sw/qa/core/uwriter.cxx
*/
template <typename value_type>
- class Ring
+ class SAL_WARN_UNUSED Ring
{
public:
typedef typename std::add_const<value_type>::type const_value_type;
@@ -148,7 +148,7 @@ namespace sw
* helper class that provides Svalue_typeL-style container iteration to the ring
*/
template <typename value_type>
- class RingContainer final
+ class SAL_WARN_UNUSED RingContainer final
{
private:
/** the item in the ring where iteration starts */
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index e0df520be313..7f2d5fb63540 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1067,7 +1067,6 @@ void SwDocTest::randomTest()
for( int i = 0; i < 2000; i++ )
{
- SwPaM aPam(m_pDoc->GetNodes());
SwCursor aCrs(getRandomPosition(m_pDoc, i/20), nullptr);
aCrs.SetMark();
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 5ec175e4fb9a..722e2bb6a6fb 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1416,8 +1416,6 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
OUString strTypeName;
SwFieldMgr aMgr;
SwTextField* pTextField = nullptr;
- SwTextNode* pTextNd = const_cast<SwTextNode*>( GetTextNode() );
- SwIndex fldIndex( pTextNd, nIndex );
sal_Int32 nFieldIndex = GetPortionData().GetFieldIndex(nIndex);
if (nFieldIndex >= 0)
{
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 2a2684862b29..06fc61b466fb 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -1487,12 +1487,9 @@ bool SwDoc::HasInvisibleContent() const
for( sal_uLong n = GetNodes().Count()-1; n; --n)
{
SwTextNode* pTextNd = GetNodes()[ n ]->GetTextNode();
- if ( pTextNd )
- {
- SwPaM aPam(*pTextNd, 0, *pTextNd, pTextNd->GetText().getLength());
- if( pTextNd->HasHiddenCharAttribute( true ) || ( pTextNd->HasHiddenCharAttribute( false ) ) )
- return true;
- }
+ if ( pTextNd &&
+ ( pTextNd->HasHiddenCharAttribute( true ) || pTextNd->HasHiddenCharAttribute( false ) ) )
+ return true;
}
for(auto pSectFormat : GetSections())
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 314e4c84ef27..0ccc138ce105 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1431,7 +1431,6 @@ void SwRangeRedline::DelCopyOfSection(size_t nMyPos)
}
}
- SwPosition aEnd( *pEnd );
*GetPoint() = *pEnd;
*GetMark() = *pEnd;
DeleteMark();
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 2cf915eb5c29..444f4de516b3 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -1045,9 +1045,6 @@ bool SwFEShell::Paste( SwDoc* pClpDoc )
// **
// ** Update SwDoc::Append, if you change the following code **
// **
-
- SwPosition aInsertPosition( rInsPos );
-
{
SwNodeIndex aIndexBefore(rInsPos.nNode);
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index e248ae8d1190..92d77dde84d6 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -360,7 +360,6 @@ SwXFootnote::getAnchor()
SwTextFootnote const*const pTextFootnote = rFormat.GetTextFootnote();
SwPaM aPam( pTextFootnote->GetTextNode(), pTextFootnote->GetStart() );
- SwPosition aMark( *aPam.Start() );
aPam.SetMark();
++aPam.GetMark()->nContent;
const uno::Reference< text::XTextRange > xRet =