| OLD | NEW |
| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 uCount++; | 308 uCount++; |
| 309 } | 309 } |
| 310 FXJSE_Value_Release(defaultPropValue); | 310 FXJSE_Value_Release(defaultPropValue); |
| 311 } | 311 } |
| 312 } else { | 312 } else { |
| 313 CFX_ByteString propertyStr; | 313 CFX_ByteString propertyStr; |
| 314 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 314 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 315 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); | 315 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); |
| 316 for (int32_t j = 2; j < iLength; j++) { | 316 for (int32_t j = 2; j < iLength; j++) { |
| 317 FXJSE_Value_GetObjectPropByIdx(argValue, j, jsObjectValue); | 317 FXJSE_Value_GetObjectPropByIdx(argValue, j, jsObjectValue); |
| 318 FXJSE_Value_GetObjectProp( | 318 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsStringC(), |
| 319 jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue); | 319 newPropertyValue); |
| 320 if (!FXJSE_Value_IsNull(newPropertyValue)) { | 320 if (!FXJSE_Value_IsNull(newPropertyValue)) { |
| 321 dSum += HValueToDouble(hThis, newPropertyValue); | 321 dSum += HValueToDouble(hThis, newPropertyValue); |
| 322 uCount++; | 322 uCount++; |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 FXJSE_Value_Release(newPropertyValue); | 325 FXJSE_Value_Release(newPropertyValue); |
| 326 } | 326 } |
| 327 FXJSE_Value_Release(jsObjectValue); | 327 FXJSE_Value_Release(jsObjectValue); |
| 328 FXJSE_Value_Release(propertyValue); | 328 FXJSE_Value_Release(propertyValue); |
| 329 } | 329 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 GetObjectDefaultValue(jsObjectValue, newPropertyValue); | 391 GetObjectDefaultValue(jsObjectValue, newPropertyValue); |
| 392 if (!FXJSE_Value_IsNull(newPropertyValue)) { | 392 if (!FXJSE_Value_IsNull(newPropertyValue)) { |
| 393 uCount++; | 393 uCount++; |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 } else { | 396 } else { |
| 397 CFX_ByteString propertyStr; | 397 CFX_ByteString propertyStr; |
| 398 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 398 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 399 for (int32_t i = 2; i < iLength; i++) { | 399 for (int32_t i = 2; i < iLength; i++) { |
| 400 FXJSE_Value_GetObjectPropByIdx(argValue, i, jsObjectValue); | 400 FXJSE_Value_GetObjectPropByIdx(argValue, i, jsObjectValue); |
| 401 FXJSE_Value_GetObjectProp( | 401 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsStringC(), |
| 402 jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue); | 402 newPropertyValue); |
| 403 uCount += (FXJSE_Value_IsNull(newPropertyValue) ? 0 : 1); | 403 uCount += (FXJSE_Value_IsNull(newPropertyValue) ? 0 : 1); |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 FXJSE_Value_Release(propertyValue); | 406 FXJSE_Value_Release(propertyValue); |
| 407 FXJSE_Value_Release(jsObjectValue); | 407 FXJSE_Value_Release(jsObjectValue); |
| 408 FXJSE_Value_Release(newPropertyValue); | 408 FXJSE_Value_Release(newPropertyValue); |
| 409 } else { | 409 } else { |
| 410 pContext->ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); | 410 pContext->ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); |
| 411 } | 411 } |
| 412 } else if (FXJSE_Value_IsObject(argValue)) { | 412 } else if (FXJSE_Value_IsObject(argValue)) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 dMaxValue = dValue; | 483 dMaxValue = dValue; |
| 484 } | 484 } |
| 485 } | 485 } |
| 486 } | 486 } |
| 487 } | 487 } |
| 488 } else { | 488 } else { |
| 489 CFX_ByteString propertyStr; | 489 CFX_ByteString propertyStr; |
| 490 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 490 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 491 for (int32_t i = 2; i < iLength; i++) { | 491 for (int32_t i = 2; i < iLength; i++) { |
| 492 FXJSE_Value_GetObjectPropByIdx(argValue, i, jsObjectValue); | 492 FXJSE_Value_GetObjectPropByIdx(argValue, i, jsObjectValue); |
| 493 FXJSE_Value_GetObjectProp( | 493 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsStringC(), |
| 494 jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue); | 494 newPropertyValue); |
| 495 if (!FXJSE_Value_IsNull(newPropertyValue)) { | 495 if (!FXJSE_Value_IsNull(newPropertyValue)) { |
| 496 uCount++; | 496 uCount++; |
| 497 if (uCount == 1) { | 497 if (uCount == 1) { |
| 498 dMaxValue = HValueToDouble(hThis, newPropertyValue); | 498 dMaxValue = HValueToDouble(hThis, newPropertyValue); |
| 499 } else { | 499 } else { |
| 500 FX_DOUBLE dValue = HValueToDouble(hThis, newPropertyValue); | 500 FX_DOUBLE dValue = HValueToDouble(hThis, newPropertyValue); |
| 501 if (dMaxValue < dValue) { | 501 if (dMaxValue < dValue) { |
| 502 dMaxValue = dValue; | 502 dMaxValue = dValue; |
| 503 } | 503 } |
| 504 } | 504 } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 dMinValue = dValue; | 586 dMinValue = dValue; |
| 587 } | 587 } |
| 588 } | 588 } |
| 589 } | 589 } |
| 590 } | 590 } |
| 591 } else { | 591 } else { |
| 592 CFX_ByteString propertyStr; | 592 CFX_ByteString propertyStr; |
| 593 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 593 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 594 for (int32_t i = 2; i < iLength; i++) { | 594 for (int32_t i = 2; i < iLength; i++) { |
| 595 FXJSE_Value_GetObjectPropByIdx(argValue, i, jsObjectValue); | 595 FXJSE_Value_GetObjectPropByIdx(argValue, i, jsObjectValue); |
| 596 FXJSE_Value_GetObjectProp( | 596 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsStringC(), |
| 597 jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue); | 597 newPropertyValue); |
| 598 if (!FXJSE_Value_IsNull(newPropertyValue)) { | 598 if (!FXJSE_Value_IsNull(newPropertyValue)) { |
| 599 uCount++; | 599 uCount++; |
| 600 if (uCount == 1) { | 600 if (uCount == 1) { |
| 601 dMinValue = HValueToDouble(hThis, newPropertyValue); | 601 dMinValue = HValueToDouble(hThis, newPropertyValue); |
| 602 } else { | 602 } else { |
| 603 FX_DOUBLE dValue = HValueToDouble(hThis, newPropertyValue); | 603 FX_DOUBLE dValue = HValueToDouble(hThis, newPropertyValue); |
| 604 if (dMinValue > dValue) { | 604 if (dMinValue > dValue) { |
| 605 dMinValue = dValue; | 605 dMinValue = dValue; |
| 606 } | 606 } |
| 607 } | 607 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 672 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 673 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); | 673 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); |
| 674 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); | 674 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); |
| 675 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsObjectValue); | 675 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsObjectValue); |
| 676 if (FXJSE_Value_IsNull(propertyValue)) { | 676 if (FXJSE_Value_IsNull(propertyValue)) { |
| 677 dDividend = HValueToDouble(hThis, jsObjectValue); | 677 dDividend = HValueToDouble(hThis, jsObjectValue); |
| 678 } else { | 678 } else { |
| 679 CFX_ByteString propertyStr; | 679 CFX_ByteString propertyStr; |
| 680 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 680 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 681 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); | 681 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); |
| 682 FXJSE_Value_GetObjectProp( | 682 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsStringC(), |
| 683 jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue); | 683 newPropertyValue); |
| 684 dDividend = HValueToDouble(hThis, newPropertyValue); | 684 dDividend = HValueToDouble(hThis, newPropertyValue); |
| 685 FXJSE_Value_Release(newPropertyValue); | 685 FXJSE_Value_Release(newPropertyValue); |
| 686 } | 686 } |
| 687 FXJSE_Value_Release(propertyValue); | 687 FXJSE_Value_Release(propertyValue); |
| 688 FXJSE_Value_Release(jsObjectValue); | 688 FXJSE_Value_Release(jsObjectValue); |
| 689 } else { | 689 } else { |
| 690 pContext->ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); | 690 pContext->ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); |
| 691 } | 691 } |
| 692 } else { | 692 } else { |
| 693 dDividend = HValueToDouble(hThis, argOne); | 693 dDividend = HValueToDouble(hThis, argOne); |
| 694 } | 694 } |
| 695 if (FXJSE_Value_IsArray(argTwo)) { | 695 if (FXJSE_Value_IsArray(argTwo)) { |
| 696 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(hruntime); | 696 FXJSE_HVALUE lengthValue = FXJSE_Value_Create(hruntime); |
| 697 FXJSE_Value_GetObjectProp(argTwo, "length", lengthValue); | 697 FXJSE_Value_GetObjectProp(argTwo, "length", lengthValue); |
| 698 int32_t iLength = FXJSE_Value_ToInteger(lengthValue); | 698 int32_t iLength = FXJSE_Value_ToInteger(lengthValue); |
| 699 FXJSE_Value_Release(lengthValue); | 699 FXJSE_Value_Release(lengthValue); |
| 700 if (iLength > 2) { | 700 if (iLength > 2) { |
| 701 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 701 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 702 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); | 702 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); |
| 703 FXJSE_Value_GetObjectPropByIdx(argTwo, 1, propertyValue); | 703 FXJSE_Value_GetObjectPropByIdx(argTwo, 1, propertyValue); |
| 704 FXJSE_Value_GetObjectPropByIdx(argTwo, 2, jsObjectValue); | 704 FXJSE_Value_GetObjectPropByIdx(argTwo, 2, jsObjectValue); |
| 705 if (FXJSE_Value_IsNull(propertyValue)) { | 705 if (FXJSE_Value_IsNull(propertyValue)) { |
| 706 dDividor = HValueToDouble(hThis, jsObjectValue); | 706 dDividor = HValueToDouble(hThis, jsObjectValue); |
| 707 } else { | 707 } else { |
| 708 CFX_ByteString propertyStr; | 708 CFX_ByteString propertyStr; |
| 709 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 709 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 710 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); | 710 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); |
| 711 FXJSE_Value_GetObjectProp( | 711 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsStringC(), |
| 712 jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue); | 712 newPropertyValue); |
| 713 dDividor = HValueToDouble(hThis, newPropertyValue); | 713 dDividor = HValueToDouble(hThis, newPropertyValue); |
| 714 FXJSE_Value_Release(newPropertyValue); | 714 FXJSE_Value_Release(newPropertyValue); |
| 715 } | 715 } |
| 716 FXJSE_Value_Release(propertyValue); | 716 FXJSE_Value_Release(propertyValue); |
| 717 FXJSE_Value_Release(jsObjectValue); | 717 FXJSE_Value_Release(jsObjectValue); |
| 718 } else { | 718 } else { |
| 719 pContext->ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); | 719 pContext->ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); |
| 720 } | 720 } |
| 721 } else { | 721 } else { |
| 722 dDividor = HValueToDouble(hThis, argTwo); | 722 dDividor = HValueToDouble(hThis, argTwo); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 754 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 755 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); | 755 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); |
| 756 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); | 756 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); |
| 757 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsObjectValue); | 757 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsObjectValue); |
| 758 if (FXJSE_Value_IsNull(propertyValue)) { | 758 if (FXJSE_Value_IsNull(propertyValue)) { |
| 759 dValue = HValueToDouble(hThis, jsObjectValue); | 759 dValue = HValueToDouble(hThis, jsObjectValue); |
| 760 } else { | 760 } else { |
| 761 CFX_ByteString propertyStr; | 761 CFX_ByteString propertyStr; |
| 762 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 762 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 763 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); | 763 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); |
| 764 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsByteStringC(), | 764 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsStringC(), |
| 765 newPropertyValue); | 765 newPropertyValue); |
| 766 dValue = HValueToDouble(hThis, newPropertyValue); | 766 dValue = HValueToDouble(hThis, newPropertyValue); |
| 767 FXJSE_Value_Release(newPropertyValue); | 767 FXJSE_Value_Release(newPropertyValue); |
| 768 } | 768 } |
| 769 FXJSE_Value_Release(propertyValue); | 769 FXJSE_Value_Release(propertyValue); |
| 770 FXJSE_Value_Release(jsObjectValue); | 770 FXJSE_Value_Release(jsObjectValue); |
| 771 } else { | 771 } else { |
| 772 dValue = HValueToDouble(hThis, argOne); | 772 dValue = HValueToDouble(hThis, argOne); |
| 773 } | 773 } |
| 774 CFX_Decimal decimalValue((FX_FLOAT)dValue, uPrecision); | 774 CFX_Decimal decimalValue((FX_FLOAT)dValue, uPrecision); |
| 775 CFX_WideString wsValue = decimalValue; | 775 CFX_WideString wsValue = decimalValue; |
| 776 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 776 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 777 wsValue.UTF8Encode().AsByteStringC()); | 777 wsValue.UTF8Encode().AsStringC()); |
| 778 } | 778 } |
| 779 FXJSE_Value_Release(argOne); | 779 FXJSE_Value_Release(argOne); |
| 780 } else if (argc == 2) { | 780 } else if (argc == 2) { |
| 781 FXJSE_HVALUE argOne = args.GetValue(0); | 781 FXJSE_HVALUE argOne = args.GetValue(0); |
| 782 FXJSE_HVALUE argTwo = args.GetValue(1); | 782 FXJSE_HVALUE argTwo = args.GetValue(1); |
| 783 if (FXJSE_Value_IsNull(argOne) || FXJSE_Value_IsNull(argTwo)) { | 783 if (FXJSE_Value_IsNull(argOne) || FXJSE_Value_IsNull(argTwo)) { |
| 784 FXJSE_Value_SetNull(args.GetReturnValue()); | 784 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 785 } else { | 785 } else { |
| 786 FX_DOUBLE dValue = 0.0; | 786 FX_DOUBLE dValue = 0.0; |
| 787 if (FXJSE_Value_IsArray(argOne)) { | 787 if (FXJSE_Value_IsArray(argOne)) { |
| 788 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 788 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 789 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); | 789 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); |
| 790 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); | 790 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); |
| 791 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsObjectValue); | 791 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsObjectValue); |
| 792 if (FXJSE_Value_IsNull(propertyValue)) { | 792 if (FXJSE_Value_IsNull(propertyValue)) { |
| 793 dValue = HValueToDouble(hThis, jsObjectValue); | 793 dValue = HValueToDouble(hThis, jsObjectValue); |
| 794 } else { | 794 } else { |
| 795 CFX_ByteString propertyStr; | 795 CFX_ByteString propertyStr; |
| 796 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 796 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 797 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); | 797 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); |
| 798 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsByteStringC(), | 798 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsStringC(), |
| 799 newPropertyValue); | 799 newPropertyValue); |
| 800 dValue = HValueToDouble(hThis, newPropertyValue); | 800 dValue = HValueToDouble(hThis, newPropertyValue); |
| 801 FXJSE_Value_Release(newPropertyValue); | 801 FXJSE_Value_Release(newPropertyValue); |
| 802 } | 802 } |
| 803 FXJSE_Value_Release(propertyValue); | 803 FXJSE_Value_Release(propertyValue); |
| 804 FXJSE_Value_Release(jsObjectValue); | 804 FXJSE_Value_Release(jsObjectValue); |
| 805 } else { | 805 } else { |
| 806 dValue = HValueToDouble(hThis, argOne); | 806 dValue = HValueToDouble(hThis, argOne); |
| 807 } | 807 } |
| 808 FX_DOUBLE dPrecision = 0.0; | 808 FX_DOUBLE dPrecision = 0.0; |
| 809 if (FXJSE_Value_IsArray(argTwo)) { | 809 if (FXJSE_Value_IsArray(argTwo)) { |
| 810 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 810 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 811 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); | 811 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); |
| 812 FXJSE_Value_GetObjectPropByIdx(argTwo, 1, propertyValue); | 812 FXJSE_Value_GetObjectPropByIdx(argTwo, 1, propertyValue); |
| 813 FXJSE_Value_GetObjectPropByIdx(argTwo, 2, jsObjectValue); | 813 FXJSE_Value_GetObjectPropByIdx(argTwo, 2, jsObjectValue); |
| 814 if (FXJSE_Value_IsNull(propertyValue)) { | 814 if (FXJSE_Value_IsNull(propertyValue)) { |
| 815 dPrecision = HValueToDouble(hThis, jsObjectValue); | 815 dPrecision = HValueToDouble(hThis, jsObjectValue); |
| 816 } else { | 816 } else { |
| 817 CFX_ByteString propertyStr; | 817 CFX_ByteString propertyStr; |
| 818 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 818 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 819 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); | 819 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); |
| 820 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsByteStringC(), | 820 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsStringC(), |
| 821 newPropertyValue); | 821 newPropertyValue); |
| 822 dPrecision = HValueToDouble(hThis, newPropertyValue); | 822 dPrecision = HValueToDouble(hThis, newPropertyValue); |
| 823 FXJSE_Value_Release(newPropertyValue); | 823 FXJSE_Value_Release(newPropertyValue); |
| 824 } | 824 } |
| 825 FXJSE_Value_Release(propertyValue); | 825 FXJSE_Value_Release(propertyValue); |
| 826 FXJSE_Value_Release(jsObjectValue); | 826 FXJSE_Value_Release(jsObjectValue); |
| 827 } else { | 827 } else { |
| 828 dPrecision = HValueToDouble(hThis, argTwo); | 828 dPrecision = HValueToDouble(hThis, argTwo); |
| 829 } | 829 } |
| 830 if (dPrecision < 0) { | 830 if (dPrecision < 0) { |
| 831 uPrecision = 0; | 831 uPrecision = 0; |
| 832 } else if (dPrecision > 12.0) { | 832 } else if (dPrecision > 12.0) { |
| 833 uPrecision = 12; | 833 uPrecision = 12; |
| 834 } else { | 834 } else { |
| 835 uPrecision = (uint8_t)dPrecision; | 835 uPrecision = (uint8_t)dPrecision; |
| 836 } | 836 } |
| 837 CFX_Decimal decimalValue((FX_FLOAT)dValue, uPrecision); | 837 CFX_Decimal decimalValue((FX_FLOAT)dValue, uPrecision); |
| 838 CFX_WideString wsValue = decimalValue; | 838 CFX_WideString wsValue = decimalValue; |
| 839 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 839 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 840 wsValue.UTF8Encode().AsByteStringC()); | 840 wsValue.UTF8Encode().AsStringC()); |
| 841 } | 841 } |
| 842 FXJSE_Value_Release(argOne); | 842 FXJSE_Value_Release(argOne); |
| 843 FXJSE_Value_Release(argTwo); | 843 FXJSE_Value_Release(argTwo); |
| 844 } else { | 844 } else { |
| 845 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 845 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 846 L"Round"); | 846 L"Round"); |
| 847 } | 847 } |
| 848 } | 848 } |
| 849 void CXFA_FM2JSContext::Sum(FXJSE_HOBJECT hThis, | 849 void CXFA_FM2JSContext::Sum(FXJSE_HOBJECT hThis, |
| 850 const CFX_ByteStringC& szFuncName, | 850 const CFX_ByteStringC& szFuncName, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 879 if (!FXJSE_Value_IsNull(newPropertyValue)) { | 879 if (!FXJSE_Value_IsNull(newPropertyValue)) { |
| 880 dSum += HValueToDouble(hThis, jsObjectValue); | 880 dSum += HValueToDouble(hThis, jsObjectValue); |
| 881 uCount++; | 881 uCount++; |
| 882 } | 882 } |
| 883 } | 883 } |
| 884 } else { | 884 } else { |
| 885 CFX_ByteString propertyStr; | 885 CFX_ByteString propertyStr; |
| 886 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 886 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 887 for (int32_t j = 2; j < iLength; j++) { | 887 for (int32_t j = 2; j < iLength; j++) { |
| 888 FXJSE_Value_GetObjectPropByIdx(argValue, j, jsObjectValue); | 888 FXJSE_Value_GetObjectPropByIdx(argValue, j, jsObjectValue); |
| 889 FXJSE_Value_GetObjectProp( | 889 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsStringC(), |
| 890 jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue); | 890 newPropertyValue); |
| 891 if (!FXJSE_Value_IsNull(newPropertyValue)) { | 891 if (!FXJSE_Value_IsNull(newPropertyValue)) { |
| 892 dSum += HValueToDouble(hThis, newPropertyValue); | 892 dSum += HValueToDouble(hThis, newPropertyValue); |
| 893 uCount++; | 893 uCount++; |
| 894 } | 894 } |
| 895 } | 895 } |
| 896 } | 896 } |
| 897 FXJSE_Value_Release(newPropertyValue); | 897 FXJSE_Value_Release(newPropertyValue); |
| 898 FXJSE_Value_Release(jsObjectValue); | 898 FXJSE_Value_Release(jsObjectValue); |
| 899 FXJSE_Value_Release(propertyValue); | 899 FXJSE_Value_Release(propertyValue); |
| 900 } else { | 900 } else { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 930 time_t currentTime; | 930 time_t currentTime; |
| 931 time(¤tTime); | 931 time(¤tTime); |
| 932 pTmStruct = gmtime(¤tTime); | 932 pTmStruct = gmtime(¤tTime); |
| 933 CFX_ByteString bufferYear; | 933 CFX_ByteString bufferYear; |
| 934 CFX_ByteString bufferMon; | 934 CFX_ByteString bufferMon; |
| 935 CFX_ByteString bufferDay; | 935 CFX_ByteString bufferDay; |
| 936 bufferYear.Format("%d", pTmStruct->tm_year + 1900); | 936 bufferYear.Format("%d", pTmStruct->tm_year + 1900); |
| 937 bufferMon.Format("%02d", pTmStruct->tm_mon + 1); | 937 bufferMon.Format("%02d", pTmStruct->tm_mon + 1); |
| 938 bufferDay.Format("%02d", pTmStruct->tm_mday); | 938 bufferDay.Format("%02d", pTmStruct->tm_mday); |
| 939 CFX_ByteString bufferCurrent = bufferYear + bufferMon + bufferDay; | 939 CFX_ByteString bufferCurrent = bufferYear + bufferMon + bufferDay; |
| 940 int32_t dDays = DateString2Num(bufferCurrent.AsByteStringC()); | 940 int32_t dDays = DateString2Num(bufferCurrent.AsStringC()); |
| 941 FXJSE_Value_SetInteger(args.GetReturnValue(), dDays); | 941 FXJSE_Value_SetInteger(args.GetReturnValue(), dDays); |
| 942 } else { | 942 } else { |
| 943 CXFA_FM2JSContext* pContext = | 943 CXFA_FM2JSContext* pContext = |
| 944 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 944 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 945 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 945 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 946 L"Date"); | 946 L"Date"); |
| 947 } | 947 } |
| 948 } | 948 } |
| 949 void CXFA_FM2JSContext::Date2Num(FXJSE_HOBJECT hThis, | 949 void CXFA_FM2JSContext::Date2Num(FXJSE_HOBJECT hThis, |
| 950 const CFX_ByteStringC& szFuncName, | 950 const CFX_ByteStringC& szFuncName, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 974 if (argc == 3) { | 974 if (argc == 3) { |
| 975 localValue = GetSimpleHValue(hThis, args, 2); | 975 localValue = GetSimpleHValue(hThis, args, 2); |
| 976 if (HValueIsNull(hThis, localValue)) { | 976 if (HValueIsNull(hThis, localValue)) { |
| 977 bFlags = TRUE; | 977 bFlags = TRUE; |
| 978 } else { | 978 } else { |
| 979 HValueToUTF8String(localValue, localString); | 979 HValueToUTF8String(localValue, localString); |
| 980 } | 980 } |
| 981 } | 981 } |
| 982 if (!bFlags) { | 982 if (!bFlags) { |
| 983 CFX_ByteString szIsoDateString; | 983 CFX_ByteString szIsoDateString; |
| 984 FX_BOOL bRet = Local2IsoDate( | 984 FX_BOOL bRet = |
| 985 hThis, dateString.AsByteStringC(), formatString.AsByteStringC(), | 985 Local2IsoDate(hThis, dateString.AsStringC(), formatString.AsStringC(), |
| 986 localString.AsByteStringC(), szIsoDateString); | 986 localString.AsStringC(), szIsoDateString); |
| 987 if (bRet) { | 987 if (bRet) { |
| 988 FXJSE_Value_SetInteger(args.GetReturnValue(), | 988 FXJSE_Value_SetInteger(args.GetReturnValue(), |
| 989 DateString2Num(szIsoDateString.AsByteStringC())); | 989 DateString2Num(szIsoDateString.AsStringC())); |
| 990 } else { | 990 } else { |
| 991 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 991 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
| 992 } | 992 } |
| 993 } else { | 993 } else { |
| 994 FXJSE_Value_SetNull(args.GetReturnValue()); | 994 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 995 } | 995 } |
| 996 FXJSE_Value_Release(dateValue); | 996 FXJSE_Value_Release(dateValue); |
| 997 if (argc > 1) { | 997 if (argc > 1) { |
| 998 FXJSE_Value_Release(formatValue); | 998 FXJSE_Value_Release(formatValue); |
| 999 if (argc == 3) { | 999 if (argc == 3) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1030 if (argc == 2) { | 1030 if (argc == 2) { |
| 1031 argLocal = GetSimpleHValue(hThis, args, 1); | 1031 argLocal = GetSimpleHValue(hThis, args, 1); |
| 1032 if (FXJSE_Value_IsNull(argLocal)) { | 1032 if (FXJSE_Value_IsNull(argLocal)) { |
| 1033 bFlags = TRUE; | 1033 bFlags = TRUE; |
| 1034 } else { | 1034 } else { |
| 1035 HValueToUTF8String(argLocal, szLocal); | 1035 HValueToUTF8String(argLocal, szLocal); |
| 1036 } | 1036 } |
| 1037 } | 1037 } |
| 1038 if (!bFlags) { | 1038 if (!bFlags) { |
| 1039 CFX_ByteString formatStr; | 1039 CFX_ByteString formatStr; |
| 1040 GetStandardDateFormat(hThis, iStyle, szLocal.AsByteStringC(), formatStr); | 1040 GetStandardDateFormat(hThis, iStyle, szLocal.AsStringC(), formatStr); |
| 1041 if (formatStr.IsEmpty()) { | 1041 if (formatStr.IsEmpty()) { |
| 1042 formatStr = ""; | 1042 formatStr = ""; |
| 1043 } | 1043 } |
| 1044 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 1044 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); |
| 1045 formatStr.AsByteStringC()); | |
| 1046 } else { | 1045 } else { |
| 1047 FXJSE_Value_SetNull(args.GetReturnValue()); | 1046 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1048 } | 1047 } |
| 1049 if (argc > 0) { | 1048 if (argc > 0) { |
| 1050 FXJSE_Value_Release(argStyle); | 1049 FXJSE_Value_Release(argStyle); |
| 1051 if (argc == 2) { | 1050 if (argc == 2) { |
| 1052 FXJSE_Value_Release(argLocal); | 1051 FXJSE_Value_Release(argLocal); |
| 1053 } | 1052 } |
| 1054 } | 1053 } |
| 1055 } else { | 1054 } else { |
| 1056 CXFA_FM2JSContext* pContext = | 1055 CXFA_FM2JSContext* pContext = |
| 1057 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1056 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 1058 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1057 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 1059 L"Date2Num"); | 1058 L"Date2Num"); |
| 1060 } | 1059 } |
| 1061 } | 1060 } |
| 1062 void CXFA_FM2JSContext::IsoDate2Num(FXJSE_HOBJECT hThis, | 1061 void CXFA_FM2JSContext::IsoDate2Num(FXJSE_HOBJECT hThis, |
| 1063 const CFX_ByteStringC& szFuncName, | 1062 const CFX_ByteStringC& szFuncName, |
| 1064 CFXJSE_Arguments& args) { | 1063 CFXJSE_Arguments& args) { |
| 1065 if (args.GetLength() == 1) { | 1064 if (args.GetLength() == 1) { |
| 1066 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 1065 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 1067 if (FXJSE_Value_IsNull(argOne)) { | 1066 if (FXJSE_Value_IsNull(argOne)) { |
| 1068 FXJSE_Value_SetNull(args.GetReturnValue()); | 1067 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1069 } else { | 1068 } else { |
| 1070 CFX_ByteString szArgString; | 1069 CFX_ByteString szArgString; |
| 1071 HValueToUTF8String(argOne, szArgString); | 1070 HValueToUTF8String(argOne, szArgString); |
| 1072 int32_t dDays = DateString2Num(szArgString.AsByteStringC()); | 1071 int32_t dDays = DateString2Num(szArgString.AsStringC()); |
| 1073 FXJSE_Value_SetInteger(args.GetReturnValue(), (int32_t)dDays); | 1072 FXJSE_Value_SetInteger(args.GetReturnValue(), (int32_t)dDays); |
| 1074 } | 1073 } |
| 1075 FXJSE_Value_Release(argOne); | 1074 FXJSE_Value_Release(argOne); |
| 1076 } else { | 1075 } else { |
| 1077 CXFA_FM2JSContext* pContext = | 1076 CXFA_FM2JSContext* pContext = |
| 1078 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1077 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 1079 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1078 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 1080 L"IsoDate2Num"); | 1079 L"IsoDate2Num"); |
| 1081 } | 1080 } |
| 1082 } | 1081 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1095 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 1094 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 1096 CFX_ByteString szArgString; | 1095 CFX_ByteString szArgString; |
| 1097 HValueToUTF8String(argOne, szArgString); | 1096 HValueToUTF8String(argOne, szArgString); |
| 1098 szArgString = szArgString.Mid(szArgString.Find('T', 0) + 1); | 1097 szArgString = szArgString.Mid(szArgString.Find('T', 0) + 1); |
| 1099 if (szArgString.IsEmpty()) { | 1098 if (szArgString.IsEmpty()) { |
| 1100 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 1099 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
| 1101 FXJSE_Value_Release(argOne); | 1100 FXJSE_Value_Release(argOne); |
| 1102 return; | 1101 return; |
| 1103 } | 1102 } |
| 1104 CXFA_LocaleValue timeValue( | 1103 CXFA_LocaleValue timeValue( |
| 1105 XFA_VT_TIME, CFX_WideString::FromUTF8(szArgString.AsByteStringC()), | 1104 XFA_VT_TIME, CFX_WideString::FromUTF8(szArgString.AsStringC()), |
| 1106 (CXFA_LocaleMgr*)pMgr); | 1105 (CXFA_LocaleMgr*)pMgr); |
| 1107 if (timeValue.IsValid()) { | 1106 if (timeValue.IsValid()) { |
| 1108 CFX_Unitime uniTime = timeValue.GetTime(); | 1107 CFX_Unitime uniTime = timeValue.GetTime(); |
| 1109 int32_t hour = uniTime.GetHour(); | 1108 int32_t hour = uniTime.GetHour(); |
| 1110 int32_t min = uniTime.GetMinute(); | 1109 int32_t min = uniTime.GetMinute(); |
| 1111 int32_t second = uniTime.GetSecond(); | 1110 int32_t second = uniTime.GetSecond(); |
| 1112 int32_t milSecond = uniTime.GetMillisecond(); | 1111 int32_t milSecond = uniTime.GetMillisecond(); |
| 1113 IFX_Locale* pDefLocale = pMgr->GetDefLocale(); | 1112 IFX_Locale* pDefLocale = pMgr->GetDefLocale(); |
| 1114 FXSYS_assert(pDefLocale); | 1113 FXSYS_assert(pDefLocale); |
| 1115 FX_TIMEZONE tzLocale; | 1114 FX_TIMEZONE tzLocale; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 if (argc == 2) { | 1159 if (argc == 2) { |
| 1161 argLocal = GetSimpleHValue(hThis, args, 1); | 1160 argLocal = GetSimpleHValue(hThis, args, 1); |
| 1162 if (FXJSE_Value_IsNull(argLocal)) { | 1161 if (FXJSE_Value_IsNull(argLocal)) { |
| 1163 bFlags = TRUE; | 1162 bFlags = TRUE; |
| 1164 } else { | 1163 } else { |
| 1165 HValueToUTF8String(argLocal, szLocal); | 1164 HValueToUTF8String(argLocal, szLocal); |
| 1166 } | 1165 } |
| 1167 } | 1166 } |
| 1168 if (!bFlags) { | 1167 if (!bFlags) { |
| 1169 CFX_ByteString formatStr; | 1168 CFX_ByteString formatStr; |
| 1170 GetLocalDateFormat(hThis, iStyle, szLocal.AsByteStringC(), formatStr, | 1169 GetLocalDateFormat(hThis, iStyle, szLocal.AsStringC(), formatStr, FALSE); |
| 1171 FALSE); | |
| 1172 if (formatStr.IsEmpty()) { | 1170 if (formatStr.IsEmpty()) { |
| 1173 formatStr = ""; | 1171 formatStr = ""; |
| 1174 } | 1172 } |
| 1175 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 1173 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); |
| 1176 formatStr.AsByteStringC()); | |
| 1177 } else { | 1174 } else { |
| 1178 FXJSE_Value_SetNull(args.GetReturnValue()); | 1175 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1179 } | 1176 } |
| 1180 if (argc > 0) { | 1177 if (argc > 0) { |
| 1181 FXJSE_Value_Release(argStyle); | 1178 FXJSE_Value_Release(argStyle); |
| 1182 if (argc == 2) { | 1179 if (argc == 2) { |
| 1183 FXJSE_Value_Release(argLocal); | 1180 FXJSE_Value_Release(argLocal); |
| 1184 } | 1181 } |
| 1185 } | 1182 } |
| 1186 } else { | 1183 } else { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1213 if (argc == 2) { | 1210 if (argc == 2) { |
| 1214 argLocal = GetSimpleHValue(hThis, args, 1); | 1211 argLocal = GetSimpleHValue(hThis, args, 1); |
| 1215 if (FXJSE_Value_IsNull(argLocal)) { | 1212 if (FXJSE_Value_IsNull(argLocal)) { |
| 1216 bFlags = TRUE; | 1213 bFlags = TRUE; |
| 1217 } else { | 1214 } else { |
| 1218 HValueToUTF8String(argLocal, szLocal); | 1215 HValueToUTF8String(argLocal, szLocal); |
| 1219 } | 1216 } |
| 1220 } | 1217 } |
| 1221 if (!bFlags) { | 1218 if (!bFlags) { |
| 1222 CFX_ByteString formatStr; | 1219 CFX_ByteString formatStr; |
| 1223 GetLocalTimeFormat(hThis, iStyle, szLocal.AsByteStringC(), formatStr, | 1220 GetLocalTimeFormat(hThis, iStyle, szLocal.AsStringC(), formatStr, FALSE); |
| 1224 FALSE); | |
| 1225 if (formatStr.IsEmpty()) { | 1221 if (formatStr.IsEmpty()) { |
| 1226 formatStr = ""; | 1222 formatStr = ""; |
| 1227 } | 1223 } |
| 1228 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 1224 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); |
| 1229 formatStr.AsByteStringC()); | |
| 1230 } else { | 1225 } else { |
| 1231 FXJSE_Value_SetNull(args.GetReturnValue()); | 1226 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1232 } | 1227 } |
| 1233 if (argc > 0) { | 1228 if (argc > 0) { |
| 1234 FXJSE_Value_Release(argStyle); | 1229 FXJSE_Value_Release(argStyle); |
| 1235 if (argc == 2) { | 1230 if (argc == 2) { |
| 1236 FXJSE_Value_Release(argLocal); | 1231 FXJSE_Value_Release(argLocal); |
| 1237 } | 1232 } |
| 1238 } | 1233 } |
| 1239 } else { | 1234 } else { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 } else { | 1361 } else { |
| 1367 iDay += static_cast<int32_t>(dDate) - 1; | 1362 iDay += static_cast<int32_t>(dDate) - 1; |
| 1368 dDate = 0; | 1363 dDate = 0; |
| 1369 } | 1364 } |
| 1370 } | 1365 } |
| 1371 } | 1366 } |
| 1372 } | 1367 } |
| 1373 CFX_ByteString szIsoDateString; | 1368 CFX_ByteString szIsoDateString; |
| 1374 szIsoDateString.Format("%d%02d%02d", iYear + i, iMonth, iDay); | 1369 szIsoDateString.Format("%d%02d%02d", iYear + i, iMonth, iDay); |
| 1375 CFX_ByteString szLocalDateString; | 1370 CFX_ByteString szLocalDateString; |
| 1376 IsoDate2Local(hThis, szIsoDateString.AsByteStringC(), | 1371 IsoDate2Local(hThis, szIsoDateString.AsStringC(), |
| 1377 formatString.AsByteStringC(), localString.AsByteStringC(), | 1372 formatString.AsStringC(), localString.AsStringC(), |
| 1378 szLocalDateString); | 1373 szLocalDateString); |
| 1379 if (szLocalDateString.IsEmpty()) { | 1374 if (szLocalDateString.IsEmpty()) { |
| 1380 szLocalDateString = ""; | 1375 szLocalDateString = ""; |
| 1381 } | 1376 } |
| 1382 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 1377 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 1383 szLocalDateString.AsByteStringC()); | 1378 szLocalDateString.AsStringC()); |
| 1384 } else { | 1379 } else { |
| 1385 FXJSE_Value_SetNull(args.GetReturnValue()); | 1380 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1386 } | 1381 } |
| 1387 FXJSE_Value_Release(dateValue); | 1382 FXJSE_Value_Release(dateValue); |
| 1388 if (argc > 1) { | 1383 if (argc > 1) { |
| 1389 FXJSE_Value_Release(formatValue); | 1384 FXJSE_Value_Release(formatValue); |
| 1390 if (argc == 3) { | 1385 if (argc == 3) { |
| 1391 FXJSE_Value_Release(localValue); | 1386 FXJSE_Value_Release(localValue); |
| 1392 } | 1387 } |
| 1393 } | 1388 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 if (argc == 3) { | 1424 if (argc == 3) { |
| 1430 localValue = GetSimpleHValue(hThis, args, 2); | 1425 localValue = GetSimpleHValue(hThis, args, 2); |
| 1431 if (FXJSE_Value_IsNull(localValue)) { | 1426 if (FXJSE_Value_IsNull(localValue)) { |
| 1432 bFlags = TRUE; | 1427 bFlags = TRUE; |
| 1433 } else { | 1428 } else { |
| 1434 HValueToUTF8String(localValue, localString); | 1429 HValueToUTF8String(localValue, localString); |
| 1435 } | 1430 } |
| 1436 } | 1431 } |
| 1437 if (!bFlags) { | 1432 if (!bFlags) { |
| 1438 CFX_ByteString szGMTTimeString; | 1433 CFX_ByteString szGMTTimeString; |
| 1439 Num2AllTime(hThis, iTime, formatString.AsByteStringC(), | 1434 Num2AllTime(hThis, iTime, formatString.AsStringC(), |
| 1440 localString.AsByteStringC(), TRUE, szGMTTimeString); | 1435 localString.AsStringC(), TRUE, szGMTTimeString); |
| 1441 if (szGMTTimeString.IsEmpty()) { | 1436 if (szGMTTimeString.IsEmpty()) { |
| 1442 szGMTTimeString = ""; | 1437 szGMTTimeString = ""; |
| 1443 } | 1438 } |
| 1444 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 1439 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 1445 szGMTTimeString.AsByteStringC()); | 1440 szGMTTimeString.AsStringC()); |
| 1446 } else { | 1441 } else { |
| 1447 FXJSE_Value_SetNull(args.GetReturnValue()); | 1442 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1448 } | 1443 } |
| 1449 FXJSE_Value_Release(timeValue); | 1444 FXJSE_Value_Release(timeValue); |
| 1450 if (argc > 1) { | 1445 if (argc > 1) { |
| 1451 FXJSE_Value_Release(formatValue); | 1446 FXJSE_Value_Release(formatValue); |
| 1452 if (argc == 3) { | 1447 if (argc == 3) { |
| 1453 FXJSE_Value_Release(localValue); | 1448 FXJSE_Value_Release(localValue); |
| 1454 } | 1449 } |
| 1455 } | 1450 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 if (argc == 3) { | 1486 if (argc == 3) { |
| 1492 localValue = GetSimpleHValue(hThis, args, 2); | 1487 localValue = GetSimpleHValue(hThis, args, 2); |
| 1493 if (FXJSE_Value_IsNull(localValue)) { | 1488 if (FXJSE_Value_IsNull(localValue)) { |
| 1494 bFlags = TRUE; | 1489 bFlags = TRUE; |
| 1495 } else { | 1490 } else { |
| 1496 HValueToUTF8String(localValue, localString); | 1491 HValueToUTF8String(localValue, localString); |
| 1497 } | 1492 } |
| 1498 } | 1493 } |
| 1499 if (!bFlags) { | 1494 if (!bFlags) { |
| 1500 CFX_ByteString szLocalTimeString; | 1495 CFX_ByteString szLocalTimeString; |
| 1501 Num2AllTime(hThis, (int32_t)fTime, formatString.AsByteStringC(), | 1496 Num2AllTime(hThis, (int32_t)fTime, formatString.AsStringC(), |
| 1502 localString.AsByteStringC(), FALSE, szLocalTimeString); | 1497 localString.AsStringC(), FALSE, szLocalTimeString); |
| 1503 if (szLocalTimeString.IsEmpty()) { | 1498 if (szLocalTimeString.IsEmpty()) { |
| 1504 szLocalTimeString = ""; | 1499 szLocalTimeString = ""; |
| 1505 } | 1500 } |
| 1506 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 1501 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 1507 szLocalTimeString.AsByteStringC()); | 1502 szLocalTimeString.AsStringC()); |
| 1508 } else { | 1503 } else { |
| 1509 FXJSE_Value_SetNull(args.GetReturnValue()); | 1504 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1510 } | 1505 } |
| 1511 FXJSE_Value_Release(timeValue); | 1506 FXJSE_Value_Release(timeValue); |
| 1512 if (argc > 1) { | 1507 if (argc > 1) { |
| 1513 FXJSE_Value_Release(formatValue); | 1508 FXJSE_Value_Release(formatValue); |
| 1514 if (argc == 3) { | 1509 if (argc == 3) { |
| 1515 FXJSE_Value_Release(localValue); | 1510 FXJSE_Value_Release(localValue); |
| 1516 } | 1511 } |
| 1517 } | 1512 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1581 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 1576 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 1582 IFX_Locale* pLocale = NULL; | 1577 IFX_Locale* pLocale = NULL; |
| 1583 if (localString.IsEmpty()) { | 1578 if (localString.IsEmpty()) { |
| 1584 CXFA_Node* pThisNode = | 1579 CXFA_Node* pThisNode = |
| 1585 ToNode(pDoc->GetScriptContext()->GetThisObject()); | 1580 ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 1586 FXSYS_assert(pThisNode); | 1581 FXSYS_assert(pThisNode); |
| 1587 CXFA_WidgetData widgetData(pThisNode); | 1582 CXFA_WidgetData widgetData(pThisNode); |
| 1588 pLocale = widgetData.GetLocal(); | 1583 pLocale = widgetData.GetLocal(); |
| 1589 } else { | 1584 } else { |
| 1590 pLocale = pMgr->GetLocaleByName( | 1585 pLocale = pMgr->GetLocaleByName( |
| 1591 CFX_WideString::FromUTF8(localString.AsByteStringC()) | 1586 CFX_WideString::FromUTF8(localString.AsStringC()).AsStringC()); |
| 1592 .AsWideStringC()); | |
| 1593 } | 1587 } |
| 1594 CFX_WideString wsFormat; | 1588 CFX_WideString wsFormat; |
| 1595 if (formatString.IsEmpty()) { | 1589 if (formatString.IsEmpty()) { |
| 1596 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 1590 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
| 1597 } else { | 1591 } else { |
| 1598 wsFormat = CFX_WideString::FromUTF8(formatString.AsByteStringC()); | 1592 wsFormat = CFX_WideString::FromUTF8(formatString.AsStringC()); |
| 1599 } | 1593 } |
| 1600 wsFormat = FX_WSTRC(L"time{") + wsFormat; | 1594 wsFormat = FX_WSTRC(L"time{") + wsFormat; |
| 1601 wsFormat += FX_WSTRC(L"}"); | 1595 wsFormat += FX_WSTRC(L"}"); |
| 1602 CXFA_LocaleValue timeValue( | 1596 CXFA_LocaleValue timeValue( |
| 1603 XFA_VT_TIME, CFX_WideString::FromUTF8(timeString.AsByteStringC()), | 1597 XFA_VT_TIME, CFX_WideString::FromUTF8(timeString.AsStringC()), |
| 1604 wsFormat, pLocale, (CXFA_LocaleMgr*)pMgr); | 1598 wsFormat, pLocale, (CXFA_LocaleMgr*)pMgr); |
| 1605 if (timeValue.IsValid()) { | 1599 if (timeValue.IsValid()) { |
| 1606 CFX_Unitime uniTime = timeValue.GetTime(); | 1600 CFX_Unitime uniTime = timeValue.GetTime(); |
| 1607 int32_t hour = uniTime.GetHour(); | 1601 int32_t hour = uniTime.GetHour(); |
| 1608 int32_t min = uniTime.GetMinute(); | 1602 int32_t min = uniTime.GetMinute(); |
| 1609 int32_t second = uniTime.GetSecond(); | 1603 int32_t second = uniTime.GetSecond(); |
| 1610 int32_t milSecond = uniTime.GetMillisecond(); | 1604 int32_t milSecond = uniTime.GetMillisecond(); |
| 1611 int32_t mins = hour * 60 + min; | 1605 int32_t mins = hour * 60 + min; |
| 1612 CXFA_TimeZoneProvider* pProvider = CXFA_TimeZoneProvider::Get(); | 1606 CXFA_TimeZoneProvider* pProvider = CXFA_TimeZoneProvider::Get(); |
| 1613 if (pProvider) { | 1607 if (pProvider) { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1669 if (argc == 2) { | 1663 if (argc == 2) { |
| 1670 argLocal = GetSimpleHValue(hThis, args, 1); | 1664 argLocal = GetSimpleHValue(hThis, args, 1); |
| 1671 if (FXJSE_Value_IsNull(argLocal)) { | 1665 if (FXJSE_Value_IsNull(argLocal)) { |
| 1672 bFlags = TRUE; | 1666 bFlags = TRUE; |
| 1673 } else { | 1667 } else { |
| 1674 HValueToUTF8String(argLocal, szLocal); | 1668 HValueToUTF8String(argLocal, szLocal); |
| 1675 } | 1669 } |
| 1676 } | 1670 } |
| 1677 if (!bFlags) { | 1671 if (!bFlags) { |
| 1678 CFX_ByteString formatStr; | 1672 CFX_ByteString formatStr; |
| 1679 GetStandardTimeFormat(hThis, iStyle, szLocal.AsByteStringC(), formatStr); | 1673 GetStandardTimeFormat(hThis, iStyle, szLocal.AsStringC(), formatStr); |
| 1680 if (formatStr.IsEmpty()) { | 1674 if (formatStr.IsEmpty()) { |
| 1681 formatStr = ""; | 1675 formatStr = ""; |
| 1682 } | 1676 } |
| 1683 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 1677 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr.AsStringC()); |
| 1684 formatStr.AsByteStringC()); | |
| 1685 } else { | 1678 } else { |
| 1686 FXJSE_Value_SetNull(args.GetReturnValue()); | 1679 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1687 } | 1680 } |
| 1688 if (argc > 0) { | 1681 if (argc > 0) { |
| 1689 FXJSE_Value_Release(argStyle); | 1682 FXJSE_Value_Release(argStyle); |
| 1690 if (argc == 2) { | 1683 if (argc == 2) { |
| 1691 FXJSE_Value_Release(argLocal); | 1684 FXJSE_Value_Release(argLocal); |
| 1692 } | 1685 } |
| 1693 } | 1686 } |
| 1694 } else { | 1687 } else { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 return FALSE; | 2022 return FALSE; |
| 2030 } | 2023 } |
| 2031 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2024 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2032 IFX_Locale* pLocale = NULL; | 2025 IFX_Locale* pLocale = NULL; |
| 2033 if (szLocale.IsEmpty()) { | 2026 if (szLocale.IsEmpty()) { |
| 2034 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2027 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2035 FXSYS_assert(pThisNode); | 2028 FXSYS_assert(pThisNode); |
| 2036 CXFA_WidgetData widgetData(pThisNode); | 2029 CXFA_WidgetData widgetData(pThisNode); |
| 2037 pLocale = widgetData.GetLocal(); | 2030 pLocale = widgetData.GetLocal(); |
| 2038 } else { | 2031 } else { |
| 2039 pLocale = pMgr->GetLocaleByName( | 2032 pLocale = |
| 2040 CFX_WideString::FromUTF8(szLocale).AsWideStringC()); | 2033 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC()); |
| 2041 } | 2034 } |
| 2042 if (!pLocale) { | 2035 if (!pLocale) { |
| 2043 return FALSE; | 2036 return FALSE; |
| 2044 } | 2037 } |
| 2045 CFX_WideString wsFormat; | 2038 CFX_WideString wsFormat; |
| 2046 if (szFormat.IsEmpty()) { | 2039 if (szFormat.IsEmpty()) { |
| 2047 pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 2040 pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
| 2048 } else { | 2041 } else { |
| 2049 wsFormat = CFX_WideString::FromUTF8(szFormat); | 2042 wsFormat = CFX_WideString::FromUTF8(szFormat); |
| 2050 } | 2043 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2066 return FALSE; | 2059 return FALSE; |
| 2067 } | 2060 } |
| 2068 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2061 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2069 IFX_Locale* pLocale = NULL; | 2062 IFX_Locale* pLocale = NULL; |
| 2070 if (szLocale.IsEmpty()) { | 2063 if (szLocale.IsEmpty()) { |
| 2071 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2064 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2072 FXSYS_assert(pThisNode); | 2065 FXSYS_assert(pThisNode); |
| 2073 CXFA_WidgetData widgetData(pThisNode); | 2066 CXFA_WidgetData widgetData(pThisNode); |
| 2074 pLocale = widgetData.GetLocal(); | 2067 pLocale = widgetData.GetLocal(); |
| 2075 } else { | 2068 } else { |
| 2076 pLocale = pMgr->GetLocaleByName( | 2069 pLocale = |
| 2077 CFX_WideString::FromUTF8(szLocale).AsWideStringC()); | 2070 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC()); |
| 2078 } | 2071 } |
| 2079 if (!pLocale) { | 2072 if (!pLocale) { |
| 2080 return FALSE; | 2073 return FALSE; |
| 2081 } | 2074 } |
| 2082 CFX_WideString wsFormat; | 2075 CFX_WideString wsFormat; |
| 2083 if (szFormat.IsEmpty()) { | 2076 if (szFormat.IsEmpty()) { |
| 2084 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 2077 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
| 2085 } else { | 2078 } else { |
| 2086 wsFormat = CFX_WideString::FromUTF8(szFormat); | 2079 wsFormat = CFX_WideString::FromUTF8(szFormat); |
| 2087 } | 2080 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2106 return FALSE; | 2099 return FALSE; |
| 2107 } | 2100 } |
| 2108 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2101 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2109 IFX_Locale* pLocale = NULL; | 2102 IFX_Locale* pLocale = NULL; |
| 2110 if (szLocale.IsEmpty()) { | 2103 if (szLocale.IsEmpty()) { |
| 2111 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2104 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2112 FXSYS_assert(pThisNode); | 2105 FXSYS_assert(pThisNode); |
| 2113 CXFA_WidgetData widgetData(pThisNode); | 2106 CXFA_WidgetData widgetData(pThisNode); |
| 2114 pLocale = widgetData.GetLocal(); | 2107 pLocale = widgetData.GetLocal(); |
| 2115 } else { | 2108 } else { |
| 2116 pLocale = pMgr->GetLocaleByName( | 2109 pLocale = |
| 2117 CFX_WideString::FromUTF8(szLocale).AsWideStringC()); | 2110 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC()); |
| 2118 } | 2111 } |
| 2119 if (!pLocale) { | 2112 if (!pLocale) { |
| 2120 return FALSE; | 2113 return FALSE; |
| 2121 } | 2114 } |
| 2122 CFX_WideString wsFormat; | 2115 CFX_WideString wsFormat; |
| 2123 if (szFormat.IsEmpty()) { | 2116 if (szFormat.IsEmpty()) { |
| 2124 pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 2117 pLocale->GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
| 2125 } else { | 2118 } else { |
| 2126 wsFormat = CFX_WideString::FromUTF8(szFormat); | 2119 wsFormat = CFX_WideString::FromUTF8(szFormat); |
| 2127 } | 2120 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2145 return FALSE; | 2138 return FALSE; |
| 2146 } | 2139 } |
| 2147 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2140 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2148 IFX_Locale* pLocale = NULL; | 2141 IFX_Locale* pLocale = NULL; |
| 2149 if (szLocale.IsEmpty()) { | 2142 if (szLocale.IsEmpty()) { |
| 2150 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2143 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2151 FXSYS_assert(pThisNode); | 2144 FXSYS_assert(pThisNode); |
| 2152 CXFA_WidgetData widgetData(pThisNode); | 2145 CXFA_WidgetData widgetData(pThisNode); |
| 2153 pLocale = widgetData.GetLocal(); | 2146 pLocale = widgetData.GetLocal(); |
| 2154 } else { | 2147 } else { |
| 2155 pLocale = pMgr->GetLocaleByName( | 2148 pLocale = |
| 2156 CFX_WideString::FromUTF8(szLocale).AsWideStringC()); | 2149 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC()); |
| 2157 } | 2150 } |
| 2158 if (!pLocale) { | 2151 if (!pLocale) { |
| 2159 return FALSE; | 2152 return FALSE; |
| 2160 } | 2153 } |
| 2161 CFX_WideString wsFormat; | 2154 CFX_WideString wsFormat; |
| 2162 if (szFormat.IsEmpty()) { | 2155 if (szFormat.IsEmpty()) { |
| 2163 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 2156 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
| 2164 } else { | 2157 } else { |
| 2165 wsFormat = CFX_WideString::FromUTF8(szFormat); | 2158 wsFormat = CFX_WideString::FromUTF8(szFormat); |
| 2166 } | 2159 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2186 return FALSE; | 2179 return FALSE; |
| 2187 } | 2180 } |
| 2188 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2181 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2189 IFX_Locale* pLocale = NULL; | 2182 IFX_Locale* pLocale = NULL; |
| 2190 if (szLocale.IsEmpty()) { | 2183 if (szLocale.IsEmpty()) { |
| 2191 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2184 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2192 FXSYS_assert(pThisNode); | 2185 FXSYS_assert(pThisNode); |
| 2193 CXFA_WidgetData widgetData(pThisNode); | 2186 CXFA_WidgetData widgetData(pThisNode); |
| 2194 pLocale = widgetData.GetLocal(); | 2187 pLocale = widgetData.GetLocal(); |
| 2195 } else { | 2188 } else { |
| 2196 pLocale = pMgr->GetLocaleByName( | 2189 pLocale = |
| 2197 CFX_WideString::FromUTF8(szLocale).AsWideStringC()); | 2190 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocale).AsStringC()); |
| 2198 } | 2191 } |
| 2199 if (!pLocale) { | 2192 if (!pLocale) { |
| 2200 return FALSE; | 2193 return FALSE; |
| 2201 } | 2194 } |
| 2202 CFX_WideString wsFormat; | 2195 CFX_WideString wsFormat; |
| 2203 if (szFormat.IsEmpty()) { | 2196 if (szFormat.IsEmpty()) { |
| 2204 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); | 2197 pLocale->GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY_Default, wsFormat); |
| 2205 } else { | 2198 } else { |
| 2206 wsFormat = CFX_WideString::FromUTF8(szFormat); | 2199 wsFormat = CFX_WideString::FromUTF8(szFormat); |
| 2207 } | 2200 } |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 return; | 2361 return; |
| 2369 } | 2362 } |
| 2370 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2363 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2371 IFX_Locale* pLocale = NULL; | 2364 IFX_Locale* pLocale = NULL; |
| 2372 if (szLocalStr.IsEmpty()) { | 2365 if (szLocalStr.IsEmpty()) { |
| 2373 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2366 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2374 FXSYS_assert(pThisNode); | 2367 FXSYS_assert(pThisNode); |
| 2375 CXFA_WidgetData widgetData(pThisNode); | 2368 CXFA_WidgetData widgetData(pThisNode); |
| 2376 pLocale = widgetData.GetLocal(); | 2369 pLocale = widgetData.GetLocal(); |
| 2377 } else { | 2370 } else { |
| 2378 pLocale = pMgr->GetLocaleByName( | 2371 pLocale = |
| 2379 CFX_WideString::FromUTF8(szLocalStr).AsWideStringC()); | 2372 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocalStr).AsStringC()); |
| 2380 } | 2373 } |
| 2381 if (!pLocale) { | 2374 if (!pLocale) { |
| 2382 return; | 2375 return; |
| 2383 } | 2376 } |
| 2384 CFX_WideString strRet; | 2377 CFX_WideString strRet; |
| 2385 pLocale->GetDatePattern(strStyle, strRet); | 2378 pLocale->GetDatePattern(strStyle, strRet); |
| 2386 if (!bStandard) { | 2379 if (!bStandard) { |
| 2387 CFX_WideString wsSymbols; | 2380 CFX_WideString wsSymbols; |
| 2388 pLocale->GetDateTimeSymbols(wsSymbols); | 2381 pLocale->GetDateTimeSymbols(wsSymbols); |
| 2389 XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Date); | 2382 XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Date); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2423 return; | 2416 return; |
| 2424 } | 2417 } |
| 2425 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 2418 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 2426 IFX_Locale* pLocale = NULL; | 2419 IFX_Locale* pLocale = NULL; |
| 2427 if (szLocalStr.IsEmpty()) { | 2420 if (szLocalStr.IsEmpty()) { |
| 2428 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 2421 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 2429 FXSYS_assert(pThisNode); | 2422 FXSYS_assert(pThisNode); |
| 2430 CXFA_WidgetData widgetData(pThisNode); | 2423 CXFA_WidgetData widgetData(pThisNode); |
| 2431 pLocale = widgetData.GetLocal(); | 2424 pLocale = widgetData.GetLocal(); |
| 2432 } else { | 2425 } else { |
| 2433 pLocale = pMgr->GetLocaleByName( | 2426 pLocale = |
| 2434 CFX_WideString::FromUTF8(szLocalStr).AsWideStringC()); | 2427 pMgr->GetLocaleByName(CFX_WideString::FromUTF8(szLocalStr).AsStringC()); |
| 2435 } | 2428 } |
| 2436 if (!pLocale) { | 2429 if (!pLocale) { |
| 2437 return; | 2430 return; |
| 2438 } | 2431 } |
| 2439 CFX_WideString strRet; | 2432 CFX_WideString strRet; |
| 2440 pLocale->GetTimePattern(strStyle, strRet); | 2433 pLocale->GetTimePattern(strStyle, strRet); |
| 2441 if (!bStandard) { | 2434 if (!bStandard) { |
| 2442 CFX_WideString wsSymbols; | 2435 CFX_WideString wsSymbols; |
| 2443 pLocale->GetDateTimeSymbols(wsSymbols); | 2436 pLocale->GetDateTimeSymbols(wsSymbols); |
| 2444 XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Time); | 2437 XFA_FM_AlternateDateTimeSymbols(strRet, wsSymbols, g_sAltTable_Time); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2475 if (!bGM) { | 2468 if (!bGM) { |
| 2476 GetLocalTimeZone(iZoneHour, iZoneMin, iZoneSec); | 2469 GetLocalTimeZone(iZoneHour, iZoneMin, iZoneSec); |
| 2477 iHour += iZoneHour; | 2470 iHour += iZoneHour; |
| 2478 iMin += iZoneMin; | 2471 iMin += iZoneMin; |
| 2479 iSec += iZoneSec; | 2472 iSec += iZoneSec; |
| 2480 } | 2473 } |
| 2481 int32_t iRet = 0; | 2474 int32_t iRet = 0; |
| 2482 CFX_ByteString strIsoTime; | 2475 CFX_ByteString strIsoTime; |
| 2483 strIsoTime.Format("%02d:%02d:%02d", iHour, iMin, iSec); | 2476 strIsoTime.Format("%02d:%02d:%02d", iHour, iMin, iSec); |
| 2484 if (bGM) { | 2477 if (bGM) { |
| 2485 iRet = GetGMTTime(hThis, strIsoTime.AsByteStringC(), szFormat, szLocale, | 2478 iRet = |
| 2486 strTime); | 2479 GetGMTTime(hThis, strIsoTime.AsStringC(), szFormat, szLocale, strTime); |
| 2487 } else { | 2480 } else { |
| 2488 iRet = IsoTime2Local(hThis, strIsoTime.AsByteStringC(), szFormat, szLocale, | 2481 iRet = IsoTime2Local(hThis, strIsoTime.AsStringC(), szFormat, szLocale, |
| 2489 strTime); | 2482 strTime); |
| 2490 } | 2483 } |
| 2491 if (!iRet) { | 2484 if (!iRet) { |
| 2492 strTime = ""; | 2485 strTime = ""; |
| 2493 } | 2486 } |
| 2494 } | 2487 } |
| 2495 | 2488 |
| 2496 void CXFA_FM2JSContext::GetLocalTimeZone(int32_t& iHour, | 2489 void CXFA_FM2JSContext::GetLocalTimeZone(int32_t& iHour, |
| 2497 int32_t& iMin, | 2490 int32_t& iMin, |
| 2498 int32_t& iSec) { | 2491 int32_t& iSec) { |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3063 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 3056 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 3064 FXJSE_Value_GetObjectPropByIdx(argIndexValue, 1, propertyValue); | 3057 FXJSE_Value_GetObjectPropByIdx(argIndexValue, 1, propertyValue); |
| 3065 FXJSE_Value_GetObjectPropByIdx( | 3058 FXJSE_Value_GetObjectPropByIdx( |
| 3066 argIndexValue, ((iLength - 1) - (iValueIndex - iIndex)), | 3059 argIndexValue, ((iLength - 1) - (iValueIndex - iIndex)), |
| 3067 jsobjectValue); | 3060 jsobjectValue); |
| 3068 if (FXJSE_Value_IsNull(propertyValue)) { | 3061 if (FXJSE_Value_IsNull(propertyValue)) { |
| 3069 GetObjectDefaultValue(jsobjectValue, newProperty); | 3062 GetObjectDefaultValue(jsobjectValue, newProperty); |
| 3070 } else { | 3063 } else { |
| 3071 CFX_ByteString propStr; | 3064 CFX_ByteString propStr; |
| 3072 FXJSE_Value_ToUTF8String(propertyValue, propStr); | 3065 FXJSE_Value_ToUTF8String(propertyValue, propStr); |
| 3073 FXJSE_Value_GetObjectProp(jsobjectValue, propStr.AsByteStringC(), | 3066 FXJSE_Value_GetObjectProp(jsobjectValue, propStr.AsStringC(), |
| 3074 newProperty); | 3067 newProperty); |
| 3075 } | 3068 } |
| 3076 CFX_ByteString bsChoosed; | 3069 CFX_ByteString bsChoosed; |
| 3077 HValueToUTF8String(newProperty, bsChoosed); | 3070 HValueToUTF8String(newProperty, bsChoosed); |
| 3078 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 3071 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3079 bsChoosed.AsByteStringC()); | 3072 bsChoosed.AsStringC()); |
| 3080 FXJSE_Value_Release(newProperty); | 3073 FXJSE_Value_Release(newProperty); |
| 3081 FXJSE_Value_Release(jsobjectValue); | 3074 FXJSE_Value_Release(jsobjectValue); |
| 3082 FXJSE_Value_Release(propertyValue); | 3075 FXJSE_Value_Release(propertyValue); |
| 3083 bFound = TRUE; | 3076 bFound = TRUE; |
| 3084 } | 3077 } |
| 3085 } else { | 3078 } else { |
| 3086 iValueIndex++; | 3079 iValueIndex++; |
| 3087 if (iValueIndex == iIndex) { | 3080 if (iValueIndex == iIndex) { |
| 3088 CFX_ByteString bsChoosed; | 3081 CFX_ByteString bsChoosed; |
| 3089 HValueToUTF8String(argIndexValue, bsChoosed); | 3082 HValueToUTF8String(argIndexValue, bsChoosed); |
| 3090 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 3083 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3091 bsChoosed.AsByteStringC()); | 3084 bsChoosed.AsStringC()); |
| 3092 bFound = TRUE; | 3085 bFound = TRUE; |
| 3093 } | 3086 } |
| 3094 } | 3087 } |
| 3095 FXJSE_Value_Release(argIndexValue); | 3088 FXJSE_Value_Release(argIndexValue); |
| 3096 iArgIndex++; | 3089 iArgIndex++; |
| 3097 } | 3090 } |
| 3098 if (!bFound) { | 3091 if (!bFound) { |
| 3099 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 3092 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 3100 } | 3093 } |
| 3101 } | 3094 } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3193 ((oneNumber >= lowNumber) && (oneNumber <= heightNumber))); | 3186 ((oneNumber >= lowNumber) && (oneNumber <= heightNumber))); |
| 3194 } else { | 3187 } else { |
| 3195 CFX_ByteString oneString; | 3188 CFX_ByteString oneString; |
| 3196 CFX_ByteString lowString; | 3189 CFX_ByteString lowString; |
| 3197 CFX_ByteString heightString; | 3190 CFX_ByteString heightString; |
| 3198 HValueToUTF8String(argOne, oneString); | 3191 HValueToUTF8String(argOne, oneString); |
| 3199 HValueToUTF8String(argLow, lowString); | 3192 HValueToUTF8String(argLow, lowString); |
| 3200 HValueToUTF8String(argHeight, heightString); | 3193 HValueToUTF8String(argHeight, heightString); |
| 3201 FXJSE_Value_SetInteger( | 3194 FXJSE_Value_SetInteger( |
| 3202 args.GetReturnValue(), | 3195 args.GetReturnValue(), |
| 3203 ((oneString.Compare(lowString.AsByteStringC()) >= 0) && | 3196 ((oneString.Compare(lowString.AsStringC()) >= 0) && |
| 3204 (oneString.Compare(heightString.AsByteStringC()) <= 0))); | 3197 (oneString.Compare(heightString.AsStringC()) <= 0))); |
| 3205 } | 3198 } |
| 3206 FXJSE_Value_Release(argLow); | 3199 FXJSE_Value_Release(argLow); |
| 3207 FXJSE_Value_Release(argHeight); | 3200 FXJSE_Value_Release(argHeight); |
| 3208 } | 3201 } |
| 3209 FXJSE_Value_Release(argOne); | 3202 FXJSE_Value_Release(argOne); |
| 3210 } else { | 3203 } else { |
| 3211 CXFA_FM2JSContext* pContext = | 3204 CXFA_FM2JSContext* pContext = |
| 3212 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3205 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 3213 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3206 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 3214 L"Within"); | 3207 L"Within"); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 3244 FXJSE_HVALUE scriptValue = GetSimpleHValue(hThis, args, 0); | 3237 FXJSE_HVALUE scriptValue = GetSimpleHValue(hThis, args, 0); |
| 3245 CFX_ByteString utf8ScriptString; | 3238 CFX_ByteString utf8ScriptString; |
| 3246 HValueToUTF8String(scriptValue, utf8ScriptString); | 3239 HValueToUTF8String(scriptValue, utf8ScriptString); |
| 3247 if (utf8ScriptString.IsEmpty()) { | 3240 if (utf8ScriptString.IsEmpty()) { |
| 3248 FXJSE_Value_SetNull(args.GetReturnValue()); | 3241 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3249 } else { | 3242 } else { |
| 3250 CFX_WideTextBuf wsJavaScriptBuf; | 3243 CFX_WideTextBuf wsJavaScriptBuf; |
| 3251 CFX_WideString javaScript; | 3244 CFX_WideString javaScript; |
| 3252 CFX_WideString wsError; | 3245 CFX_WideString wsError; |
| 3253 XFA_FM2JS_Translate( | 3246 XFA_FM2JS_Translate( |
| 3254 CFX_WideString::FromUTF8(utf8ScriptString.AsByteStringC()) | 3247 CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(), |
| 3255 .AsWideStringC(), | |
| 3256 wsJavaScriptBuf, wsError); | 3248 wsJavaScriptBuf, wsError); |
| 3257 FXJSE_HCONTEXT hContext = FXJSE_Context_Create(hruntime); | 3249 FXJSE_HCONTEXT hContext = FXJSE_Context_Create(hruntime); |
| 3258 FXJSE_HVALUE returnValue = FXJSE_Value_Create(hruntime); | 3250 FXJSE_HVALUE returnValue = FXJSE_Value_Create(hruntime); |
| 3259 javaScript = wsJavaScriptBuf.GetWideString(); | 3251 javaScript = wsJavaScriptBuf.GetWideString(); |
| 3260 FXJSE_ExecuteScript(hContext, | 3252 FXJSE_ExecuteScript(hContext, |
| 3261 FX_UTF8Encode(javaScript, javaScript.GetLength()), | 3253 FX_UTF8Encode(javaScript, javaScript.GetLength()), |
| 3262 returnValue); | 3254 returnValue); |
| 3263 FXJSE_Value_Set(args.GetReturnValue(), returnValue); | 3255 FXJSE_Value_Set(args.GetReturnValue(), returnValue); |
| 3264 FXJSE_Value_Release(returnValue); | 3256 FXJSE_Value_Release(returnValue); |
| 3265 FXJSE_Context_Release(hContext); | 3257 FXJSE_Context_Release(hContext); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3367 VALUETYPE_HAVEDIGIT, | 3359 VALUETYPE_HAVEDIGIT, |
| 3368 VALUETYPE_HAVEDIGITWHITE, | 3360 VALUETYPE_HAVEDIGITWHITE, |
| 3369 VALUETYPE_ISCM, | 3361 VALUETYPE_ISCM, |
| 3370 VALUETYPE_ISMM, | 3362 VALUETYPE_ISMM, |
| 3371 VALUETYPE_ISPT, | 3363 VALUETYPE_ISPT, |
| 3372 VALUETYPE_ISMP, | 3364 VALUETYPE_ISMP, |
| 3373 VALUETYPE_ISIN, | 3365 VALUETYPE_ISIN, |
| 3374 }; | 3366 }; |
| 3375 unitspanString.MakeLower(); | 3367 unitspanString.MakeLower(); |
| 3376 CFX_WideString wsTypeString = | 3368 CFX_WideString wsTypeString = |
| 3377 CFX_WideString::FromUTF8(unitspanString.AsByteStringC()); | 3369 CFX_WideString::FromUTF8(unitspanString.AsStringC()); |
| 3378 const FX_WCHAR* pData = wsTypeString; | 3370 const FX_WCHAR* pData = wsTypeString; |
| 3379 int32_t u = 0; | 3371 int32_t u = 0; |
| 3380 int32_t uLen = wsTypeString.GetLength(); | 3372 int32_t uLen = wsTypeString.GetLength(); |
| 3381 while (*(pData + u) == 0x20 || *(pData + u) == 0x09 || | 3373 while (*(pData + u) == 0x20 || *(pData + u) == 0x09 || |
| 3382 *(pData + u) == 0x0B || *(pData + u) == 0x0C || | 3374 *(pData + u) == 0x0B || *(pData + u) == 0x0C || |
| 3383 *(pData + u) == 0x0A || *(pData + u) == 0x0D) { | 3375 *(pData + u) == 0x0A || *(pData + u) == 0x0D) { |
| 3384 u++; | 3376 u++; |
| 3385 } | 3377 } |
| 3386 XFA_FM2JS_VALUETYPE_ParserStatus eParserStatus = VALUETYPE_START; | 3378 XFA_FM2JS_VALUETYPE_ParserStatus eParserStatus = VALUETYPE_START; |
| 3387 FX_WCHAR typeChar; | 3379 FX_WCHAR typeChar; |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3633 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { | 3625 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { |
| 3634 FXJSE_Value_SetNull(args.GetReturnValue()); | 3626 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3635 } else { | 3627 } else { |
| 3636 CFX_ByteString stringTwo; | 3628 CFX_ByteString stringTwo; |
| 3637 HValueToUTF8String(argTwo, stringTwo); | 3629 HValueToUTF8String(argTwo, stringTwo); |
| 3638 if (stringTwo.IsEmpty()) { | 3630 if (stringTwo.IsEmpty()) { |
| 3639 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); | 3631 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); |
| 3640 } else { | 3632 } else { |
| 3641 CFX_ByteString stringOne; | 3633 CFX_ByteString stringOne; |
| 3642 HValueToUTF8String(argOne, stringOne); | 3634 HValueToUTF8String(argOne, stringOne); |
| 3643 FX_STRSIZE iPosition = stringOne.Find(stringTwo.AsByteStringC()); | 3635 FX_STRSIZE iPosition = stringOne.Find(stringTwo.AsStringC()); |
| 3644 FXJSE_Value_SetInteger(args.GetReturnValue(), iPosition + 1); | 3636 FXJSE_Value_SetInteger(args.GetReturnValue(), iPosition + 1); |
| 3645 } | 3637 } |
| 3646 } | 3638 } |
| 3647 FXJSE_Value_Release(argOne); | 3639 FXJSE_Value_Release(argOne); |
| 3648 FXJSE_Value_Release(argTwo); | 3640 FXJSE_Value_Release(argTwo); |
| 3649 } else { | 3641 } else { |
| 3650 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3642 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 3651 L"At"); | 3643 L"At"); |
| 3652 } | 3644 } |
| 3653 } | 3645 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 3671 } | 3663 } |
| 3672 } | 3664 } |
| 3673 for (int32_t i = 0; i < argc; i++) { | 3665 for (int32_t i = 0; i < argc; i++) { |
| 3674 FXJSE_Value_Release(argValues[i]); | 3666 FXJSE_Value_Release(argValues[i]); |
| 3675 } | 3667 } |
| 3676 FX_Free(argValues); | 3668 FX_Free(argValues); |
| 3677 if (bAllNull) { | 3669 if (bAllNull) { |
| 3678 FXJSE_Value_SetNull(args.GetReturnValue()); | 3670 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3679 } else { | 3671 } else { |
| 3680 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 3672 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3681 resultString.AsByteStringC()); | 3673 resultString.AsStringC()); |
| 3682 } | 3674 } |
| 3683 } else { | 3675 } else { |
| 3684 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3676 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 3685 L"Concat"); | 3677 L"Concat"); |
| 3686 } | 3678 } |
| 3687 } | 3679 } |
| 3688 void CXFA_FM2JSContext::Decode(FXJSE_HOBJECT hThis, | 3680 void CXFA_FM2JSContext::Decode(FXJSE_HOBJECT hThis, |
| 3689 const CFX_ByteStringC& szFuncName, | 3681 const CFX_ByteStringC& szFuncName, |
| 3690 CFXJSE_Arguments& args) { | 3682 CFXJSE_Arguments& args) { |
| 3691 CXFA_FM2JSContext* pContext = | 3683 CXFA_FM2JSContext* pContext = |
| 3692 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3684 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 3693 int32_t argc = args.GetLength(); | 3685 int32_t argc = args.GetLength(); |
| 3694 if (argc == 1) { | 3686 if (argc == 1) { |
| 3695 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 3687 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 3696 if (HValueIsNull(hThis, argOne)) { | 3688 if (HValueIsNull(hThis, argOne)) { |
| 3697 FXJSE_Value_SetNull(args.GetReturnValue()); | 3689 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3698 } else { | 3690 } else { |
| 3699 CFX_ByteString toDecodeString; | 3691 CFX_ByteString toDecodeString; |
| 3700 HValueToUTF8String(argOne, toDecodeString); | 3692 HValueToUTF8String(argOne, toDecodeString); |
| 3701 CFX_ByteTextBuf resultBuf; | 3693 CFX_ByteTextBuf resultBuf; |
| 3702 DecodeURL(toDecodeString.AsByteStringC(), resultBuf); | 3694 DecodeURL(toDecodeString.AsStringC(), resultBuf); |
| 3703 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 3695 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3704 resultBuf.GetByteString()); | 3696 resultBuf.GetByteString()); |
| 3705 } | 3697 } |
| 3706 FXJSE_Value_Release(argOne); | 3698 FXJSE_Value_Release(argOne); |
| 3707 } else if (argc == 2) { | 3699 } else if (argc == 2) { |
| 3708 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 3700 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 3709 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 3701 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
| 3710 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { | 3702 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { |
| 3711 FXJSE_Value_SetNull(args.GetReturnValue()); | 3703 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3712 } else { | 3704 } else { |
| 3713 CFX_ByteString toDecodeString; | 3705 CFX_ByteString toDecodeString; |
| 3714 HValueToUTF8String(argOne, toDecodeString); | 3706 HValueToUTF8String(argOne, toDecodeString); |
| 3715 CFX_ByteString identifyString; | 3707 CFX_ByteString identifyString; |
| 3716 HValueToUTF8String(argTwo, identifyString); | 3708 HValueToUTF8String(argTwo, identifyString); |
| 3717 CFX_ByteTextBuf resultBuf; | 3709 CFX_ByteTextBuf resultBuf; |
| 3718 if (identifyString.EqualNoCase("html")) { | 3710 if (identifyString.EqualNoCase("html")) { |
| 3719 DecodeHTML(toDecodeString.AsByteStringC(), resultBuf); | 3711 DecodeHTML(toDecodeString.AsStringC(), resultBuf); |
| 3720 } else if (identifyString.EqualNoCase("xml")) { | 3712 } else if (identifyString.EqualNoCase("xml")) { |
| 3721 DecodeXML(toDecodeString.AsByteStringC(), resultBuf); | 3713 DecodeXML(toDecodeString.AsStringC(), resultBuf); |
| 3722 } else { | 3714 } else { |
| 3723 DecodeURL(toDecodeString.AsByteStringC(), resultBuf); | 3715 DecodeURL(toDecodeString.AsStringC(), resultBuf); |
| 3724 } | 3716 } |
| 3725 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 3717 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3726 resultBuf.GetByteString()); | 3718 resultBuf.GetByteString()); |
| 3727 } | 3719 } |
| 3728 FXJSE_Value_Release(argOne); | 3720 FXJSE_Value_Release(argOne); |
| 3729 FXJSE_Value_Release(argTwo); | 3721 FXJSE_Value_Release(argTwo); |
| 3730 } else { | 3722 } else { |
| 3731 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3723 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 3732 L"Decode"); | 3724 L"Decode"); |
| 3733 } | 3725 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3778 wsResultBuf.AppendChar(chTemp); | 3770 wsResultBuf.AppendChar(chTemp); |
| 3779 } else { | 3771 } else { |
| 3780 wsResultBuf.AppendChar(ch); | 3772 wsResultBuf.AppendChar(ch); |
| 3781 } | 3773 } |
| 3782 ++i; | 3774 ++i; |
| 3783 } | 3775 } |
| 3784 wsResultBuf.AppendChar(0); | 3776 wsResultBuf.AppendChar(0); |
| 3785 szResultString.Clear(); | 3777 szResultString.Clear(); |
| 3786 szResultString << FX_UTF8Encode(wsResultBuf.GetBuffer(), | 3778 szResultString << FX_UTF8Encode(wsResultBuf.GetBuffer(), |
| 3787 wsResultBuf.GetLength()) | 3779 wsResultBuf.GetLength()) |
| 3788 .AsByteStringC(); | 3780 .AsStringC(); |
| 3789 } | 3781 } |
| 3790 void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, | 3782 void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, |
| 3791 CFX_ByteTextBuf& szResultString) { | 3783 CFX_ByteTextBuf& szResultString) { |
| 3792 CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(szHTMLString); | 3784 CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(szHTMLString); |
| 3793 FX_WCHAR strString[9]; | 3785 FX_WCHAR strString[9]; |
| 3794 int32_t iStrIndex = 0; | 3786 int32_t iStrIndex = 0; |
| 3795 int32_t iLen = wsHTMLString.GetLength(); | 3787 int32_t iLen = wsHTMLString.GetLength(); |
| 3796 int32_t i = 0; | 3788 int32_t i = 0; |
| 3797 int32_t iCode = 0; | 3789 int32_t iCode = 0; |
| 3798 FX_WCHAR ch = 0; | 3790 FX_WCHAR ch = 0; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3852 wsResultBuf.AppendChar(iCode); | 3844 wsResultBuf.AppendChar(iCode); |
| 3853 } | 3845 } |
| 3854 iStrIndex = 0; | 3846 iStrIndex = 0; |
| 3855 strString[iStrIndex] = 0; | 3847 strString[iStrIndex] = 0; |
| 3856 ++i; | 3848 ++i; |
| 3857 } | 3849 } |
| 3858 wsResultBuf.AppendChar(0); | 3850 wsResultBuf.AppendChar(0); |
| 3859 szResultString.Clear(); | 3851 szResultString.Clear(); |
| 3860 szResultString << FX_UTF8Encode(wsResultBuf.GetBuffer(), | 3852 szResultString << FX_UTF8Encode(wsResultBuf.GetBuffer(), |
| 3861 wsResultBuf.GetLength()) | 3853 wsResultBuf.GetLength()) |
| 3862 .AsByteStringC(); | 3854 .AsStringC(); |
| 3863 } | 3855 } |
| 3864 void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString, | 3856 void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString, |
| 3865 CFX_ByteTextBuf& szResultString) { | 3857 CFX_ByteTextBuf& szResultString) { |
| 3866 CFX_WideString wsXMLString = CFX_WideString::FromUTF8(szXMLString); | 3858 CFX_WideString wsXMLString = CFX_WideString::FromUTF8(szXMLString); |
| 3867 FX_WCHAR strString[9]; | 3859 FX_WCHAR strString[9]; |
| 3868 int32_t iStrIndex = 0; | 3860 int32_t iStrIndex = 0; |
| 3869 int32_t iLen = wsXMLString.GetLength(); | 3861 int32_t iLen = wsXMLString.GetLength(); |
| 3870 int32_t i = 0; | 3862 int32_t i = 0; |
| 3871 int32_t iCode = 0; | 3863 int32_t iCode = 0; |
| 3872 FX_WCHAR ch = 0; | 3864 FX_WCHAR ch = 0; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3949 break; | 3941 break; |
| 3950 } | 3942 } |
| 3951 iStrIndex = 0; | 3943 iStrIndex = 0; |
| 3952 strString[iStrIndex] = 0; | 3944 strString[iStrIndex] = 0; |
| 3953 ++i; | 3945 ++i; |
| 3954 iCode = 0; | 3946 iCode = 0; |
| 3955 } | 3947 } |
| 3956 wsXMLBuf.AppendChar(0); | 3948 wsXMLBuf.AppendChar(0); |
| 3957 szResultString.Clear(); | 3949 szResultString.Clear(); |
| 3958 szResultString << FX_UTF8Encode(wsXMLBuf.GetBuffer(), wsXMLBuf.GetLength()) | 3950 szResultString << FX_UTF8Encode(wsXMLBuf.GetBuffer(), wsXMLBuf.GetLength()) |
| 3959 .AsByteStringC(); | 3951 .AsStringC(); |
| 3960 } | 3952 } |
| 3961 void CXFA_FM2JSContext::Encode(FXJSE_HOBJECT hThis, | 3953 void CXFA_FM2JSContext::Encode(FXJSE_HOBJECT hThis, |
| 3962 const CFX_ByteStringC& szFuncName, | 3954 const CFX_ByteStringC& szFuncName, |
| 3963 CFXJSE_Arguments& args) { | 3955 CFXJSE_Arguments& args) { |
| 3964 CXFA_FM2JSContext* pContext = | 3956 CXFA_FM2JSContext* pContext = |
| 3965 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3957 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 3966 int32_t argc = args.GetLength(); | 3958 int32_t argc = args.GetLength(); |
| 3967 if (argc == 1) { | 3959 if (argc == 1) { |
| 3968 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 3960 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 3969 if (HValueIsNull(hThis, argOne)) { | 3961 if (HValueIsNull(hThis, argOne)) { |
| 3970 FXJSE_Value_SetNull(args.GetReturnValue()); | 3962 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3971 } else { | 3963 } else { |
| 3972 CFX_ByteString toEncodeString; | 3964 CFX_ByteString toEncodeString; |
| 3973 HValueToUTF8String(argOne, toEncodeString); | 3965 HValueToUTF8String(argOne, toEncodeString); |
| 3974 CFX_ByteTextBuf resultBuf; | 3966 CFX_ByteTextBuf resultBuf; |
| 3975 EncodeURL(toEncodeString.AsByteStringC(), resultBuf); | 3967 EncodeURL(toEncodeString.AsStringC(), resultBuf); |
| 3976 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 3968 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3977 resultBuf.GetByteString()); | 3969 resultBuf.GetByteString()); |
| 3978 } | 3970 } |
| 3979 FXJSE_Value_Release(argOne); | 3971 FXJSE_Value_Release(argOne); |
| 3980 } else if (argc == 2) { | 3972 } else if (argc == 2) { |
| 3981 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 3973 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 3982 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 3974 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
| 3983 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { | 3975 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { |
| 3984 FXJSE_Value_SetNull(args.GetReturnValue()); | 3976 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3985 } else { | 3977 } else { |
| 3986 CFX_ByteString toEncodeString; | 3978 CFX_ByteString toEncodeString; |
| 3987 HValueToUTF8String(argOne, toEncodeString); | 3979 HValueToUTF8String(argOne, toEncodeString); |
| 3988 CFX_ByteString identifyString; | 3980 CFX_ByteString identifyString; |
| 3989 HValueToUTF8String(argTwo, identifyString); | 3981 HValueToUTF8String(argTwo, identifyString); |
| 3990 CFX_ByteTextBuf resultBuf; | 3982 CFX_ByteTextBuf resultBuf; |
| 3991 if (identifyString.EqualNoCase("html")) { | 3983 if (identifyString.EqualNoCase("html")) { |
| 3992 EncodeHTML(toEncodeString.AsByteStringC(), resultBuf); | 3984 EncodeHTML(toEncodeString.AsStringC(), resultBuf); |
| 3993 } else if (identifyString.EqualNoCase("xml")) { | 3985 } else if (identifyString.EqualNoCase("xml")) { |
| 3994 EncodeXML(toEncodeString.AsByteStringC(), resultBuf); | 3986 EncodeXML(toEncodeString.AsStringC(), resultBuf); |
| 3995 } else { | 3987 } else { |
| 3996 EncodeURL(toEncodeString.AsByteStringC(), resultBuf); | 3988 EncodeURL(toEncodeString.AsStringC(), resultBuf); |
| 3997 } | 3989 } |
| 3998 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 3990 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3999 resultBuf.GetByteString()); | 3991 resultBuf.GetByteString()); |
| 4000 } | 3992 } |
| 4001 FXJSE_Value_Release(argOne); | 3993 FXJSE_Value_Release(argOne); |
| 4002 FXJSE_Value_Release(argTwo); | 3994 FXJSE_Value_Release(argTwo); |
| 4003 } else { | 3995 } else { |
| 4004 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3996 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4005 L"Encode"); | 3997 L"Encode"); |
| 4006 } | 3998 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4103 strEncode[1] = strTmp.GetAt(iIndex); | 4095 strEncode[1] = strTmp.GetAt(iIndex); |
| 4104 strEncode[2] = strTmp.GetAt(iIndex - 1); | 4096 strEncode[2] = strTmp.GetAt(iIndex - 1); |
| 4105 iIndex -= 2; | 4097 iIndex -= 2; |
| 4106 wsResultBuf << FX_WSTRC(strEncode); | 4098 wsResultBuf << FX_WSTRC(strEncode); |
| 4107 } | 4099 } |
| 4108 } | 4100 } |
| 4109 } | 4101 } |
| 4110 wsResultBuf.AppendChar(0); | 4102 wsResultBuf.AppendChar(0); |
| 4111 szResultBuf.Clear(); | 4103 szResultBuf.Clear(); |
| 4112 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength()) | 4104 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength()) |
| 4113 .AsByteStringC(); | 4105 .AsStringC(); |
| 4114 } | 4106 } |
| 4115 void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString, | 4107 void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString, |
| 4116 CFX_ByteTextBuf& szResultBuf) { | 4108 CFX_ByteTextBuf& szResultBuf) { |
| 4117 CFX_ByteString str = szHTMLString.c_str(); | 4109 CFX_ByteString str = szHTMLString.c_str(); |
| 4118 CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(str.AsByteStringC()); | 4110 CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(str.AsStringC()); |
| 4119 const FX_WCHAR* strCode = L"0123456789abcdef"; | 4111 const FX_WCHAR* strCode = L"0123456789abcdef"; |
| 4120 FX_WCHAR strEncode[9]; | 4112 FX_WCHAR strEncode[9]; |
| 4121 strEncode[0] = '&'; | 4113 strEncode[0] = '&'; |
| 4122 strEncode[1] = '#'; | 4114 strEncode[1] = '#'; |
| 4123 strEncode[2] = 'x'; | 4115 strEncode[2] = 'x'; |
| 4124 strEncode[5] = ';'; | 4116 strEncode[5] = ';'; |
| 4125 strEncode[6] = 0; | 4117 strEncode[6] = 0; |
| 4126 strEncode[7] = ';'; | 4118 strEncode[7] = ';'; |
| 4127 strEncode[8] = 0; | 4119 strEncode[8] = 0; |
| 4128 CFX_WideTextBuf wsResultBuf; | 4120 CFX_WideTextBuf wsResultBuf; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4157 strEncode[5] = strCode[iLittleByte / 16]; | 4149 strEncode[5] = strCode[iLittleByte / 16]; |
| 4158 strEncode[6] = strCode[iLittleByte % 16]; | 4150 strEncode[6] = strCode[iLittleByte % 16]; |
| 4159 wsResultBuf << FX_WSTRC(strEncode); | 4151 wsResultBuf << FX_WSTRC(strEncode); |
| 4160 } | 4152 } |
| 4161 } | 4153 } |
| 4162 ++i; | 4154 ++i; |
| 4163 } | 4155 } |
| 4164 wsResultBuf.AppendChar(0); | 4156 wsResultBuf.AppendChar(0); |
| 4165 szResultBuf.Clear(); | 4157 szResultBuf.Clear(); |
| 4166 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength()) | 4158 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength()) |
| 4167 .AsByteStringC(); | 4159 .AsStringC(); |
| 4168 } | 4160 } |
| 4169 void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString, | 4161 void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString, |
| 4170 CFX_ByteTextBuf& szResultBuf) { | 4162 CFX_ByteTextBuf& szResultBuf) { |
| 4171 CFX_WideString wsXMLString = CFX_WideString::FromUTF8(szXMLString); | 4163 CFX_WideString wsXMLString = CFX_WideString::FromUTF8(szXMLString); |
| 4172 CFX_WideTextBuf wsResultBuf; | 4164 CFX_WideTextBuf wsResultBuf; |
| 4173 enum { | 4165 enum { |
| 4174 QUOT, | 4166 QUOT, |
| 4175 AMP, | 4167 AMP, |
| 4176 APOS, | 4168 APOS, |
| 4177 LT, | 4169 LT, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4238 strEncode[5] = strCode[iLittleByte / 16]; | 4230 strEncode[5] = strCode[iLittleByte / 16]; |
| 4239 strEncode[6] = strCode[iLittleByte % 16]; | 4231 strEncode[6] = strCode[iLittleByte % 16]; |
| 4240 wsResultBuf << FX_WSTRC(strEncode); | 4232 wsResultBuf << FX_WSTRC(strEncode); |
| 4241 } | 4233 } |
| 4242 } break; | 4234 } break; |
| 4243 } | 4235 } |
| 4244 } | 4236 } |
| 4245 wsResultBuf.AppendChar(0); | 4237 wsResultBuf.AppendChar(0); |
| 4246 szResultBuf.Clear(); | 4238 szResultBuf.Clear(); |
| 4247 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength()) | 4239 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength()) |
| 4248 .AsByteStringC(); | 4240 .AsStringC(); |
| 4249 } | 4241 } |
| 4250 FX_BOOL CXFA_FM2JSContext::HTMLSTR2Code(const CFX_WideStringC& pData, | 4242 FX_BOOL CXFA_FM2JSContext::HTMLSTR2Code(const CFX_WideStringC& pData, |
| 4251 uint32_t& iCode) { | 4243 uint32_t& iCode) { |
| 4252 int32_t iLength = pData.GetLength(); | 4244 int32_t iLength = pData.GetLength(); |
| 4253 uint32_t uHash = FX_HashCode_String_GetW(pData.c_str(), iLength); | 4245 uint32_t uHash = FX_HashCode_String_GetW(pData.c_str(), iLength); |
| 4254 XFA_FMHtmlHashedReserveCode htmlhashedreservecode; | 4246 XFA_FMHtmlHashedReserveCode htmlhashedreservecode; |
| 4255 int32_t iStart = 0, | 4247 int32_t iStart = 0, |
| 4256 iEnd = (sizeof(reservesForDecode) / sizeof(reservesForDecode[0])) - 1; | 4248 iEnd = (sizeof(reservesForDecode) / sizeof(reservesForDecode[0])) - 1; |
| 4257 int32_t iMid = (iStart + iEnd) / 2; | 4249 int32_t iMid = (iStart + iEnd) / 2; |
| 4258 do { | 4250 do { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4387 CFX_ByteString szValue; | 4379 CFX_ByteString szValue; |
| 4388 HValueToUTF8String(argTwo, szValue); | 4380 HValueToUTF8String(argTwo, szValue); |
| 4389 CXFA_Document* pDoc = pContext->GetDocument(); | 4381 CXFA_Document* pDoc = pContext->GetDocument(); |
| 4390 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 4382 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 4391 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 4383 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 4392 FXSYS_assert(pThisNode); | 4384 FXSYS_assert(pThisNode); |
| 4393 CXFA_WidgetData widgetData(pThisNode); | 4385 CXFA_WidgetData widgetData(pThisNode); |
| 4394 IFX_Locale* pLocale = widgetData.GetLocal(); | 4386 IFX_Locale* pLocale = widgetData.GetLocal(); |
| 4395 uint32_t patternType; | 4387 uint32_t patternType; |
| 4396 FX_BOOL bCompelte = | 4388 FX_BOOL bCompelte = |
| 4397 XFA_PATTERN_STRING_Type(szPattern.AsByteStringC(), patternType); | 4389 XFA_PATTERN_STRING_Type(szPattern.AsStringC(), patternType); |
| 4398 CFX_WideString wsPattern = | 4390 CFX_WideString wsPattern = CFX_WideString::FromUTF8(szPattern.AsStringC()); |
| 4399 CFX_WideString::FromUTF8(szPattern.AsByteStringC()); | 4391 CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsStringC()); |
| 4400 CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsByteStringC()); | |
| 4401 if (!bCompelte) { | 4392 if (!bCompelte) { |
| 4402 switch (patternType) { | 4393 switch (patternType) { |
| 4403 case XFA_VT_DATETIME: { | 4394 case XFA_VT_DATETIME: { |
| 4404 FX_STRSIZE iTChar = wsPattern.Find(L'T'); | 4395 FX_STRSIZE iTChar = wsPattern.Find(L'T'); |
| 4405 CFX_WideString wsDatePattern = FX_WSTRC(L"date{"); | 4396 CFX_WideString wsDatePattern = FX_WSTRC(L"date{"); |
| 4406 wsDatePattern += wsPattern.Left(iTChar); | 4397 wsDatePattern += wsPattern.Left(iTChar); |
| 4407 wsDatePattern += FX_WSTRC(L"} "); | 4398 wsDatePattern += FX_WSTRC(L"} "); |
| 4408 CFX_WideString wsTimePattern = FX_WSTRC(L"time{"); | 4399 CFX_WideString wsTimePattern = FX_WSTRC(L"time{"); |
| 4409 wsTimePattern += wsPattern.Mid(iTChar + 1); | 4400 wsTimePattern += wsPattern.Mid(iTChar + 1); |
| 4410 wsTimePattern += FX_WSTRC(L"}"); | 4401 wsTimePattern += FX_WSTRC(L"}"); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4444 } break; | 4435 } break; |
| 4445 } | 4436 } |
| 4446 } | 4437 } |
| 4447 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale, | 4438 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale, |
| 4448 (CXFA_LocaleMgr*)pMgr); | 4439 (CXFA_LocaleMgr*)pMgr); |
| 4449 CFX_WideString wsRet; | 4440 CFX_WideString wsRet; |
| 4450 if (localeValue.FormatPatterns(wsRet, wsPattern, pLocale, | 4441 if (localeValue.FormatPatterns(wsRet, wsPattern, pLocale, |
| 4451 XFA_VALUEPICTURE_Display)) { | 4442 XFA_VALUEPICTURE_Display)) { |
| 4452 FXJSE_Value_SetUTF8String( | 4443 FXJSE_Value_SetUTF8String( |
| 4453 args.GetReturnValue(), | 4444 args.GetReturnValue(), |
| 4454 FX_UTF8Encode(wsRet, wsRet.GetLength()).AsByteStringC()); | 4445 FX_UTF8Encode(wsRet, wsRet.GetLength()).AsStringC()); |
| 4455 } else { | 4446 } else { |
| 4456 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4447 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4457 } | 4448 } |
| 4458 FXJSE_Value_Release(argOne); | 4449 FXJSE_Value_Release(argOne); |
| 4459 FXJSE_Value_Release(argTwo); | 4450 FXJSE_Value_Release(argTwo); |
| 4460 } else { | 4451 } else { |
| 4461 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4452 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4462 L"Format"); | 4453 L"Format"); |
| 4463 } | 4454 } |
| 4464 } | 4455 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 4477 if (argIsNull) { | 4468 if (argIsNull) { |
| 4478 FXJSE_Value_SetNull(args.GetReturnValue()); | 4469 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4479 } else { | 4470 } else { |
| 4480 CFX_ByteString sourceString; | 4471 CFX_ByteString sourceString; |
| 4481 HValueToUTF8String(argOne, sourceString); | 4472 HValueToUTF8String(argOne, sourceString); |
| 4482 int32_t count = HValueToInteger(hThis, argTwo); | 4473 int32_t count = HValueToInteger(hThis, argTwo); |
| 4483 if (count < 0) { | 4474 if (count < 0) { |
| 4484 count = 0; | 4475 count = 0; |
| 4485 } | 4476 } |
| 4486 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4477 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4487 sourceString.Left(count).AsByteStringC()); | 4478 sourceString.Left(count).AsStringC()); |
| 4488 } | 4479 } |
| 4489 FXJSE_Value_Release(argOne); | 4480 FXJSE_Value_Release(argOne); |
| 4490 FXJSE_Value_Release(argTwo); | 4481 FXJSE_Value_Release(argTwo); |
| 4491 } else { | 4482 } else { |
| 4492 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4483 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4493 L"Left"); | 4484 L"Left"); |
| 4494 } | 4485 } |
| 4495 } | 4486 } |
| 4496 void CXFA_FM2JSContext::Len(FXJSE_HOBJECT hThis, | 4487 void CXFA_FM2JSContext::Len(FXJSE_HOBJECT hThis, |
| 4497 const CFX_ByteStringC& szFuncName, | 4488 const CFX_ByteStringC& szFuncName, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 4523 FXJSE_HVALUE localeValue = 0; | 4514 FXJSE_HVALUE localeValue = 0; |
| 4524 if (HValueIsNull(hThis, argOne)) { | 4515 if (HValueIsNull(hThis, argOne)) { |
| 4525 FXJSE_Value_SetNull(args.GetReturnValue()); | 4516 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4526 } else { | 4517 } else { |
| 4527 if (argc == 2) { | 4518 if (argc == 2) { |
| 4528 localeValue = GetSimpleHValue(hThis, args, 1); | 4519 localeValue = GetSimpleHValue(hThis, args, 1); |
| 4529 } | 4520 } |
| 4530 HValueToUTF8String(argOne, argString); | 4521 HValueToUTF8String(argOne, argString); |
| 4531 CFX_WideTextBuf lowStringBuf; | 4522 CFX_WideTextBuf lowStringBuf; |
| 4532 CFX_WideString wsArgString = | 4523 CFX_WideString wsArgString = |
| 4533 CFX_WideString::FromUTF8(argString.AsByteStringC()); | 4524 CFX_WideString::FromUTF8(argString.AsStringC()); |
| 4534 const FX_WCHAR* pData = wsArgString; | 4525 const FX_WCHAR* pData = wsArgString; |
| 4535 int32_t iLen = argString.GetLength(); | 4526 int32_t iLen = argString.GetLength(); |
| 4536 int32_t i = 0; | 4527 int32_t i = 0; |
| 4537 int32_t ch = 0; | 4528 int32_t ch = 0; |
| 4538 while (i < iLen) { | 4529 while (i < iLen) { |
| 4539 ch = *(pData + i); | 4530 ch = *(pData + i); |
| 4540 if (ch >= 0x41 && ch <= 0x5A) { | 4531 if (ch >= 0x41 && ch <= 0x5A) { |
| 4541 ch += 32; | 4532 ch += 32; |
| 4542 } else if (ch >= 0xC0 && ch <= 0xDE) { | 4533 } else if (ch >= 0xC0 && ch <= 0xDE) { |
| 4543 ch += 32; | 4534 ch += 32; |
| 4544 } else if (ch == 0x100 || ch == 0x102 || ch == 0x104) { | 4535 } else if (ch == 0x100 || ch == 0x102 || ch == 0x104) { |
| 4545 ch += 1; | 4536 ch += 1; |
| 4546 } | 4537 } |
| 4547 lowStringBuf.AppendChar(ch); | 4538 lowStringBuf.AppendChar(ch); |
| 4548 ++i; | 4539 ++i; |
| 4549 } | 4540 } |
| 4550 lowStringBuf.AppendChar(0); | 4541 lowStringBuf.AppendChar(0); |
| 4551 FXJSE_Value_SetUTF8String( | 4542 FXJSE_Value_SetUTF8String( |
| 4552 args.GetReturnValue(), | 4543 args.GetReturnValue(), |
| 4553 FX_UTF8Encode(lowStringBuf.GetBuffer(), lowStringBuf.GetLength()) | 4544 FX_UTF8Encode(lowStringBuf.GetBuffer(), lowStringBuf.GetLength()) |
| 4554 .AsByteStringC()); | 4545 .AsStringC()); |
| 4555 if (argc == 2) { | 4546 if (argc == 2) { |
| 4556 FXJSE_Value_Release(localeValue); | 4547 FXJSE_Value_Release(localeValue); |
| 4557 } | 4548 } |
| 4558 } | 4549 } |
| 4559 FXJSE_Value_Release(argOne); | 4550 FXJSE_Value_Release(argOne); |
| 4560 } else { | 4551 } else { |
| 4561 CXFA_FM2JSContext* pContext = | 4552 CXFA_FM2JSContext* pContext = |
| 4562 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 4553 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 4563 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4554 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4564 L"Lower"); | 4555 L"Lower"); |
| 4565 } | 4556 } |
| 4566 } | 4557 } |
| 4567 void CXFA_FM2JSContext::Ltrim(FXJSE_HOBJECT hThis, | 4558 void CXFA_FM2JSContext::Ltrim(FXJSE_HOBJECT hThis, |
| 4568 const CFX_ByteStringC& szFuncName, | 4559 const CFX_ByteStringC& szFuncName, |
| 4569 CFXJSE_Arguments& args) { | 4560 CFXJSE_Arguments& args) { |
| 4570 CXFA_FM2JSContext* pContext = | 4561 CXFA_FM2JSContext* pContext = |
| 4571 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 4562 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 4572 if (args.GetLength() == 1) { | 4563 if (args.GetLength() == 1) { |
| 4573 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4564 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 4574 if (HValueIsNull(hThis, argOne)) { | 4565 if (HValueIsNull(hThis, argOne)) { |
| 4575 FXJSE_Value_SetNull(args.GetReturnValue()); | 4566 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4576 } else { | 4567 } else { |
| 4577 CFX_ByteString sourceString; | 4568 CFX_ByteString sourceString; |
| 4578 HValueToUTF8String(argOne, sourceString); | 4569 HValueToUTF8String(argOne, sourceString); |
| 4579 sourceString.TrimLeft(); | 4570 sourceString.TrimLeft(); |
| 4580 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4571 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4581 sourceString.AsByteStringC()); | 4572 sourceString.AsStringC()); |
| 4582 } | 4573 } |
| 4583 FXJSE_Value_Release(argOne); | 4574 FXJSE_Value_Release(argOne); |
| 4584 } else { | 4575 } else { |
| 4585 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4576 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4586 L"Ltrim"); | 4577 L"Ltrim"); |
| 4587 } | 4578 } |
| 4588 } | 4579 } |
| 4589 void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis, | 4580 void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis, |
| 4590 const CFX_ByteStringC& szFuncName, | 4581 const CFX_ByteStringC& szFuncName, |
| 4591 CFXJSE_Arguments& args) { | 4582 CFXJSE_Arguments& args) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4602 CFX_ByteString szValue; | 4593 CFX_ByteString szValue; |
| 4603 HValueToUTF8String(argTwo, szValue); | 4594 HValueToUTF8String(argTwo, szValue); |
| 4604 CXFA_Document* pDoc = pContext->GetDocument(); | 4595 CXFA_Document* pDoc = pContext->GetDocument(); |
| 4605 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 4596 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 4606 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 4597 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 4607 FXSYS_assert(pThisNode); | 4598 FXSYS_assert(pThisNode); |
| 4608 CXFA_WidgetData widgetData(pThisNode); | 4599 CXFA_WidgetData widgetData(pThisNode); |
| 4609 IFX_Locale* pLocale = widgetData.GetLocal(); | 4600 IFX_Locale* pLocale = widgetData.GetLocal(); |
| 4610 uint32_t patternType; | 4601 uint32_t patternType; |
| 4611 FX_BOOL bCompletePattern = | 4602 FX_BOOL bCompletePattern = |
| 4612 XFA_PATTERN_STRING_Type(szPattern.AsByteStringC(), patternType); | 4603 XFA_PATTERN_STRING_Type(szPattern.AsStringC(), patternType); |
| 4613 CFX_WideString wsPattern = | 4604 CFX_WideString wsPattern = |
| 4614 CFX_WideString::FromUTF8(szPattern.AsByteStringC()); | 4605 CFX_WideString::FromUTF8(szPattern.AsStringC()); |
| 4615 CFX_WideString wsValue = | 4606 CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsStringC()); |
| 4616 CFX_WideString::FromUTF8(szValue.AsByteStringC()); | |
| 4617 CFX_ByteString szParsedValue; | 4607 CFX_ByteString szParsedValue; |
| 4618 if (bCompletePattern) { | 4608 if (bCompletePattern) { |
| 4619 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale, | 4609 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale, |
| 4620 (CXFA_LocaleMgr*)pMgr); | 4610 (CXFA_LocaleMgr*)pMgr); |
| 4621 if (localeValue.IsValid()) { | 4611 if (localeValue.IsValid()) { |
| 4622 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4612 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
| 4623 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4613 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4624 szParsedValue.AsByteStringC()); | 4614 szParsedValue.AsStringC()); |
| 4625 } else { | 4615 } else { |
| 4626 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4616 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4627 } | 4617 } |
| 4628 } else { | 4618 } else { |
| 4629 switch (patternType) { | 4619 switch (patternType) { |
| 4630 case XFA_VT_DATETIME: { | 4620 case XFA_VT_DATETIME: { |
| 4631 FX_STRSIZE iTChar = wsPattern.Find(L'T'); | 4621 FX_STRSIZE iTChar = wsPattern.Find(L'T'); |
| 4632 CFX_WideString wsDatePattern = FX_WSTRC(L"date{"); | 4622 CFX_WideString wsDatePattern = FX_WSTRC(L"date{"); |
| 4633 wsDatePattern += wsPattern.Left(iTChar); | 4623 wsDatePattern += wsPattern.Left(iTChar); |
| 4634 wsDatePattern += FX_WSTRC(L"} "); | 4624 wsDatePattern += FX_WSTRC(L"} "); |
| 4635 CFX_WideString wsTimePattern = FX_WSTRC(L"time{"); | 4625 CFX_WideString wsTimePattern = FX_WSTRC(L"time{"); |
| 4636 wsTimePattern += wsPattern.Mid(iTChar + 1); | 4626 wsTimePattern += wsPattern.Mid(iTChar + 1); |
| 4637 wsTimePattern += FX_WSTRC(L"}"); | 4627 wsTimePattern += FX_WSTRC(L"}"); |
| 4638 wsPattern = wsDatePattern + wsTimePattern; | 4628 wsPattern = wsDatePattern + wsTimePattern; |
| 4639 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, | 4629 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, |
| 4640 pLocale, (CXFA_LocaleMgr*)pMgr); | 4630 pLocale, (CXFA_LocaleMgr*)pMgr); |
| 4641 if (localeValue.IsValid()) { | 4631 if (localeValue.IsValid()) { |
| 4642 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4632 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
| 4643 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4633 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4644 szParsedValue.AsByteStringC()); | 4634 szParsedValue.AsStringC()); |
| 4645 } else { | 4635 } else { |
| 4646 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4636 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4647 } | 4637 } |
| 4648 } break; | 4638 } break; |
| 4649 case XFA_VT_DATE: { | 4639 case XFA_VT_DATE: { |
| 4650 wsPattern = FX_WSTRC(L"date{") + wsPattern; | 4640 wsPattern = FX_WSTRC(L"date{") + wsPattern; |
| 4651 wsPattern += FX_WSTRC(L"}"); | 4641 wsPattern += FX_WSTRC(L"}"); |
| 4652 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, | 4642 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, |
| 4653 pLocale, (CXFA_LocaleMgr*)pMgr); | 4643 pLocale, (CXFA_LocaleMgr*)pMgr); |
| 4654 if (localeValue.IsValid()) { | 4644 if (localeValue.IsValid()) { |
| 4655 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4645 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
| 4656 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4646 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4657 szParsedValue.AsByteStringC()); | 4647 szParsedValue.AsStringC()); |
| 4658 } else { | 4648 } else { |
| 4659 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4649 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4660 } | 4650 } |
| 4661 } break; | 4651 } break; |
| 4662 case XFA_VT_TIME: { | 4652 case XFA_VT_TIME: { |
| 4663 wsPattern = FX_WSTRC(L"time{") + wsPattern; | 4653 wsPattern = FX_WSTRC(L"time{") + wsPattern; |
| 4664 wsPattern += FX_WSTRC(L"}"); | 4654 wsPattern += FX_WSTRC(L"}"); |
| 4665 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, | 4655 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, |
| 4666 pLocale, (CXFA_LocaleMgr*)pMgr); | 4656 pLocale, (CXFA_LocaleMgr*)pMgr); |
| 4667 if (localeValue.IsValid()) { | 4657 if (localeValue.IsValid()) { |
| 4668 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4658 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
| 4669 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4659 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4670 szParsedValue.AsByteStringC()); | 4660 szParsedValue.AsStringC()); |
| 4671 } else { | 4661 } else { |
| 4672 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4662 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4673 } | 4663 } |
| 4674 } break; | 4664 } break; |
| 4675 case XFA_VT_TEXT: { | 4665 case XFA_VT_TEXT: { |
| 4676 wsPattern = FX_WSTRC(L"text{") + wsPattern; | 4666 wsPattern = FX_WSTRC(L"text{") + wsPattern; |
| 4677 wsPattern += FX_WSTRC(L"}"); | 4667 wsPattern += FX_WSTRC(L"}"); |
| 4678 CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsPattern, | 4668 CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsPattern, |
| 4679 pLocale, (CXFA_LocaleMgr*)pMgr); | 4669 pLocale, (CXFA_LocaleMgr*)pMgr); |
| 4680 if (localeValue.IsValid()) { | 4670 if (localeValue.IsValid()) { |
| 4681 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4671 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
| 4682 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4672 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4683 szParsedValue.AsByteStringC()); | 4673 szParsedValue.AsStringC()); |
| 4684 } else { | 4674 } else { |
| 4685 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4675 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4686 } | 4676 } |
| 4687 } break; | 4677 } break; |
| 4688 case XFA_VT_FLOAT: { | 4678 case XFA_VT_FLOAT: { |
| 4689 wsPattern = FX_WSTRC(L"num{") + wsPattern; | 4679 wsPattern = FX_WSTRC(L"num{") + wsPattern; |
| 4690 wsPattern += FX_WSTRC(L"}"); | 4680 wsPattern += FX_WSTRC(L"}"); |
| 4691 CXFA_LocaleValue localeValue(XFA_VT_FLOAT, wsValue, wsPattern, | 4681 CXFA_LocaleValue localeValue(XFA_VT_FLOAT, wsValue, wsPattern, |
| 4692 pLocale, (CXFA_LocaleMgr*)pMgr); | 4682 pLocale, (CXFA_LocaleMgr*)pMgr); |
| 4693 if (localeValue.IsValid()) { | 4683 if (localeValue.IsValid()) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4707 FXJSE_Value_SetDouble(args.GetReturnValue(), | 4697 FXJSE_Value_SetDouble(args.GetReturnValue(), |
| 4708 localeValue.GetDoubleNum()); | 4698 localeValue.GetDoubleNum()); |
| 4709 } else { | 4699 } else { |
| 4710 wsTestPattern = FX_WSTRC(L"text{") + wsPattern; | 4700 wsTestPattern = FX_WSTRC(L"text{") + wsPattern; |
| 4711 wsTestPattern += FX_WSTRC(L"}"); | 4701 wsTestPattern += FX_WSTRC(L"}"); |
| 4712 CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsTestPattern, | 4702 CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsTestPattern, |
| 4713 pLocale, (CXFA_LocaleMgr*)pMgr); | 4703 pLocale, (CXFA_LocaleMgr*)pMgr); |
| 4714 if (localeValue.IsValid()) { | 4704 if (localeValue.IsValid()) { |
| 4715 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4705 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
| 4716 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4706 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4717 szParsedValue.AsByteStringC()); | 4707 szParsedValue.AsStringC()); |
| 4718 } else { | 4708 } else { |
| 4719 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4709 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4720 } | 4710 } |
| 4721 } | 4711 } |
| 4722 } break; | 4712 } break; |
| 4723 } | 4713 } |
| 4724 } | 4714 } |
| 4725 } | 4715 } |
| 4726 FXJSE_Value_Release(argOne); | 4716 FXJSE_Value_Release(argOne); |
| 4727 FXJSE_Value_Release(argTwo); | 4717 FXJSE_Value_Release(argTwo); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4764 chTemp = oneString.GetAt(iTemp); | 4754 chTemp = oneString.GetAt(iTemp); |
| 4765 if (chTemp == twoString.GetAt(iFindIndex)) { | 4755 if (chTemp == twoString.GetAt(iFindIndex)) { |
| 4766 ++iTemp; | 4756 ++iTemp; |
| 4767 ++iFindIndex; | 4757 ++iFindIndex; |
| 4768 } else { | 4758 } else { |
| 4769 iFindIndex = 0; | 4759 iFindIndex = 0; |
| 4770 break; | 4760 break; |
| 4771 } | 4761 } |
| 4772 } | 4762 } |
| 4773 if (iFindIndex == iFindLen) { | 4763 if (iFindIndex == iFindLen) { |
| 4774 resultString << threeString.AsByteStringC(); | 4764 resultString << threeString.AsStringC(); |
| 4775 u += iFindLen - 1; | 4765 u += iFindLen - 1; |
| 4776 iFindIndex = 0; | 4766 iFindIndex = 0; |
| 4777 } else { | 4767 } else { |
| 4778 resultString.AppendChar(ch); | 4768 resultString.AppendChar(ch); |
| 4779 } | 4769 } |
| 4780 } else { | 4770 } else { |
| 4781 resultString.AppendChar(ch); | 4771 resultString.AppendChar(ch); |
| 4782 } | 4772 } |
| 4783 } | 4773 } |
| 4784 resultString.AppendChar(0); | 4774 resultString.AppendChar(0); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 4811 if (argIsNull) { | 4801 if (argIsNull) { |
| 4812 FXJSE_Value_SetNull(args.GetReturnValue()); | 4802 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4813 } else { | 4803 } else { |
| 4814 CFX_ByteString sourceString; | 4804 CFX_ByteString sourceString; |
| 4815 HValueToUTF8String(argOne, sourceString); | 4805 HValueToUTF8String(argOne, sourceString); |
| 4816 int32_t count = HValueToInteger(hThis, argTwo); | 4806 int32_t count = HValueToInteger(hThis, argTwo); |
| 4817 if (count < 0) { | 4807 if (count < 0) { |
| 4818 count = 0; | 4808 count = 0; |
| 4819 } | 4809 } |
| 4820 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4810 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4821 sourceString.Right(count).AsByteStringC()); | 4811 sourceString.Right(count).AsStringC()); |
| 4822 } | 4812 } |
| 4823 FXJSE_Value_Release(argOne); | 4813 FXJSE_Value_Release(argOne); |
| 4824 FXJSE_Value_Release(argTwo); | 4814 FXJSE_Value_Release(argTwo); |
| 4825 } else { | 4815 } else { |
| 4826 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4816 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4827 L"Right"); | 4817 L"Right"); |
| 4828 } | 4818 } |
| 4829 } | 4819 } |
| 4830 void CXFA_FM2JSContext::Rtrim(FXJSE_HOBJECT hThis, | 4820 void CXFA_FM2JSContext::Rtrim(FXJSE_HOBJECT hThis, |
| 4831 const CFX_ByteStringC& szFuncName, | 4821 const CFX_ByteStringC& szFuncName, |
| 4832 CFXJSE_Arguments& args) { | 4822 CFXJSE_Arguments& args) { |
| 4833 CXFA_FM2JSContext* pContext = | 4823 CXFA_FM2JSContext* pContext = |
| 4834 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 4824 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 4835 if (args.GetLength() == 1) { | 4825 if (args.GetLength() == 1) { |
| 4836 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4826 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 4837 if (HValueIsNull(hThis, argOne)) { | 4827 if (HValueIsNull(hThis, argOne)) { |
| 4838 FXJSE_Value_SetNull(args.GetReturnValue()); | 4828 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4839 } else { | 4829 } else { |
| 4840 CFX_ByteString sourceString; | 4830 CFX_ByteString sourceString; |
| 4841 HValueToUTF8String(argOne, sourceString); | 4831 HValueToUTF8String(argOne, sourceString); |
| 4842 sourceString.TrimRight(); | 4832 sourceString.TrimRight(); |
| 4843 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4833 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4844 sourceString.AsByteStringC()); | 4834 sourceString.AsStringC()); |
| 4845 } | 4835 } |
| 4846 FXJSE_Value_Release(argOne); | 4836 FXJSE_Value_Release(argOne); |
| 4847 } else { | 4837 } else { |
| 4848 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4838 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4849 L"Rtrim"); | 4839 L"Rtrim"); |
| 4850 } | 4840 } |
| 4851 } | 4841 } |
| 4852 void CXFA_FM2JSContext::Space(FXJSE_HOBJECT hThis, | 4842 void CXFA_FM2JSContext::Space(FXJSE_HOBJECT hThis, |
| 4853 const CFX_ByteStringC& szFuncName, | 4843 const CFX_ByteStringC& szFuncName, |
| 4854 CFXJSE_Arguments& args) { | 4844 CFXJSE_Arguments& args) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5039 insertValue = GetSimpleHValue(hThis, args, 3); | 5029 insertValue = GetSimpleHValue(hThis, args, 3); |
| 5040 HValueToUTF8String(insertValue, insertString); | 5030 HValueToUTF8String(insertValue, insertString); |
| 5041 } | 5031 } |
| 5042 iStart -= 1; | 5032 iStart -= 1; |
| 5043 CFX_ByteTextBuf resultString; | 5033 CFX_ByteTextBuf resultString; |
| 5044 int32_t i = 0; | 5034 int32_t i = 0; |
| 5045 while (i < iStart) { | 5035 while (i < iStart) { |
| 5046 resultString.AppendChar(sourceString.GetAt(i)); | 5036 resultString.AppendChar(sourceString.GetAt(i)); |
| 5047 ++i; | 5037 ++i; |
| 5048 } | 5038 } |
| 5049 resultString << insertString.AsByteStringC(); | 5039 resultString << insertString.AsStringC(); |
| 5050 i = iStart + iDelete; | 5040 i = iStart + iDelete; |
| 5051 while (i < iLength) { | 5041 while (i < iLength) { |
| 5052 resultString.AppendChar(sourceString.GetAt(i)); | 5042 resultString.AppendChar(sourceString.GetAt(i)); |
| 5053 ++i; | 5043 ++i; |
| 5054 } | 5044 } |
| 5055 resultString.AppendChar(0); | 5045 resultString.AppendChar(0); |
| 5056 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 5046 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 5057 resultString.GetByteString()); | 5047 resultString.GetByteString()); |
| 5058 FXJSE_Value_Release(sourceValue); | 5048 FXJSE_Value_Release(sourceValue); |
| 5059 FXJSE_Value_Release(startValue); | 5049 FXJSE_Value_Release(startValue); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5093 if (iStart < 1) { | 5083 if (iStart < 1) { |
| 5094 iStart = 1; | 5084 iStart = 1; |
| 5095 } | 5085 } |
| 5096 if (iStart > iLength) { | 5086 if (iStart > iLength) { |
| 5097 iStart = iLength; | 5087 iStart = iLength; |
| 5098 } | 5088 } |
| 5099 if (iCount <= 0) { | 5089 if (iCount <= 0) { |
| 5100 iCount = 0; | 5090 iCount = 0; |
| 5101 } | 5091 } |
| 5102 iStart -= 1; | 5092 iStart -= 1; |
| 5103 FXJSE_Value_SetUTF8String( | 5093 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 5104 args.GetReturnValue(), | 5094 szSourceStr.Mid(iStart, iCount).AsStringC()); |
| 5105 szSourceStr.Mid(iStart, iCount).AsByteStringC()); | |
| 5106 } | 5095 } |
| 5107 } | 5096 } |
| 5108 FXJSE_Value_Release(stringValue); | 5097 FXJSE_Value_Release(stringValue); |
| 5109 FXJSE_Value_Release(startValue); | 5098 FXJSE_Value_Release(startValue); |
| 5110 FXJSE_Value_Release(endValue); | 5099 FXJSE_Value_Release(endValue); |
| 5111 } else { | 5100 } else { |
| 5112 CXFA_FM2JSContext* pContext = | 5101 CXFA_FM2JSContext* pContext = |
| 5113 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5102 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 5114 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5103 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 5115 L"Substr"); | 5104 L"Substr"); |
| 5116 } | 5105 } |
| 5117 } | 5106 } |
| 5118 void CXFA_FM2JSContext::Uuid(FXJSE_HOBJECT hThis, | 5107 void CXFA_FM2JSContext::Uuid(FXJSE_HOBJECT hThis, |
| 5119 const CFX_ByteStringC& szFuncName, | 5108 const CFX_ByteStringC& szFuncName, |
| 5120 CFXJSE_Arguments& args) { | 5109 CFXJSE_Arguments& args) { |
| 5121 int32_t argc = args.GetLength(); | 5110 int32_t argc = args.GetLength(); |
| 5122 if ((argc == 0) || (argc == 1)) { | 5111 if ((argc == 0) || (argc == 1)) { |
| 5123 int32_t iNum = 0; | 5112 int32_t iNum = 0; |
| 5124 FXJSE_HVALUE argOne = 0; | 5113 FXJSE_HVALUE argOne = 0; |
| 5125 if (argc == 1) { | 5114 if (argc == 1) { |
| 5126 argOne = GetSimpleHValue(hThis, args, 0); | 5115 argOne = GetSimpleHValue(hThis, args, 0); |
| 5127 iNum = (int32_t)HValueToFloat(hThis, argOne); | 5116 iNum = (int32_t)HValueToFloat(hThis, argOne); |
| 5128 } | 5117 } |
| 5129 FX_GUID guid; | 5118 FX_GUID guid; |
| 5130 FX_GUID_CreateV4(&guid); | 5119 FX_GUID_CreateV4(&guid); |
| 5131 CFX_ByteString bsUId; | 5120 CFX_ByteString bsUId; |
| 5132 FX_GUID_ToString(&guid, bsUId, iNum); | 5121 FX_GUID_ToString(&guid, bsUId, iNum); |
| 5133 FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsUId.AsByteStringC()); | 5122 FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsUId.AsStringC()); |
| 5134 if (argc == 1) { | 5123 if (argc == 1) { |
| 5135 FXJSE_Value_Release(argOne); | 5124 FXJSE_Value_Release(argOne); |
| 5136 } | 5125 } |
| 5137 } else { | 5126 } else { |
| 5138 CXFA_FM2JSContext* pContext = | 5127 CXFA_FM2JSContext* pContext = |
| 5139 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5128 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 5140 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5129 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 5141 L"Uuid"); | 5130 L"Uuid"); |
| 5142 } | 5131 } |
| 5143 } | 5132 } |
| 5144 void CXFA_FM2JSContext::Upper(FXJSE_HOBJECT hThis, | 5133 void CXFA_FM2JSContext::Upper(FXJSE_HOBJECT hThis, |
| 5145 const CFX_ByteStringC& szFuncName, | 5134 const CFX_ByteStringC& szFuncName, |
| 5146 CFXJSE_Arguments& args) { | 5135 CFXJSE_Arguments& args) { |
| 5147 int32_t argc = args.GetLength(); | 5136 int32_t argc = args.GetLength(); |
| 5148 if ((argc > 0) && (argc < 3)) { | 5137 if ((argc > 0) && (argc < 3)) { |
| 5149 CFX_ByteString argString; | 5138 CFX_ByteString argString; |
| 5150 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 5139 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 5151 FXJSE_HVALUE localeValue = 0; | 5140 FXJSE_HVALUE localeValue = 0; |
| 5152 if (HValueIsNull(hThis, argOne)) { | 5141 if (HValueIsNull(hThis, argOne)) { |
| 5153 FXJSE_Value_SetNull(args.GetReturnValue()); | 5142 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5154 } else { | 5143 } else { |
| 5155 if (argc == 2) { | 5144 if (argc == 2) { |
| 5156 localeValue = GetSimpleHValue(hThis, args, 1); | 5145 localeValue = GetSimpleHValue(hThis, args, 1); |
| 5157 } | 5146 } |
| 5158 HValueToUTF8String(argOne, argString); | 5147 HValueToUTF8String(argOne, argString); |
| 5159 CFX_WideTextBuf upperStringBuf; | 5148 CFX_WideTextBuf upperStringBuf; |
| 5160 CFX_WideString wsArgString = | 5149 CFX_WideString wsArgString = |
| 5161 CFX_WideString::FromUTF8(argString.AsByteStringC()); | 5150 CFX_WideString::FromUTF8(argString.AsStringC()); |
| 5162 const FX_WCHAR* pData = wsArgString; | 5151 const FX_WCHAR* pData = wsArgString; |
| 5163 int32_t iLen = wsArgString.GetLength(); | 5152 int32_t iLen = wsArgString.GetLength(); |
| 5164 int32_t i = 0; | 5153 int32_t i = 0; |
| 5165 int32_t ch = 0; | 5154 int32_t ch = 0; |
| 5166 while (i < iLen) { | 5155 while (i < iLen) { |
| 5167 ch = *(pData + i); | 5156 ch = *(pData + i); |
| 5168 if (ch >= 0x61 && ch <= 0x7A) { | 5157 if (ch >= 0x61 && ch <= 0x7A) { |
| 5169 ch -= 32; | 5158 ch -= 32; |
| 5170 } else if (ch >= 0xE0 && ch <= 0xFE) { | 5159 } else if (ch >= 0xE0 && ch <= 0xFE) { |
| 5171 ch -= 32; | 5160 ch -= 32; |
| 5172 } else if (ch == 0x101 || ch == 0x103 || ch == 0x105) { | 5161 } else if (ch == 0x101 || ch == 0x103 || ch == 0x105) { |
| 5173 ch -= 1; | 5162 ch -= 1; |
| 5174 } | 5163 } |
| 5175 upperStringBuf.AppendChar(ch); | 5164 upperStringBuf.AppendChar(ch); |
| 5176 ++i; | 5165 ++i; |
| 5177 } | 5166 } |
| 5178 upperStringBuf.AppendChar(0); | 5167 upperStringBuf.AppendChar(0); |
| 5179 FXJSE_Value_SetUTF8String( | 5168 FXJSE_Value_SetUTF8String( |
| 5180 args.GetReturnValue(), | 5169 args.GetReturnValue(), |
| 5181 FX_UTF8Encode(upperStringBuf.GetBuffer(), upperStringBuf.GetLength()) | 5170 FX_UTF8Encode(upperStringBuf.GetBuffer(), upperStringBuf.GetLength()) |
| 5182 .AsByteStringC()); | 5171 .AsStringC()); |
| 5183 if (argc == 2) { | 5172 if (argc == 2) { |
| 5184 FXJSE_Value_Release(localeValue); | 5173 FXJSE_Value_Release(localeValue); |
| 5185 } | 5174 } |
| 5186 } | 5175 } |
| 5187 FXJSE_Value_Release(argOne); | 5176 FXJSE_Value_Release(argOne); |
| 5188 } else { | 5177 } else { |
| 5189 CXFA_FM2JSContext* pContext = | 5178 CXFA_FM2JSContext* pContext = |
| 5190 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5179 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 5191 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5180 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 5192 L"Upper"); | 5181 L"Upper"); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5225 HValueToUTF8String(localeValue, localeString); | 5214 HValueToUTF8String(localeValue, localeString); |
| 5226 } | 5215 } |
| 5227 } | 5216 } |
| 5228 if (!bFlags) { | 5217 if (!bFlags) { |
| 5229 if ((fNumber < 0) || (fNumber > 922337203685477550)) { | 5218 if ((fNumber < 0) || (fNumber > 922337203685477550)) { |
| 5230 FXJSE_Value_SetUTF8String(args.GetReturnValue(), "*"); | 5219 FXJSE_Value_SetUTF8String(args.GetReturnValue(), "*"); |
| 5231 } else { | 5220 } else { |
| 5232 CFX_ByteTextBuf resultBuf; | 5221 CFX_ByteTextBuf resultBuf; |
| 5233 CFX_ByteString numberString; | 5222 CFX_ByteString numberString; |
| 5234 numberString.Format("%.2f", fNumber); | 5223 numberString.Format("%.2f", fNumber); |
| 5235 WordUS(numberString.AsByteStringC(), iIdentifier, resultBuf); | 5224 WordUS(numberString.AsStringC(), iIdentifier, resultBuf); |
| 5236 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 5225 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 5237 resultBuf.GetByteString()); | 5226 resultBuf.GetByteString()); |
| 5238 } | 5227 } |
| 5239 } else { | 5228 } else { |
| 5240 FXJSE_Value_SetNull(args.GetReturnValue()); | 5229 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5241 } | 5230 } |
| 5242 FXJSE_Value_Release(numberValue); | 5231 FXJSE_Value_Release(numberValue); |
| 5243 if (argc > 1) { | 5232 if (argc > 1) { |
| 5244 FXJSE_Value_Release(identifierValue); | 5233 FXJSE_Value_Release(identifierValue); |
| 5245 if (argc == 3) { | 5234 if (argc == 3) { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5461 } | 5450 } |
| 5462 IXFA_AppProvider* pAppProvider = | 5451 IXFA_AppProvider* pAppProvider = |
| 5463 pDoc->GetParser()->GetNotify()->GetAppProvider(); | 5452 pDoc->GetParser()->GetNotify()->GetAppProvider(); |
| 5464 if (!pAppProvider) { | 5453 if (!pAppProvider) { |
| 5465 return; | 5454 return; |
| 5466 } | 5455 } |
| 5467 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 5456 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 5468 CFX_ByteString urlString; | 5457 CFX_ByteString urlString; |
| 5469 HValueToUTF8String(argOne, urlString); | 5458 HValueToUTF8String(argOne, urlString); |
| 5470 IFX_FileRead* pFile = pAppProvider->DownloadURL( | 5459 IFX_FileRead* pFile = pAppProvider->DownloadURL( |
| 5471 CFX_WideString::FromUTF8(urlString.AsByteStringC()).AsWideStringC()); | 5460 CFX_WideString::FromUTF8(urlString.AsStringC()).AsStringC()); |
| 5472 if (pFile) { | 5461 if (pFile) { |
| 5473 int32_t size = pFile->GetSize(); | 5462 int32_t size = pFile->GetSize(); |
| 5474 uint8_t* pData = FX_Alloc(uint8_t, size); | 5463 uint8_t* pData = FX_Alloc(uint8_t, size); |
| 5475 pFile->ReadBlock(pData, size); | 5464 pFile->ReadBlock(pData, size); |
| 5476 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 5465 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 5477 CFX_ByteStringC(pData, size)); | 5466 CFX_ByteStringC(pData, size)); |
| 5478 FX_Free(pData); | 5467 FX_Free(pData); |
| 5479 pFile->Release(); | 5468 pFile->Release(); |
| 5480 } | 5469 } |
| 5481 FXJSE_Value_Release(argOne); | 5470 FXJSE_Value_Release(argOne); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5521 if (argc > 3) { | 5510 if (argc > 3) { |
| 5522 argFour = GetSimpleHValue(hThis, args, 3); | 5511 argFour = GetSimpleHValue(hThis, args, 3); |
| 5523 HValueToUTF8String(argFour, bsEncode); | 5512 HValueToUTF8String(argFour, bsEncode); |
| 5524 } | 5513 } |
| 5525 if (argc > 4) { | 5514 if (argc > 4) { |
| 5526 argFive = GetSimpleHValue(hThis, args, 4); | 5515 argFive = GetSimpleHValue(hThis, args, 4); |
| 5527 HValueToUTF8String(argFive, bsHeader); | 5516 HValueToUTF8String(argFive, bsHeader); |
| 5528 } | 5517 } |
| 5529 CFX_WideString decodedResponse; | 5518 CFX_WideString decodedResponse; |
| 5530 FX_BOOL bFlags = pAppProvider->PostRequestURL( | 5519 FX_BOOL bFlags = pAppProvider->PostRequestURL( |
| 5531 CFX_WideString::FromUTF8(bsURL.AsByteStringC()).AsWideStringC(), | 5520 CFX_WideString::FromUTF8(bsURL.AsStringC()).AsStringC(), |
| 5532 CFX_WideString::FromUTF8(bsData.AsByteStringC()).AsWideStringC(), | 5521 CFX_WideString::FromUTF8(bsData.AsStringC()).AsStringC(), |
| 5533 CFX_WideString::FromUTF8(bsContentType.AsByteStringC()).AsWideStringC(), | 5522 CFX_WideString::FromUTF8(bsContentType.AsStringC()).AsStringC(), |
| 5534 CFX_WideString::FromUTF8(bsEncode.AsByteStringC()).AsWideStringC(), | 5523 CFX_WideString::FromUTF8(bsEncode.AsStringC()).AsStringC(), |
| 5535 CFX_WideString::FromUTF8(bsHeader.AsByteStringC()).AsWideStringC(), | 5524 CFX_WideString::FromUTF8(bsHeader.AsStringC()).AsStringC(), |
| 5536 decodedResponse); | 5525 decodedResponse); |
| 5537 FXJSE_Value_Release(argOne); | 5526 FXJSE_Value_Release(argOne); |
| 5538 FXJSE_Value_Release(argTwo); | 5527 FXJSE_Value_Release(argTwo); |
| 5539 if (argc > 2) { | 5528 if (argc > 2) { |
| 5540 FXJSE_Value_Release(argThree); | 5529 FXJSE_Value_Release(argThree); |
| 5541 } | 5530 } |
| 5542 if (argc > 3) { | 5531 if (argc > 3) { |
| 5543 FXJSE_Value_Release(argFour); | 5532 FXJSE_Value_Release(argFour); |
| 5544 } | 5533 } |
| 5545 if (argc > 4) { | 5534 if (argc > 4) { |
| 5546 FXJSE_Value_Release(argFive); | 5535 FXJSE_Value_Release(argFive); |
| 5547 } | 5536 } |
| 5548 if (bFlags) { | 5537 if (bFlags) { |
| 5549 FXJSE_Value_SetUTF8String( | 5538 FXJSE_Value_SetUTF8String( |
| 5550 args.GetReturnValue(), | 5539 args.GetReturnValue(), |
| 5551 FX_UTF8Encode(decodedResponse, decodedResponse.GetLength()) | 5540 FX_UTF8Encode(decodedResponse, decodedResponse.GetLength()) |
| 5552 .AsByteStringC()); | 5541 .AsStringC()); |
| 5553 } else { | 5542 } else { |
| 5554 pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY); | 5543 pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY); |
| 5555 } | 5544 } |
| 5556 } else { | 5545 } else { |
| 5557 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5546 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 5558 L"Post"); | 5547 L"Post"); |
| 5559 } | 5548 } |
| 5560 } | 5549 } |
| 5561 void CXFA_FM2JSContext::Put(FXJSE_HOBJECT hThis, | 5550 void CXFA_FM2JSContext::Put(FXJSE_HOBJECT hThis, |
| 5562 const CFX_ByteStringC& szFuncName, | 5551 const CFX_ByteStringC& szFuncName, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 5582 FXJSE_HVALUE argThree; | 5571 FXJSE_HVALUE argThree; |
| 5583 argOne = GetSimpleHValue(hThis, args, 0); | 5572 argOne = GetSimpleHValue(hThis, args, 0); |
| 5584 HValueToUTF8String(argOne, bsURL); | 5573 HValueToUTF8String(argOne, bsURL); |
| 5585 argTwo = GetSimpleHValue(hThis, args, 1); | 5574 argTwo = GetSimpleHValue(hThis, args, 1); |
| 5586 HValueToUTF8String(argTwo, bsData); | 5575 HValueToUTF8String(argTwo, bsData); |
| 5587 if (argc > 2) { | 5576 if (argc > 2) { |
| 5588 argThree = GetSimpleHValue(hThis, args, 2); | 5577 argThree = GetSimpleHValue(hThis, args, 2); |
| 5589 HValueToUTF8String(argThree, bsEncode); | 5578 HValueToUTF8String(argThree, bsEncode); |
| 5590 } | 5579 } |
| 5591 FX_BOOL bFlags = pAppProvider->PutRequestURL( | 5580 FX_BOOL bFlags = pAppProvider->PutRequestURL( |
| 5592 CFX_WideString::FromUTF8(bsURL.AsByteStringC()).AsWideStringC(), | 5581 CFX_WideString::FromUTF8(bsURL.AsStringC()).AsStringC(), |
| 5593 CFX_WideString::FromUTF8(bsData.AsByteStringC()).AsWideStringC(), | 5582 CFX_WideString::FromUTF8(bsData.AsStringC()).AsStringC(), |
| 5594 CFX_WideString::FromUTF8(bsEncode.AsByteStringC()).AsWideStringC()); | 5583 CFX_WideString::FromUTF8(bsEncode.AsStringC()).AsStringC()); |
| 5595 FXJSE_Value_Release(argOne); | 5584 FXJSE_Value_Release(argOne); |
| 5596 FXJSE_Value_Release(argTwo); | 5585 FXJSE_Value_Release(argTwo); |
| 5597 if (argc > 2) { | 5586 if (argc > 2) { |
| 5598 FXJSE_Value_Release(argThree); | 5587 FXJSE_Value_Release(argThree); |
| 5599 } | 5588 } |
| 5600 if (bFlags) { | 5589 if (bFlags) { |
| 5601 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 5590 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 5602 } else { | 5591 } else { |
| 5603 pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY); | 5592 pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY); |
| 5604 } | 5593 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 5632 if (!bSetStatus) { | 5621 if (!bSetStatus) { |
| 5633 pContext->ThrowScriptErrorMessage(XFA_IDS_NOT_DEFAUL_VALUE); | 5622 pContext->ThrowScriptErrorMessage(XFA_IDS_NOT_DEFAUL_VALUE); |
| 5634 break; | 5623 break; |
| 5635 } | 5624 } |
| 5636 } | 5625 } |
| 5637 } else { | 5626 } else { |
| 5638 CFX_ByteString propertyStr; | 5627 CFX_ByteString propertyStr; |
| 5639 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 5628 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 5640 for (int32_t i = 2; i < iLeftLength; i++) { | 5629 for (int32_t i = 2; i < iLeftLength; i++) { |
| 5641 FXJSE_Value_GetObjectPropByIdx(lValue, i, jsObjectValue); | 5630 FXJSE_Value_GetObjectPropByIdx(lValue, i, jsObjectValue); |
| 5642 FXJSE_Value_SetObjectProp(jsObjectValue, propertyStr.AsByteStringC(), | 5631 FXJSE_Value_SetObjectProp(jsObjectValue, propertyStr.AsStringC(), |
| 5643 rValue); | 5632 rValue); |
| 5644 } | 5633 } |
| 5645 } | 5634 } |
| 5646 FXJSE_Value_Release(jsObjectValue); | 5635 FXJSE_Value_Release(jsObjectValue); |
| 5647 FXJSE_Value_Release(propertyValue); | 5636 FXJSE_Value_Release(propertyValue); |
| 5648 } else if (FXJSE_Value_IsObject(lValue)) { | 5637 } else if (FXJSE_Value_IsObject(lValue)) { |
| 5649 bSetStatus = SetObjectDefaultValue(lValue, rValue); | 5638 bSetStatus = SetObjectDefaultValue(lValue, rValue); |
| 5650 if (!bSetStatus) { | 5639 if (!bSetStatus) { |
| 5651 pContext->ThrowScriptErrorMessage(XFA_IDS_NOT_DEFAUL_VALUE); | 5640 pContext->ThrowScriptErrorMessage(XFA_IDS_NOT_DEFAUL_VALUE); |
| 5652 } | 5641 } |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5818 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { | 5807 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { |
| 5819 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 5808 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
| 5820 } else if (FXJSE_Value_IsUTF8String(argFirst) && | 5809 } else if (FXJSE_Value_IsUTF8String(argFirst) && |
| 5821 FXJSE_Value_IsUTF8String(argSecond)) { | 5810 FXJSE_Value_IsUTF8String(argSecond)) { |
| 5822 CFX_ByteString firstOutput; | 5811 CFX_ByteString firstOutput; |
| 5823 CFX_ByteString secondOutput; | 5812 CFX_ByteString secondOutput; |
| 5824 FXJSE_Value_ToUTF8String(argFirst, firstOutput); | 5813 FXJSE_Value_ToUTF8String(argFirst, firstOutput); |
| 5825 FXJSE_Value_ToUTF8String(argSecond, secondOutput); | 5814 FXJSE_Value_ToUTF8String(argSecond, secondOutput); |
| 5826 FXJSE_Value_SetInteger( | 5815 FXJSE_Value_SetInteger( |
| 5827 args.GetReturnValue(), | 5816 args.GetReturnValue(), |
| 5828 firstOutput.Compare(secondOutput.AsByteStringC()) == -1); | 5817 firstOutput.Compare(secondOutput.AsStringC()) == -1); |
| 5829 } else { | 5818 } else { |
| 5830 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5819 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
| 5831 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5820 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
| 5832 FXJSE_Value_SetInteger(args.GetReturnValue(), (first < second) ? 1 : 0); | 5821 FXJSE_Value_SetInteger(args.GetReturnValue(), (first < second) ? 1 : 0); |
| 5833 } | 5822 } |
| 5834 FXJSE_Value_Release(argFirst); | 5823 FXJSE_Value_Release(argFirst); |
| 5835 FXJSE_Value_Release(argSecond); | 5824 FXJSE_Value_Release(argSecond); |
| 5836 } else { | 5825 } else { |
| 5837 CXFA_FM2JSContext* pContext = | 5826 CXFA_FM2JSContext* pContext = |
| 5838 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5827 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5851 (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) ? 1 | 5840 (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) ? 1 |
| 5852 : 0); | 5841 : 0); |
| 5853 } else if (FXJSE_Value_IsUTF8String(argFirst) && | 5842 } else if (FXJSE_Value_IsUTF8String(argFirst) && |
| 5854 FXJSE_Value_IsUTF8String(argSecond)) { | 5843 FXJSE_Value_IsUTF8String(argSecond)) { |
| 5855 CFX_ByteString firstOutput; | 5844 CFX_ByteString firstOutput; |
| 5856 CFX_ByteString secondOutput; | 5845 CFX_ByteString secondOutput; |
| 5857 FXJSE_Value_ToUTF8String(argFirst, firstOutput); | 5846 FXJSE_Value_ToUTF8String(argFirst, firstOutput); |
| 5858 FXJSE_Value_ToUTF8String(argSecond, secondOutput); | 5847 FXJSE_Value_ToUTF8String(argSecond, secondOutput); |
| 5859 FXJSE_Value_SetInteger( | 5848 FXJSE_Value_SetInteger( |
| 5860 args.GetReturnValue(), | 5849 args.GetReturnValue(), |
| 5861 firstOutput.Compare(secondOutput.AsByteStringC()) != 1); | 5850 firstOutput.Compare(secondOutput.AsStringC()) != 1); |
| 5862 } else { | 5851 } else { |
| 5863 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5852 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
| 5864 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5853 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
| 5865 FXJSE_Value_SetInteger(args.GetReturnValue(), (first <= second) ? 1 : 0); | 5854 FXJSE_Value_SetInteger(args.GetReturnValue(), (first <= second) ? 1 : 0); |
| 5866 } | 5855 } |
| 5867 FXJSE_Value_Release(argFirst); | 5856 FXJSE_Value_Release(argFirst); |
| 5868 FXJSE_Value_Release(argSecond); | 5857 FXJSE_Value_Release(argSecond); |
| 5869 } else { | 5858 } else { |
| 5870 CXFA_FM2JSContext* pContext = | 5859 CXFA_FM2JSContext* pContext = |
| 5871 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5860 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 5872 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5861 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| 5873 } | 5862 } |
| 5874 } | 5863 } |
| 5875 void CXFA_FM2JSContext::greater_operator(FXJSE_HOBJECT hThis, | 5864 void CXFA_FM2JSContext::greater_operator(FXJSE_HOBJECT hThis, |
| 5876 const CFX_ByteStringC& szFuncName, | 5865 const CFX_ByteStringC& szFuncName, |
| 5877 CFXJSE_Arguments& args) { | 5866 CFXJSE_Arguments& args) { |
| 5878 if (args.GetLength() == 2) { | 5867 if (args.GetLength() == 2) { |
| 5879 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); | 5868 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); |
| 5880 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); | 5869 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); |
| 5881 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { | 5870 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { |
| 5882 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 5871 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
| 5883 } else if (FXJSE_Value_IsUTF8String(argFirst) && | 5872 } else if (FXJSE_Value_IsUTF8String(argFirst) && |
| 5884 FXJSE_Value_IsUTF8String(argSecond)) { | 5873 FXJSE_Value_IsUTF8String(argSecond)) { |
| 5885 CFX_ByteString firstOutput; | 5874 CFX_ByteString firstOutput; |
| 5886 CFX_ByteString secondOutput; | 5875 CFX_ByteString secondOutput; |
| 5887 FXJSE_Value_ToUTF8String(argFirst, firstOutput); | 5876 FXJSE_Value_ToUTF8String(argFirst, firstOutput); |
| 5888 FXJSE_Value_ToUTF8String(argSecond, secondOutput); | 5877 FXJSE_Value_ToUTF8String(argSecond, secondOutput); |
| 5889 FXJSE_Value_SetInteger( | 5878 FXJSE_Value_SetInteger( |
| 5890 args.GetReturnValue(), | 5879 args.GetReturnValue(), |
| 5891 firstOutput.Compare(secondOutput.AsByteStringC()) == 1); | 5880 firstOutput.Compare(secondOutput.AsStringC()) == 1); |
| 5892 } else { | 5881 } else { |
| 5893 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5882 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
| 5894 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5883 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
| 5895 FXJSE_Value_SetInteger(args.GetReturnValue(), (first > second) ? 1 : 0); | 5884 FXJSE_Value_SetInteger(args.GetReturnValue(), (first > second) ? 1 : 0); |
| 5896 } | 5885 } |
| 5897 FXJSE_Value_Release(argFirst); | 5886 FXJSE_Value_Release(argFirst); |
| 5898 FXJSE_Value_Release(argSecond); | 5887 FXJSE_Value_Release(argSecond); |
| 5899 } else { | 5888 } else { |
| 5900 CXFA_FM2JSContext* pContext = | 5889 CXFA_FM2JSContext* pContext = |
| 5901 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5890 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5914 (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) ? 1 | 5903 (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) ? 1 |
| 5915 : 0); | 5904 : 0); |
| 5916 } else if (FXJSE_Value_IsUTF8String(argFirst) && | 5905 } else if (FXJSE_Value_IsUTF8String(argFirst) && |
| 5917 FXJSE_Value_IsUTF8String(argSecond)) { | 5906 FXJSE_Value_IsUTF8String(argSecond)) { |
| 5918 CFX_ByteString firstOutput; | 5907 CFX_ByteString firstOutput; |
| 5919 CFX_ByteString secondOutput; | 5908 CFX_ByteString secondOutput; |
| 5920 FXJSE_Value_ToUTF8String(argFirst, firstOutput); | 5909 FXJSE_Value_ToUTF8String(argFirst, firstOutput); |
| 5921 FXJSE_Value_ToUTF8String(argSecond, secondOutput); | 5910 FXJSE_Value_ToUTF8String(argSecond, secondOutput); |
| 5922 FXJSE_Value_SetInteger( | 5911 FXJSE_Value_SetInteger( |
| 5923 args.GetReturnValue(), | 5912 args.GetReturnValue(), |
| 5924 firstOutput.Compare(secondOutput.AsByteStringC()) != -1); | 5913 firstOutput.Compare(secondOutput.AsStringC()) != -1); |
| 5925 } else { | 5914 } else { |
| 5926 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5915 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
| 5927 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5916 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
| 5928 FXJSE_Value_SetInteger(args.GetReturnValue(), (first >= second) ? 1 : 0); | 5917 FXJSE_Value_SetInteger(args.GetReturnValue(), (first >= second) ? 1 : 0); |
| 5929 } | 5918 } |
| 5930 FXJSE_Value_Release(argFirst); | 5919 FXJSE_Value_Release(argFirst); |
| 5931 FXJSE_Value_Release(argSecond); | 5920 FXJSE_Value_Release(argSecond); |
| 5932 } else { | 5921 } else { |
| 5933 CXFA_FM2JSContext* pContext = | 5922 CXFA_FM2JSContext* pContext = |
| 5934 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5923 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6094 CFX_ByteString szName = args.GetUTF8String(2); | 6083 CFX_ByteString szName = args.GetUTF8String(2); |
| 6095 int32_t iIndexFlags = args.GetInt32(3); | 6084 int32_t iIndexFlags = args.GetInt32(3); |
| 6096 int32_t iIndexValue = 0; | 6085 int32_t iIndexValue = 0; |
| 6097 FXJSE_HVALUE argIndex = NULL; | 6086 FXJSE_HVALUE argIndex = NULL; |
| 6098 if (argc == 5) { | 6087 if (argc == 5) { |
| 6099 bIsStar = FALSE; | 6088 bIsStar = FALSE; |
| 6100 argIndex = args.GetValue(4); | 6089 argIndex = args.GetValue(4); |
| 6101 iIndexValue = HValueToInteger(hThis, argIndex); | 6090 iIndexValue = HValueToInteger(hThis, argIndex); |
| 6102 } | 6091 } |
| 6103 CFX_ByteString szSomExp; | 6092 CFX_ByteString szSomExp; |
| 6104 GenerateSomExpression(szName.AsByteStringC(), iIndexFlags, iIndexValue, | 6093 GenerateSomExpression(szName.AsStringC(), iIndexFlags, iIndexValue, bIsStar, |
| 6105 bIsStar, szSomExp); | 6094 szSomExp); |
| 6106 if (FXJSE_Value_IsArray(argAccessor)) { | 6095 if (FXJSE_Value_IsArray(argAccessor)) { |
| 6107 FXJSE_HVALUE hLengthValue = FXJSE_Value_Create(hruntime); | 6096 FXJSE_HVALUE hLengthValue = FXJSE_Value_Create(hruntime); |
| 6108 FXJSE_Value_GetObjectProp(argAccessor, "length", hLengthValue); | 6097 FXJSE_Value_GetObjectProp(argAccessor, "length", hLengthValue); |
| 6109 int32_t iLength = FXJSE_Value_ToInteger(hLengthValue); | 6098 int32_t iLength = FXJSE_Value_ToInteger(hLengthValue); |
| 6110 FXJSE_Value_Release(hLengthValue); | 6099 FXJSE_Value_Release(hLengthValue); |
| 6111 int32_t iCounter = 0; | 6100 int32_t iCounter = 0; |
| 6112 FXJSE_HVALUE** hResolveValues = FX_Alloc(FXJSE_HVALUE*, iLength - 2); | 6101 FXJSE_HVALUE** hResolveValues = FX_Alloc(FXJSE_HVALUE*, iLength - 2); |
| 6113 int32_t* iSizes = FX_Alloc(int32_t, iLength - 2); | 6102 int32_t* iSizes = FX_Alloc(int32_t, iLength - 2); |
| 6114 for (int32_t i = 0; i < (iLength - 2); i++) { | 6103 for (int32_t i = 0; i < (iLength - 2); i++) { |
| 6115 iSizes[i] = 0; | 6104 iSizes[i] = 0; |
| 6116 } | 6105 } |
| 6117 FXJSE_HVALUE hJSObjValue = FXJSE_Value_Create(hruntime); | 6106 FXJSE_HVALUE hJSObjValue = FXJSE_Value_Create(hruntime); |
| 6118 FX_BOOL bAttribute = FALSE; | 6107 FX_BOOL bAttribute = FALSE; |
| 6119 for (int32_t i = 2; i < iLength; i++) { | 6108 for (int32_t i = 2; i < iLength; i++) { |
| 6120 FXJSE_Value_GetObjectPropByIdx(argAccessor, i, hJSObjValue); | 6109 FXJSE_Value_GetObjectPropByIdx(argAccessor, i, hJSObjValue); |
| 6121 XFA_RESOLVENODE_RS resoveNodeRS; | 6110 XFA_RESOLVENODE_RS resoveNodeRS; |
| 6122 int32_t iRet = | 6111 int32_t iRet = ResolveObjects(hThis, hJSObjValue, szSomExp.AsStringC(), |
| 6123 ResolveObjects(hThis, hJSObjValue, szSomExp.AsByteStringC(), | 6112 resoveNodeRS, TRUE, szName.IsEmpty()); |
| 6124 resoveNodeRS, TRUE, szName.IsEmpty()); | |
| 6125 if (iRet > 0) { | 6113 if (iRet > 0) { |
| 6126 ParseResolveResult(hThis, resoveNodeRS, hJSObjValue, | 6114 ParseResolveResult(hThis, resoveNodeRS, hJSObjValue, |
| 6127 hResolveValues[i - 2], iSizes[i - 2], bAttribute); | 6115 hResolveValues[i - 2], iSizes[i - 2], bAttribute); |
| 6128 iCounter += iSizes[i - 2]; | 6116 iCounter += iSizes[i - 2]; |
| 6129 } | 6117 } |
| 6130 } | 6118 } |
| 6131 FXJSE_Value_Release(hJSObjValue); | 6119 FXJSE_Value_Release(hJSObjValue); |
| 6132 if (iCounter > 0) { | 6120 if (iCounter > 0) { |
| 6133 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iCounter + 2); | 6121 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iCounter + 2); |
| 6134 for (int32_t i = 0; i < (iCounter + 2); i++) { | 6122 for (int32_t i = 0; i < (iCounter + 2); i++) { |
| 6135 rgValues[i] = FXJSE_Value_Create(hruntime); | 6123 rgValues[i] = FXJSE_Value_Create(hruntime); |
| 6136 } | 6124 } |
| 6137 FXJSE_Value_SetInteger(rgValues[0], 1); | 6125 FXJSE_Value_SetInteger(rgValues[0], 1); |
| 6138 if (bAttribute) { | 6126 if (bAttribute) { |
| 6139 FXJSE_Value_SetUTF8String(rgValues[1], szName.AsByteStringC()); | 6127 FXJSE_Value_SetUTF8String(rgValues[1], szName.AsStringC()); |
| 6140 } else { | 6128 } else { |
| 6141 FXJSE_Value_SetNull(rgValues[1]); | 6129 FXJSE_Value_SetNull(rgValues[1]); |
| 6142 } | 6130 } |
| 6143 int32_t iIndex = 2; | 6131 int32_t iIndex = 2; |
| 6144 for (int32_t i = 0; i < iLength - 2; i++) { | 6132 for (int32_t i = 0; i < iLength - 2; i++) { |
| 6145 for (int32_t j = 0; j < iSizes[i]; j++) { | 6133 for (int32_t j = 0; j < iSizes[i]; j++) { |
| 6146 FXJSE_Value_Set(rgValues[iIndex], hResolveValues[i][j]); | 6134 FXJSE_Value_Set(rgValues[iIndex], hResolveValues[i][j]); |
| 6147 iIndex++; | 6135 iIndex++; |
| 6148 } | 6136 } |
| 6149 } | 6137 } |
| 6150 FXJSE_Value_SetArray(args.GetReturnValue(), (iCounter + 2), rgValues); | 6138 FXJSE_Value_SetArray(args.GetReturnValue(), (iCounter + 2), rgValues); |
| 6151 for (int32_t i = 0; i < (iCounter + 2); i++) { | 6139 for (int32_t i = 0; i < (iCounter + 2); i++) { |
| 6152 FXJSE_Value_Release(rgValues[i]); | 6140 FXJSE_Value_Release(rgValues[i]); |
| 6153 } | 6141 } |
| 6154 FX_Free(rgValues); | 6142 FX_Free(rgValues); |
| 6155 } else { | 6143 } else { |
| 6156 CFX_WideString wsPropertyName = | 6144 CFX_WideString wsPropertyName = |
| 6157 CFX_WideString::FromUTF8(szName.AsByteStringC()); | 6145 CFX_WideString::FromUTF8(szName.AsStringC()); |
| 6158 CFX_WideString wsSomExpression = | 6146 CFX_WideString wsSomExpression = |
| 6159 CFX_WideString::FromUTF8(szSomExp.AsByteStringC()); | 6147 CFX_WideString::FromUTF8(szSomExp.AsStringC()); |
| 6160 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, | 6148 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, |
| 6161 (const FX_WCHAR*)wsPropertyName, | 6149 (const FX_WCHAR*)wsPropertyName, |
| 6162 (const FX_WCHAR*)wsSomExpression); | 6150 (const FX_WCHAR*)wsSomExpression); |
| 6163 } | 6151 } |
| 6164 for (int32_t i = 0; i < iLength - 2; i++) { | 6152 for (int32_t i = 0; i < iLength - 2; i++) { |
| 6165 for (int32_t j = 0; j < iSizes[i]; j++) { | 6153 for (int32_t j = 0; j < iSizes[i]; j++) { |
| 6166 FXJSE_Value_Release(hResolveValues[i][j]); | 6154 FXJSE_Value_Release(hResolveValues[i][j]); |
| 6167 } | 6155 } |
| 6168 if (iSizes[i] > 0) { | 6156 if (iSizes[i] > 0) { |
| 6169 FX_Free(hResolveValues[i]); | 6157 FX_Free(hResolveValues[i]); |
| 6170 } | 6158 } |
| 6171 } | 6159 } |
| 6172 FX_Free(hResolveValues); | 6160 FX_Free(hResolveValues); |
| 6173 FX_Free(iSizes); | 6161 FX_Free(iSizes); |
| 6174 } else { | 6162 } else { |
| 6175 XFA_RESOLVENODE_RS resoveNodeRS; | 6163 XFA_RESOLVENODE_RS resoveNodeRS; |
| 6176 int32_t iRet = 0; | 6164 int32_t iRet = 0; |
| 6177 if (FXJSE_Value_IsObject(argAccessor) || | 6165 if (FXJSE_Value_IsObject(argAccessor) || |
| 6178 (FXJSE_Value_IsNull(argAccessor) && bsAccessorName.IsEmpty())) { | 6166 (FXJSE_Value_IsNull(argAccessor) && bsAccessorName.IsEmpty())) { |
| 6179 iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsByteStringC(), | 6167 iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsStringC(), |
| 6180 resoveNodeRS, TRUE, szName.IsEmpty()); | 6168 resoveNodeRS, TRUE, szName.IsEmpty()); |
| 6181 } else if (!FXJSE_Value_IsObject(argAccessor) && | 6169 } else if (!FXJSE_Value_IsObject(argAccessor) && |
| 6182 !bsAccessorName.IsEmpty()) { | 6170 !bsAccessorName.IsEmpty()) { |
| 6183 FX_BOOL bGetObject = | 6171 FX_BOOL bGetObject = |
| 6184 GetObjectByName(hThis, argAccessor, bsAccessorName.AsByteStringC()); | 6172 GetObjectByName(hThis, argAccessor, bsAccessorName.AsStringC()); |
| 6185 if (bGetObject) { | 6173 if (bGetObject) { |
| 6186 iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsByteStringC(), | 6174 iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsStringC(), |
| 6187 resoveNodeRS, TRUE, szName.IsEmpty()); | 6175 resoveNodeRS, TRUE, szName.IsEmpty()); |
| 6188 } | 6176 } |
| 6189 } | 6177 } |
| 6190 if (iRet > 0) { | 6178 if (iRet > 0) { |
| 6191 FXJSE_HVALUE* hResolveValues; | 6179 FXJSE_HVALUE* hResolveValues; |
| 6192 int32_t iSize = 0; | 6180 int32_t iSize = 0; |
| 6193 FX_BOOL bAttribute = FALSE; | 6181 FX_BOOL bAttribute = FALSE; |
| 6194 ParseResolveResult(hThis, resoveNodeRS, argAccessor, hResolveValues, | 6182 ParseResolveResult(hThis, resoveNodeRS, argAccessor, hResolveValues, |
| 6195 iSize, bAttribute); | 6183 iSize, bAttribute); |
| 6196 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iSize + 2); | 6184 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iSize + 2); |
| 6197 for (int32_t i = 0; i < (iSize + 2); i++) { | 6185 for (int32_t i = 0; i < (iSize + 2); i++) { |
| 6198 rgValues[i] = FXJSE_Value_Create(hruntime); | 6186 rgValues[i] = FXJSE_Value_Create(hruntime); |
| 6199 } | 6187 } |
| 6200 FXJSE_Value_SetInteger(rgValues[0], 1); | 6188 FXJSE_Value_SetInteger(rgValues[0], 1); |
| 6201 if (bAttribute) { | 6189 if (bAttribute) { |
| 6202 FXJSE_Value_SetUTF8String(rgValues[1], szName.AsByteStringC()); | 6190 FXJSE_Value_SetUTF8String(rgValues[1], szName.AsStringC()); |
| 6203 } else { | 6191 } else { |
| 6204 FXJSE_Value_SetNull(rgValues[1]); | 6192 FXJSE_Value_SetNull(rgValues[1]); |
| 6205 } | 6193 } |
| 6206 for (int32_t i = 0; i < iSize; i++) { | 6194 for (int32_t i = 0; i < iSize; i++) { |
| 6207 FXJSE_Value_Set(rgValues[i + 2], hResolveValues[i]); | 6195 FXJSE_Value_Set(rgValues[i + 2], hResolveValues[i]); |
| 6208 } | 6196 } |
| 6209 FXJSE_Value_SetArray(args.GetReturnValue(), (iSize + 2), rgValues); | 6197 FXJSE_Value_SetArray(args.GetReturnValue(), (iSize + 2), rgValues); |
| 6210 for (int32_t i = 0; i < (iSize + 2); i++) { | 6198 for (int32_t i = 0; i < (iSize + 2); i++) { |
| 6211 FXJSE_Value_Release(rgValues[i]); | 6199 FXJSE_Value_Release(rgValues[i]); |
| 6212 } | 6200 } |
| 6213 FX_Free(rgValues); | 6201 FX_Free(rgValues); |
| 6214 for (int32_t i = 0; i < iSize; i++) { | 6202 for (int32_t i = 0; i < iSize; i++) { |
| 6215 FXJSE_Value_Release(hResolveValues[i]); | 6203 FXJSE_Value_Release(hResolveValues[i]); |
| 6216 } | 6204 } |
| 6217 FX_Free(hResolveValues); | 6205 FX_Free(hResolveValues); |
| 6218 } else { | 6206 } else { |
| 6219 CFX_WideString wsPropertyName = | 6207 CFX_WideString wsPropertyName = |
| 6220 CFX_WideString::FromUTF8(szName.AsByteStringC()); | 6208 CFX_WideString::FromUTF8(szName.AsStringC()); |
| 6221 CFX_WideString wsSomExpression = | 6209 CFX_WideString wsSomExpression = |
| 6222 CFX_WideString::FromUTF8(szSomExp.AsByteStringC()); | 6210 CFX_WideString::FromUTF8(szSomExp.AsStringC()); |
| 6223 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, | 6211 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, |
| 6224 (const FX_WCHAR*)wsPropertyName, | 6212 (const FX_WCHAR*)wsPropertyName, |
| 6225 (const FX_WCHAR*)wsSomExpression); | 6213 (const FX_WCHAR*)wsSomExpression); |
| 6226 } | 6214 } |
| 6227 } | 6215 } |
| 6228 if (argc == 5) { | 6216 if (argc == 5) { |
| 6229 FXJSE_Value_Release(argIndex); | 6217 FXJSE_Value_Release(argIndex); |
| 6230 } | 6218 } |
| 6231 FXJSE_Value_Release(argAccessor); | 6219 FXJSE_Value_Release(argAccessor); |
| 6232 } else { | 6220 } else { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 6247 CFX_ByteString szName = args.GetUTF8String(2); | 6235 CFX_ByteString szName = args.GetUTF8String(2); |
| 6248 int32_t iIndexFlags = args.GetInt32(3); | 6236 int32_t iIndexFlags = args.GetInt32(3); |
| 6249 int32_t iIndexValue = 0; | 6237 int32_t iIndexValue = 0; |
| 6250 FXJSE_HVALUE argIndex = NULL; | 6238 FXJSE_HVALUE argIndex = NULL; |
| 6251 if (argc == 5) { | 6239 if (argc == 5) { |
| 6252 bIsStar = FALSE; | 6240 bIsStar = FALSE; |
| 6253 argIndex = args.GetValue(4); | 6241 argIndex = args.GetValue(4); |
| 6254 iIndexValue = HValueToInteger(hThis, argIndex); | 6242 iIndexValue = HValueToInteger(hThis, argIndex); |
| 6255 } | 6243 } |
| 6256 CFX_ByteString szSomExp; | 6244 CFX_ByteString szSomExp; |
| 6257 GenerateSomExpression(szName.AsByteStringC(), iIndexFlags, iIndexValue, | 6245 GenerateSomExpression(szName.AsStringC(), iIndexFlags, iIndexValue, bIsStar, |
| 6258 bIsStar, szSomExp); | 6246 szSomExp); |
| 6259 if (FXJSE_Value_IsArray(argAccessor)) { | 6247 if (FXJSE_Value_IsArray(argAccessor)) { |
| 6260 FXJSE_HVALUE hLengthValue = FXJSE_Value_Create(hruntime); | 6248 FXJSE_HVALUE hLengthValue = FXJSE_Value_Create(hruntime); |
| 6261 FXJSE_Value_GetObjectProp(argAccessor, "length", hLengthValue); | 6249 FXJSE_Value_GetObjectProp(argAccessor, "length", hLengthValue); |
| 6262 int32_t iLength = FXJSE_Value_ToInteger(hLengthValue); | 6250 int32_t iLength = FXJSE_Value_ToInteger(hLengthValue); |
| 6263 int32_t iCounter = 0; | 6251 int32_t iCounter = 0; |
| 6264 FXJSE_HVALUE** hResolveValues = FX_Alloc(FXJSE_HVALUE*, iLength - 2); | 6252 FXJSE_HVALUE** hResolveValues = FX_Alloc(FXJSE_HVALUE*, iLength - 2); |
| 6265 int32_t* iSizes = FX_Alloc(int32_t, iLength - 2); | 6253 int32_t* iSizes = FX_Alloc(int32_t, iLength - 2); |
| 6266 FXJSE_HVALUE hJSObjValue = FXJSE_Value_Create(hruntime); | 6254 FXJSE_HVALUE hJSObjValue = FXJSE_Value_Create(hruntime); |
| 6267 FX_BOOL bAttribute = FALSE; | 6255 FX_BOOL bAttribute = FALSE; |
| 6268 for (int32_t i = 2; i < iLength; i++) { | 6256 for (int32_t i = 2; i < iLength; i++) { |
| 6269 FXJSE_Value_GetObjectPropByIdx(argAccessor, i, hJSObjValue); | 6257 FXJSE_Value_GetObjectPropByIdx(argAccessor, i, hJSObjValue); |
| 6270 XFA_RESOLVENODE_RS resoveNodeRS; | 6258 XFA_RESOLVENODE_RS resoveNodeRS; |
| 6271 int32_t iRet = ResolveObjects( | 6259 int32_t iRet = ResolveObjects(hThis, hJSObjValue, szSomExp.AsStringC(), |
| 6272 hThis, hJSObjValue, szSomExp.AsByteStringC(), resoveNodeRS, FALSE); | 6260 resoveNodeRS, FALSE); |
| 6273 if (iRet > 0) { | 6261 if (iRet > 0) { |
| 6274 ParseResolveResult(hThis, resoveNodeRS, hJSObjValue, | 6262 ParseResolveResult(hThis, resoveNodeRS, hJSObjValue, |
| 6275 hResolveValues[i - 2], iSizes[i - 2], bAttribute); | 6263 hResolveValues[i - 2], iSizes[i - 2], bAttribute); |
| 6276 iCounter += iSizes[i - 2]; | 6264 iCounter += iSizes[i - 2]; |
| 6277 } | 6265 } |
| 6278 } | 6266 } |
| 6279 FXJSE_Value_Release(hJSObjValue); | 6267 FXJSE_Value_Release(hJSObjValue); |
| 6280 if (iCounter > 0) { | 6268 if (iCounter > 0) { |
| 6281 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iCounter + 2); | 6269 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iCounter + 2); |
| 6282 for (int32_t i = 0; i < (iCounter + 2); i++) { | 6270 for (int32_t i = 0; i < (iCounter + 2); i++) { |
| 6283 rgValues[i] = FXJSE_Value_Create(hruntime); | 6271 rgValues[i] = FXJSE_Value_Create(hruntime); |
| 6284 } | 6272 } |
| 6285 FXJSE_Value_SetInteger(rgValues[0], 1); | 6273 FXJSE_Value_SetInteger(rgValues[0], 1); |
| 6286 if (bAttribute) { | 6274 if (bAttribute) { |
| 6287 FXJSE_Value_SetUTF8String(rgValues[1], szName.AsByteStringC()); | 6275 FXJSE_Value_SetUTF8String(rgValues[1], szName.AsStringC()); |
| 6288 } else { | 6276 } else { |
| 6289 FXJSE_Value_SetNull(rgValues[1]); | 6277 FXJSE_Value_SetNull(rgValues[1]); |
| 6290 } | 6278 } |
| 6291 int32_t iIndex = 2; | 6279 int32_t iIndex = 2; |
| 6292 for (int32_t i = 0; i < iLength - 2; i++) { | 6280 for (int32_t i = 0; i < iLength - 2; i++) { |
| 6293 for (int32_t j = 0; j < iSizes[i]; j++) { | 6281 for (int32_t j = 0; j < iSizes[i]; j++) { |
| 6294 FXJSE_Value_Set(rgValues[iIndex], hResolveValues[i][j]); | 6282 FXJSE_Value_Set(rgValues[iIndex], hResolveValues[i][j]); |
| 6295 iIndex++; | 6283 iIndex++; |
| 6296 } | 6284 } |
| 6297 } | 6285 } |
| 6298 FXJSE_Value_SetArray(args.GetReturnValue(), (iCounter + 2), rgValues); | 6286 FXJSE_Value_SetArray(args.GetReturnValue(), (iCounter + 2), rgValues); |
| 6299 for (int32_t i = 0; i < (iCounter + 2); i++) { | 6287 for (int32_t i = 0; i < (iCounter + 2); i++) { |
| 6300 FXJSE_Value_Release(rgValues[i]); | 6288 FXJSE_Value_Release(rgValues[i]); |
| 6301 } | 6289 } |
| 6302 FX_Free(rgValues); | 6290 FX_Free(rgValues); |
| 6303 } else { | 6291 } else { |
| 6304 CFX_WideString wsPropertyName = | 6292 CFX_WideString wsPropertyName = |
| 6305 CFX_WideString::FromUTF8(szName.AsByteStringC()); | 6293 CFX_WideString::FromUTF8(szName.AsStringC()); |
| 6306 CFX_WideString wsSomExpression = | 6294 CFX_WideString wsSomExpression = |
| 6307 CFX_WideString::FromUTF8(szSomExp.AsByteStringC()); | 6295 CFX_WideString::FromUTF8(szSomExp.AsStringC()); |
| 6308 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, | 6296 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, |
| 6309 (const FX_WCHAR*)wsPropertyName, | 6297 (const FX_WCHAR*)wsPropertyName, |
| 6310 (const FX_WCHAR*)wsSomExpression); | 6298 (const FX_WCHAR*)wsSomExpression); |
| 6311 } | 6299 } |
| 6312 for (int32_t i = 0; i < iLength - 2; i++) { | 6300 for (int32_t i = 0; i < iLength - 2; i++) { |
| 6313 for (int32_t j = 0; j < iSizes[i]; j++) { | 6301 for (int32_t j = 0; j < iSizes[i]; j++) { |
| 6314 FXJSE_Value_Release(hResolveValues[i][j]); | 6302 FXJSE_Value_Release(hResolveValues[i][j]); |
| 6315 } | 6303 } |
| 6316 FX_Free(hResolveValues[i]); | 6304 FX_Free(hResolveValues[i]); |
| 6317 } | 6305 } |
| 6318 FX_Free(hResolveValues); | 6306 FX_Free(hResolveValues); |
| 6319 FX_Free(iSizes); | 6307 FX_Free(iSizes); |
| 6320 FXJSE_Value_Release(hLengthValue); | 6308 FXJSE_Value_Release(hLengthValue); |
| 6321 } else { | 6309 } else { |
| 6322 XFA_RESOLVENODE_RS resoveNodeRS; | 6310 XFA_RESOLVENODE_RS resoveNodeRS; |
| 6323 int32_t iRet = 0; | 6311 int32_t iRet = 0; |
| 6324 if (FXJSE_Value_IsObject(argAccessor) || | 6312 if (FXJSE_Value_IsObject(argAccessor) || |
| 6325 (FXJSE_Value_IsNull(argAccessor) && bsAccessorName.IsEmpty())) { | 6313 (FXJSE_Value_IsNull(argAccessor) && bsAccessorName.IsEmpty())) { |
| 6326 iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsByteStringC(), | 6314 iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsStringC(), |
| 6327 resoveNodeRS, FALSE); | 6315 resoveNodeRS, FALSE); |
| 6328 } else if (!FXJSE_Value_IsObject(argAccessor) && | 6316 } else if (!FXJSE_Value_IsObject(argAccessor) && |
| 6329 !bsAccessorName.IsEmpty()) { | 6317 !bsAccessorName.IsEmpty()) { |
| 6330 FX_BOOL bGetObject = | 6318 FX_BOOL bGetObject = |
| 6331 GetObjectByName(hThis, argAccessor, bsAccessorName.AsByteStringC()); | 6319 GetObjectByName(hThis, argAccessor, bsAccessorName.AsStringC()); |
| 6332 if (bGetObject) { | 6320 if (bGetObject) { |
| 6333 iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsByteStringC(), | 6321 iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsStringC(), |
| 6334 resoveNodeRS, FALSE); | 6322 resoveNodeRS, FALSE); |
| 6335 } | 6323 } |
| 6336 } | 6324 } |
| 6337 if (iRet > 0) { | 6325 if (iRet > 0) { |
| 6338 FXJSE_HVALUE* hResolveValues; | 6326 FXJSE_HVALUE* hResolveValues; |
| 6339 int32_t iSize = 0; | 6327 int32_t iSize = 0; |
| 6340 FX_BOOL bAttribute = FALSE; | 6328 FX_BOOL bAttribute = FALSE; |
| 6341 ParseResolveResult(hThis, resoveNodeRS, argAccessor, hResolveValues, | 6329 ParseResolveResult(hThis, resoveNodeRS, argAccessor, hResolveValues, |
| 6342 iSize, bAttribute); | 6330 iSize, bAttribute); |
| 6343 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iSize + 2); | 6331 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iSize + 2); |
| 6344 for (int32_t i = 0; i < (iSize + 2); i++) { | 6332 for (int32_t i = 0; i < (iSize + 2); i++) { |
| 6345 rgValues[i] = FXJSE_Value_Create(hruntime); | 6333 rgValues[i] = FXJSE_Value_Create(hruntime); |
| 6346 } | 6334 } |
| 6347 FXJSE_Value_SetInteger(rgValues[0], 1); | 6335 FXJSE_Value_SetInteger(rgValues[0], 1); |
| 6348 if (bAttribute) { | 6336 if (bAttribute) { |
| 6349 FXJSE_Value_SetUTF8String(rgValues[1], szName.AsByteStringC()); | 6337 FXJSE_Value_SetUTF8String(rgValues[1], szName.AsStringC()); |
| 6350 } else { | 6338 } else { |
| 6351 FXJSE_Value_SetNull(rgValues[1]); | 6339 FXJSE_Value_SetNull(rgValues[1]); |
| 6352 } | 6340 } |
| 6353 for (int32_t i = 0; i < iSize; i++) { | 6341 for (int32_t i = 0; i < iSize; i++) { |
| 6354 FXJSE_Value_Set(rgValues[i + 2], hResolveValues[i]); | 6342 FXJSE_Value_Set(rgValues[i + 2], hResolveValues[i]); |
| 6355 } | 6343 } |
| 6356 FXJSE_Value_SetArray(args.GetReturnValue(), (iSize + 2), rgValues); | 6344 FXJSE_Value_SetArray(args.GetReturnValue(), (iSize + 2), rgValues); |
| 6357 for (int32_t i = 0; i < (iSize + 2); i++) { | 6345 for (int32_t i = 0; i < (iSize + 2); i++) { |
| 6358 FXJSE_Value_Release(rgValues[i]); | 6346 FXJSE_Value_Release(rgValues[i]); |
| 6359 } | 6347 } |
| 6360 FX_Free(rgValues); | 6348 FX_Free(rgValues); |
| 6361 for (int32_t i = 0; i < iSize; i++) { | 6349 for (int32_t i = 0; i < iSize; i++) { |
| 6362 FXJSE_Value_Release(hResolveValues[i]); | 6350 FXJSE_Value_Release(hResolveValues[i]); |
| 6363 } | 6351 } |
| 6364 FX_Free(hResolveValues); | 6352 FX_Free(hResolveValues); |
| 6365 } else { | 6353 } else { |
| 6366 CFX_WideString wsPropertyName = | 6354 CFX_WideString wsPropertyName = |
| 6367 CFX_WideString::FromUTF8(szName.AsByteStringC()); | 6355 CFX_WideString::FromUTF8(szName.AsStringC()); |
| 6368 CFX_WideString wsSomExpression = | 6356 CFX_WideString wsSomExpression = |
| 6369 CFX_WideString::FromUTF8(szSomExp.AsByteStringC()); | 6357 CFX_WideString::FromUTF8(szSomExp.AsStringC()); |
| 6370 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, | 6358 pContext->ThrowScriptErrorMessage(XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT, |
| 6371 (const FX_WCHAR*)wsPropertyName, | 6359 (const FX_WCHAR*)wsPropertyName, |
| 6372 (const FX_WCHAR*)wsSomExpression); | 6360 (const FX_WCHAR*)wsSomExpression); |
| 6373 } | 6361 } |
| 6374 } | 6362 } |
| 6375 if (argc == 5) { | 6363 if (argc == 5) { |
| 6376 FXJSE_Value_Release(argIndex); | 6364 FXJSE_Value_Release(argIndex); |
| 6377 } | 6365 } |
| 6378 FXJSE_Value_Release(argAccessor); | 6366 FXJSE_Value_Release(argAccessor); |
| 6379 } else { | 6367 } else { |
| 6380 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 6368 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| 6381 } | 6369 } |
| 6382 } | 6370 } |
| 6383 void CXFA_FM2JSContext::eval_translation(FXJSE_HOBJECT hThis, | 6371 void CXFA_FM2JSContext::eval_translation(FXJSE_HOBJECT hThis, |
| 6384 const CFX_ByteStringC& szFuncName, | 6372 const CFX_ByteStringC& szFuncName, |
| 6385 CFXJSE_Arguments& args) { | 6373 CFXJSE_Arguments& args) { |
| 6386 CXFA_FM2JSContext* pContext = | 6374 CXFA_FM2JSContext* pContext = |
| 6387 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 6375 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 6388 int32_t argc = args.GetLength(); | 6376 int32_t argc = args.GetLength(); |
| 6389 if (argc == 1) { | 6377 if (argc == 1) { |
| 6390 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 6378 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 6391 CFX_ByteString argString; | 6379 CFX_ByteString argString; |
| 6392 HValueToUTF8String(argOne, argString); | 6380 HValueToUTF8String(argOne, argString); |
| 6393 if (argString.IsEmpty()) { | 6381 if (argString.IsEmpty()) { |
| 6394 pContext->ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); | 6382 pContext->ThrowScriptErrorMessage(XFA_IDS_ARGUMENT_MISMATCH); |
| 6395 } else { | 6383 } else { |
| 6396 CFX_WideString scriptString = | 6384 CFX_WideString scriptString = |
| 6397 CFX_WideString::FromUTF8(argString.AsByteStringC()); | 6385 CFX_WideString::FromUTF8(argString.AsStringC()); |
| 6398 CFX_WideTextBuf wsJavaScriptBuf; | 6386 CFX_WideTextBuf wsJavaScriptBuf; |
| 6399 CFX_WideString wsError; | 6387 CFX_WideString wsError; |
| 6400 XFA_FM2JS_Translate(scriptString.AsWideStringC(), wsJavaScriptBuf, | 6388 XFA_FM2JS_Translate(scriptString.AsStringC(), wsJavaScriptBuf, wsError); |
| 6401 wsError); | |
| 6402 if (wsError.IsEmpty()) { | 6389 if (wsError.IsEmpty()) { |
| 6403 CFX_WideString javaScript = wsJavaScriptBuf.GetWideString(); | 6390 CFX_WideString javaScript = wsJavaScriptBuf.GetWideString(); |
| 6404 FXJSE_Value_SetUTF8String( | 6391 FXJSE_Value_SetUTF8String( |
| 6405 args.GetReturnValue(), | 6392 args.GetReturnValue(), |
| 6406 FX_UTF8Encode(javaScript, javaScript.GetLength()).AsByteStringC()); | 6393 FX_UTF8Encode(javaScript, javaScript.GetLength()).AsStringC()); |
| 6407 } else { | 6394 } else { |
| 6408 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 6395 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| 6409 } | 6396 } |
| 6410 } | 6397 } |
| 6411 FXJSE_Value_Release(argOne); | 6398 FXJSE_Value_Release(argOne); |
| 6412 } else { | 6399 } else { |
| 6413 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 6400 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 6414 L"Eval"); | 6401 L"Eval"); |
| 6415 } | 6402 } |
| 6416 } | 6403 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6451 if (FXJSE_Value_IsArray(argOne)) { | 6438 if (FXJSE_Value_IsArray(argOne)) { |
| 6452 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 6439 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 6453 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); | 6440 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); |
| 6454 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); | 6441 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); |
| 6455 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsobjectValue); | 6442 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsobjectValue); |
| 6456 if (FXJSE_Value_IsNull(propertyValue)) { | 6443 if (FXJSE_Value_IsNull(propertyValue)) { |
| 6457 GetObjectDefaultValue(jsobjectValue, args.GetReturnValue()); | 6444 GetObjectDefaultValue(jsobjectValue, args.GetReturnValue()); |
| 6458 } else { | 6445 } else { |
| 6459 CFX_ByteString propertyStr; | 6446 CFX_ByteString propertyStr; |
| 6460 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 6447 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 6461 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(), | 6448 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsStringC(), |
| 6462 args.GetReturnValue()); | 6449 args.GetReturnValue()); |
| 6463 } | 6450 } |
| 6464 FXJSE_Value_Release(propertyValue); | 6451 FXJSE_Value_Release(propertyValue); |
| 6465 FXJSE_Value_Release(jsobjectValue); | 6452 FXJSE_Value_Release(jsobjectValue); |
| 6466 } else if (FXJSE_Value_IsObject(argOne)) { | 6453 } else if (FXJSE_Value_IsObject(argOne)) { |
| 6467 GetObjectDefaultValue(argOne, args.GetReturnValue()); | 6454 GetObjectDefaultValue(argOne, args.GetReturnValue()); |
| 6468 } else { | 6455 } else { |
| 6469 FXJSE_Value_Set(args.GetReturnValue(), argOne); | 6456 FXJSE_Value_Set(args.GetReturnValue(), argOne); |
| 6470 } | 6457 } |
| 6471 FXJSE_Value_Release(argOne); | 6458 FXJSE_Value_Release(argOne); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6620 if (iLength > 2) { | 6607 if (iLength > 2) { |
| 6621 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 6608 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 6622 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); | 6609 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); |
| 6623 FXJSE_Value_GetObjectPropByIdx(argIndex, 1, propertyValue); | 6610 FXJSE_Value_GetObjectPropByIdx(argIndex, 1, propertyValue); |
| 6624 FXJSE_Value_GetObjectPropByIdx(argIndex, 2, jsobjectValue); | 6611 FXJSE_Value_GetObjectPropByIdx(argIndex, 2, jsobjectValue); |
| 6625 if (FXJSE_Value_IsNull(propertyValue)) { | 6612 if (FXJSE_Value_IsNull(propertyValue)) { |
| 6626 GetObjectDefaultValue(jsobjectValue, simpleValue); | 6613 GetObjectDefaultValue(jsobjectValue, simpleValue); |
| 6627 } else { | 6614 } else { |
| 6628 CFX_ByteString propertyStr; | 6615 CFX_ByteString propertyStr; |
| 6629 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 6616 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 6630 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(), | 6617 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsStringC(), |
| 6631 simpleValue); | 6618 simpleValue); |
| 6632 } | 6619 } |
| 6633 FXJSE_Value_Release(propertyValue); | 6620 FXJSE_Value_Release(propertyValue); |
| 6634 FXJSE_Value_Release(jsobjectValue); | 6621 FXJSE_Value_Release(jsobjectValue); |
| 6635 } else { | 6622 } else { |
| 6636 FXJSE_Value_SetUndefined(simpleValue); | 6623 FXJSE_Value_SetUndefined(simpleValue); |
| 6637 } | 6624 } |
| 6638 FXJSE_Value_Release(argIndex); | 6625 FXJSE_Value_Release(argIndex); |
| 6639 return simpleValue; | 6626 return simpleValue; |
| 6640 } else if (FXJSE_Value_IsObject(argIndex)) { | 6627 } else if (FXJSE_Value_IsObject(argIndex)) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 6664 FXJSE_HVALUE defaultValue = FXJSE_Value_Create(hruntime); | 6651 FXJSE_HVALUE defaultValue = FXJSE_Value_Create(hruntime); |
| 6665 GetObjectDefaultValue(jsObjectValue, defaultValue); | 6652 GetObjectDefaultValue(jsObjectValue, defaultValue); |
| 6666 if (FXJSE_Value_IsNull(defaultValue)) { | 6653 if (FXJSE_Value_IsNull(defaultValue)) { |
| 6667 isNull = TRUE; | 6654 isNull = TRUE; |
| 6668 } | 6655 } |
| 6669 FXJSE_Value_Release(defaultValue); | 6656 FXJSE_Value_Release(defaultValue); |
| 6670 } else { | 6657 } else { |
| 6671 CFX_ByteString propertyStr; | 6658 CFX_ByteString propertyStr; |
| 6672 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 6659 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 6673 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); | 6660 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); |
| 6674 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsByteStringC(), | 6661 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsStringC(), |
| 6675 newPropertyValue); | 6662 newPropertyValue); |
| 6676 if (FXJSE_Value_IsNull(newPropertyValue)) { | 6663 if (FXJSE_Value_IsNull(newPropertyValue)) { |
| 6677 isNull = TRUE; | 6664 isNull = TRUE; |
| 6678 } | 6665 } |
| 6679 FXJSE_Value_Release(newPropertyValue); | 6666 FXJSE_Value_Release(newPropertyValue); |
| 6680 } | 6667 } |
| 6681 FXJSE_Value_Release(propertyValue); | 6668 FXJSE_Value_Release(propertyValue); |
| 6682 FXJSE_Value_Release(jsObjectValue); | 6669 FXJSE_Value_Release(jsObjectValue); |
| 6683 } else { | 6670 } else { |
| 6684 isNull = TRUE; | 6671 isNull = TRUE; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6771 for (int32_t j = 2; j < iLength; j++) { | 6758 for (int32_t j = 2; j < iLength; j++) { |
| 6772 FXJSE_Value_GetObjectPropByIdx(argsValue[i], j, jsObjectValue); | 6759 FXJSE_Value_GetObjectPropByIdx(argsValue[i], j, jsObjectValue); |
| 6773 GetObjectDefaultValue(jsObjectValue, resultValues[index]); | 6760 GetObjectDefaultValue(jsObjectValue, resultValues[index]); |
| 6774 index++; | 6761 index++; |
| 6775 } | 6762 } |
| 6776 } else { | 6763 } else { |
| 6777 CFX_ByteString propertyString; | 6764 CFX_ByteString propertyString; |
| 6778 FXJSE_Value_ToUTF8String(propertyValue, propertyString); | 6765 FXJSE_Value_ToUTF8String(propertyValue, propertyString); |
| 6779 for (int32_t j = 2; j < iLength; j++) { | 6766 for (int32_t j = 2; j < iLength; j++) { |
| 6780 FXJSE_Value_GetObjectPropByIdx(argsValue[i], j, jsObjectValue); | 6767 FXJSE_Value_GetObjectPropByIdx(argsValue[i], j, jsObjectValue); |
| 6781 FXJSE_Value_GetObjectProp(jsObjectValue, | 6768 FXJSE_Value_GetObjectProp(jsObjectValue, propertyString.AsStringC(), |
| 6782 propertyString.AsByteStringC(), | |
| 6783 resultValues[index]); | 6769 resultValues[index]); |
| 6784 index++; | 6770 index++; |
| 6785 } | 6771 } |
| 6786 } | 6772 } |
| 6787 FXJSE_Value_Release(propertyValue); | 6773 FXJSE_Value_Release(propertyValue); |
| 6788 FXJSE_Value_Release(jsObjectValue); | 6774 FXJSE_Value_Release(jsObjectValue); |
| 6789 } | 6775 } |
| 6790 } else if (FXJSE_Value_IsObject(argsValue[i])) { | 6776 } else if (FXJSE_Value_IsObject(argsValue[i])) { |
| 6791 GetObjectDefaultValue(argsValue[i], resultValues[index]); | 6777 GetObjectDefaultValue(argsValue[i], resultValues[index]); |
| 6792 index++; | 6778 index++; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6859 CXFA_Document* pDoc = pContext->GetDocument(); | 6845 CXFA_Document* pDoc = pContext->GetDocument(); |
| 6860 if (!pDoc) { | 6846 if (!pDoc) { |
| 6861 return bFlags; | 6847 return bFlags; |
| 6862 } | 6848 } |
| 6863 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); | 6849 CXFA_ScriptContext* pScriptContext = pDoc->GetScriptContext(); |
| 6864 XFA_RESOLVENODE_RS resoveNodeRS; | 6850 XFA_RESOLVENODE_RS resoveNodeRS; |
| 6865 uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | 6851 uint32_t dwFlags = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | |
| 6866 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; | 6852 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; |
| 6867 int32_t iRet = pScriptContext->ResolveObjects( | 6853 int32_t iRet = pScriptContext->ResolveObjects( |
| 6868 pScriptContext->GetThisObject(), | 6854 pScriptContext->GetThisObject(), |
| 6869 CFX_WideString::FromUTF8(szAccessorName).AsWideStringC(), resoveNodeRS, | 6855 CFX_WideString::FromUTF8(szAccessorName).AsStringC(), resoveNodeRS, |
| 6870 dwFlags); | 6856 dwFlags); |
| 6871 if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { | 6857 if (iRet >= 1 && resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { |
| 6872 FXJSE_Value_Set(accessorValue, pScriptContext->GetJSValueFromMap( | 6858 FXJSE_Value_Set(accessorValue, pScriptContext->GetJSValueFromMap( |
| 6873 resoveNodeRS.nodes.GetAt(0))); | 6859 resoveNodeRS.nodes.GetAt(0))); |
| 6874 bFlags = TRUE; | 6860 bFlags = TRUE; |
| 6875 } | 6861 } |
| 6876 return bFlags; | 6862 return bFlags; |
| 6877 } | 6863 } |
| 6878 int32_t CXFA_FM2JSContext::ResolveObjects(FXJSE_HOBJECT hThis, | 6864 int32_t CXFA_FM2JSContext::ResolveObjects(FXJSE_HOBJECT hThis, |
| 6879 FXJSE_HVALUE hRefValue, | 6865 FXJSE_HVALUE hRefValue, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6915 dFlags = (bsSomExp == "*") | 6901 dFlags = (bsSomExp == "*") |
| 6916 ? (XFA_RESOLVENODE_Children) | 6902 ? (XFA_RESOLVENODE_Children) |
| 6917 : (XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | | 6903 : (XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Attributes | |
| 6918 XFA_RESOLVENODE_Properties); | 6904 XFA_RESOLVENODE_Properties); |
| 6919 } | 6905 } |
| 6920 } | 6906 } |
| 6921 } else { | 6907 } else { |
| 6922 pNode = (CXFA_Object*)FXJSE_Value_ToObject(hRefValue, NULL); | 6908 pNode = (CXFA_Object*)FXJSE_Value_ToObject(hRefValue, NULL); |
| 6923 dFlags = XFA_RESOLVENODE_AnyChild; | 6909 dFlags = XFA_RESOLVENODE_AnyChild; |
| 6924 } | 6910 } |
| 6925 iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression.AsWideStringC(), | 6911 iRet = pScriptContext->ResolveObjects(pNode, wsSomExpression.AsStringC(), |
| 6926 resoveNodeRS, dFlags); | 6912 resoveNodeRS, dFlags); |
| 6927 return iRet; | 6913 return iRet; |
| 6928 } | 6914 } |
| 6929 void CXFA_FM2JSContext::ParseResolveResult( | 6915 void CXFA_FM2JSContext::ParseResolveResult( |
| 6930 FXJSE_HOBJECT hThis, | 6916 FXJSE_HOBJECT hThis, |
| 6931 const XFA_RESOLVENODE_RS& resoveNodeRS, | 6917 const XFA_RESOLVENODE_RS& resoveNodeRS, |
| 6932 FXJSE_HVALUE hParentValue, | 6918 FXJSE_HVALUE hParentValue, |
| 6933 FXJSE_HVALUE*& resultValues, | 6919 FXJSE_HVALUE*& resultValues, |
| 6934 int32_t& iSize, | 6920 int32_t& iSize, |
| 6935 FX_BOOL& bAttribute) { | 6921 FX_BOOL& bAttribute) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6980 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 6966 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 6981 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); | 6967 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); |
| 6982 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 6968 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 6983 FXJSE_Value_GetObjectPropByIdx(hValue, 1, propertyValue); | 6969 FXJSE_Value_GetObjectPropByIdx(hValue, 1, propertyValue); |
| 6984 FXJSE_Value_GetObjectPropByIdx(hValue, 2, jsobjectValue); | 6970 FXJSE_Value_GetObjectPropByIdx(hValue, 2, jsobjectValue); |
| 6985 if (FXJSE_Value_IsNull(propertyValue)) { | 6971 if (FXJSE_Value_IsNull(propertyValue)) { |
| 6986 GetObjectDefaultValue(jsobjectValue, newProperty); | 6972 GetObjectDefaultValue(jsobjectValue, newProperty); |
| 6987 } else { | 6973 } else { |
| 6988 CFX_ByteString propertyStr; | 6974 CFX_ByteString propertyStr; |
| 6989 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 6975 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 6990 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(), | 6976 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsStringC(), |
| 6991 newProperty); | 6977 newProperty); |
| 6992 } | 6978 } |
| 6993 iValue = HValueToInteger(hThis, newProperty); | 6979 iValue = HValueToInteger(hThis, newProperty); |
| 6994 FXJSE_Value_Release(newProperty); | 6980 FXJSE_Value_Release(newProperty); |
| 6995 FXJSE_Value_Release(jsobjectValue); | 6981 FXJSE_Value_Release(jsobjectValue); |
| 6996 FXJSE_Value_Release(propertyValue); | 6982 FXJSE_Value_Release(propertyValue); |
| 6997 return iValue; | 6983 return iValue; |
| 6998 } else if (FXJSE_Value_IsObject(hValue)) { | 6984 } else if (FXJSE_Value_IsObject(hValue)) { |
| 6999 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 6985 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 7000 GetObjectDefaultValue(hValue, newProperty); | 6986 GetObjectDefaultValue(hValue, newProperty); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 7024 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 7010 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 7025 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); | 7011 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); |
| 7026 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 7012 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 7027 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); | 7013 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); |
| 7028 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsobjectValue); | 7014 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsobjectValue); |
| 7029 if (FXJSE_Value_IsNull(propertyValue)) { | 7015 if (FXJSE_Value_IsNull(propertyValue)) { |
| 7030 GetObjectDefaultValue(jsobjectValue, newProperty); | 7016 GetObjectDefaultValue(jsobjectValue, newProperty); |
| 7031 } else { | 7017 } else { |
| 7032 CFX_ByteString propertyStr; | 7018 CFX_ByteString propertyStr; |
| 7033 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 7019 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 7034 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(), | 7020 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsStringC(), |
| 7035 newProperty); | 7021 newProperty); |
| 7036 } | 7022 } |
| 7037 fRet = HValueToFloat(hThis, newProperty); | 7023 fRet = HValueToFloat(hThis, newProperty); |
| 7038 FXJSE_Value_Release(newProperty); | 7024 FXJSE_Value_Release(newProperty); |
| 7039 FXJSE_Value_Release(jsobjectValue); | 7025 FXJSE_Value_Release(jsobjectValue); |
| 7040 FXJSE_Value_Release(propertyValue); | 7026 FXJSE_Value_Release(propertyValue); |
| 7041 } else if (FXJSE_Value_IsObject(arg)) { | 7027 } else if (FXJSE_Value_IsObject(arg)) { |
| 7042 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 7028 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 7043 GetObjectDefaultValue(arg, newProperty); | 7029 GetObjectDefaultValue(arg, newProperty); |
| 7044 fRet = HValueToFloat(hThis, newProperty); | 7030 fRet = HValueToFloat(hThis, newProperty); |
| 7045 FXJSE_Value_Release(newProperty); | 7031 FXJSE_Value_Release(newProperty); |
| 7046 } else if (FXJSE_Value_IsUTF8String(arg)) { | 7032 } else if (FXJSE_Value_IsUTF8String(arg)) { |
| 7047 CFX_ByteString bsOutput; | 7033 CFX_ByteString bsOutput; |
| 7048 FXJSE_Value_ToUTF8String(arg, bsOutput); | 7034 FXJSE_Value_ToUTF8String(arg, bsOutput); |
| 7049 fRet = (FX_FLOAT)StringToDouble(bsOutput.AsByteStringC()); | 7035 fRet = (FX_FLOAT)StringToDouble(bsOutput.AsStringC()); |
| 7050 } else if (FXJSE_Value_IsUndefined(arg)) { | 7036 } else if (FXJSE_Value_IsUndefined(arg)) { |
| 7051 fRet = 0; | 7037 fRet = 0; |
| 7052 } else { | 7038 } else { |
| 7053 fRet = FXJSE_Value_ToFloat(arg); | 7039 fRet = FXJSE_Value_ToFloat(arg); |
| 7054 } | 7040 } |
| 7055 return fRet; | 7041 return fRet; |
| 7056 } | 7042 } |
| 7057 FX_DOUBLE CXFA_FM2JSContext::HValueToDouble(FXJSE_HOBJECT hThis, | 7043 FX_DOUBLE CXFA_FM2JSContext::HValueToDouble(FXJSE_HOBJECT hThis, |
| 7058 FXJSE_HVALUE arg) { | 7044 FXJSE_HVALUE arg) { |
| 7059 CXFA_FM2JSContext* pContext = | 7045 CXFA_FM2JSContext* pContext = |
| 7060 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 7046 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 7061 FXJSE_HRUNTIME hruntime = pContext->GetScriptRuntime(); | 7047 FXJSE_HRUNTIME hruntime = pContext->GetScriptRuntime(); |
| 7062 FX_DOUBLE dRet = 0; | 7048 FX_DOUBLE dRet = 0; |
| 7063 if (FXJSE_Value_IsArray(arg)) { | 7049 if (FXJSE_Value_IsArray(arg)) { |
| 7064 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 7050 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 7065 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); | 7051 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); |
| 7066 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 7052 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 7067 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); | 7053 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); |
| 7068 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsobjectValue); | 7054 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsobjectValue); |
| 7069 if (FXJSE_Value_IsNull(propertyValue)) { | 7055 if (FXJSE_Value_IsNull(propertyValue)) { |
| 7070 GetObjectDefaultValue(jsobjectValue, newProperty); | 7056 GetObjectDefaultValue(jsobjectValue, newProperty); |
| 7071 } else { | 7057 } else { |
| 7072 CFX_ByteString propertyStr; | 7058 CFX_ByteString propertyStr; |
| 7073 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 7059 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 7074 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(), | 7060 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsStringC(), |
| 7075 newProperty); | 7061 newProperty); |
| 7076 } | 7062 } |
| 7077 dRet = HValueToDouble(hThis, newProperty); | 7063 dRet = HValueToDouble(hThis, newProperty); |
| 7078 FXJSE_Value_Release(newProperty); | 7064 FXJSE_Value_Release(newProperty); |
| 7079 FXJSE_Value_Release(jsobjectValue); | 7065 FXJSE_Value_Release(jsobjectValue); |
| 7080 FXJSE_Value_Release(propertyValue); | 7066 FXJSE_Value_Release(propertyValue); |
| 7081 } else if (FXJSE_Value_IsObject(arg)) { | 7067 } else if (FXJSE_Value_IsObject(arg)) { |
| 7082 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 7068 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 7083 GetObjectDefaultValue(arg, newProperty); | 7069 GetObjectDefaultValue(arg, newProperty); |
| 7084 dRet = HValueToDouble(hThis, newProperty); | 7070 dRet = HValueToDouble(hThis, newProperty); |
| 7085 FXJSE_Value_Release(newProperty); | 7071 FXJSE_Value_Release(newProperty); |
| 7086 } else if (FXJSE_Value_IsUTF8String(arg)) { | 7072 } else if (FXJSE_Value_IsUTF8String(arg)) { |
| 7087 CFX_ByteString bsOutput; | 7073 CFX_ByteString bsOutput; |
| 7088 FXJSE_Value_ToUTF8String(arg, bsOutput); | 7074 FXJSE_Value_ToUTF8String(arg, bsOutput); |
| 7089 dRet = StringToDouble(bsOutput.AsByteStringC()); | 7075 dRet = StringToDouble(bsOutput.AsStringC()); |
| 7090 } else if (FXJSE_Value_IsUndefined(arg)) { | 7076 } else if (FXJSE_Value_IsUndefined(arg)) { |
| 7091 dRet = 0; | 7077 dRet = 0; |
| 7092 } else { | 7078 } else { |
| 7093 dRet = FXJSE_Value_ToDouble(arg); | 7079 dRet = FXJSE_Value_ToDouble(arg); |
| 7094 } | 7080 } |
| 7095 return dRet; | 7081 return dRet; |
| 7096 } | 7082 } |
| 7097 void CXFA_FM2JSContext::HValueToUTF8String(FXJSE_HVALUE arg, | 7083 void CXFA_FM2JSContext::HValueToUTF8String(FXJSE_HVALUE arg, |
| 7098 CFX_ByteString& szOutputString) { | 7084 CFX_ByteString& szOutputString) { |
| 7099 if (FXJSE_Value_IsNull(arg) || FXJSE_Value_IsUndefined(arg)) { | 7085 if (FXJSE_Value_IsNull(arg) || FXJSE_Value_IsUndefined(arg)) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7240 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); | 7226 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); |
| 7241 FXSYS_assert(pAppProvider); | 7227 FXSYS_assert(pAppProvider); |
| 7242 CFX_WideString wsFormat; | 7228 CFX_WideString wsFormat; |
| 7243 pAppProvider->LoadString(iStringID, wsFormat); | 7229 pAppProvider->LoadString(iStringID, wsFormat); |
| 7244 CFX_WideString wsMessage; | 7230 CFX_WideString wsMessage; |
| 7245 va_list arg_ptr; | 7231 va_list arg_ptr; |
| 7246 va_start(arg_ptr, iStringID); | 7232 va_start(arg_ptr, iStringID); |
| 7247 wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr); | 7233 wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr); |
| 7248 va_end(arg_ptr); | 7234 va_end(arg_ptr); |
| 7249 FXJSE_ThrowMessage( | 7235 FXJSE_ThrowMessage( |
| 7250 "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsByteStringC()); | 7236 "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsStringC()); |
| 7251 } | 7237 } |
| OLD | NEW |