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

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

Issue 1998873002: Clean up XFA code which causes warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 7 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 | « xfa/fxfa/app/xfa_ffwidgetacc.cpp ('k') | xfa/fxfa/parser/xfa_basic_imp.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 "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 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 1284 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
1285 L"LocalTimeFmt"); 1285 L"LocalTimeFmt");
1286 } 1286 }
1287 } 1287 }
1288 void CXFA_FM2JSContext::Num2Date(FXJSE_HOBJECT hThis, 1288 void CXFA_FM2JSContext::Num2Date(FXJSE_HOBJECT hThis,
1289 const CFX_ByteStringC& szFuncName, 1289 const CFX_ByteStringC& szFuncName,
1290 CFXJSE_Arguments& args) { 1290 CFXJSE_Arguments& args) {
1291 int32_t argc = args.GetLength(); 1291 int32_t argc = args.GetLength();
1292 if ((argc > 0) && (argc < 4)) { 1292 if ((argc > 0) && (argc < 4)) {
1293 FX_BOOL bFlags = FALSE; 1293 FX_BOOL bFlags = FALSE;
1294 int32_t dDate; 1294 int32_t dDate = 0;
1295 CFX_ByteString formatString; 1295 CFX_ByteString formatString;
1296 CFX_ByteString localString; 1296 CFX_ByteString localString;
1297 FXJSE_HVALUE dateValue = GetSimpleHValue(hThis, args, 0); 1297 FXJSE_HVALUE dateValue = GetSimpleHValue(hThis, args, 0);
1298 FXJSE_HVALUE formatValue = 0; 1298 FXJSE_HVALUE formatValue = 0;
1299 FXJSE_HVALUE localValue = 0; 1299 FXJSE_HVALUE localValue = 0;
1300 if (HValueIsNull(hThis, dateValue)) { 1300 if (HValueIsNull(hThis, dateValue)) {
1301 bFlags = TRUE; 1301 bFlags = TRUE;
1302 } else { 1302 } else {
1303 dDate = (int32_t)HValueToFloat(hThis, dateValue); 1303 dDate = (int32_t)HValueToFloat(hThis, dateValue);
1304 bFlags = dDate < 1; 1304 bFlags = dDate < 1;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 1439 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
1440 L"Num2Date"); 1440 L"Num2Date");
1441 } 1441 }
1442 } 1442 }
1443 void CXFA_FM2JSContext::Num2GMTime(FXJSE_HOBJECT hThis, 1443 void CXFA_FM2JSContext::Num2GMTime(FXJSE_HOBJECT hThis,
1444 const CFX_ByteStringC& szFuncName, 1444 const CFX_ByteStringC& szFuncName,
1445 CFXJSE_Arguments& args) { 1445 CFXJSE_Arguments& args) {
1446 int32_t argc = args.GetLength(); 1446 int32_t argc = args.GetLength();
1447 if ((argc > 0) && (argc < 4)) { 1447 if ((argc > 0) && (argc < 4)) {
1448 FX_BOOL bFlags = FALSE; 1448 FX_BOOL bFlags = FALSE;
1449 int32_t iTime; 1449 int32_t iTime = 0;
1450 CFX_ByteString formatString; 1450 CFX_ByteString formatString;
1451 CFX_ByteString localString; 1451 CFX_ByteString localString;
1452 FXJSE_HVALUE timeValue = GetSimpleHValue(hThis, args, 0); 1452 FXJSE_HVALUE timeValue = GetSimpleHValue(hThis, args, 0);
1453 FXJSE_HVALUE formatValue = 0; 1453 FXJSE_HVALUE formatValue = 0;
1454 FXJSE_HVALUE localValue = 0; 1454 FXJSE_HVALUE localValue = 0;
1455 if (FXJSE_Value_IsNull(timeValue)) { 1455 if (FXJSE_Value_IsNull(timeValue)) {
1456 bFlags = TRUE; 1456 bFlags = TRUE;
1457 } else { 1457 } else {
1458 iTime = (int32_t)HValueToFloat(hThis, timeValue); 1458 iTime = (int32_t)HValueToFloat(hThis, timeValue);
1459 if (FXSYS_abs(iTime) < 1.0) { 1459 if (FXSYS_abs(iTime) < 1.0) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 1501 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
1502 L"Num2GMTime"); 1502 L"Num2GMTime");
1503 } 1503 }
1504 } 1504 }
1505 void CXFA_FM2JSContext::Num2Time(FXJSE_HOBJECT hThis, 1505 void CXFA_FM2JSContext::Num2Time(FXJSE_HOBJECT hThis,
1506 const CFX_ByteStringC& szFuncName, 1506 const CFX_ByteStringC& szFuncName,
1507 CFXJSE_Arguments& args) { 1507 CFXJSE_Arguments& args) {
1508 int32_t argc = args.GetLength(); 1508 int32_t argc = args.GetLength();
1509 if ((argc > 0) && (argc < 4)) { 1509 if ((argc > 0) && (argc < 4)) {
1510 FX_BOOL bFlags = FALSE; 1510 FX_BOOL bFlags = FALSE;
1511 FX_FLOAT fTime; 1511 FX_FLOAT fTime = 0.0f;
1512 CFX_ByteString formatString; 1512 CFX_ByteString formatString;
1513 CFX_ByteString localString; 1513 CFX_ByteString localString;
1514 FXJSE_HVALUE timeValue = GetSimpleHValue(hThis, args, 0); 1514 FXJSE_HVALUE timeValue = GetSimpleHValue(hThis, args, 0);
1515 FXJSE_HVALUE formatValue = 0; 1515 FXJSE_HVALUE formatValue = 0;
1516 FXJSE_HVALUE localValue = 0; 1516 FXJSE_HVALUE localValue = 0;
1517 if (FXJSE_Value_IsNull(timeValue)) { 1517 if (FXJSE_Value_IsNull(timeValue)) {
1518 bFlags = TRUE; 1518 bFlags = TRUE;
1519 } else { 1519 } else {
1520 fTime = HValueToFloat(hThis, timeValue); 1520 fTime = HValueToFloat(hThis, timeValue);
1521 if (FXSYS_fabs(fTime) < 1.0) { 1521 if (FXSYS_fabs(fTime) < 1.0) {
(...skipping 3331 matching lines...) Expand 10 before | Expand all | Expand 10 after
4853 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 4853 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
4854 L"Space"); 4854 L"Space");
4855 } 4855 }
4856 } 4856 }
4857 void CXFA_FM2JSContext::Str(FXJSE_HOBJECT hThis, 4857 void CXFA_FM2JSContext::Str(FXJSE_HOBJECT hThis,
4858 const CFX_ByteStringC& szFuncName, 4858 const CFX_ByteStringC& szFuncName,
4859 CFXJSE_Arguments& args) { 4859 CFXJSE_Arguments& args) {
4860 int32_t argc = args.GetLength(); 4860 int32_t argc = args.GetLength();
4861 if ((argc > 0) && (argc < 4)) { 4861 if ((argc > 0) && (argc < 4)) {
4862 FX_BOOL bFlags = FALSE; 4862 FX_BOOL bFlags = FALSE;
4863 FX_FLOAT fNumber; 4863 FX_FLOAT fNumber = 0.0f;
4864 int32_t iWidth = 10; 4864 int32_t iWidth = 10;
4865 int32_t iPrecision = 0; 4865 int32_t iPrecision = 0;
4866 FXJSE_HVALUE numberValue = GetSimpleHValue(hThis, args, 0); 4866 FXJSE_HVALUE numberValue = GetSimpleHValue(hThis, args, 0);
4867 FXJSE_HVALUE widthValue = 0; 4867 FXJSE_HVALUE widthValue = 0;
4868 FXJSE_HVALUE precisionValue = 0; 4868 FXJSE_HVALUE precisionValue = 0;
4869 if (FXJSE_Value_IsNull(numberValue)) { 4869 if (FXJSE_Value_IsNull(numberValue)) {
4870 bFlags = TRUE; 4870 bFlags = TRUE;
4871 } else { 4871 } else {
4872 fNumber = HValueToFloat(hThis, numberValue); 4872 fNumber = HValueToFloat(hThis, numberValue);
4873 } 4873 }
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
5164 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, 5164 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
5165 L"Upper"); 5165 L"Upper");
5166 } 5166 }
5167 } 5167 }
5168 void CXFA_FM2JSContext::WordNum(FXJSE_HOBJECT hThis, 5168 void CXFA_FM2JSContext::WordNum(FXJSE_HOBJECT hThis,
5169 const CFX_ByteStringC& szFuncName, 5169 const CFX_ByteStringC& szFuncName,
5170 CFXJSE_Arguments& args) { 5170 CFXJSE_Arguments& args) {
5171 int32_t argc = args.GetLength(); 5171 int32_t argc = args.GetLength();
5172 if ((argc > 0) && (argc < 4)) { 5172 if ((argc > 0) && (argc < 4)) {
5173 FX_BOOL bFlags = FALSE; 5173 FX_BOOL bFlags = FALSE;
5174 FX_FLOAT fNumber; 5174 FX_FLOAT fNumber = 0.0f;
5175 int32_t iIdentifier = 0; 5175 int32_t iIdentifier = 0;
5176 CFX_ByteString localeString; 5176 CFX_ByteString localeString;
5177 FXJSE_HVALUE numberValue = GetSimpleHValue(hThis, args, 0); 5177 FXJSE_HVALUE numberValue = GetSimpleHValue(hThis, args, 0);
5178 FXJSE_HVALUE identifierValue = 0; 5178 FXJSE_HVALUE identifierValue = 0;
5179 FXJSE_HVALUE localeValue = 0; 5179 FXJSE_HVALUE localeValue = 0;
5180 if (FXJSE_Value_IsNull(numberValue)) { 5180 if (FXJSE_Value_IsNull(numberValue)) {
5181 bFlags = TRUE; 5181 bFlags = TRUE;
5182 } else { 5182 } else {
5183 fNumber = HValueToFloat(hThis, numberValue); 5183 fNumber = HValueToFloat(hThis, numberValue);
5184 } 5184 }
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
5470 IXFA_AppProvider* pAppProvider = 5470 IXFA_AppProvider* pAppProvider =
5471 pDoc->GetParser()->GetNotify()->GetAppProvider(); 5471 pDoc->GetParser()->GetNotify()->GetAppProvider();
5472 if (!pAppProvider) { 5472 if (!pAppProvider) {
5473 return; 5473 return;
5474 } 5474 }
5475 CFX_ByteString bsURL; 5475 CFX_ByteString bsURL;
5476 CFX_ByteString bsData; 5476 CFX_ByteString bsData;
5477 CFX_ByteString bsContentType; 5477 CFX_ByteString bsContentType;
5478 CFX_ByteString bsEncode; 5478 CFX_ByteString bsEncode;
5479 CFX_ByteString bsHeader; 5479 CFX_ByteString bsHeader;
5480 FXJSE_HVALUE argOne; 5480 FXJSE_HVALUE argThree = nullptr;
5481 FXJSE_HVALUE argTwo; 5481 FXJSE_HVALUE argFour = nullptr;
5482 FXJSE_HVALUE argThree; 5482 FXJSE_HVALUE argFive = nullptr;
5483 FXJSE_HVALUE argFour; 5483 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0);
5484 FXJSE_HVALUE argFive;
5485 argOne = GetSimpleHValue(hThis, args, 0);
5486 HValueToUTF8String(argOne, bsURL); 5484 HValueToUTF8String(argOne, bsURL);
5487 argTwo = GetSimpleHValue(hThis, args, 1); 5485 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1);
5488 HValueToUTF8String(argTwo, bsData); 5486 HValueToUTF8String(argTwo, bsData);
5489 if (argc > 2) { 5487 if (argc > 2) {
5490 argThree = GetSimpleHValue(hThis, args, 2); 5488 argThree = GetSimpleHValue(hThis, args, 2);
5491 HValueToUTF8String(argThree, bsContentType); 5489 HValueToUTF8String(argThree, bsContentType);
5492 } 5490 }
5493 if (argc > 3) { 5491 if (argc > 3) {
5494 argFour = GetSimpleHValue(hThis, args, 3); 5492 argFour = GetSimpleHValue(hThis, args, 3);
5495 HValueToUTF8String(argFour, bsEncode); 5493 HValueToUTF8String(argFour, bsEncode);
5496 } 5494 }
5497 if (argc > 4) { 5495 if (argc > 4) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
5541 return; 5539 return;
5542 } 5540 }
5543 IXFA_AppProvider* pAppProvider = 5541 IXFA_AppProvider* pAppProvider =
5544 pDoc->GetParser()->GetNotify()->GetAppProvider(); 5542 pDoc->GetParser()->GetNotify()->GetAppProvider();
5545 if (!pAppProvider) { 5543 if (!pAppProvider) {
5546 return; 5544 return;
5547 } 5545 }
5548 CFX_ByteString bsURL; 5546 CFX_ByteString bsURL;
5549 CFX_ByteString bsData; 5547 CFX_ByteString bsData;
5550 CFX_ByteString bsEncode; 5548 CFX_ByteString bsEncode;
5551 FXJSE_HVALUE argOne; 5549 FXJSE_HVALUE argThree = nullptr;
5552 FXJSE_HVALUE argTwo; 5550 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0);
5553 FXJSE_HVALUE argThree;
5554 argOne = GetSimpleHValue(hThis, args, 0);
5555 HValueToUTF8String(argOne, bsURL); 5551 HValueToUTF8String(argOne, bsURL);
5556 argTwo = GetSimpleHValue(hThis, args, 1); 5552 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1);
5557 HValueToUTF8String(argTwo, bsData); 5553 HValueToUTF8String(argTwo, bsData);
5558 if (argc > 2) { 5554 if (argc > 2) {
5559 argThree = GetSimpleHValue(hThis, args, 2); 5555 argThree = GetSimpleHValue(hThis, args, 2);
5560 HValueToUTF8String(argThree, bsEncode); 5556 HValueToUTF8String(argThree, bsEncode);
5561 } 5557 }
5562 FX_BOOL bFlags = pAppProvider->PutRequestURL( 5558 FX_BOOL bFlags = pAppProvider->PutRequestURL(
5563 CFX_WideString::FromUTF8(bsURL.AsStringC()), 5559 CFX_WideString::FromUTF8(bsURL.AsStringC()),
5564 CFX_WideString::FromUTF8(bsData.AsStringC()), 5560 CFX_WideString::FromUTF8(bsData.AsStringC()),
5565 CFX_WideString::FromUTF8(bsEncode.AsStringC())); 5561 CFX_WideString::FromUTF8(bsEncode.AsStringC()));
5566 FXJSE_Value_Release(argOne); 5562 FXJSE_Value_Release(argOne);
(...skipping 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after
7211 CFX_WideString wsFormat; 7207 CFX_WideString wsFormat;
7212 pAppProvider->LoadString(iStringID, wsFormat); 7208 pAppProvider->LoadString(iStringID, wsFormat);
7213 CFX_WideString wsMessage; 7209 CFX_WideString wsMessage;
7214 va_list arg_ptr; 7210 va_list arg_ptr;
7215 va_start(arg_ptr, iStringID); 7211 va_start(arg_ptr, iStringID);
7216 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); 7212 wsMessage.FormatV(wsFormat.c_str(), arg_ptr);
7217 va_end(arg_ptr); 7213 va_end(arg_ptr);
7218 FXJSE_ThrowMessage( 7214 FXJSE_ThrowMessage(
7219 "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); 7215 "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC());
7220 } 7216 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffwidgetacc.cpp ('k') | xfa/fxfa/parser/xfa_basic_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698