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

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

Issue 1347833002: Ensure functions in FXJS_V8 are prefixed by FXJS_. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, nits, format. Created 5 years, 3 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/global.cpp ('k') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | 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 "../../include/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/IJavaScript.h" 8 #include "../../include/javascript/IJavaScript.h"
9 #include "../../include/javascript/JS_Define.h" 9 #include "../../include/javascript/JS_Define.h"
10 #include "../../include/javascript/JS_Object.h" 10 #include "../../include/javascript/JS_Object.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 if (!p2.ConvertToDate(jsDate)) { 205 if (!p2.ConvertToDate(jsDate)) {
206 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPRINT1); 206 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPRINT1);
207 return FALSE; 207 return FALSE;
208 } 208 }
209 209
210 if (!jsDate.IsValidDate()) { 210 if (!jsDate.IsValidDate()) {
211 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPRINT2); 211 sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPRINT2);
212 return FALSE; 212 return FALSE;
213 } 213 }
214 214
215 if (p1.GetType() == VT_number) { 215 if (p1.GetType() == CJS_Value::VT_number) {
216 int nFormat = p1.ToInt(); 216 int nFormat = p1.ToInt();
217 CFX_WideString swResult; 217 CFX_WideString swResult;
218 218
219 switch (nFormat) { 219 switch (nFormat) {
220 case 0: 220 case 0:
221 swResult.Format(L"D:%04d%02d%02d%02d%02d%02d", jsDate.GetYear(), 221 swResult.Format(L"D:%04d%02d%02d%02d%02d%02d", jsDate.GetYear(),
222 jsDate.GetMonth() + 1, jsDate.GetDay(), 222 jsDate.GetMonth() + 1, jsDate.GetDay(),
223 jsDate.GetHours(), jsDate.GetMinutes(), 223 jsDate.GetHours(), jsDate.GetMinutes(),
224 jsDate.GetSeconds()); 224 jsDate.GetSeconds());
225 break; 225 break;
226 case 1: 226 case 1:
227 swResult.Format(L"%04d.%02d.%02d %02d:%02d:%02d", jsDate.GetYear(), 227 swResult.Format(L"%04d.%02d.%02d %02d:%02d:%02d", jsDate.GetYear(),
228 jsDate.GetMonth() + 1, jsDate.GetDay(), 228 jsDate.GetMonth() + 1, jsDate.GetDay(),
229 jsDate.GetHours(), jsDate.GetMinutes(), 229 jsDate.GetHours(), jsDate.GetMinutes(),
230 jsDate.GetSeconds()); 230 jsDate.GetSeconds());
231 break; 231 break;
232 case 2: 232 case 2:
233 swResult.Format(L"%04d/%02d/%02d %02d:%02d:%02d", jsDate.GetYear(), 233 swResult.Format(L"%04d/%02d/%02d %02d:%02d:%02d", jsDate.GetYear(),
234 jsDate.GetMonth() + 1, jsDate.GetDay(), 234 jsDate.GetMonth() + 1, jsDate.GetDay(),
235 jsDate.GetHours(), jsDate.GetMinutes(), 235 jsDate.GetHours(), jsDate.GetMinutes(),
236 jsDate.GetSeconds()); 236 jsDate.GetSeconds());
237 break; 237 break;
238 default: 238 default:
239 return FALSE; 239 return FALSE;
240 } 240 }
241 241
242 vRet = swResult.c_str(); 242 vRet = swResult.c_str();
243 return TRUE; 243 return TRUE;
244 } 244 }
245 if (p1.GetType() == VT_string) { 245 if (p1.GetType() == CJS_Value::VT_string) {
246 std::basic_string<wchar_t> cFormat = p1.ToCFXWideString().c_str(); 246 std::basic_string<wchar_t> cFormat = p1.ToCFXWideString().c_str();
247 247
248 bool bXFAPicture = false; 248 bool bXFAPicture = false;
249 if (iSize > 2) { 249 if (iSize > 2) {
250 bXFAPicture = params[2].ToBool(); 250 bXFAPicture = params[2].ToBool();
251 } 251 }
252 252
253 if (bXFAPicture) { 253 if (bXFAPicture) {
254 return FALSE; // currently, it doesn't support XFAPicture. 254 return FALSE; // currently, it doesn't support XFAPicture.
255 } 255 }
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 int iSize = params.size(); 558 int iSize = params.size();
559 if (iSize == 0) 559 if (iSize == 0)
560 return FALSE; 560 return FALSE;
561 int nByte = params[0].ToInt(); 561 int nByte = params[0].ToInt();
562 unsigned char cByte = (unsigned char)nByte; 562 unsigned char cByte = (unsigned char)nByte;
563 CFX_WideString csValue; 563 CFX_WideString csValue;
564 csValue.Format(L"%c", cByte); 564 csValue.Format(L"%c", cByte);
565 vRet = csValue.c_str(); 565 vRet = csValue.c_str();
566 return TRUE; 566 return TRUE;
567 } 567 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/global.cpp ('k') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698