Lei Zhang : comctl32: Better day of the month input checking in datetime.

Alexandre Julliard julliard at winehq.org
Wed Nov 26 07:32:35 CST 2008


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

Author: Lei Zhang <thestig at google.com>
Date:   Tue Nov 25 14:59:29 2008 -0800

comctl32: Better day of the month input checking in datetime.

---

 dlls/comctl32/datetime.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c
index de31fa0..34c750a 100644
--- a/dlls/comctl32/datetime.c
+++ b/dlls/comctl32/datetime.c
@@ -955,6 +955,7 @@ DATETIME_Char (DATETIME_INFO *infoPtr, WPARAM vkCode, LPARAM keyData)
 
     if (vkCode >= '0' && vkCode <= '9') {
         int num = vkCode-'0';
+        int newDays;
 
         /* this is a somewhat simplified version of what Windows does */
         SYSTEMTIME *date = &infoPtr->date;
@@ -986,11 +987,11 @@ DATETIME_Char (DATETIME_INFO *infoPtr, WPARAM vkCode, LPARAM keyData)
                 break;
             case ONEDIGITDAY:
             case TWODIGITDAY:
-                /* probably better checking here would help */
-                if ((date->wDay%10) >= 3 && num > 1)
+                newDays = (date->wDay%10)*10+num;
+                if (newDays > MONTHCAL_MonthLength(date->wMonth, date->wYear))
                     date->wDay = num;
                 else
-                    date->wDay = (date->wDay%10)*10+num;
+                    date->wDay = newDays;
                 date->wDayOfWeek = DATETIME_CalculateDayOfWeek(
                         date->wDay,date->wMonth,date->wYear);
                 DATETIME_SendDateTimeChangeNotify (infoPtr);




More information about the wine-cvs mailing list