[PATCH 1/2] vbscript: Implement DateSerial().
Dmitry Timoshkov
dmitry at baikal.ru
Sun May 15 07:58:04 CDT 2022
Nikolay Sivov <nsivov at codeweavers.com> wrote:
> -static HRESULT Global_DateSerial(BuiltinDisp *This, VARIANT *arg, unsigned args_cnt, VARIANT *res)
> +static HRESULT Global_DateSerial(BuiltinDisp *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
> {
> - FIXME("\n");
> - return E_NOTIMPL;
> + int year, month, day;
> + SYSTEMTIME lt;
> + HRESULT hres;
> + double date;
> + UDATE ud;
> +
> + TRACE("\n");
> +
> + assert(args_cnt == 3);
> +
> + hres = to_int(args, &year);
> + if (SUCCEEDED(hres))
> + hres = to_int(args + 1, &month);
> + if (SUCCEEDED(hres))
> + hres = to_int(args + 2, &day);
> +
> + if (SUCCEEDED(hres))
> + {
> + lt.wYear = year;
> + lt.wMonth = month;
> + lt.wDay = day;
> +
> + ud.st = lt;
> + ud.wDayOfYear = 0;
> + hres = VarDateFromUdateEx(&ud, 0, 0, &date);
> + }
Having 'lt' as an intermediate variable seems to be redundant. Also
ud.st is not fully initialized unlike in 2/2.
--
Dmitry.
More information about the wine-devel
mailing list