[Libreoffice-commits] core.git: sw/inc sw/source
Matteo Casalin
matteo.casalin at yahoo.com
Fri Aug 16 08:14:43 PDT 2013
sw/inc/section.hxx | 2 +-
sw/source/core/docnode/section.cxx | 11 +++++------
2 files changed, 6 insertions(+), 7 deletions(-)
New commits:
commit 0f7de1dce1b8b6ce4ecb8cb9f70cb6f8bc9051a5
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date: Thu Aug 15 16:24:25 2013 +0200
Prefer mutable members to const_cast
Change-Id: Icca5d46b36efa6e8684eb9dd9ea44b496a1829b2
Reviewed-on: https://gerrit.libreoffice.org/5441
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx
index 77fdd2a..db6ce8a 100644
--- a/sw/inc/section.hxx
+++ b/sw/inc/section.hxx
@@ -153,7 +153,7 @@ class SW_DLLPUBLIC SwSection
friend class SwSectionFrm;
private:
- SwSectionData m_Data;
+ mutable SwSectionData m_Data;
SwServerObjectRef m_RefObj; // Set if DataServer.
::sfx2::SvBaseLinkRef m_RefLink;
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 54c3e58..d243448 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -277,12 +277,11 @@ bool SwSection::DataEquals(SwSectionData const& rCmp) const
(void) GetLinkFileName(); // updates m_sLinkFileName
bool const bProtect(m_Data.IsProtectFlag());
bool const bEditInReadonly(m_Data.IsEditInReadonlyFlag());
- const_cast<SwSection*>(this)->m_Data.SetProtectFlag(IsProtect());
- const_cast<SwSection*>(this)->m_Data
- .SetEditInReadonlyFlag(IsEditInReadonly());
+ m_Data.SetProtectFlag(IsProtect());
+ m_Data.SetEditInReadonlyFlag(IsEditInReadonly());
bool const bResult( m_Data == rCmp );
- const_cast<SwSection*>(this)->m_Data.SetProtectFlag(bProtect);
- const_cast<SwSection*>(this)->m_Data.SetEditInReadonlyFlag(bEditInReadonly);
+ m_Data.SetProtectFlag(bProtect);
+ m_Data.SetEditInReadonlyFlag(bEditInReadonly);
return bResult;
}
@@ -574,7 +573,7 @@ const String& SwSection::GetLinkFileName() const
break;
default: break;
}
- const_cast<SwSection*>(this)->m_Data.SetLinkFileName(sTmp);
+ m_Data.SetLinkFileName(sTmp);
}
return m_Data.GetLinkFileName();
}
More information about the Libreoffice-commits
mailing list