oleaut32: Fix year 0

André Hentschel nerv at dawncrow.de
Wed Feb 3 12:24:06 CST 2010


Sorry, forgot the numbering [1/2], but this patch would be [2/2]
---
 dlls/oleaut32/tests/vartest.c |    2 +-
 dlls/oleaut32/variant.c       |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c
index 34f0e3f..c5d65a2 100644
--- a/dlls/oleaut32/tests/vartest.c
+++ b/dlls/oleaut32/tests/vartest.c
@@ -1665,7 +1665,7 @@ static void test_VarDateFromUdate(void)
   UD2T(1,12001,-1020,18,1,16,0,0,0,0,S_OK,29221.75087962963);        /* Test rolled year and month */
   UD2T(1,-23,1982,18,1,16,0,0,0,0,S_OK,29221.75087962963);           /* Test backrolled month */
   UD2T(-59,3,1980,18,1,16,0,0,0,0,S_OK,29221.75087962963);           /* Test backrolled days */
-  todo_wine UD2T(1,1,0,0,0,0,0,0,0,0,S_OK,36526);                    /* Test zero year */
+  UD2T(1,1,0,0,0,0,0,0,0,0,S_OK,36526);                              /* Test zero year */
   UD2T(0,0,1980,0,0,0,0,0,0,0,S_OK,29189);                           /* Test zero day and month */
   UD2T(0,1,1980,0,0,0,0,2,1,0,S_OK,29220.0);                         /* Test zero day = LastDayOfMonth */
   UD2T(-1,1,1980,18,1,16,0,0,0,0,S_OK,29219.75087962963);            /* Test day -1 = LastDayOfMonth - 1 */
diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c
index a2a5bd8..55d0935 100644
--- a/dlls/oleaut32/variant.c
+++ b/dlls/oleaut32/variant.c
@@ -1145,7 +1145,7 @@ static HRESULT VARIANT_RollUdate(UDATE *lpUd)
   if (iYear > 9999 || iYear < -9999)
     return E_INVALIDARG; /* Invalid value */
   /* Years < 100 are treated as 1900 + year */
-  if (iYear >= 0 && iYear < 100)
+  if (iYear > 0 && iYear < 100)
     iYear += 1900;
 
   iMinute += (iSecond - (iSecond % 60)) / 60;
@@ -1180,7 +1180,7 @@ static HRESULT VARIANT_RollUdate(UDATE *lpUd)
   if (iSecond<0){iSecond+=60; iMinute--;}
   if (iMinute<0){iMinute+=60; iHour--;}
   if (iHour<0)  {iHour+=24; iDay--;}
-  if (iYear<0)  iYear+=2000;
+  if (iYear<=0)  iYear+=2000;
 
   lpUd->st.wYear   = iYear;
   lpUd->st.wMonth  = iMonth;
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list