diff options
author | Eike Rathke <erack@redhat.com> | 2017-07-18 19:43:05 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-07-18 19:43:35 +0200 |
commit | 038063a352f59bad1ecdeeb63016e37f6945a420 (patch) | |
tree | b64769d58f9bc001dbf235f420038ba436344a33 /chart2 | |
parent | 71c3113e9dbf61693fd947262370cc61cdf31ac7 (diff) |
Change nonsense non-const Date* GetNullDate() to const Date&
* first, a non-const Date* may leave the impression that one could change the
NullDate through the pointer, which is only partly successful; luckily no one
did that
* second, there is always a NullDate so checking for nullptr is superfluous
* third, the pointer was dereferenced (maybe after a check) everywhere to
obtain the NullDate, luckily..
Change-Id: I3c3a788ba0336596ac6bde4c96e77a0cdb7a4a95
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/tools/NumberFormatterWrapper.cxx | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/chart2/source/tools/NumberFormatterWrapper.cxx b/chart2/source/tools/NumberFormatterWrapper.cxx index ead2d47e4cb4..11597d87818a 100644 --- a/chart2/source/tools/NumberFormatterWrapper.cxx +++ b/chart2/source/tools/NumberFormatterWrapper.cxx @@ -79,9 +79,7 @@ Date NumberFormatterWrapper::getNullDate() const } else if( m_pNumberFormatter ) { - Date* pDate = m_pNumberFormatter->GetNullDate(); - if( pDate ) - aRet = *pDate; + aRet = m_pNumberFormatter->GetNullDate(); } return aRet; } @@ -101,13 +99,10 @@ OUString NumberFormatterWrapper::getFormattedString( sal_Int32 nNumberFormatKey, sal_uInt16 nDay = 30,nMonth = 12; if ( m_aNullDate.hasValue() ) { - Date* pDate = m_pNumberFormatter->GetNullDate(); - if ( pDate ) - { - nYear = pDate->GetYear(); - nMonth = pDate->GetMonth(); - nDay = pDate->GetDay(); - } // if ( pDate ) + const Date& rDate = m_pNumberFormatter->GetNullDate(); + nYear = rDate.GetYear(); + nMonth = rDate.GetMonth(); + nDay = rDate.GetDay(); util::Date aNewNullDate; m_aNullDate >>= aNewNullDate; m_pNumberFormatter->ChangeNullDate(aNewNullDate.Day,aNewNullDate.Month,aNewNullDate.Year); |