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

List:       wine-patches
Subject:    [1/3] comctl32: Use current month and year when checking day of month.
From:       "Vincent Povirk" <vincent () codeweavers ! com>
Date:       2011-03-31 19:43:13
Message-ID: 33F6268AA99B6C448F07F03B2B6497D3975558 () taz ! CodeWeavers ! local
[Download RAW message or body]

["0001-comctl32-Use-current-month-and-year-when-checking-day-.txt" (text/plain)]

From 5cff7c4aa625ab4dd62ba7ed9aba8267fac29814 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent@codeweavers.com>
Date: Thu, 31 Mar 2011 13:55:24 -0500
Subject: [PATCH 1/3] comctl32: Use current month and year when checking day of month.

---
 dlls/comctl32/datetime.c       |    3 ++-
 dlls/comctl32/tests/datetime.c |    9 +++++++++
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c
index 8269758..bc643eb 100644
--- a/dlls/comctl32/datetime.c
+++ b/dlls/comctl32/datetime.c
@@ -167,7 +167,8 @@ DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *sy
     if (flag == GDT_VALID) {
       if (systime->wYear < 1601 || systime->wYear > 30827 ||
           systime->wMonth < 1 || systime->wMonth > 12 ||
-          systime->wDay < 1 || systime->wDay > 31 ||
+          systime->wDay < 1 ||
+          systime->wDay > MONTHCAL_MonthLength(systime->wMonth, systime->wYear) ||
           systime->wHour > 23 ||
           systime->wMinute > 59 ||
           systime->wSecond > 59 ||
diff --git a/dlls/comctl32/tests/datetime.c b/dlls/comctl32/tests/datetime.c
index 8b902ba..d60ad54 100644
--- a/dlls/comctl32/tests/datetime.c
+++ b/dlls/comctl32/tests/datetime.c
@@ -600,6 +600,15 @@ static void test_dtm_set_and_get_system_time(void)
     r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt);
     expect(GDT_VALID, r);
     expect_systime(&ref, &getSt);
+    /* day invalid for current month */
+    st = ref;
+    st.wDay = 30;
+    st.wMonth = 2;
+    r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st);
+    expect(0, r);
+    r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt);
+    expect(GDT_VALID, r);
+    expect_systime(&ref, &getSt);
     /* day of week isn't validated */
     st = ref;
     st.wDayOfWeek = 10;
-- 
1.7.1





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

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