diff options
author | tsepez <tsepez@chromium.org> | 2016-11-11 17:23:48 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-11 17:23:48 -0800 |
commit | 211d4edbe2f71ca62c76f36ce25090342c58e43c (patch) | |
tree | 645a4823ce6df9021333552b55288cd13344a4f9 /xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | |
parent | 8f3eb6051c0465923d6694bd0f0b6dc5bb51cbe3 (diff) | |
download | pdfium-211d4edbe2f71ca62c76f36ce25090342c58e43c.tar.xz |
Add fpdfppo_embeddertest.cpp.
The lack of coverage of the fpdfppo APIs was noticed while
trying to diagnose another issue. Adding basic calls to
these APIs then kicked out an assert in XFA, where duplicate
global CFXA_TimeZoneProviders were not expected. These are
cheap to create except for the global C RTL tzset() call, so
keep track of that and make these on demand.
Review-Url: https://codereview.chromium.org/2488403004
Diffstat (limited to 'xfa/fxfa/fm2js/xfa_fm2jscontext.cpp')
-rw-r--r-- | xfa/fxfa/fm2js/xfa_fm2jscontext.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index 947ef7941e..5c267717a3 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -1182,7 +1182,7 @@ void CXFA_FM2JSContext::IsoTime2Num(CFXJSE_Value* pThis, int32_t milSecond = uniTime.GetMillisecond(); FX_TIMEZONE tzLocale; - pMgr->GetDefLocale()->GetTimeZone(tzLocale); + pMgr->GetDefLocale()->GetTimeZone(&tzLocale); // TODO(dsinclair): See if there is other time conversion code in pdfium and // consolidate. @@ -1605,19 +1605,19 @@ void CXFA_FM2JSContext::Time2Num(CFXJSE_Value* pThis, int32_t second = uniTime.GetSecond(); int32_t milSecond = uniTime.GetMillisecond(); int32_t mins = hour * 60 + min; - CXFA_TimeZoneProvider* pProvider = CXFA_TimeZoneProvider::Get(); - if (pProvider) { - FX_TIMEZONE tz; - pProvider->GetTimeZone(tz); - mins -= (tz.tzHour * 60); - while (mins > 1440) - mins -= 1440; - while (mins < 0) - mins += 1440; - - hour = mins / 60; - min = mins % 60; - } + + FX_TIMEZONE tz; + CXFA_TimeZoneProvider provider; + provider.GetTimeZone(&tz); + mins -= (tz.tzHour * 60); + while (mins > 1440) + mins -= 1440; + + while (mins < 0) + mins += 1440; + + hour = mins / 60; + min = mins % 60; args.GetReturnValue()->SetInteger(hour * 3600000 + min * 60000 + second * 1000 + milSecond + 1); } |