[Libreoffice-commits] core.git: include/svtools svtools/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Thu Jul 20 18:54:15 UTC 2017


 include/svtools/calendar.hxx        |    2 +-
 svtools/source/control/calendar.cxx |   17 ++++++++---------
 2 files changed, 9 insertions(+), 10 deletions(-)

New commits:
commit 102b01c80a271ccaec226d7b0bcc960917ea6b57
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Thu Jul 20 17:34:46 2017 +0200

    change some Date += long to Date += sal_Int32
    
    found by adding
     Date& operator+=(long) = delete;
    to Date class
    
    Change-Id: I0e6b59a2e789f2bdf2f271b99d10c6acbae8bf55
    Reviewed-on: https://gerrit.libreoffice.org/40241
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svtools/calendar.hxx b/include/svtools/calendar.hxx
index e0c583e732a1..6cd7f153d5de 100644
--- a/include/svtools/calendar.hxx
+++ b/include/svtools/calendar.hxx
@@ -176,7 +176,7 @@ private:
     Color*          mpStandardColor;
     Color*          mpSaturdayColor;
     Color*          mpSundayColor;
-    sal_uLong       mnDayCount;
+    sal_Int32       mnDayCount;
     long            mnDaysOffX;
     long            mnWeekDayOffY;
     long            mnDaysOffY;
diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx
index f48bff13eb1c..324a548b0bf2 100644
--- a/svtools/source/control/calendar.cxx
+++ b/svtools/source/control/calendar.cxx
@@ -418,7 +418,7 @@ void Calendar::ImplFormat()
     maFirstDate = aTempDate;
     nWeekDay = (sal_uInt16)aTempDate.GetDayOfWeek();
     nWeekDay = (nWeekDay+(7-(sal_uInt16)eStartDay)) % 7;
-    maFirstDate -= (sal_uLong)nWeekDay;
+    maFirstDate -= static_cast<sal_Int32>(nWeekDay);
     mnDayCount = nWeekDay;
     sal_uInt16 nDaysInMonth;
     sal_uInt16 nMonthCount = (sal_uInt16)(mnMonthPerLine*mnLines);
@@ -981,7 +981,7 @@ void Calendar::ImplUpdateSelection( IntDateSet* pOld )
 
     for ( IntDateSet::const_iterator it = pOld->begin(); it != pOld->end(); ++it )
     {
-        sal_uLong nKey = *it;
+        sal_Int32 nKey = *it;
         if ( pNew->find( nKey ) == pNew->end() )
         {
             Date aTempDate( nKey );
@@ -991,7 +991,7 @@ void Calendar::ImplUpdateSelection( IntDateSet* pOld )
 
     for ( IntDateSet::const_iterator it = pNew->begin(); it != pNew->end(); ++it )
     {
-        sal_uLong nKey = *it;
+        sal_Int32 nKey = *it;
         if ( pOld->find( nKey ) == pOld->end() )
         {
             Date aTempDate( nKey );
@@ -1256,8 +1256,7 @@ void Calendar::ImplEndTracking( bool bCancel )
         if ( !bCancel )
         {
             // determine if we should scroll the visible area
-            sal_uLong nSelCount = mpSelectTable->size();
-            if ( nSelCount )
+            if ( !mpSelectTable->empty() )
             {
                 Date aFirstSelDate( *mpSelectTable->begin() );
                 Date aLastSelDate( *mpSelectTable->rbegin() );
@@ -1695,7 +1694,7 @@ void Calendar::SetCurDate( const Date& rNewDate )
                 while ( nDateOff > aTempDate.GetDaysInMonth() )
                 {
                     aFirstDate += aFirstDate.GetDaysInMonth();
-                    long nDaysInMonth = aTempDate.GetDaysInMonth();
+                    sal_Int32 nDaysInMonth = aTempDate.GetDaysInMonth();
                     aTempDate += nDaysInMonth;
                     nDateOff -= nDaysInMonth;
                 }
@@ -1779,7 +1778,7 @@ tools::Rectangle Calendar::GetDateRect( const Date& rDate ) const
 
     long    nX;
     long    nY;
-    sal_uLong   nDaysOff;
+    sal_Int32   nDaysOff;
     sal_uInt16  nDayIndex;
     Date    aDate = GetFirstMonth();
 
@@ -1787,7 +1786,7 @@ tools::Rectangle Calendar::GetDateRect( const Date& rDate ) const
     {
         aRect = GetDateRect( aDate );
         nDaysOff = aDate-rDate;
-        nX = (long)(nDaysOff*mnDayWidth);
+        nX = nDaysOff*mnDayWidth;
         aRect.Left() -= nX;
         aRect.Right() -= nX;
         return aRect;
@@ -1803,7 +1802,7 @@ tools::Rectangle Calendar::GetDateRect( const Date& rDate ) const
             aRect = GetDateRect( aLastDate );
             nDaysOff = rDate-aLastDate;
             nDayIndex = 0;
-            for ( sal_uLong i = 0; i <= nDaysOff; i++ )
+            for ( sal_Int32 i = 0; i <= nDaysOff; i++ )
             {
                 if ( aLastDate == rDate )
                 {


More information about the Libreoffice-commits mailing list