[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/kdepim/enterprise4/kdepimlibs
From:       Thomas McGuire <mcguire () kde ! org>
Date:       2009-05-20 14:59:48
Message-ID: 1242831588.713948.17561.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 970683 by tmcguire:

Merged revisions 968125 via svnmerge from 
svn+ssh://tmcguire@svn.kde.org/home/kde/branches/KDE/4.2/kdepimlibs

........
  r968125 | winterz | 2009-05-15 03:08:11 +0200 (Fri, 15 May 2009) | 4 lines
  
  backport SVN commit 968124 by winterz:
  
  Add crash guards to the period rounding calcuations if the recurrence frequency is \
                0.
........


 _M            . (directory)  
 M  +16 -9     kcal/recurrencerule.cpp  


** branches/kdepim/enterprise4/kdepimlibs #property svnmerge-integrated
   - /branches/KDE/4.2/kdepimlibs:0-906699,908595,908778,909375,909480-909481,913686,9 \
14463,916781,917250,917474,917890,918215,920496,921344,921567,921657,925739,926581,926 \
658,926671,928173,929204,929982,930782-930954,931305,932900,932969,932982,933037,93303 \
9,933042,933082,933951,935076,939240,939625-939627,939629-939630,940569,941695,944611, \
944613-944614,944619,944621,944882,953497,954584,957769,960523,960542,960992,963977,965556,966698,967206 \
/branches/KDE/4.1/kdepimlibs:1-834831,835273,835640-835906,835908-836398,836400-837899 \
,838884,839404,839801,841029,841539,841636,842671,843335,844834,844837,845949,846411,8 \
47482,848343-848345,850102,851238-851239,851691,853473,854917,856768,859481,859713,859 \
717,863249,865199,865203,868165,873590,875281,879229,879951,880893,880897,880908,88602 \
0,886341,887083,890863,892407,892930,893121,893737,893938,893947,893950,893953,893956, \
894620,894622,894875,894879-894881,894903,894905,894985,895056,895515,895906,895909-895910,895918,895924,896487
  ,896770,898353,899979,899982,904282,905120,905542,905607
   + /branches/KDE/4.2/kdepimlibs:0-906699,908595,908778,909375,909480-909481,913686,9 \
14463,916781,917250,917474,917890,918215,920496,921344,921567,921657,925739,926581,926 \
658,926671,928173,929204,929982,930782-930954,931305,932900,932969,932982,933037,93303 \
9,933042,933082,933951,935076,939240,939625-939627,939629-939630,940569,941695,944611, \
944613-944614,944619,944621,944882,953497,954584,957769,960523,960542,960992,963977,965556,966698,967206,968125 \
/branches/KDE/4.1/kdepimlibs:1-834831,835273,835640-835906,835908-836398,836400-837899 \
,838884,839404,839801,841029,841539,841636,842671,843335,844834,844837,845949,846411,8 \
47482,848343-848345,850102,851238-851239,851691,853473,854917,856768,859481,859713,859 \
717,863249,865199,865203,868165,873590,875281,879229,879951,880893,880897,880908,88602 \
0,886341,887083,890863,892407,892930,893121,893737,893938,893947,893950,893953,893956, \
894620,894622,894875,894879-894881,894903,894905,894985,895056,895515,895906,895909-895910,895918,895924
  ,896487,896770,898353,899979,899982,904282,905120,905542,905607
--- branches/kdepim/enterprise4/kdepimlibs/kcal/recurrencerule.cpp #970682:970683
@@ -751,7 +751,6 @@
                                // unless it matches the rule)
     uint mFrequency;
     /** how often it recurs:
-          -1 means infinitely,
            0 means an explicit end date,
            positive values give the number of occurrences */
     int mDuration;
@@ -1789,7 +1788,9 @@
   case rSecondly:
     periods = static_cast<int>( start.secsTo_long( toDate ) / modifier );
     // round it down to the next lower multiple of frequency:
-    periods = ( periods / mFrequency ) * mFrequency;
+    if ( mFrequency > 0 ) {
+      periods = ( periods / mFrequency ) * mFrequency;
+    }
     nextValid = start.addSecs( modifier * periods );
     break;
   case rWeekly:
@@ -1799,7 +1800,9 @@
   case rDaily:
     periods = start.daysTo( toDate ) / modifier;
     // round it down to the next lower multiple of frequency:
-    periods = ( periods / mFrequency ) * mFrequency;
+    if ( mFrequency > 0 ) {
+      periods = ( periods / mFrequency ) * mFrequency;
+    }
     nextValid = start.addDays( modifier * periods );
     break;
   case rMonthly:
@@ -1807,7 +1810,9 @@
     periods = 12 * ( toDate.date().year() - start.date().year() ) +
               ( toDate.date().month() - start.date().month() );
     // round it down to the next lower multiple of frequency:
-    periods = ( periods / mFrequency ) * mFrequency;
+    if ( mFrequency > 0 ) {
+      periods = ( periods / mFrequency ) * mFrequency;
+    }
     // set the day to the first day of the month, so we don't have problems
     // with non-existent days like Feb 30 or April 31
     start.setDate( QDate( start.date().year(), start.date().month(), 1 ) );
@@ -1816,7 +1821,9 @@
   case rYearly:
     periods = ( toDate.date().year() - start.date().year() );
     // round it down to the next lower multiple of frequency:
-    periods = ( periods / mFrequency ) * mFrequency;
+    if ( mFrequency > 0 ) {
+      periods = ( periods / mFrequency ) * mFrequency;
+    }
     nextValid.setDate( start.date().addYears( periods ) );
     break;
   default:
@@ -1853,7 +1860,7 @@
   case rSecondly:
     periods = static_cast<int>( start.secsTo_long( toDate ) / modifier );
     periods = qMax( 0L, periods );
-    if ( periods > 0 ) {
+    if ( periods > 0 && mFrequency > 0 ) {
       periods += ( mFrequency - 1 - ( ( periods - 1 ) % mFrequency ) );
     }
     nextValid = start.addSecs( modifier * periods );
@@ -1866,7 +1873,7 @@
   case rDaily:
     periods = start.daysTo( toDate ) / modifier;
     periods = qMax( 0L, periods );
-    if ( periods > 0 ) {
+    if ( periods > 0 && mFrequency > 0 ) {
       periods += ( mFrequency - 1 - ( ( periods - 1 ) % mFrequency ) );
     }
     nextValid = start.addDays( modifier * periods );
@@ -1876,7 +1883,7 @@
     periods = 12 * ( toDate.date().year() - start.date().year() ) +
               ( toDate.date().month() - start.date().month() );
     periods = qMax( 0L, periods );
-    if ( periods > 0 ) {
+    if ( periods > 0 && mFrequency > 0 ) {
       periods += ( mFrequency - 1 - ( ( periods - 1 ) % mFrequency ) );
     }
     // set the day to the first day of the month, so we don't have problems
@@ -1888,7 +1895,7 @@
   case rYearly:
     periods = ( toDate.date().year() - start.date().year() );
     periods = qMax( 0L, periods );
-    if ( periods > 0 ) {
+    if ( periods > 0 && mFrequency > 0 ) {
       periods += ( mFrequency - 1 - ( ( periods - 1 ) % mFrequency ) );
     }
     nextValid.setDate( start.date().addYears( periods ) );


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic