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

Side by Side Diff: fpdfsdk/src/javascript/util.cpp

Issue 1542693002: Merge to XFA: Cleanup CJS_PublicMethods: (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 12 months 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
« no previous file with comments | « fpdfsdk/src/javascript/public_methods_embeddertest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "util.h" 7 #include "util.h"
8 8
9 #include "JS_Context.h" 9 #include "JS_Context.h"
10 #include "JS_Define.h" 10 #include "JS_Define.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 if (c == L'e' || c == L'E' || c == L'f' || c == L'g' || c == L'G') { 98 if (c == L'e' || c == L'E' || c == L'f' || c == L'g' || c == L'G') {
99 return UTIL_DOUBLE; 99 return UTIL_DOUBLE;
100 } 100 }
101 if (c == L's' || c == L'S') { 101 if (c == L's' || c == L'S') {
102 // Map s to S since we always deal internally 102 // Map s to S since we always deal internally
103 // with wchar_t strings. 103 // with wchar_t strings.
104 (*sFormat)[i] = L'S'; 104 (*sFormat)[i] = L'S';
105 return UTIL_STRING; 105 return UTIL_STRING;
106 } 106 }
107 if (c == L'.' || c == L'+' || c == L'-' || c == L'#' || c == L' ' || 107 if (c == L'.' || c == L'+' || c == L'-' || c == L'#' || c == L' ' ||
108 CJS_PublicMethods::IsDigit(c)) { 108 FXSYS_iswdigit(c)) {
109 continue; 109 continue;
110 } 110 }
111 break; 111 break;
112 } 112 }
113 } 113 }
114 114
115 return -1; 115 return -1;
116 } 116 }
117 117
118 FX_BOOL util::printf(IJS_Context* cc, 118 FX_BOOL util::printf(IJS_Context* cc,
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 CJS_Value& vRet, 495 CJS_Value& vRet,
496 CFX_WideString& sError) { 496 CFX_WideString& sError) {
497 int iSize = params.size(); 497 int iSize = params.size();
498 if (iSize < 2) 498 if (iSize < 2)
499 return FALSE; 499 return FALSE;
500 500
501 CFX_WideString sFormat = params[0].ToCFXWideString(); 501 CFX_WideString sFormat = params[0].ToCFXWideString();
502 CFX_WideString sDate = params[1].ToCFXWideString(); 502 CFX_WideString sDate = params[1].ToCFXWideString();
503 double dDate = JS_GetDateTime(); 503 double dDate = JS_GetDateTime();
504 if (sDate.GetLength() > 0) { 504 if (sDate.GetLength() > 0) {
505 FX_BOOL bWrongFormat = FALSE; 505 dDate = CJS_PublicMethods::MakeRegularDate(sDate, sFormat, nullptr);
506 dDate = CJS_PublicMethods::MakeRegularDate(sDate, sFormat, bWrongFormat);
507 } 506 }
508 507
509 if (!JS_PortIsNan(dDate)) { 508 if (!JS_PortIsNan(dDate)) {
510 vRet = CJS_Date(CJS_Runtime::FromContext(cc), dDate); 509 vRet = CJS_Date(CJS_Runtime::FromContext(cc), dDate);
511 } else { 510 } else {
512 vRet.SetNull(); 511 vRet.SetNull();
513 } 512 }
514 513
515 return TRUE; 514 return TRUE;
516 } 515 }
(...skipping 29 matching lines...) Expand all
546 int iSize = params.size(); 545 int iSize = params.size();
547 if (iSize == 0) 546 if (iSize == 0)
548 return FALSE; 547 return FALSE;
549 int nByte = params[0].ToInt(); 548 int nByte = params[0].ToInt();
550 unsigned char cByte = (unsigned char)nByte; 549 unsigned char cByte = (unsigned char)nByte;
551 CFX_WideString csValue; 550 CFX_WideString csValue;
552 csValue.Format(L"%c", cByte); 551 csValue.Format(L"%c", cByte);
553 vRet = csValue.c_str(); 552 vRet = csValue.c_str();
554 return TRUE; 553 return TRUE;
555 } 554 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/public_methods_embeddertest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698