Commit 3309feb6 authored by Nick Wellnhofer's avatar Nick Wellnhofer

Always initialize EXSLT month and day to 1

Fixes bug #757970
https://bugzilla.gnome.org/show_bug.cgi?id=757970
parent f600feac
......@@ -667,6 +667,11 @@ exsltDateCreateDate (exsltDateType type)
}
memset (ret, 0, sizeof(exsltDateVal));
if (type != XS_DURATION) {
ret->value.date.mon = 1;
ret->value.date.day = 1;
}
if (type != EXSLT_UNKNOWN)
ret->type = type;
......@@ -1395,10 +1400,10 @@ _exsltDateTruncateDate (exsltDateValPtr dt, exsltDateType type)
}
if ((type & XS_GDAY) != XS_GDAY)
dt->value.date.day = 0;
dt->value.date.day = 1;
if ((type & XS_GMONTH) != XS_GMONTH)
dt->value.date.mon = 0;
dt->value.date.mon = 1;
if ((type & XS_GYEAR) != XS_GYEAR)
dt->value.date.year = 0;
......@@ -1473,18 +1478,10 @@ _exsltDateAdd (exsltDateValPtr dt, exsltDateValPtr dur)
d = &(dt->value.date);
u = &(dur->value.dur);
/* normalization */
if (d->mon == 0)
d->mon = 1;
/* normalize for time zone offset */
u->sec -= (d->tzo * 60); /* changed from + to - (bug 153000) */
d->tzo = 0;
/* normalization */
if (d->day == 0)
d->day = 1;
/* month */
carry = d->mon + u->mon;
r->mon = (unsigned int)MODULO_RANGE(carry, 1, 13);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment