Nikolay Sivov : comctl32/monthcal: Fix navigation from last day in a month.

Alexandre Julliard julliard at winehq.org
Mon Aug 2 11:03:54 CDT 2010


Module: wine
Branch: master
Commit: 23e9866be846657e95bcb69bde1e9baa58587b9e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=23e9866be846657e95bcb69bde1e9baa58587b9e

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sat Jul 31 13:36:37 2010 +0400

comctl32/monthcal: Fix navigation from last day in a month.

---

 dlls/comctl32/monthcal.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index 2ae3f46..5f5c7c2 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -458,22 +458,32 @@ int MONTHCAL_CalculateDayOfWeek(SYSTEMTIME *date, BOOL inplace)
 /* properly updates date to point on next month */
 static inline void MONTHCAL_GetNextMonth(SYSTEMTIME *date)
 {
+  INT length;
+
   if(++date->wMonth > 12)
   {
     date->wMonth = 1;
     date->wYear++;
   }
+  /* fix moving from last day in a month */
+  length = MONTHCAL_MonthLength(date->wMonth, date->wYear);
+  if(date->wDay > length) date->wDay = length;
   MONTHCAL_CalculateDayOfWeek(date, TRUE);
 }
 
 /* properly updates date to point on prev month */
 static inline void MONTHCAL_GetPrevMonth(SYSTEMTIME *date)
 {
+  INT length;
+
   if(--date->wMonth < 1)
   {
     date->wMonth = 12;
     date->wYear--;
   }
+  /* fix moving from last day in a month */
+  length = MONTHCAL_MonthLength(date->wMonth, date->wYear);
+  if(date->wDay > length) date->wDay = length;
   MONTHCAL_CalculateDayOfWeek(date, TRUE);
 }
 




More information about the wine-cvs mailing list