[PATCH 2/7] Fix navigation from last day in a month

Nikolay Sivov nsivov at codeweavers.com
Sat Jul 31 04:36:37 CDT 2010


---
 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);
 }
 
-- 
1.5.6.5



--------------010002070303010109040407--



More information about the wine-patches mailing list