Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: xfa/fxfa/fm2js/xfa_fm2jscontext.cpp

Issue 2488403004: Add fpdfppo_embeddertest.cpp. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/fm2js/xfa_fm2jscontext.h" 7 #include "xfa/fxfa/fm2js/xfa_fm2jscontext.h"
8 8
9 #include <time.h> 9 #include <time.h>
10 10
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 args.GetReturnValue()->SetInteger(0); 1598 args.GetReturnValue()->SetInteger(0);
1599 return; 1599 return;
1600 } 1600 }
1601 1601
1602 CFX_Unitime uniTime = localeValue.GetTime(); 1602 CFX_Unitime uniTime = localeValue.GetTime();
1603 int32_t hour = uniTime.GetHour(); 1603 int32_t hour = uniTime.GetHour();
1604 int32_t min = uniTime.GetMinute(); 1604 int32_t min = uniTime.GetMinute();
1605 int32_t second = uniTime.GetSecond(); 1605 int32_t second = uniTime.GetSecond();
1606 int32_t milSecond = uniTime.GetMillisecond(); 1606 int32_t milSecond = uniTime.GetMillisecond();
1607 int32_t mins = hour * 60 + min; 1607 int32_t mins = hour * 60 + min;
1608 CXFA_TimeZoneProvider* pProvider = CXFA_TimeZoneProvider::Get();
1609 if (pProvider) {
1610 FX_TIMEZONE tz;
1611 pProvider->GetTimeZone(tz);
1612 mins -= (tz.tzHour * 60);
1613 while (mins > 1440)
1614 mins -= 1440;
1615 while (mins < 0)
1616 mins += 1440;
1617 1608
1618 hour = mins / 60; 1609 FX_TIMEZONE tz;
1619 min = mins % 60; 1610 CXFA_TimeZoneProvider provider;
1620 } 1611 provider.GetTimeZone(tz);
1612 mins -= (tz.tzHour * 60);
1613 while (mins > 1440)
Lei Zhang 2016/11/11 23:56:48 mins %= 1440?
Tom Sepez 2016/11/12 00:35:46 leave for now, no functional changes til another c
1614 mins -= 1440;
1615
1616 while (mins < 0)
Lei Zhang 2016/11/11 23:56:48 And then just if (mins < 0) ?
Tom Sepez 2016/11/12 00:35:46 ditto
1617 mins += 1440;
1618
1619 hour = mins / 60;
1620 min = mins % 60;
1621 args.GetReturnValue()->SetInteger(hour * 3600000 + min * 60000 + 1621 args.GetReturnValue()->SetInteger(hour * 3600000 + min * 60000 +
1622 second * 1000 + milSecond + 1); 1622 second * 1000 + milSecond + 1);
1623 } 1623 }
1624 1624
1625 // static 1625 // static
1626 void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis, 1626 void CXFA_FM2JSContext::TimeFmt(CFXJSE_Value* pThis,
1627 const CFX_ByteStringC& szFuncName, 1627 const CFX_ByteStringC& szFuncName,
1628 CFXJSE_Arguments& args) { 1628 CFXJSE_Arguments& args) {
1629 int32_t argc = args.GetLength(); 1629 int32_t argc = args.GetLength();
1630 if (argc > 2) { 1630 if (argc > 2) {
(...skipping 4887 matching lines...) Expand 10 before | Expand all | Expand 10 after
6518 CFX_WideString wsFormat; 6518 CFX_WideString wsFormat;
6519 pAppProvider->LoadString(iStringID, wsFormat); 6519 pAppProvider->LoadString(iStringID, wsFormat);
6520 CFX_WideString wsMessage; 6520 CFX_WideString wsMessage;
6521 va_list arg_ptr; 6521 va_list arg_ptr;
6522 va_start(arg_ptr, iStringID); 6522 va_start(arg_ptr, iStringID);
6523 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); 6523 wsMessage.FormatV(wsFormat.c_str(), arg_ptr);
6524 va_end(arg_ptr); 6524 va_end(arg_ptr);
6525 FXJSE_ThrowMessage( 6525 FXJSE_ThrowMessage(
6526 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); 6526 FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC());
6527 } 6527 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698