| 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(jsObjectValue, propertyStr, | 318 FXJSE_Value_GetObjectProp( |
| 319 newPropertyValue); | 319 jsObjectValue, propertyStr.AsByteStringC(), 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(jsObjectValue, propertyStr, | 401 FXJSE_Value_GetObjectProp( |
| 402 newPropertyValue); | 402 jsObjectValue, propertyStr.AsByteStringC(), 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(jsObjectValue, propertyStr, | 493 FXJSE_Value_GetObjectProp( |
| 494 newPropertyValue); | 494 jsObjectValue, propertyStr.AsByteStringC(), 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(jsObjectValue, propertyStr, | 596 FXJSE_Value_GetObjectProp( |
| 597 newPropertyValue); | 597 jsObjectValue, propertyStr.AsByteStringC(), 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(jsObjectValue, propertyStr, | 682 FXJSE_Value_GetObjectProp( |
| 683 newPropertyValue); | 683 jsObjectValue, propertyStr.AsByteStringC(), 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(jsObjectValue, propertyStr, | 711 FXJSE_Value_GetObjectProp( |
| 712 newPropertyValue); | 712 jsObjectValue, propertyStr.AsByteStringC(), 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, | 764 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsByteStringC(), |
| 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(), wsValue.UTF8Encode()); | 776 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 777 wsValue.UTF8Encode().AsByteStringC()); |
| 777 } | 778 } |
| 778 FXJSE_Value_Release(argOne); | 779 FXJSE_Value_Release(argOne); |
| 779 } else if (argc == 2) { | 780 } else if (argc == 2) { |
| 780 FXJSE_HVALUE argOne = args.GetValue(0); | 781 FXJSE_HVALUE argOne = args.GetValue(0); |
| 781 FXJSE_HVALUE argTwo = args.GetValue(1); | 782 FXJSE_HVALUE argTwo = args.GetValue(1); |
| 782 if (FXJSE_Value_IsNull(argOne) || FXJSE_Value_IsNull(argTwo)) { | 783 if (FXJSE_Value_IsNull(argOne) || FXJSE_Value_IsNull(argTwo)) { |
| 783 FXJSE_Value_SetNull(args.GetReturnValue()); | 784 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 784 } else { | 785 } else { |
| 785 FX_DOUBLE dValue = 0.0; | 786 FX_DOUBLE dValue = 0.0; |
| 786 if (FXJSE_Value_IsArray(argOne)) { | 787 if (FXJSE_Value_IsArray(argOne)) { |
| 787 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 788 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 788 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); | 789 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); |
| 789 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); | 790 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); |
| 790 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsObjectValue); | 791 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsObjectValue); |
| 791 if (FXJSE_Value_IsNull(propertyValue)) { | 792 if (FXJSE_Value_IsNull(propertyValue)) { |
| 792 dValue = HValueToDouble(hThis, jsObjectValue); | 793 dValue = HValueToDouble(hThis, jsObjectValue); |
| 793 } else { | 794 } else { |
| 794 CFX_ByteString propertyStr; | 795 CFX_ByteString propertyStr; |
| 795 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 796 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 796 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); | 797 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); |
| 797 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr, | 798 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsByteStringC(), |
| 798 newPropertyValue); | 799 newPropertyValue); |
| 799 dValue = HValueToDouble(hThis, newPropertyValue); | 800 dValue = HValueToDouble(hThis, newPropertyValue); |
| 800 FXJSE_Value_Release(newPropertyValue); | 801 FXJSE_Value_Release(newPropertyValue); |
| 801 } | 802 } |
| 802 FXJSE_Value_Release(propertyValue); | 803 FXJSE_Value_Release(propertyValue); |
| 803 FXJSE_Value_Release(jsObjectValue); | 804 FXJSE_Value_Release(jsObjectValue); |
| 804 } else { | 805 } else { |
| 805 dValue = HValueToDouble(hThis, argOne); | 806 dValue = HValueToDouble(hThis, argOne); |
| 806 } | 807 } |
| 807 FX_DOUBLE dPrecision = 0.0; | 808 FX_DOUBLE dPrecision = 0.0; |
| 808 if (FXJSE_Value_IsArray(argTwo)) { | 809 if (FXJSE_Value_IsArray(argTwo)) { |
| 809 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 810 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 810 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); | 811 FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime); |
| 811 FXJSE_Value_GetObjectPropByIdx(argTwo, 1, propertyValue); | 812 FXJSE_Value_GetObjectPropByIdx(argTwo, 1, propertyValue); |
| 812 FXJSE_Value_GetObjectPropByIdx(argTwo, 2, jsObjectValue); | 813 FXJSE_Value_GetObjectPropByIdx(argTwo, 2, jsObjectValue); |
| 813 if (FXJSE_Value_IsNull(propertyValue)) { | 814 if (FXJSE_Value_IsNull(propertyValue)) { |
| 814 dPrecision = HValueToDouble(hThis, jsObjectValue); | 815 dPrecision = HValueToDouble(hThis, jsObjectValue); |
| 815 } else { | 816 } else { |
| 816 CFX_ByteString propertyStr; | 817 CFX_ByteString propertyStr; |
| 817 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 818 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 818 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); | 819 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); |
| 819 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr, | 820 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsByteStringC(), |
| 820 newPropertyValue); | 821 newPropertyValue); |
| 821 dPrecision = HValueToDouble(hThis, newPropertyValue); | 822 dPrecision = HValueToDouble(hThis, newPropertyValue); |
| 822 FXJSE_Value_Release(newPropertyValue); | 823 FXJSE_Value_Release(newPropertyValue); |
| 823 } | 824 } |
| 824 FXJSE_Value_Release(propertyValue); | 825 FXJSE_Value_Release(propertyValue); |
| 825 FXJSE_Value_Release(jsObjectValue); | 826 FXJSE_Value_Release(jsObjectValue); |
| 826 } else { | 827 } else { |
| 827 dPrecision = HValueToDouble(hThis, argTwo); | 828 dPrecision = HValueToDouble(hThis, argTwo); |
| 828 } | 829 } |
| 829 if (dPrecision < 0) { | 830 if (dPrecision < 0) { |
| 830 uPrecision = 0; | 831 uPrecision = 0; |
| 831 } else if (dPrecision > 12.0) { | 832 } else if (dPrecision > 12.0) { |
| 832 uPrecision = 12; | 833 uPrecision = 12; |
| 833 } else { | 834 } else { |
| 834 uPrecision = (uint8_t)dPrecision; | 835 uPrecision = (uint8_t)dPrecision; |
| 835 } | 836 } |
| 836 CFX_Decimal decimalValue((FX_FLOAT)dValue, uPrecision); | 837 CFX_Decimal decimalValue((FX_FLOAT)dValue, uPrecision); |
| 837 CFX_WideString wsValue = decimalValue; | 838 CFX_WideString wsValue = decimalValue; |
| 838 FXJSE_Value_SetUTF8String(args.GetReturnValue(), wsValue.UTF8Encode()); | 839 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 840 wsValue.UTF8Encode().AsByteStringC()); |
| 839 } | 841 } |
| 840 FXJSE_Value_Release(argOne); | 842 FXJSE_Value_Release(argOne); |
| 841 FXJSE_Value_Release(argTwo); | 843 FXJSE_Value_Release(argTwo); |
| 842 } else { | 844 } else { |
| 843 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 845 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 844 L"Round"); | 846 L"Round"); |
| 845 } | 847 } |
| 846 } | 848 } |
| 847 void CXFA_FM2JSContext::Sum(FXJSE_HOBJECT hThis, | 849 void CXFA_FM2JSContext::Sum(FXJSE_HOBJECT hThis, |
| 848 const CFX_ByteStringC& szFuncName, | 850 const CFX_ByteStringC& szFuncName, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 877 if (!FXJSE_Value_IsNull(newPropertyValue)) { | 879 if (!FXJSE_Value_IsNull(newPropertyValue)) { |
| 878 dSum += HValueToDouble(hThis, jsObjectValue); | 880 dSum += HValueToDouble(hThis, jsObjectValue); |
| 879 uCount++; | 881 uCount++; |
| 880 } | 882 } |
| 881 } | 883 } |
| 882 } else { | 884 } else { |
| 883 CFX_ByteString propertyStr; | 885 CFX_ByteString propertyStr; |
| 884 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 886 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 885 for (int32_t j = 2; j < iLength; j++) { | 887 for (int32_t j = 2; j < iLength; j++) { |
| 886 FXJSE_Value_GetObjectPropByIdx(argValue, j, jsObjectValue); | 888 FXJSE_Value_GetObjectPropByIdx(argValue, j, jsObjectValue); |
| 887 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr, | 889 FXJSE_Value_GetObjectProp( |
| 888 newPropertyValue); | 890 jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue); |
| 889 if (!FXJSE_Value_IsNull(newPropertyValue)) { | 891 if (!FXJSE_Value_IsNull(newPropertyValue)) { |
| 890 dSum += HValueToDouble(hThis, newPropertyValue); | 892 dSum += HValueToDouble(hThis, newPropertyValue); |
| 891 uCount++; | 893 uCount++; |
| 892 } | 894 } |
| 893 } | 895 } |
| 894 } | 896 } |
| 895 FXJSE_Value_Release(newPropertyValue); | 897 FXJSE_Value_Release(newPropertyValue); |
| 896 FXJSE_Value_Release(jsObjectValue); | 898 FXJSE_Value_Release(jsObjectValue); |
| 897 FXJSE_Value_Release(propertyValue); | 899 FXJSE_Value_Release(propertyValue); |
| 898 } else { | 900 } else { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 928 time_t currentTime; | 930 time_t currentTime; |
| 929 time(¤tTime); | 931 time(¤tTime); |
| 930 pTmStruct = gmtime(¤tTime); | 932 pTmStruct = gmtime(¤tTime); |
| 931 CFX_ByteString bufferYear; | 933 CFX_ByteString bufferYear; |
| 932 CFX_ByteString bufferMon; | 934 CFX_ByteString bufferMon; |
| 933 CFX_ByteString bufferDay; | 935 CFX_ByteString bufferDay; |
| 934 bufferYear.Format("%d", pTmStruct->tm_year + 1900); | 936 bufferYear.Format("%d", pTmStruct->tm_year + 1900); |
| 935 bufferMon.Format("%02d", pTmStruct->tm_mon + 1); | 937 bufferMon.Format("%02d", pTmStruct->tm_mon + 1); |
| 936 bufferDay.Format("%02d", pTmStruct->tm_mday); | 938 bufferDay.Format("%02d", pTmStruct->tm_mday); |
| 937 CFX_ByteString bufferCurrent = bufferYear + bufferMon + bufferDay; | 939 CFX_ByteString bufferCurrent = bufferYear + bufferMon + bufferDay; |
| 938 int32_t dDays = DateString2Num(bufferCurrent); | 940 int32_t dDays = DateString2Num(bufferCurrent.AsByteStringC()); |
| 939 FXJSE_Value_SetInteger(args.GetReturnValue(), dDays); | 941 FXJSE_Value_SetInteger(args.GetReturnValue(), dDays); |
| 940 } else { | 942 } else { |
| 941 CXFA_FM2JSContext* pContext = | 943 CXFA_FM2JSContext* pContext = |
| 942 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 944 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 943 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 945 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 944 L"Date"); | 946 L"Date"); |
| 945 } | 947 } |
| 946 } | 948 } |
| 947 void CXFA_FM2JSContext::Date2Num(FXJSE_HOBJECT hThis, | 949 void CXFA_FM2JSContext::Date2Num(FXJSE_HOBJECT hThis, |
| 948 const CFX_ByteStringC& szFuncName, | 950 const CFX_ByteStringC& szFuncName, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 972 if (argc == 3) { | 974 if (argc == 3) { |
| 973 localValue = GetSimpleHValue(hThis, args, 2); | 975 localValue = GetSimpleHValue(hThis, args, 2); |
| 974 if (HValueIsNull(hThis, localValue)) { | 976 if (HValueIsNull(hThis, localValue)) { |
| 975 bFlags = TRUE; | 977 bFlags = TRUE; |
| 976 } else { | 978 } else { |
| 977 HValueToUTF8String(localValue, localString); | 979 HValueToUTF8String(localValue, localString); |
| 978 } | 980 } |
| 979 } | 981 } |
| 980 if (!bFlags) { | 982 if (!bFlags) { |
| 981 CFX_ByteString szIsoDateString; | 983 CFX_ByteString szIsoDateString; |
| 982 FX_BOOL bRet = Local2IsoDate(hThis, dateString, formatString, localString, | 984 FX_BOOL bRet = Local2IsoDate( |
| 983 szIsoDateString); | 985 hThis, dateString.AsByteStringC(), formatString.AsByteStringC(), |
| 986 localString.AsByteStringC(), szIsoDateString); |
| 984 if (bRet) { | 987 if (bRet) { |
| 985 FXJSE_Value_SetInteger(args.GetReturnValue(), | 988 FXJSE_Value_SetInteger(args.GetReturnValue(), |
| 986 DateString2Num(szIsoDateString)); | 989 DateString2Num(szIsoDateString.AsByteStringC())); |
| 987 } else { | 990 } else { |
| 988 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 991 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
| 989 } | 992 } |
| 990 } else { | 993 } else { |
| 991 FXJSE_Value_SetNull(args.GetReturnValue()); | 994 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 992 } | 995 } |
| 993 FXJSE_Value_Release(dateValue); | 996 FXJSE_Value_Release(dateValue); |
| 994 if (argc > 1) { | 997 if (argc > 1) { |
| 995 FXJSE_Value_Release(formatValue); | 998 FXJSE_Value_Release(formatValue); |
| 996 if (argc == 3) { | 999 if (argc == 3) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1027 if (argc == 2) { | 1030 if (argc == 2) { |
| 1028 argLocal = GetSimpleHValue(hThis, args, 1); | 1031 argLocal = GetSimpleHValue(hThis, args, 1); |
| 1029 if (FXJSE_Value_IsNull(argLocal)) { | 1032 if (FXJSE_Value_IsNull(argLocal)) { |
| 1030 bFlags = TRUE; | 1033 bFlags = TRUE; |
| 1031 } else { | 1034 } else { |
| 1032 HValueToUTF8String(argLocal, szLocal); | 1035 HValueToUTF8String(argLocal, szLocal); |
| 1033 } | 1036 } |
| 1034 } | 1037 } |
| 1035 if (!bFlags) { | 1038 if (!bFlags) { |
| 1036 CFX_ByteString formatStr; | 1039 CFX_ByteString formatStr; |
| 1037 GetStandardDateFormat(hThis, iStyle, szLocal, formatStr); | 1040 GetStandardDateFormat(hThis, iStyle, szLocal.AsByteStringC(), formatStr); |
| 1038 if (formatStr.IsEmpty()) { | 1041 if (formatStr.IsEmpty()) { |
| 1039 formatStr = ""; | 1042 formatStr = ""; |
| 1040 } | 1043 } |
| 1041 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr); | 1044 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 1045 formatStr.AsByteStringC()); |
| 1042 } else { | 1046 } else { |
| 1043 FXJSE_Value_SetNull(args.GetReturnValue()); | 1047 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1044 } | 1048 } |
| 1045 if (argc > 0) { | 1049 if (argc > 0) { |
| 1046 FXJSE_Value_Release(argStyle); | 1050 FXJSE_Value_Release(argStyle); |
| 1047 if (argc == 2) { | 1051 if (argc == 2) { |
| 1048 FXJSE_Value_Release(argLocal); | 1052 FXJSE_Value_Release(argLocal); |
| 1049 } | 1053 } |
| 1050 } | 1054 } |
| 1051 } else { | 1055 } else { |
| 1052 CXFA_FM2JSContext* pContext = | 1056 CXFA_FM2JSContext* pContext = |
| 1053 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1057 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 1054 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1058 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 1055 L"Date2Num"); | 1059 L"Date2Num"); |
| 1056 } | 1060 } |
| 1057 } | 1061 } |
| 1058 void CXFA_FM2JSContext::IsoDate2Num(FXJSE_HOBJECT hThis, | 1062 void CXFA_FM2JSContext::IsoDate2Num(FXJSE_HOBJECT hThis, |
| 1059 const CFX_ByteStringC& szFuncName, | 1063 const CFX_ByteStringC& szFuncName, |
| 1060 CFXJSE_Arguments& args) { | 1064 CFXJSE_Arguments& args) { |
| 1061 if (args.GetLength() == 1) { | 1065 if (args.GetLength() == 1) { |
| 1062 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 1066 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 1063 if (FXJSE_Value_IsNull(argOne)) { | 1067 if (FXJSE_Value_IsNull(argOne)) { |
| 1064 FXJSE_Value_SetNull(args.GetReturnValue()); | 1068 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1065 } else { | 1069 } else { |
| 1066 CFX_ByteString szArgString; | 1070 CFX_ByteString szArgString; |
| 1067 HValueToUTF8String(argOne, szArgString); | 1071 HValueToUTF8String(argOne, szArgString); |
| 1068 int32_t dDays = DateString2Num(szArgString); | 1072 int32_t dDays = DateString2Num(szArgString.AsByteStringC()); |
| 1069 FXJSE_Value_SetInteger(args.GetReturnValue(), (int32_t)dDays); | 1073 FXJSE_Value_SetInteger(args.GetReturnValue(), (int32_t)dDays); |
| 1070 } | 1074 } |
| 1071 FXJSE_Value_Release(argOne); | 1075 FXJSE_Value_Release(argOne); |
| 1072 } else { | 1076 } else { |
| 1073 CXFA_FM2JSContext* pContext = | 1077 CXFA_FM2JSContext* pContext = |
| 1074 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 1078 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 1075 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 1079 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 1076 L"IsoDate2Num"); | 1080 L"IsoDate2Num"); |
| 1077 } | 1081 } |
| 1078 } | 1082 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 if (argc == 2) { | 1161 if (argc == 2) { |
| 1158 argLocal = GetSimpleHValue(hThis, args, 1); | 1162 argLocal = GetSimpleHValue(hThis, args, 1); |
| 1159 if (FXJSE_Value_IsNull(argLocal)) { | 1163 if (FXJSE_Value_IsNull(argLocal)) { |
| 1160 bFlags = TRUE; | 1164 bFlags = TRUE; |
| 1161 } else { | 1165 } else { |
| 1162 HValueToUTF8String(argLocal, szLocal); | 1166 HValueToUTF8String(argLocal, szLocal); |
| 1163 } | 1167 } |
| 1164 } | 1168 } |
| 1165 if (!bFlags) { | 1169 if (!bFlags) { |
| 1166 CFX_ByteString formatStr; | 1170 CFX_ByteString formatStr; |
| 1167 GetLocalDateFormat(hThis, iStyle, szLocal, formatStr, FALSE); | 1171 GetLocalDateFormat(hThis, iStyle, szLocal.AsByteStringC(), formatStr, |
| 1172 FALSE); |
| 1168 if (formatStr.IsEmpty()) { | 1173 if (formatStr.IsEmpty()) { |
| 1169 formatStr = ""; | 1174 formatStr = ""; |
| 1170 } | 1175 } |
| 1171 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr); | 1176 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 1177 formatStr.AsByteStringC()); |
| 1172 } else { | 1178 } else { |
| 1173 FXJSE_Value_SetNull(args.GetReturnValue()); | 1179 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1174 } | 1180 } |
| 1175 if (argc > 0) { | 1181 if (argc > 0) { |
| 1176 FXJSE_Value_Release(argStyle); | 1182 FXJSE_Value_Release(argStyle); |
| 1177 if (argc == 2) { | 1183 if (argc == 2) { |
| 1178 FXJSE_Value_Release(argLocal); | 1184 FXJSE_Value_Release(argLocal); |
| 1179 } | 1185 } |
| 1180 } | 1186 } |
| 1181 } else { | 1187 } else { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1208 if (argc == 2) { | 1214 if (argc == 2) { |
| 1209 argLocal = GetSimpleHValue(hThis, args, 1); | 1215 argLocal = GetSimpleHValue(hThis, args, 1); |
| 1210 if (FXJSE_Value_IsNull(argLocal)) { | 1216 if (FXJSE_Value_IsNull(argLocal)) { |
| 1211 bFlags = TRUE; | 1217 bFlags = TRUE; |
| 1212 } else { | 1218 } else { |
| 1213 HValueToUTF8String(argLocal, szLocal); | 1219 HValueToUTF8String(argLocal, szLocal); |
| 1214 } | 1220 } |
| 1215 } | 1221 } |
| 1216 if (!bFlags) { | 1222 if (!bFlags) { |
| 1217 CFX_ByteString formatStr; | 1223 CFX_ByteString formatStr; |
| 1218 GetLocalTimeFormat(hThis, iStyle, szLocal, formatStr, FALSE); | 1224 GetLocalTimeFormat(hThis, iStyle, szLocal.AsByteStringC(), formatStr, |
| 1225 FALSE); |
| 1219 if (formatStr.IsEmpty()) { | 1226 if (formatStr.IsEmpty()) { |
| 1220 formatStr = ""; | 1227 formatStr = ""; |
| 1221 } | 1228 } |
| 1222 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr); | 1229 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 1230 formatStr.AsByteStringC()); |
| 1223 } else { | 1231 } else { |
| 1224 FXJSE_Value_SetNull(args.GetReturnValue()); | 1232 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1225 } | 1233 } |
| 1226 if (argc > 0) { | 1234 if (argc > 0) { |
| 1227 FXJSE_Value_Release(argStyle); | 1235 FXJSE_Value_Release(argStyle); |
| 1228 if (argc == 2) { | 1236 if (argc == 2) { |
| 1229 FXJSE_Value_Release(argLocal); | 1237 FXJSE_Value_Release(argLocal); |
| 1230 } | 1238 } |
| 1231 } | 1239 } |
| 1232 } else { | 1240 } else { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 } else { | 1367 } else { |
| 1360 iDay += static_cast<int32_t>(dDate) - 1; | 1368 iDay += static_cast<int32_t>(dDate) - 1; |
| 1361 dDate = 0; | 1369 dDate = 0; |
| 1362 } | 1370 } |
| 1363 } | 1371 } |
| 1364 } | 1372 } |
| 1365 } | 1373 } |
| 1366 CFX_ByteString szIsoDateString; | 1374 CFX_ByteString szIsoDateString; |
| 1367 szIsoDateString.Format("%d%02d%02d", iYear + i, iMonth, iDay); | 1375 szIsoDateString.Format("%d%02d%02d", iYear + i, iMonth, iDay); |
| 1368 CFX_ByteString szLocalDateString; | 1376 CFX_ByteString szLocalDateString; |
| 1369 IsoDate2Local(hThis, szIsoDateString, formatString, localString, | 1377 IsoDate2Local(hThis, szIsoDateString.AsByteStringC(), |
| 1378 formatString.AsByteStringC(), localString.AsByteStringC(), |
| 1370 szLocalDateString); | 1379 szLocalDateString); |
| 1371 if (szLocalDateString.IsEmpty()) { | 1380 if (szLocalDateString.IsEmpty()) { |
| 1372 szLocalDateString = ""; | 1381 szLocalDateString = ""; |
| 1373 } | 1382 } |
| 1374 FXJSE_Value_SetUTF8String(args.GetReturnValue(), szLocalDateString); | 1383 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 1384 szLocalDateString.AsByteStringC()); |
| 1375 } else { | 1385 } else { |
| 1376 FXJSE_Value_SetNull(args.GetReturnValue()); | 1386 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1377 } | 1387 } |
| 1378 FXJSE_Value_Release(dateValue); | 1388 FXJSE_Value_Release(dateValue); |
| 1379 if (argc > 1) { | 1389 if (argc > 1) { |
| 1380 FXJSE_Value_Release(formatValue); | 1390 FXJSE_Value_Release(formatValue); |
| 1381 if (argc == 3) { | 1391 if (argc == 3) { |
| 1382 FXJSE_Value_Release(localValue); | 1392 FXJSE_Value_Release(localValue); |
| 1383 } | 1393 } |
| 1384 } | 1394 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 if (argc == 3) { | 1430 if (argc == 3) { |
| 1421 localValue = GetSimpleHValue(hThis, args, 2); | 1431 localValue = GetSimpleHValue(hThis, args, 2); |
| 1422 if (FXJSE_Value_IsNull(localValue)) { | 1432 if (FXJSE_Value_IsNull(localValue)) { |
| 1423 bFlags = TRUE; | 1433 bFlags = TRUE; |
| 1424 } else { | 1434 } else { |
| 1425 HValueToUTF8String(localValue, localString); | 1435 HValueToUTF8String(localValue, localString); |
| 1426 } | 1436 } |
| 1427 } | 1437 } |
| 1428 if (!bFlags) { | 1438 if (!bFlags) { |
| 1429 CFX_ByteString szGMTTimeString; | 1439 CFX_ByteString szGMTTimeString; |
| 1430 Num2AllTime(hThis, iTime, formatString, localString, TRUE, | 1440 Num2AllTime(hThis, iTime, formatString.AsByteStringC(), |
| 1431 szGMTTimeString); | 1441 localString.AsByteStringC(), TRUE, szGMTTimeString); |
| 1432 if (szGMTTimeString.IsEmpty()) { | 1442 if (szGMTTimeString.IsEmpty()) { |
| 1433 szGMTTimeString = ""; | 1443 szGMTTimeString = ""; |
| 1434 } | 1444 } |
| 1435 FXJSE_Value_SetUTF8String(args.GetReturnValue(), szGMTTimeString); | 1445 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 1446 szGMTTimeString.AsByteStringC()); |
| 1436 } else { | 1447 } else { |
| 1437 FXJSE_Value_SetNull(args.GetReturnValue()); | 1448 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1438 } | 1449 } |
| 1439 FXJSE_Value_Release(timeValue); | 1450 FXJSE_Value_Release(timeValue); |
| 1440 if (argc > 1) { | 1451 if (argc > 1) { |
| 1441 FXJSE_Value_Release(formatValue); | 1452 FXJSE_Value_Release(formatValue); |
| 1442 if (argc == 3) { | 1453 if (argc == 3) { |
| 1443 FXJSE_Value_Release(localValue); | 1454 FXJSE_Value_Release(localValue); |
| 1444 } | 1455 } |
| 1445 } | 1456 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 if (argc == 3) { | 1492 if (argc == 3) { |
| 1482 localValue = GetSimpleHValue(hThis, args, 2); | 1493 localValue = GetSimpleHValue(hThis, args, 2); |
| 1483 if (FXJSE_Value_IsNull(localValue)) { | 1494 if (FXJSE_Value_IsNull(localValue)) { |
| 1484 bFlags = TRUE; | 1495 bFlags = TRUE; |
| 1485 } else { | 1496 } else { |
| 1486 HValueToUTF8String(localValue, localString); | 1497 HValueToUTF8String(localValue, localString); |
| 1487 } | 1498 } |
| 1488 } | 1499 } |
| 1489 if (!bFlags) { | 1500 if (!bFlags) { |
| 1490 CFX_ByteString szLocalTimeString; | 1501 CFX_ByteString szLocalTimeString; |
| 1491 Num2AllTime(hThis, (int32_t)fTime, formatString, localString, FALSE, | 1502 Num2AllTime(hThis, (int32_t)fTime, formatString.AsByteStringC(), |
| 1492 szLocalTimeString); | 1503 localString.AsByteStringC(), FALSE, szLocalTimeString); |
| 1493 if (szLocalTimeString.IsEmpty()) { | 1504 if (szLocalTimeString.IsEmpty()) { |
| 1494 szLocalTimeString = ""; | 1505 szLocalTimeString = ""; |
| 1495 } | 1506 } |
| 1496 FXJSE_Value_SetUTF8String(args.GetReturnValue(), szLocalTimeString); | 1507 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 1508 szLocalTimeString.AsByteStringC()); |
| 1497 } else { | 1509 } else { |
| 1498 FXJSE_Value_SetNull(args.GetReturnValue()); | 1510 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1499 } | 1511 } |
| 1500 FXJSE_Value_Release(timeValue); | 1512 FXJSE_Value_Release(timeValue); |
| 1501 if (argc > 1) { | 1513 if (argc > 1) { |
| 1502 FXJSE_Value_Release(formatValue); | 1514 FXJSE_Value_Release(formatValue); |
| 1503 if (argc == 3) { | 1515 if (argc == 3) { |
| 1504 FXJSE_Value_Release(localValue); | 1516 FXJSE_Value_Release(localValue); |
| 1505 } | 1517 } |
| 1506 } | 1518 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 if (argc == 2) { | 1671 if (argc == 2) { |
| 1660 argLocal = GetSimpleHValue(hThis, args, 1); | 1672 argLocal = GetSimpleHValue(hThis, args, 1); |
| 1661 if (FXJSE_Value_IsNull(argLocal)) { | 1673 if (FXJSE_Value_IsNull(argLocal)) { |
| 1662 bFlags = TRUE; | 1674 bFlags = TRUE; |
| 1663 } else { | 1675 } else { |
| 1664 HValueToUTF8String(argLocal, szLocal); | 1676 HValueToUTF8String(argLocal, szLocal); |
| 1665 } | 1677 } |
| 1666 } | 1678 } |
| 1667 if (!bFlags) { | 1679 if (!bFlags) { |
| 1668 CFX_ByteString formatStr; | 1680 CFX_ByteString formatStr; |
| 1669 GetStandardTimeFormat(hThis, iStyle, szLocal, formatStr); | 1681 GetStandardTimeFormat(hThis, iStyle, szLocal.AsByteStringC(), formatStr); |
| 1670 if (formatStr.IsEmpty()) { | 1682 if (formatStr.IsEmpty()) { |
| 1671 formatStr = ""; | 1683 formatStr = ""; |
| 1672 } | 1684 } |
| 1673 FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr); | 1685 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 1686 formatStr.AsByteStringC()); |
| 1674 } else { | 1687 } else { |
| 1675 FXJSE_Value_SetNull(args.GetReturnValue()); | 1688 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 1676 } | 1689 } |
| 1677 if (argc > 0) { | 1690 if (argc > 0) { |
| 1678 FXJSE_Value_Release(argStyle); | 1691 FXJSE_Value_Release(argStyle); |
| 1679 if (argc == 2) { | 1692 if (argc == 2) { |
| 1680 FXJSE_Value_Release(argLocal); | 1693 FXJSE_Value_Release(argLocal); |
| 1681 } | 1694 } |
| 1682 } | 1695 } |
| 1683 } else { | 1696 } else { |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2479 if (!bGM) { | 2492 if (!bGM) { |
| 2480 GetLocalTimeZone(iZoneHour, iZoneMin, iZoneSec); | 2493 GetLocalTimeZone(iZoneHour, iZoneMin, iZoneSec); |
| 2481 iHour += iZoneHour; | 2494 iHour += iZoneHour; |
| 2482 iMin += iZoneMin; | 2495 iMin += iZoneMin; |
| 2483 iSec += iZoneSec; | 2496 iSec += iZoneSec; |
| 2484 } | 2497 } |
| 2485 int32_t iRet = 0; | 2498 int32_t iRet = 0; |
| 2486 CFX_ByteString strIsoTime; | 2499 CFX_ByteString strIsoTime; |
| 2487 strIsoTime.Format("%02d:%02d:%02d", iHour, iMin, iSec); | 2500 strIsoTime.Format("%02d:%02d:%02d", iHour, iMin, iSec); |
| 2488 if (bGM) { | 2501 if (bGM) { |
| 2489 iRet = GetGMTTime(hThis, strIsoTime, szFormat, szLocale, strTime); | 2502 iRet = GetGMTTime(hThis, strIsoTime.AsByteStringC(), szFormat, szLocale, |
| 2503 strTime); |
| 2490 } else { | 2504 } else { |
| 2491 iRet = IsoTime2Local(hThis, strIsoTime, szFormat, szLocale, strTime); | 2505 iRet = IsoTime2Local(hThis, strIsoTime.AsByteStringC(), szFormat, szLocale, |
| 2506 strTime); |
| 2492 } | 2507 } |
| 2493 if (!iRet) { | 2508 if (!iRet) { |
| 2494 strTime = ""; | 2509 strTime = ""; |
| 2495 } | 2510 } |
| 2496 } | 2511 } |
| 2497 | 2512 |
| 2498 void CXFA_FM2JSContext::GetLocalTimeZone(int32_t& iHour, | 2513 void CXFA_FM2JSContext::GetLocalTimeZone(int32_t& iHour, |
| 2499 int32_t& iMin, | 2514 int32_t& iMin, |
| 2500 int32_t& iSec) { | 2515 int32_t& iSec) { |
| 2501 time_t now; | 2516 time_t now; |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3065 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 3080 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 3066 FXJSE_Value_GetObjectPropByIdx(argIndexValue, 1, propertyValue); | 3081 FXJSE_Value_GetObjectPropByIdx(argIndexValue, 1, propertyValue); |
| 3067 FXJSE_Value_GetObjectPropByIdx( | 3082 FXJSE_Value_GetObjectPropByIdx( |
| 3068 argIndexValue, ((iLength - 1) - (iValueIndex - iIndex)), | 3083 argIndexValue, ((iLength - 1) - (iValueIndex - iIndex)), |
| 3069 jsobjectValue); | 3084 jsobjectValue); |
| 3070 if (FXJSE_Value_IsNull(propertyValue)) { | 3085 if (FXJSE_Value_IsNull(propertyValue)) { |
| 3071 GetObjectDefaultValue(jsobjectValue, newProperty); | 3086 GetObjectDefaultValue(jsobjectValue, newProperty); |
| 3072 } else { | 3087 } else { |
| 3073 CFX_ByteString propStr; | 3088 CFX_ByteString propStr; |
| 3074 FXJSE_Value_ToUTF8String(propertyValue, propStr); | 3089 FXJSE_Value_ToUTF8String(propertyValue, propStr); |
| 3075 FXJSE_Value_GetObjectProp(jsobjectValue, propStr, newProperty); | 3090 FXJSE_Value_GetObjectProp(jsobjectValue, propStr.AsByteStringC(), |
| 3091 newProperty); |
| 3076 } | 3092 } |
| 3077 CFX_ByteString bsChoosed; | 3093 CFX_ByteString bsChoosed; |
| 3078 HValueToUTF8String(newProperty, bsChoosed); | 3094 HValueToUTF8String(newProperty, bsChoosed); |
| 3079 FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsChoosed); | 3095 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3096 bsChoosed.AsByteStringC()); |
| 3080 FXJSE_Value_Release(newProperty); | 3097 FXJSE_Value_Release(newProperty); |
| 3081 FXJSE_Value_Release(jsobjectValue); | 3098 FXJSE_Value_Release(jsobjectValue); |
| 3082 FXJSE_Value_Release(propertyValue); | 3099 FXJSE_Value_Release(propertyValue); |
| 3083 bFound = TRUE; | 3100 bFound = TRUE; |
| 3084 } | 3101 } |
| 3085 } else { | 3102 } else { |
| 3086 iValueIndex++; | 3103 iValueIndex++; |
| 3087 if (iValueIndex == iIndex) { | 3104 if (iValueIndex == iIndex) { |
| 3088 CFX_ByteString bsChoosed; | 3105 CFX_ByteString bsChoosed; |
| 3089 HValueToUTF8String(argIndexValue, bsChoosed); | 3106 HValueToUTF8String(argIndexValue, bsChoosed); |
| 3090 FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsChoosed); | 3107 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3108 bsChoosed.AsByteStringC()); |
| 3091 bFound = TRUE; | 3109 bFound = TRUE; |
| 3092 } | 3110 } |
| 3093 } | 3111 } |
| 3094 FXJSE_Value_Release(argIndexValue); | 3112 FXJSE_Value_Release(argIndexValue); |
| 3095 iArgIndex++; | 3113 iArgIndex++; |
| 3096 } | 3114 } |
| 3097 if (!bFound) { | 3115 if (!bFound) { |
| 3098 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 3116 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 3099 } | 3117 } |
| 3100 } | 3118 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3190 FXJSE_Value_SetInteger( | 3208 FXJSE_Value_SetInteger( |
| 3191 args.GetReturnValue(), | 3209 args.GetReturnValue(), |
| 3192 ((oneNumber >= lowNumber) && (oneNumber <= heightNumber))); | 3210 ((oneNumber >= lowNumber) && (oneNumber <= heightNumber))); |
| 3193 } else { | 3211 } else { |
| 3194 CFX_ByteString oneString; | 3212 CFX_ByteString oneString; |
| 3195 CFX_ByteString lowString; | 3213 CFX_ByteString lowString; |
| 3196 CFX_ByteString heightString; | 3214 CFX_ByteString heightString; |
| 3197 HValueToUTF8String(argOne, oneString); | 3215 HValueToUTF8String(argOne, oneString); |
| 3198 HValueToUTF8String(argLow, lowString); | 3216 HValueToUTF8String(argLow, lowString); |
| 3199 HValueToUTF8String(argHeight, heightString); | 3217 HValueToUTF8String(argHeight, heightString); |
| 3200 FXJSE_Value_SetInteger(args.GetReturnValue(), | 3218 FXJSE_Value_SetInteger( |
| 3201 ((oneString.Compare(lowString) >= 0) && | 3219 args.GetReturnValue(), |
| 3202 (oneString.Compare(heightString) <= 0))); | 3220 ((oneString.Compare(lowString.AsByteStringC()) >= 0) && |
| 3221 (oneString.Compare(heightString.AsByteStringC()) <= 0))); |
| 3203 } | 3222 } |
| 3204 FXJSE_Value_Release(argLow); | 3223 FXJSE_Value_Release(argLow); |
| 3205 FXJSE_Value_Release(argHeight); | 3224 FXJSE_Value_Release(argHeight); |
| 3206 } | 3225 } |
| 3207 FXJSE_Value_Release(argOne); | 3226 FXJSE_Value_Release(argOne); |
| 3208 } else { | 3227 } else { |
| 3209 CXFA_FM2JSContext* pContext = | 3228 CXFA_FM2JSContext* pContext = |
| 3210 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3229 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 3211 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3230 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 3212 L"Within"); | 3231 L"Within"); |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3630 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { | 3649 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { |
| 3631 FXJSE_Value_SetNull(args.GetReturnValue()); | 3650 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3632 } else { | 3651 } else { |
| 3633 CFX_ByteString stringTwo; | 3652 CFX_ByteString stringTwo; |
| 3634 HValueToUTF8String(argTwo, stringTwo); | 3653 HValueToUTF8String(argTwo, stringTwo); |
| 3635 if (stringTwo.IsEmpty()) { | 3654 if (stringTwo.IsEmpty()) { |
| 3636 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); | 3655 FXJSE_Value_SetInteger(args.GetReturnValue(), 1); |
| 3637 } else { | 3656 } else { |
| 3638 CFX_ByteString stringOne; | 3657 CFX_ByteString stringOne; |
| 3639 HValueToUTF8String(argOne, stringOne); | 3658 HValueToUTF8String(argOne, stringOne); |
| 3640 FX_STRSIZE iPosition = stringOne.Find(stringTwo); | 3659 FX_STRSIZE iPosition = stringOne.Find(stringTwo.AsByteStringC()); |
| 3641 FXJSE_Value_SetInteger(args.GetReturnValue(), iPosition + 1); | 3660 FXJSE_Value_SetInteger(args.GetReturnValue(), iPosition + 1); |
| 3642 } | 3661 } |
| 3643 } | 3662 } |
| 3644 FXJSE_Value_Release(argOne); | 3663 FXJSE_Value_Release(argOne); |
| 3645 FXJSE_Value_Release(argTwo); | 3664 FXJSE_Value_Release(argTwo); |
| 3646 } else { | 3665 } else { |
| 3647 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3666 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 3648 L"At"); | 3667 L"At"); |
| 3649 } | 3668 } |
| 3650 } | 3669 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3667 bAllNull = FALSE; | 3686 bAllNull = FALSE; |
| 3668 } | 3687 } |
| 3669 } | 3688 } |
| 3670 for (int32_t i = 0; i < argc; i++) { | 3689 for (int32_t i = 0; i < argc; i++) { |
| 3671 FXJSE_Value_Release(argValues[i]); | 3690 FXJSE_Value_Release(argValues[i]); |
| 3672 } | 3691 } |
| 3673 FX_Free(argValues); | 3692 FX_Free(argValues); |
| 3674 if (bAllNull) { | 3693 if (bAllNull) { |
| 3675 FXJSE_Value_SetNull(args.GetReturnValue()); | 3694 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3676 } else { | 3695 } else { |
| 3677 FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString); | 3696 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3697 resultString.AsByteStringC()); |
| 3678 } | 3698 } |
| 3679 } else { | 3699 } else { |
| 3680 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3700 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 3681 L"Concat"); | 3701 L"Concat"); |
| 3682 } | 3702 } |
| 3683 } | 3703 } |
| 3684 void CXFA_FM2JSContext::Decode(FXJSE_HOBJECT hThis, | 3704 void CXFA_FM2JSContext::Decode(FXJSE_HOBJECT hThis, |
| 3685 const CFX_ByteStringC& szFuncName, | 3705 const CFX_ByteStringC& szFuncName, |
| 3686 CFXJSE_Arguments& args) { | 3706 CFXJSE_Arguments& args) { |
| 3687 CXFA_FM2JSContext* pContext = | 3707 CXFA_FM2JSContext* pContext = |
| 3688 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3708 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 3689 int32_t argc = args.GetLength(); | 3709 int32_t argc = args.GetLength(); |
| 3690 if (argc == 1) { | 3710 if (argc == 1) { |
| 3691 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 3711 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 3692 if (HValueIsNull(hThis, argOne)) { | 3712 if (HValueIsNull(hThis, argOne)) { |
| 3693 FXJSE_Value_SetNull(args.GetReturnValue()); | 3713 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3694 } else { | 3714 } else { |
| 3695 CFX_ByteString toDecodeString; | 3715 CFX_ByteString toDecodeString; |
| 3696 HValueToUTF8String(argOne, toDecodeString); | 3716 HValueToUTF8String(argOne, toDecodeString); |
| 3697 CFX_ByteTextBuf resultBuf; | 3717 CFX_ByteTextBuf resultBuf; |
| 3698 DecodeURL(toDecodeString, resultBuf); | 3718 DecodeURL(toDecodeString.AsByteStringC(), resultBuf); |
| 3699 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 3719 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3700 resultBuf.GetByteString()); | 3720 resultBuf.GetByteString()); |
| 3701 } | 3721 } |
| 3702 FXJSE_Value_Release(argOne); | 3722 FXJSE_Value_Release(argOne); |
| 3703 } else if (argc == 2) { | 3723 } else if (argc == 2) { |
| 3704 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 3724 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 3705 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 3725 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
| 3706 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { | 3726 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { |
| 3707 FXJSE_Value_SetNull(args.GetReturnValue()); | 3727 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3708 } else { | 3728 } else { |
| 3709 CFX_ByteString toDecodeString; | 3729 CFX_ByteString toDecodeString; |
| 3710 HValueToUTF8String(argOne, toDecodeString); | 3730 HValueToUTF8String(argOne, toDecodeString); |
| 3711 CFX_ByteString identifyString; | 3731 CFX_ByteString identifyString; |
| 3712 HValueToUTF8String(argTwo, identifyString); | 3732 HValueToUTF8String(argTwo, identifyString); |
| 3713 CFX_ByteTextBuf resultBuf; | 3733 CFX_ByteTextBuf resultBuf; |
| 3714 if (identifyString.EqualNoCase("html")) { | 3734 if (identifyString.EqualNoCase("html")) { |
| 3715 DecodeHTML(toDecodeString, resultBuf); | 3735 DecodeHTML(toDecodeString.AsByteStringC(), resultBuf); |
| 3716 } else if (identifyString.EqualNoCase("xml")) { | 3736 } else if (identifyString.EqualNoCase("xml")) { |
| 3717 DecodeXML(toDecodeString, resultBuf); | 3737 DecodeXML(toDecodeString.AsByteStringC(), resultBuf); |
| 3718 } else { | 3738 } else { |
| 3719 DecodeURL(toDecodeString, resultBuf); | 3739 DecodeURL(toDecodeString.AsByteStringC(), resultBuf); |
| 3720 } | 3740 } |
| 3721 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 3741 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3722 resultBuf.GetByteString()); | 3742 resultBuf.GetByteString()); |
| 3723 } | 3743 } |
| 3724 FXJSE_Value_Release(argOne); | 3744 FXJSE_Value_Release(argOne); |
| 3725 FXJSE_Value_Release(argTwo); | 3745 FXJSE_Value_Release(argTwo); |
| 3726 } else { | 3746 } else { |
| 3727 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 3747 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 3728 L"Decode"); | 3748 L"Decode"); |
| 3729 } | 3749 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3774 } | 3794 } |
| 3775 wsResultBuf.AppendChar(chTemp); | 3795 wsResultBuf.AppendChar(chTemp); |
| 3776 } else { | 3796 } else { |
| 3777 wsResultBuf.AppendChar(ch); | 3797 wsResultBuf.AppendChar(ch); |
| 3778 } | 3798 } |
| 3779 ++i; | 3799 ++i; |
| 3780 } | 3800 } |
| 3781 wsResultBuf.AppendChar(0); | 3801 wsResultBuf.AppendChar(0); |
| 3782 szResultString.Clear(); | 3802 szResultString.Clear(); |
| 3783 szResultString << FX_UTF8Encode(wsResultBuf.GetBuffer(), | 3803 szResultString << FX_UTF8Encode(wsResultBuf.GetBuffer(), |
| 3784 wsResultBuf.GetLength()); | 3804 wsResultBuf.GetLength()) |
| 3805 .AsByteStringC(); |
| 3785 } | 3806 } |
| 3786 void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, | 3807 void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString, |
| 3787 CFX_ByteTextBuf& szResultString) { | 3808 CFX_ByteTextBuf& szResultString) { |
| 3788 CFX_WideString wsHTMLString = CFX_WideString::FromUTF8( | 3809 CFX_WideString wsHTMLString = CFX_WideString::FromUTF8( |
| 3789 szHTMLString.GetCStr(), szHTMLString.GetLength()); | 3810 szHTMLString.GetCStr(), szHTMLString.GetLength()); |
| 3790 FX_WCHAR strString[9]; | 3811 FX_WCHAR strString[9]; |
| 3791 int32_t iStrIndex = 0; | 3812 int32_t iStrIndex = 0; |
| 3792 int32_t iLen = wsHTMLString.GetLength(); | 3813 int32_t iLen = wsHTMLString.GetLength(); |
| 3793 int32_t i = 0; | 3814 int32_t i = 0; |
| 3794 int32_t iCode = 0; | 3815 int32_t iCode = 0; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3848 } else { | 3869 } else { |
| 3849 wsResultBuf.AppendChar(iCode); | 3870 wsResultBuf.AppendChar(iCode); |
| 3850 } | 3871 } |
| 3851 iStrIndex = 0; | 3872 iStrIndex = 0; |
| 3852 strString[iStrIndex] = 0; | 3873 strString[iStrIndex] = 0; |
| 3853 ++i; | 3874 ++i; |
| 3854 } | 3875 } |
| 3855 wsResultBuf.AppendChar(0); | 3876 wsResultBuf.AppendChar(0); |
| 3856 szResultString.Clear(); | 3877 szResultString.Clear(); |
| 3857 szResultString << FX_UTF8Encode(wsResultBuf.GetBuffer(), | 3878 szResultString << FX_UTF8Encode(wsResultBuf.GetBuffer(), |
| 3858 wsResultBuf.GetLength()); | 3879 wsResultBuf.GetLength()) |
| 3880 .AsByteStringC(); |
| 3859 } | 3881 } |
| 3860 void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString, | 3882 void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString, |
| 3861 CFX_ByteTextBuf& szResultString) { | 3883 CFX_ByteTextBuf& szResultString) { |
| 3862 CFX_WideString wsXMLString = | 3884 CFX_WideString wsXMLString = |
| 3863 CFX_WideString::FromUTF8(szXMLString.GetCStr(), szXMLString.GetLength()); | 3885 CFX_WideString::FromUTF8(szXMLString.GetCStr(), szXMLString.GetLength()); |
| 3864 FX_WCHAR strString[9]; | 3886 FX_WCHAR strString[9]; |
| 3865 int32_t iStrIndex = 0; | 3887 int32_t iStrIndex = 0; |
| 3866 int32_t iLen = wsXMLString.GetLength(); | 3888 int32_t iLen = wsXMLString.GetLength(); |
| 3867 int32_t i = 0; | 3889 int32_t i = 0; |
| 3868 int32_t iCode = 0; | 3890 int32_t iCode = 0; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3945 wsXMLBuf.AppendChar(iCode); | 3967 wsXMLBuf.AppendChar(iCode); |
| 3946 break; | 3968 break; |
| 3947 } | 3969 } |
| 3948 iStrIndex = 0; | 3970 iStrIndex = 0; |
| 3949 strString[iStrIndex] = 0; | 3971 strString[iStrIndex] = 0; |
| 3950 ++i; | 3972 ++i; |
| 3951 iCode = 0; | 3973 iCode = 0; |
| 3952 } | 3974 } |
| 3953 wsXMLBuf.AppendChar(0); | 3975 wsXMLBuf.AppendChar(0); |
| 3954 szResultString.Clear(); | 3976 szResultString.Clear(); |
| 3955 szResultString << FX_UTF8Encode(wsXMLBuf.GetBuffer(), wsXMLBuf.GetLength()); | 3977 szResultString << FX_UTF8Encode(wsXMLBuf.GetBuffer(), wsXMLBuf.GetLength()) |
| 3978 .AsByteStringC(); |
| 3956 } | 3979 } |
| 3957 void CXFA_FM2JSContext::Encode(FXJSE_HOBJECT hThis, | 3980 void CXFA_FM2JSContext::Encode(FXJSE_HOBJECT hThis, |
| 3958 const CFX_ByteStringC& szFuncName, | 3981 const CFX_ByteStringC& szFuncName, |
| 3959 CFXJSE_Arguments& args) { | 3982 CFXJSE_Arguments& args) { |
| 3960 CXFA_FM2JSContext* pContext = | 3983 CXFA_FM2JSContext* pContext = |
| 3961 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 3984 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 3962 int32_t argc = args.GetLength(); | 3985 int32_t argc = args.GetLength(); |
| 3963 if (argc == 1) { | 3986 if (argc == 1) { |
| 3964 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 3987 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 3965 if (HValueIsNull(hThis, argOne)) { | 3988 if (HValueIsNull(hThis, argOne)) { |
| 3966 FXJSE_Value_SetNull(args.GetReturnValue()); | 3989 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3967 } else { | 3990 } else { |
| 3968 CFX_ByteString toEncodeString; | 3991 CFX_ByteString toEncodeString; |
| 3969 HValueToUTF8String(argOne, toEncodeString); | 3992 HValueToUTF8String(argOne, toEncodeString); |
| 3970 CFX_ByteTextBuf resultBuf; | 3993 CFX_ByteTextBuf resultBuf; |
| 3971 EncodeURL(toEncodeString, resultBuf); | 3994 EncodeURL(toEncodeString.AsByteStringC(), resultBuf); |
| 3972 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 3995 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3973 resultBuf.GetByteString()); | 3996 resultBuf.GetByteString()); |
| 3974 } | 3997 } |
| 3975 FXJSE_Value_Release(argOne); | 3998 FXJSE_Value_Release(argOne); |
| 3976 } else if (argc == 2) { | 3999 } else if (argc == 2) { |
| 3977 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4000 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 3978 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); | 4001 FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); |
| 3979 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { | 4002 if (HValueIsNull(hThis, argOne) || HValueIsNull(hThis, argTwo)) { |
| 3980 FXJSE_Value_SetNull(args.GetReturnValue()); | 4003 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 3981 } else { | 4004 } else { |
| 3982 CFX_ByteString toEncodeString; | 4005 CFX_ByteString toEncodeString; |
| 3983 HValueToUTF8String(argOne, toEncodeString); | 4006 HValueToUTF8String(argOne, toEncodeString); |
| 3984 CFX_ByteString identifyString; | 4007 CFX_ByteString identifyString; |
| 3985 HValueToUTF8String(argTwo, identifyString); | 4008 HValueToUTF8String(argTwo, identifyString); |
| 3986 CFX_ByteTextBuf resultBuf; | 4009 CFX_ByteTextBuf resultBuf; |
| 3987 if (identifyString.EqualNoCase("html")) { | 4010 if (identifyString.EqualNoCase("html")) { |
| 3988 EncodeHTML(toEncodeString, resultBuf); | 4011 EncodeHTML(toEncodeString.AsByteStringC(), resultBuf); |
| 3989 } else if (identifyString.EqualNoCase("xml")) { | 4012 } else if (identifyString.EqualNoCase("xml")) { |
| 3990 EncodeXML(toEncodeString, resultBuf); | 4013 EncodeXML(toEncodeString.AsByteStringC(), resultBuf); |
| 3991 } else { | 4014 } else { |
| 3992 EncodeURL(toEncodeString, resultBuf); | 4015 EncodeURL(toEncodeString.AsByteStringC(), resultBuf); |
| 3993 } | 4016 } |
| 3994 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4017 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 3995 resultBuf.GetByteString()); | 4018 resultBuf.GetByteString()); |
| 3996 } | 4019 } |
| 3997 FXJSE_Value_Release(argOne); | 4020 FXJSE_Value_Release(argOne); |
| 3998 FXJSE_Value_Release(argTwo); | 4021 FXJSE_Value_Release(argTwo); |
| 3999 } else { | 4022 } else { |
| 4000 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4023 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4001 L"Encode"); | 4024 L"Encode"); |
| 4002 } | 4025 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4099 while (iIndex > 0) { | 4122 while (iIndex > 0) { |
| 4100 strEncode[1] = strTmp.GetAt(iIndex); | 4123 strEncode[1] = strTmp.GetAt(iIndex); |
| 4101 strEncode[2] = strTmp.GetAt(iIndex - 1); | 4124 strEncode[2] = strTmp.GetAt(iIndex - 1); |
| 4102 iIndex -= 2; | 4125 iIndex -= 2; |
| 4103 wsResultBuf << FX_WSTRC(strEncode); | 4126 wsResultBuf << FX_WSTRC(strEncode); |
| 4104 } | 4127 } |
| 4105 } | 4128 } |
| 4106 } | 4129 } |
| 4107 wsResultBuf.AppendChar(0); | 4130 wsResultBuf.AppendChar(0); |
| 4108 szResultBuf.Clear(); | 4131 szResultBuf.Clear(); |
| 4109 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), | 4132 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength()) |
| 4110 wsResultBuf.GetLength()); | 4133 .AsByteStringC(); |
| 4111 } | 4134 } |
| 4112 void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString, | 4135 void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString, |
| 4113 CFX_ByteTextBuf& szResultBuf) { | 4136 CFX_ByteTextBuf& szResultBuf) { |
| 4114 CFX_ByteString str = szHTMLString.GetCStr(); | 4137 CFX_ByteString str = szHTMLString.GetCStr(); |
| 4115 CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(str, str.GetLength()); | 4138 CFX_WideString wsHTMLString = CFX_WideString::FromUTF8(str, str.GetLength()); |
| 4116 const FX_WCHAR* strCode = L"0123456789abcdef"; | 4139 const FX_WCHAR* strCode = L"0123456789abcdef"; |
| 4117 FX_WCHAR strEncode[9]; | 4140 FX_WCHAR strEncode[9]; |
| 4118 strEncode[0] = '&'; | 4141 strEncode[0] = '&'; |
| 4119 strEncode[1] = '#'; | 4142 strEncode[1] = '#'; |
| 4120 strEncode[2] = 'x'; | 4143 strEncode[2] = 'x'; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4153 strEncode[4] = strCode[iBigByte % 16]; | 4176 strEncode[4] = strCode[iBigByte % 16]; |
| 4154 strEncode[5] = strCode[iLittleByte / 16]; | 4177 strEncode[5] = strCode[iLittleByte / 16]; |
| 4155 strEncode[6] = strCode[iLittleByte % 16]; | 4178 strEncode[6] = strCode[iLittleByte % 16]; |
| 4156 wsResultBuf << FX_WSTRC(strEncode); | 4179 wsResultBuf << FX_WSTRC(strEncode); |
| 4157 } | 4180 } |
| 4158 } | 4181 } |
| 4159 ++i; | 4182 ++i; |
| 4160 } | 4183 } |
| 4161 wsResultBuf.AppendChar(0); | 4184 wsResultBuf.AppendChar(0); |
| 4162 szResultBuf.Clear(); | 4185 szResultBuf.Clear(); |
| 4163 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), | 4186 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength()) |
| 4164 wsResultBuf.GetLength()); | 4187 .AsByteStringC(); |
| 4165 } | 4188 } |
| 4166 void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString, | 4189 void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString, |
| 4167 CFX_ByteTextBuf& szResultBuf) { | 4190 CFX_ByteTextBuf& szResultBuf) { |
| 4168 CFX_WideString wsXMLString = | 4191 CFX_WideString wsXMLString = |
| 4169 CFX_WideString::FromUTF8(szXMLString.GetCStr(), szXMLString.GetLength()); | 4192 CFX_WideString::FromUTF8(szXMLString.GetCStr(), szXMLString.GetLength()); |
| 4170 CFX_WideTextBuf wsResultBuf; | 4193 CFX_WideTextBuf wsResultBuf; |
| 4171 enum { | 4194 enum { |
| 4172 QUOT, | 4195 QUOT, |
| 4173 AMP, | 4196 AMP, |
| 4174 APOS, | 4197 APOS, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4235 strEncode[4] = strCode[iBigByte % 16]; | 4258 strEncode[4] = strCode[iBigByte % 16]; |
| 4236 strEncode[5] = strCode[iLittleByte / 16]; | 4259 strEncode[5] = strCode[iLittleByte / 16]; |
| 4237 strEncode[6] = strCode[iLittleByte % 16]; | 4260 strEncode[6] = strCode[iLittleByte % 16]; |
| 4238 wsResultBuf << FX_WSTRC(strEncode); | 4261 wsResultBuf << FX_WSTRC(strEncode); |
| 4239 } | 4262 } |
| 4240 } break; | 4263 } break; |
| 4241 } | 4264 } |
| 4242 } | 4265 } |
| 4243 wsResultBuf.AppendChar(0); | 4266 wsResultBuf.AppendChar(0); |
| 4244 szResultBuf.Clear(); | 4267 szResultBuf.Clear(); |
| 4245 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), | 4268 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength()) |
| 4246 wsResultBuf.GetLength()); | 4269 .AsByteStringC(); |
| 4247 } | 4270 } |
| 4248 FX_BOOL CXFA_FM2JSContext::HTMLSTR2Code(const CFX_WideStringC& pData, | 4271 FX_BOOL CXFA_FM2JSContext::HTMLSTR2Code(const CFX_WideStringC& pData, |
| 4249 uint32_t& iCode) { | 4272 uint32_t& iCode) { |
| 4250 int32_t iLength = pData.GetLength(); | 4273 int32_t iLength = pData.GetLength(); |
| 4251 uint32_t uHash = FX_HashCode_String_GetW(pData.GetPtr(), iLength); | 4274 uint32_t uHash = FX_HashCode_String_GetW(pData.GetPtr(), iLength); |
| 4252 XFA_FMHtmlHashedReserveCode htmlhashedreservecode; | 4275 XFA_FMHtmlHashedReserveCode htmlhashedreservecode; |
| 4253 int32_t iStart = 0, | 4276 int32_t iStart = 0, |
| 4254 iEnd = (sizeof(reservesForDecode) / sizeof(reservesForDecode[0])) - 1; | 4277 iEnd = (sizeof(reservesForDecode) / sizeof(reservesForDecode[0])) - 1; |
| 4255 int32_t iMid = (iStart + iEnd) / 2; | 4278 int32_t iMid = (iStart + iEnd) / 2; |
| 4256 do { | 4279 do { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4385 HValueToUTF8String(argOne, szPattern); | 4408 HValueToUTF8String(argOne, szPattern); |
| 4386 CFX_ByteString szValue; | 4409 CFX_ByteString szValue; |
| 4387 HValueToUTF8String(argTwo, szValue); | 4410 HValueToUTF8String(argTwo, szValue); |
| 4388 CXFA_Document* pDoc = pContext->GetDocument(); | 4411 CXFA_Document* pDoc = pContext->GetDocument(); |
| 4389 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 4412 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 4390 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 4413 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 4391 FXSYS_assert(pThisNode); | 4414 FXSYS_assert(pThisNode); |
| 4392 CXFA_WidgetData widgetData(pThisNode); | 4415 CXFA_WidgetData widgetData(pThisNode); |
| 4393 IFX_Locale* pLocale = widgetData.GetLocal(); | 4416 IFX_Locale* pLocale = widgetData.GetLocal(); |
| 4394 uint32_t patternType; | 4417 uint32_t patternType; |
| 4395 FX_BOOL bCompelte = XFA_PATTERN_STRING_Type(szPattern, patternType); | 4418 FX_BOOL bCompelte = |
| 4419 XFA_PATTERN_STRING_Type(szPattern.AsByteStringC(), patternType); |
| 4396 CFX_WideString wsPattern = | 4420 CFX_WideString wsPattern = |
| 4397 CFX_WideString::FromUTF8(szPattern, szPattern.GetLength()); | 4421 CFX_WideString::FromUTF8(szPattern, szPattern.GetLength()); |
| 4398 CFX_WideString wsValue = | 4422 CFX_WideString wsValue = |
| 4399 CFX_WideString::FromUTF8(szValue, szValue.GetLength()); | 4423 CFX_WideString::FromUTF8(szValue, szValue.GetLength()); |
| 4400 if (!bCompelte) { | 4424 if (!bCompelte) { |
| 4401 switch (patternType) { | 4425 switch (patternType) { |
| 4402 case XFA_VT_DATETIME: { | 4426 case XFA_VT_DATETIME: { |
| 4403 FX_STRSIZE iTChar = wsPattern.Find(L'T'); | 4427 FX_STRSIZE iTChar = wsPattern.Find(L'T'); |
| 4404 CFX_WideString wsDatePattern = FX_WSTRC(L"date{"); | 4428 CFX_WideString wsDatePattern = FX_WSTRC(L"date{"); |
| 4405 wsDatePattern += wsPattern.Left(iTChar); | 4429 wsDatePattern += wsPattern.Left(iTChar); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4441 patternType = XFA_VT_TEXT; | 4465 patternType = XFA_VT_TEXT; |
| 4442 } | 4466 } |
| 4443 } break; | 4467 } break; |
| 4444 } | 4468 } |
| 4445 } | 4469 } |
| 4446 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale, | 4470 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale, |
| 4447 (CXFA_LocaleMgr*)pMgr); | 4471 (CXFA_LocaleMgr*)pMgr); |
| 4448 CFX_WideString wsRet; | 4472 CFX_WideString wsRet; |
| 4449 if (localeValue.FormatPatterns(wsRet, wsPattern, pLocale, | 4473 if (localeValue.FormatPatterns(wsRet, wsPattern, pLocale, |
| 4450 XFA_VALUEPICTURE_Display)) { | 4474 XFA_VALUEPICTURE_Display)) { |
| 4451 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4475 FXJSE_Value_SetUTF8String( |
| 4452 FX_UTF8Encode(wsRet, wsRet.GetLength())); | 4476 args.GetReturnValue(), |
| 4477 FX_UTF8Encode(wsRet, wsRet.GetLength()).AsByteStringC()); |
| 4453 } else { | 4478 } else { |
| 4454 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4479 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4455 } | 4480 } |
| 4456 FXJSE_Value_Release(argOne); | 4481 FXJSE_Value_Release(argOne); |
| 4457 FXJSE_Value_Release(argTwo); | 4482 FXJSE_Value_Release(argTwo); |
| 4458 } else { | 4483 } else { |
| 4459 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4484 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4460 L"Format"); | 4485 L"Format"); |
| 4461 } | 4486 } |
| 4462 } | 4487 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 4475 if (argIsNull) { | 4500 if (argIsNull) { |
| 4476 FXJSE_Value_SetNull(args.GetReturnValue()); | 4501 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4477 } else { | 4502 } else { |
| 4478 CFX_ByteString sourceString; | 4503 CFX_ByteString sourceString; |
| 4479 HValueToUTF8String(argOne, sourceString); | 4504 HValueToUTF8String(argOne, sourceString); |
| 4480 int32_t count = HValueToInteger(hThis, argTwo); | 4505 int32_t count = HValueToInteger(hThis, argTwo); |
| 4481 if (count < 0) { | 4506 if (count < 0) { |
| 4482 count = 0; | 4507 count = 0; |
| 4483 } | 4508 } |
| 4484 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4509 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4485 sourceString.Left(count)); | 4510 sourceString.Left(count).AsByteStringC()); |
| 4486 } | 4511 } |
| 4487 FXJSE_Value_Release(argOne); | 4512 FXJSE_Value_Release(argOne); |
| 4488 FXJSE_Value_Release(argTwo); | 4513 FXJSE_Value_Release(argTwo); |
| 4489 } else { | 4514 } else { |
| 4490 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4515 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4491 L"Left"); | 4516 L"Left"); |
| 4492 } | 4517 } |
| 4493 } | 4518 } |
| 4494 void CXFA_FM2JSContext::Len(FXJSE_HOBJECT hThis, | 4519 void CXFA_FM2JSContext::Len(FXJSE_HOBJECT hThis, |
| 4495 const CFX_ByteStringC& szFuncName, | 4520 const CFX_ByteStringC& szFuncName, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4541 ch += 32; | 4566 ch += 32; |
| 4542 } else if (ch == 0x100 || ch == 0x102 || ch == 0x104) { | 4567 } else if (ch == 0x100 || ch == 0x102 || ch == 0x104) { |
| 4543 ch += 1; | 4568 ch += 1; |
| 4544 } | 4569 } |
| 4545 lowStringBuf.AppendChar(ch); | 4570 lowStringBuf.AppendChar(ch); |
| 4546 ++i; | 4571 ++i; |
| 4547 } | 4572 } |
| 4548 lowStringBuf.AppendChar(0); | 4573 lowStringBuf.AppendChar(0); |
| 4549 FXJSE_Value_SetUTF8String( | 4574 FXJSE_Value_SetUTF8String( |
| 4550 args.GetReturnValue(), | 4575 args.GetReturnValue(), |
| 4551 FX_UTF8Encode(lowStringBuf.GetBuffer(), lowStringBuf.GetLength())); | 4576 FX_UTF8Encode(lowStringBuf.GetBuffer(), lowStringBuf.GetLength()) |
| 4577 .AsByteStringC()); |
| 4552 if (argc == 2) { | 4578 if (argc == 2) { |
| 4553 FXJSE_Value_Release(localeValue); | 4579 FXJSE_Value_Release(localeValue); |
| 4554 } | 4580 } |
| 4555 } | 4581 } |
| 4556 FXJSE_Value_Release(argOne); | 4582 FXJSE_Value_Release(argOne); |
| 4557 } else { | 4583 } else { |
| 4558 CXFA_FM2JSContext* pContext = | 4584 CXFA_FM2JSContext* pContext = |
| 4559 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 4585 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 4560 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4586 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4561 L"Lower"); | 4587 L"Lower"); |
| 4562 } | 4588 } |
| 4563 } | 4589 } |
| 4564 void CXFA_FM2JSContext::Ltrim(FXJSE_HOBJECT hThis, | 4590 void CXFA_FM2JSContext::Ltrim(FXJSE_HOBJECT hThis, |
| 4565 const CFX_ByteStringC& szFuncName, | 4591 const CFX_ByteStringC& szFuncName, |
| 4566 CFXJSE_Arguments& args) { | 4592 CFXJSE_Arguments& args) { |
| 4567 CXFA_FM2JSContext* pContext = | 4593 CXFA_FM2JSContext* pContext = |
| 4568 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 4594 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 4569 if (args.GetLength() == 1) { | 4595 if (args.GetLength() == 1) { |
| 4570 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4596 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 4571 if (HValueIsNull(hThis, argOne)) { | 4597 if (HValueIsNull(hThis, argOne)) { |
| 4572 FXJSE_Value_SetNull(args.GetReturnValue()); | 4598 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4573 } else { | 4599 } else { |
| 4574 CFX_ByteString sourceString; | 4600 CFX_ByteString sourceString; |
| 4575 HValueToUTF8String(argOne, sourceString); | 4601 HValueToUTF8String(argOne, sourceString); |
| 4576 sourceString.TrimLeft(); | 4602 sourceString.TrimLeft(); |
| 4577 FXJSE_Value_SetUTF8String(args.GetReturnValue(), sourceString); | 4603 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4604 sourceString.AsByteStringC()); |
| 4578 } | 4605 } |
| 4579 FXJSE_Value_Release(argOne); | 4606 FXJSE_Value_Release(argOne); |
| 4580 } else { | 4607 } else { |
| 4581 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4608 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4582 L"Ltrim"); | 4609 L"Ltrim"); |
| 4583 } | 4610 } |
| 4584 } | 4611 } |
| 4585 void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis, | 4612 void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis, |
| 4586 const CFX_ByteStringC& szFuncName, | 4613 const CFX_ByteStringC& szFuncName, |
| 4587 CFXJSE_Arguments& args) { | 4614 CFXJSE_Arguments& args) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4598 CFX_ByteString szValue; | 4625 CFX_ByteString szValue; |
| 4599 HValueToUTF8String(argTwo, szValue); | 4626 HValueToUTF8String(argTwo, szValue); |
| 4600 CXFA_Document* pDoc = pContext->GetDocument(); | 4627 CXFA_Document* pDoc = pContext->GetDocument(); |
| 4601 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); | 4628 IFX_LocaleMgr* pMgr = (IFX_LocaleMgr*)pDoc->GetLocalMgr(); |
| 4602 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); | 4629 CXFA_Node* pThisNode = ToNode(pDoc->GetScriptContext()->GetThisObject()); |
| 4603 FXSYS_assert(pThisNode); | 4630 FXSYS_assert(pThisNode); |
| 4604 CXFA_WidgetData widgetData(pThisNode); | 4631 CXFA_WidgetData widgetData(pThisNode); |
| 4605 IFX_Locale* pLocale = widgetData.GetLocal(); | 4632 IFX_Locale* pLocale = widgetData.GetLocal(); |
| 4606 uint32_t patternType; | 4633 uint32_t patternType; |
| 4607 FX_BOOL bCompletePattern = | 4634 FX_BOOL bCompletePattern = |
| 4608 XFA_PATTERN_STRING_Type(szPattern, patternType); | 4635 XFA_PATTERN_STRING_Type(szPattern.AsByteStringC(), patternType); |
| 4609 CFX_WideString wsPattern = | 4636 CFX_WideString wsPattern = |
| 4610 CFX_WideString::FromUTF8(szPattern, szPattern.GetLength()); | 4637 CFX_WideString::FromUTF8(szPattern, szPattern.GetLength()); |
| 4611 CFX_WideString wsValue = | 4638 CFX_WideString wsValue = |
| 4612 CFX_WideString::FromUTF8(szValue, szValue.GetLength()); | 4639 CFX_WideString::FromUTF8(szValue, szValue.GetLength()); |
| 4613 CFX_ByteString szParsedValue; | 4640 CFX_ByteString szParsedValue; |
| 4614 if (bCompletePattern) { | 4641 if (bCompletePattern) { |
| 4615 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale, | 4642 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, pLocale, |
| 4616 (CXFA_LocaleMgr*)pMgr); | 4643 (CXFA_LocaleMgr*)pMgr); |
| 4617 if (localeValue.IsValid()) { | 4644 if (localeValue.IsValid()) { |
| 4618 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4645 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
| 4619 FXJSE_Value_SetUTF8String(args.GetReturnValue(), szParsedValue); | 4646 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4647 szParsedValue.AsByteStringC()); |
| 4620 } else { | 4648 } else { |
| 4621 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4649 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4622 } | 4650 } |
| 4623 } else { | 4651 } else { |
| 4624 switch (patternType) { | 4652 switch (patternType) { |
| 4625 case XFA_VT_DATETIME: { | 4653 case XFA_VT_DATETIME: { |
| 4626 FX_STRSIZE iTChar = wsPattern.Find(L'T'); | 4654 FX_STRSIZE iTChar = wsPattern.Find(L'T'); |
| 4627 CFX_WideString wsDatePattern = FX_WSTRC(L"date{"); | 4655 CFX_WideString wsDatePattern = FX_WSTRC(L"date{"); |
| 4628 wsDatePattern += wsPattern.Left(iTChar); | 4656 wsDatePattern += wsPattern.Left(iTChar); |
| 4629 wsDatePattern += FX_WSTRC(L"} "); | 4657 wsDatePattern += FX_WSTRC(L"} "); |
| 4630 CFX_WideString wsTimePattern = FX_WSTRC(L"time{"); | 4658 CFX_WideString wsTimePattern = FX_WSTRC(L"time{"); |
| 4631 wsTimePattern += wsPattern.Mid(iTChar + 1); | 4659 wsTimePattern += wsPattern.Mid(iTChar + 1); |
| 4632 wsTimePattern += FX_WSTRC(L"}"); | 4660 wsTimePattern += FX_WSTRC(L"}"); |
| 4633 wsPattern = wsDatePattern + wsTimePattern; | 4661 wsPattern = wsDatePattern + wsTimePattern; |
| 4634 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, | 4662 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, |
| 4635 pLocale, (CXFA_LocaleMgr*)pMgr); | 4663 pLocale, (CXFA_LocaleMgr*)pMgr); |
| 4636 if (localeValue.IsValid()) { | 4664 if (localeValue.IsValid()) { |
| 4637 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4665 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
| 4638 FXJSE_Value_SetUTF8String(args.GetReturnValue(), szParsedValue); | 4666 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4667 szParsedValue.AsByteStringC()); |
| 4639 } else { | 4668 } else { |
| 4640 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4669 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4641 } | 4670 } |
| 4642 } break; | 4671 } break; |
| 4643 case XFA_VT_DATE: { | 4672 case XFA_VT_DATE: { |
| 4644 wsPattern = FX_WSTRC(L"date{") + wsPattern; | 4673 wsPattern = FX_WSTRC(L"date{") + wsPattern; |
| 4645 wsPattern += FX_WSTRC(L"}"); | 4674 wsPattern += FX_WSTRC(L"}"); |
| 4646 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, | 4675 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, |
| 4647 pLocale, (CXFA_LocaleMgr*)pMgr); | 4676 pLocale, (CXFA_LocaleMgr*)pMgr); |
| 4648 if (localeValue.IsValid()) { | 4677 if (localeValue.IsValid()) { |
| 4649 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4678 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
| 4650 FXJSE_Value_SetUTF8String(args.GetReturnValue(), szParsedValue); | 4679 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4680 szParsedValue.AsByteStringC()); |
| 4651 } else { | 4681 } else { |
| 4652 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4682 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4653 } | 4683 } |
| 4654 } break; | 4684 } break; |
| 4655 case XFA_VT_TIME: { | 4685 case XFA_VT_TIME: { |
| 4656 wsPattern = FX_WSTRC(L"time{") + wsPattern; | 4686 wsPattern = FX_WSTRC(L"time{") + wsPattern; |
| 4657 wsPattern += FX_WSTRC(L"}"); | 4687 wsPattern += FX_WSTRC(L"}"); |
| 4658 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, | 4688 CXFA_LocaleValue localeValue(patternType, wsValue, wsPattern, |
| 4659 pLocale, (CXFA_LocaleMgr*)pMgr); | 4689 pLocale, (CXFA_LocaleMgr*)pMgr); |
| 4660 if (localeValue.IsValid()) { | 4690 if (localeValue.IsValid()) { |
| 4661 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4691 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
| 4662 FXJSE_Value_SetUTF8String(args.GetReturnValue(), szParsedValue); | 4692 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4693 szParsedValue.AsByteStringC()); |
| 4663 } else { | 4694 } else { |
| 4664 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4695 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4665 } | 4696 } |
| 4666 } break; | 4697 } break; |
| 4667 case XFA_VT_TEXT: { | 4698 case XFA_VT_TEXT: { |
| 4668 wsPattern = FX_WSTRC(L"text{") + wsPattern; | 4699 wsPattern = FX_WSTRC(L"text{") + wsPattern; |
| 4669 wsPattern += FX_WSTRC(L"}"); | 4700 wsPattern += FX_WSTRC(L"}"); |
| 4670 CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsPattern, | 4701 CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsPattern, |
| 4671 pLocale, (CXFA_LocaleMgr*)pMgr); | 4702 pLocale, (CXFA_LocaleMgr*)pMgr); |
| 4672 if (localeValue.IsValid()) { | 4703 if (localeValue.IsValid()) { |
| 4673 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4704 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
| 4674 FXJSE_Value_SetUTF8String(args.GetReturnValue(), szParsedValue); | 4705 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4706 szParsedValue.AsByteStringC()); |
| 4675 } else { | 4707 } else { |
| 4676 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4708 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4677 } | 4709 } |
| 4678 } break; | 4710 } break; |
| 4679 case XFA_VT_FLOAT: { | 4711 case XFA_VT_FLOAT: { |
| 4680 wsPattern = FX_WSTRC(L"num{") + wsPattern; | 4712 wsPattern = FX_WSTRC(L"num{") + wsPattern; |
| 4681 wsPattern += FX_WSTRC(L"}"); | 4713 wsPattern += FX_WSTRC(L"}"); |
| 4682 CXFA_LocaleValue localeValue(XFA_VT_FLOAT, wsValue, wsPattern, | 4714 CXFA_LocaleValue localeValue(XFA_VT_FLOAT, wsValue, wsPattern, |
| 4683 pLocale, (CXFA_LocaleMgr*)pMgr); | 4715 pLocale, (CXFA_LocaleMgr*)pMgr); |
| 4684 if (localeValue.IsValid()) { | 4716 if (localeValue.IsValid()) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 4697 if (localeValue.IsValid()) { | 4729 if (localeValue.IsValid()) { |
| 4698 FXJSE_Value_SetDouble(args.GetReturnValue(), | 4730 FXJSE_Value_SetDouble(args.GetReturnValue(), |
| 4699 localeValue.GetDoubleNum()); | 4731 localeValue.GetDoubleNum()); |
| 4700 } else { | 4732 } else { |
| 4701 wsTestPattern = FX_WSTRC(L"text{") + wsPattern; | 4733 wsTestPattern = FX_WSTRC(L"text{") + wsPattern; |
| 4702 wsTestPattern += FX_WSTRC(L"}"); | 4734 wsTestPattern += FX_WSTRC(L"}"); |
| 4703 CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsTestPattern, | 4735 CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsTestPattern, |
| 4704 pLocale, (CXFA_LocaleMgr*)pMgr); | 4736 pLocale, (CXFA_LocaleMgr*)pMgr); |
| 4705 if (localeValue.IsValid()) { | 4737 if (localeValue.IsValid()) { |
| 4706 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); | 4738 szParsedValue = FX_UTF8Encode(localeValue.GetValue()); |
| 4707 FXJSE_Value_SetUTF8String(args.GetReturnValue(), szParsedValue); | 4739 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4740 szParsedValue.AsByteStringC()); |
| 4708 } else { | 4741 } else { |
| 4709 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); | 4742 FXJSE_Value_SetUTF8String(args.GetReturnValue(), ""); |
| 4710 } | 4743 } |
| 4711 } | 4744 } |
| 4712 } break; | 4745 } break; |
| 4713 } | 4746 } |
| 4714 } | 4747 } |
| 4715 } | 4748 } |
| 4716 FXJSE_Value_Release(argOne); | 4749 FXJSE_Value_Release(argOne); |
| 4717 FXJSE_Value_Release(argTwo); | 4750 FXJSE_Value_Release(argTwo); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4754 chTemp = oneString.GetAt(iTemp); | 4787 chTemp = oneString.GetAt(iTemp); |
| 4755 if (chTemp == twoString.GetAt(iFindIndex)) { | 4788 if (chTemp == twoString.GetAt(iFindIndex)) { |
| 4756 ++iTemp; | 4789 ++iTemp; |
| 4757 ++iFindIndex; | 4790 ++iFindIndex; |
| 4758 } else { | 4791 } else { |
| 4759 iFindIndex = 0; | 4792 iFindIndex = 0; |
| 4760 break; | 4793 break; |
| 4761 } | 4794 } |
| 4762 } | 4795 } |
| 4763 if (iFindIndex == iFindLen) { | 4796 if (iFindIndex == iFindLen) { |
| 4764 resultString << threeString; | 4797 resultString << threeString.AsByteStringC(); |
| 4765 u += iFindLen - 1; | 4798 u += iFindLen - 1; |
| 4766 iFindIndex = 0; | 4799 iFindIndex = 0; |
| 4767 } else { | 4800 } else { |
| 4768 resultString.AppendChar(ch); | 4801 resultString.AppendChar(ch); |
| 4769 } | 4802 } |
| 4770 } else { | 4803 } else { |
| 4771 resultString.AppendChar(ch); | 4804 resultString.AppendChar(ch); |
| 4772 } | 4805 } |
| 4773 } | 4806 } |
| 4774 resultString.AppendChar(0); | 4807 resultString.AppendChar(0); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 4801 if (argIsNull) { | 4834 if (argIsNull) { |
| 4802 FXJSE_Value_SetNull(args.GetReturnValue()); | 4835 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4803 } else { | 4836 } else { |
| 4804 CFX_ByteString sourceString; | 4837 CFX_ByteString sourceString; |
| 4805 HValueToUTF8String(argOne, sourceString); | 4838 HValueToUTF8String(argOne, sourceString); |
| 4806 int32_t count = HValueToInteger(hThis, argTwo); | 4839 int32_t count = HValueToInteger(hThis, argTwo); |
| 4807 if (count < 0) { | 4840 if (count < 0) { |
| 4808 count = 0; | 4841 count = 0; |
| 4809 } | 4842 } |
| 4810 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 4843 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4811 sourceString.Right(count)); | 4844 sourceString.Right(count).AsByteStringC()); |
| 4812 } | 4845 } |
| 4813 FXJSE_Value_Release(argOne); | 4846 FXJSE_Value_Release(argOne); |
| 4814 FXJSE_Value_Release(argTwo); | 4847 FXJSE_Value_Release(argTwo); |
| 4815 } else { | 4848 } else { |
| 4816 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4849 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4817 L"Right"); | 4850 L"Right"); |
| 4818 } | 4851 } |
| 4819 } | 4852 } |
| 4820 void CXFA_FM2JSContext::Rtrim(FXJSE_HOBJECT hThis, | 4853 void CXFA_FM2JSContext::Rtrim(FXJSE_HOBJECT hThis, |
| 4821 const CFX_ByteStringC& szFuncName, | 4854 const CFX_ByteStringC& szFuncName, |
| 4822 CFXJSE_Arguments& args) { | 4855 CFXJSE_Arguments& args) { |
| 4823 CXFA_FM2JSContext* pContext = | 4856 CXFA_FM2JSContext* pContext = |
| 4824 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 4857 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 4825 if (args.GetLength() == 1) { | 4858 if (args.GetLength() == 1) { |
| 4826 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); | 4859 FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); |
| 4827 if (HValueIsNull(hThis, argOne)) { | 4860 if (HValueIsNull(hThis, argOne)) { |
| 4828 FXJSE_Value_SetNull(args.GetReturnValue()); | 4861 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 4829 } else { | 4862 } else { |
| 4830 CFX_ByteString sourceString; | 4863 CFX_ByteString sourceString; |
| 4831 HValueToUTF8String(argOne, sourceString); | 4864 HValueToUTF8String(argOne, sourceString); |
| 4832 sourceString.TrimRight(); | 4865 sourceString.TrimRight(); |
| 4833 FXJSE_Value_SetUTF8String(args.GetReturnValue(), sourceString); | 4866 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 4867 sourceString.AsByteStringC()); |
| 4834 } | 4868 } |
| 4835 FXJSE_Value_Release(argOne); | 4869 FXJSE_Value_Release(argOne); |
| 4836 } else { | 4870 } else { |
| 4837 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 4871 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 4838 L"Rtrim"); | 4872 L"Rtrim"); |
| 4839 } | 4873 } |
| 4840 } | 4874 } |
| 4841 void CXFA_FM2JSContext::Space(FXJSE_HOBJECT hThis, | 4875 void CXFA_FM2JSContext::Space(FXJSE_HOBJECT hThis, |
| 4842 const CFX_ByteStringC& szFuncName, | 4876 const CFX_ByteStringC& szFuncName, |
| 4843 CFXJSE_Arguments& args) { | 4877 CFXJSE_Arguments& args) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5028 insertValue = GetSimpleHValue(hThis, args, 3); | 5062 insertValue = GetSimpleHValue(hThis, args, 3); |
| 5029 HValueToUTF8String(insertValue, insertString); | 5063 HValueToUTF8String(insertValue, insertString); |
| 5030 } | 5064 } |
| 5031 iStart -= 1; | 5065 iStart -= 1; |
| 5032 CFX_ByteTextBuf resultString; | 5066 CFX_ByteTextBuf resultString; |
| 5033 int32_t i = 0; | 5067 int32_t i = 0; |
| 5034 while (i < iStart) { | 5068 while (i < iStart) { |
| 5035 resultString.AppendChar(sourceString.GetAt(i)); | 5069 resultString.AppendChar(sourceString.GetAt(i)); |
| 5036 ++i; | 5070 ++i; |
| 5037 } | 5071 } |
| 5038 resultString << insertString; | 5072 resultString << insertString.AsByteStringC(); |
| 5039 i = iStart + iDelete; | 5073 i = iStart + iDelete; |
| 5040 while (i < iLength) { | 5074 while (i < iLength) { |
| 5041 resultString.AppendChar(sourceString.GetAt(i)); | 5075 resultString.AppendChar(sourceString.GetAt(i)); |
| 5042 ++i; | 5076 ++i; |
| 5043 } | 5077 } |
| 5044 resultString.AppendChar(0); | 5078 resultString.AppendChar(0); |
| 5045 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 5079 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 5046 resultString.GetByteString()); | 5080 resultString.GetByteString()); |
| 5047 FXJSE_Value_Release(sourceValue); | 5081 FXJSE_Value_Release(sourceValue); |
| 5048 FXJSE_Value_Release(startValue); | 5082 FXJSE_Value_Release(startValue); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5082 if (iStart < 1) { | 5116 if (iStart < 1) { |
| 5083 iStart = 1; | 5117 iStart = 1; |
| 5084 } | 5118 } |
| 5085 if (iStart > iLength) { | 5119 if (iStart > iLength) { |
| 5086 iStart = iLength; | 5120 iStart = iLength; |
| 5087 } | 5121 } |
| 5088 if (iCount <= 0) { | 5122 if (iCount <= 0) { |
| 5089 iCount = 0; | 5123 iCount = 0; |
| 5090 } | 5124 } |
| 5091 iStart -= 1; | 5125 iStart -= 1; |
| 5092 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 5126 FXJSE_Value_SetUTF8String( |
| 5093 szSourceStr.Mid(iStart, iCount)); | 5127 args.GetReturnValue(), |
| 5128 szSourceStr.Mid(iStart, iCount).AsByteStringC()); |
| 5094 } | 5129 } |
| 5095 } | 5130 } |
| 5096 FXJSE_Value_Release(stringValue); | 5131 FXJSE_Value_Release(stringValue); |
| 5097 FXJSE_Value_Release(startValue); | 5132 FXJSE_Value_Release(startValue); |
| 5098 FXJSE_Value_Release(endValue); | 5133 FXJSE_Value_Release(endValue); |
| 5099 } else { | 5134 } else { |
| 5100 CXFA_FM2JSContext* pContext = | 5135 CXFA_FM2JSContext* pContext = |
| 5101 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5136 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 5102 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5137 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 5103 L"Substr"); | 5138 L"Substr"); |
| 5104 } | 5139 } |
| 5105 } | 5140 } |
| 5106 void CXFA_FM2JSContext::Uuid(FXJSE_HOBJECT hThis, | 5141 void CXFA_FM2JSContext::Uuid(FXJSE_HOBJECT hThis, |
| 5107 const CFX_ByteStringC& szFuncName, | 5142 const CFX_ByteStringC& szFuncName, |
| 5108 CFXJSE_Arguments& args) { | 5143 CFXJSE_Arguments& args) { |
| 5109 int32_t argc = args.GetLength(); | 5144 int32_t argc = args.GetLength(); |
| 5110 if ((argc == 0) || (argc == 1)) { | 5145 if ((argc == 0) || (argc == 1)) { |
| 5111 int32_t iNum = 0; | 5146 int32_t iNum = 0; |
| 5112 FXJSE_HVALUE argOne = 0; | 5147 FXJSE_HVALUE argOne = 0; |
| 5113 if (argc == 1) { | 5148 if (argc == 1) { |
| 5114 argOne = GetSimpleHValue(hThis, args, 0); | 5149 argOne = GetSimpleHValue(hThis, args, 0); |
| 5115 iNum = (int32_t)HValueToFloat(hThis, argOne); | 5150 iNum = (int32_t)HValueToFloat(hThis, argOne); |
| 5116 } | 5151 } |
| 5117 FX_GUID guid; | 5152 FX_GUID guid; |
| 5118 FX_GUID_CreateV4(&guid); | 5153 FX_GUID_CreateV4(&guid); |
| 5119 CFX_ByteString bsUId; | 5154 CFX_ByteString bsUId; |
| 5120 FX_GUID_ToString(&guid, bsUId, iNum); | 5155 FX_GUID_ToString(&guid, bsUId, iNum); |
| 5121 FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsUId); | 5156 FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsUId.AsByteStringC()); |
| 5122 if (argc == 1) { | 5157 if (argc == 1) { |
| 5123 FXJSE_Value_Release(argOne); | 5158 FXJSE_Value_Release(argOne); |
| 5124 } | 5159 } |
| 5125 } else { | 5160 } else { |
| 5126 CXFA_FM2JSContext* pContext = | 5161 CXFA_FM2JSContext* pContext = |
| 5127 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5162 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 5128 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5163 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 5129 L"Uuid"); | 5164 L"Uuid"); |
| 5130 } | 5165 } |
| 5131 } | 5166 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 5157 ch -= 32; | 5192 ch -= 32; |
| 5158 } else if (ch >= 0xE0 && ch <= 0xFE) { | 5193 } else if (ch >= 0xE0 && ch <= 0xFE) { |
| 5159 ch -= 32; | 5194 ch -= 32; |
| 5160 } else if (ch == 0x101 || ch == 0x103 || ch == 0x105) { | 5195 } else if (ch == 0x101 || ch == 0x103 || ch == 0x105) { |
| 5161 ch -= 1; | 5196 ch -= 1; |
| 5162 } | 5197 } |
| 5163 upperStringBuf.AppendChar(ch); | 5198 upperStringBuf.AppendChar(ch); |
| 5164 ++i; | 5199 ++i; |
| 5165 } | 5200 } |
| 5166 upperStringBuf.AppendChar(0); | 5201 upperStringBuf.AppendChar(0); |
| 5167 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 5202 FXJSE_Value_SetUTF8String( |
| 5168 FX_UTF8Encode(upperStringBuf.GetBuffer(), | 5203 args.GetReturnValue(), |
| 5169 upperStringBuf.GetLength())); | 5204 FX_UTF8Encode(upperStringBuf.GetBuffer(), upperStringBuf.GetLength()) |
| 5205 .AsByteStringC()); |
| 5170 if (argc == 2) { | 5206 if (argc == 2) { |
| 5171 FXJSE_Value_Release(localeValue); | 5207 FXJSE_Value_Release(localeValue); |
| 5172 } | 5208 } |
| 5173 } | 5209 } |
| 5174 FXJSE_Value_Release(argOne); | 5210 FXJSE_Value_Release(argOne); |
| 5175 } else { | 5211 } else { |
| 5176 CXFA_FM2JSContext* pContext = | 5212 CXFA_FM2JSContext* pContext = |
| 5177 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5213 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 5178 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5214 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 5179 L"Upper"); | 5215 L"Upper"); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5212 HValueToUTF8String(localeValue, localeString); | 5248 HValueToUTF8String(localeValue, localeString); |
| 5213 } | 5249 } |
| 5214 } | 5250 } |
| 5215 if (!bFlags) { | 5251 if (!bFlags) { |
| 5216 if ((fNumber < 0) || (fNumber > 922337203685477550)) { | 5252 if ((fNumber < 0) || (fNumber > 922337203685477550)) { |
| 5217 FXJSE_Value_SetUTF8String(args.GetReturnValue(), "*"); | 5253 FXJSE_Value_SetUTF8String(args.GetReturnValue(), "*"); |
| 5218 } else { | 5254 } else { |
| 5219 CFX_ByteTextBuf resultBuf; | 5255 CFX_ByteTextBuf resultBuf; |
| 5220 CFX_ByteString numberString; | 5256 CFX_ByteString numberString; |
| 5221 numberString.Format("%.2f", fNumber); | 5257 numberString.Format("%.2f", fNumber); |
| 5222 WordUS(numberString, iIdentifier, resultBuf); | 5258 WordUS(numberString.AsByteStringC(), iIdentifier, resultBuf); |
| 5223 FXJSE_Value_SetUTF8String(args.GetReturnValue(), | 5259 FXJSE_Value_SetUTF8String(args.GetReturnValue(), |
| 5224 resultBuf.GetByteString()); | 5260 resultBuf.GetByteString()); |
| 5225 } | 5261 } |
| 5226 } else { | 5262 } else { |
| 5227 FXJSE_Value_SetNull(args.GetReturnValue()); | 5263 FXJSE_Value_SetNull(args.GetReturnValue()); |
| 5228 } | 5264 } |
| 5229 FXJSE_Value_Release(numberValue); | 5265 FXJSE_Value_Release(numberValue); |
| 5230 if (argc > 1) { | 5266 if (argc > 1) { |
| 5231 FXJSE_Value_Release(identifierValue); | 5267 FXJSE_Value_Release(identifierValue); |
| 5232 if (argc == 3) { | 5268 if (argc == 3) { |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5528 } | 5564 } |
| 5529 if (argc > 3) { | 5565 if (argc > 3) { |
| 5530 FXJSE_Value_Release(argFour); | 5566 FXJSE_Value_Release(argFour); |
| 5531 } | 5567 } |
| 5532 if (argc > 4) { | 5568 if (argc > 4) { |
| 5533 FXJSE_Value_Release(argFive); | 5569 FXJSE_Value_Release(argFive); |
| 5534 } | 5570 } |
| 5535 if (bFlags) { | 5571 if (bFlags) { |
| 5536 FXJSE_Value_SetUTF8String( | 5572 FXJSE_Value_SetUTF8String( |
| 5537 args.GetReturnValue(), | 5573 args.GetReturnValue(), |
| 5538 FX_UTF8Encode(decodedResponse, decodedResponse.GetLength())); | 5574 FX_UTF8Encode(decodedResponse, decodedResponse.GetLength()) |
| 5575 .AsByteStringC()); |
| 5539 } else { | 5576 } else { |
| 5540 pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY); | 5577 pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY); |
| 5541 } | 5578 } |
| 5542 } else { | 5579 } else { |
| 5543 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 5580 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 5544 L"Post"); | 5581 L"Post"); |
| 5545 } | 5582 } |
| 5546 } | 5583 } |
| 5547 void CXFA_FM2JSContext::Put(FXJSE_HOBJECT hThis, | 5584 void CXFA_FM2JSContext::Put(FXJSE_HOBJECT hThis, |
| 5548 const CFX_ByteStringC& szFuncName, | 5585 const CFX_ByteStringC& szFuncName, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5618 if (!bSetStatus) { | 5655 if (!bSetStatus) { |
| 5619 pContext->ThrowScriptErrorMessage(XFA_IDS_NOT_DEFAUL_VALUE); | 5656 pContext->ThrowScriptErrorMessage(XFA_IDS_NOT_DEFAUL_VALUE); |
| 5620 break; | 5657 break; |
| 5621 } | 5658 } |
| 5622 } | 5659 } |
| 5623 } else { | 5660 } else { |
| 5624 CFX_ByteString propertyStr; | 5661 CFX_ByteString propertyStr; |
| 5625 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 5662 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 5626 for (int32_t i = 2; i < iLeftLength; i++) { | 5663 for (int32_t i = 2; i < iLeftLength; i++) { |
| 5627 FXJSE_Value_GetObjectPropByIdx(lValue, i, jsObjectValue); | 5664 FXJSE_Value_GetObjectPropByIdx(lValue, i, jsObjectValue); |
| 5628 FXJSE_Value_SetObjectProp(jsObjectValue, propertyStr, rValue); | 5665 FXJSE_Value_SetObjectProp(jsObjectValue, propertyStr.AsByteStringC(), |
| 5666 rValue); |
| 5629 } | 5667 } |
| 5630 } | 5668 } |
| 5631 FXJSE_Value_Release(jsObjectValue); | 5669 FXJSE_Value_Release(jsObjectValue); |
| 5632 FXJSE_Value_Release(propertyValue); | 5670 FXJSE_Value_Release(propertyValue); |
| 5633 } else if (FXJSE_Value_IsObject(lValue)) { | 5671 } else if (FXJSE_Value_IsObject(lValue)) { |
| 5634 bSetStatus = SetObjectDefaultValue(lValue, rValue); | 5672 bSetStatus = SetObjectDefaultValue(lValue, rValue); |
| 5635 if (!bSetStatus) { | 5673 if (!bSetStatus) { |
| 5636 pContext->ThrowScriptErrorMessage(XFA_IDS_NOT_DEFAUL_VALUE); | 5674 pContext->ThrowScriptErrorMessage(XFA_IDS_NOT_DEFAUL_VALUE); |
| 5637 } | 5675 } |
| 5638 } | 5676 } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5801 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); | 5839 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); |
| 5802 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); | 5840 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); |
| 5803 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { | 5841 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { |
| 5804 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 5842 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
| 5805 } else if (FXJSE_Value_IsUTF8String(argFirst) && | 5843 } else if (FXJSE_Value_IsUTF8String(argFirst) && |
| 5806 FXJSE_Value_IsUTF8String(argSecond)) { | 5844 FXJSE_Value_IsUTF8String(argSecond)) { |
| 5807 CFX_ByteString firstOutput; | 5845 CFX_ByteString firstOutput; |
| 5808 CFX_ByteString secondOutput; | 5846 CFX_ByteString secondOutput; |
| 5809 FXJSE_Value_ToUTF8String(argFirst, firstOutput); | 5847 FXJSE_Value_ToUTF8String(argFirst, firstOutput); |
| 5810 FXJSE_Value_ToUTF8String(argSecond, secondOutput); | 5848 FXJSE_Value_ToUTF8String(argSecond, secondOutput); |
| 5811 FXJSE_Value_SetInteger(args.GetReturnValue(), | 5849 FXJSE_Value_SetInteger( |
| 5812 (firstOutput.Compare(secondOutput) == -1) ? 1 : 0); | 5850 args.GetReturnValue(), |
| 5851 firstOutput.Compare(secondOutput.AsByteStringC()) == -1); |
| 5813 } else { | 5852 } else { |
| 5814 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5853 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
| 5815 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5854 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
| 5816 FXJSE_Value_SetInteger(args.GetReturnValue(), (first < second) ? 1 : 0); | 5855 FXJSE_Value_SetInteger(args.GetReturnValue(), (first < second) ? 1 : 0); |
| 5817 } | 5856 } |
| 5818 FXJSE_Value_Release(argFirst); | 5857 FXJSE_Value_Release(argFirst); |
| 5819 FXJSE_Value_Release(argSecond); | 5858 FXJSE_Value_Release(argSecond); |
| 5820 } else { | 5859 } else { |
| 5821 CXFA_FM2JSContext* pContext = | 5860 CXFA_FM2JSContext* pContext = |
| 5822 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5861 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 5833 FXJSE_Value_SetInteger( | 5872 FXJSE_Value_SetInteger( |
| 5834 args.GetReturnValue(), | 5873 args.GetReturnValue(), |
| 5835 (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) ? 1 | 5874 (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) ? 1 |
| 5836 : 0); | 5875 : 0); |
| 5837 } else if (FXJSE_Value_IsUTF8String(argFirst) && | 5876 } else if (FXJSE_Value_IsUTF8String(argFirst) && |
| 5838 FXJSE_Value_IsUTF8String(argSecond)) { | 5877 FXJSE_Value_IsUTF8String(argSecond)) { |
| 5839 CFX_ByteString firstOutput; | 5878 CFX_ByteString firstOutput; |
| 5840 CFX_ByteString secondOutput; | 5879 CFX_ByteString secondOutput; |
| 5841 FXJSE_Value_ToUTF8String(argFirst, firstOutput); | 5880 FXJSE_Value_ToUTF8String(argFirst, firstOutput); |
| 5842 FXJSE_Value_ToUTF8String(argSecond, secondOutput); | 5881 FXJSE_Value_ToUTF8String(argSecond, secondOutput); |
| 5843 FXJSE_Value_SetInteger(args.GetReturnValue(), | 5882 FXJSE_Value_SetInteger( |
| 5844 (firstOutput.Compare(secondOutput) != 1) ? 1 : 0); | 5883 args.GetReturnValue(), |
| 5884 firstOutput.Compare(secondOutput.AsByteStringC()) != 1); |
| 5845 } else { | 5885 } else { |
| 5846 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5886 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
| 5847 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5887 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
| 5848 FXJSE_Value_SetInteger(args.GetReturnValue(), (first <= second) ? 1 : 0); | 5888 FXJSE_Value_SetInteger(args.GetReturnValue(), (first <= second) ? 1 : 0); |
| 5849 } | 5889 } |
| 5850 FXJSE_Value_Release(argFirst); | 5890 FXJSE_Value_Release(argFirst); |
| 5851 FXJSE_Value_Release(argSecond); | 5891 FXJSE_Value_Release(argSecond); |
| 5852 } else { | 5892 } else { |
| 5853 CXFA_FM2JSContext* pContext = | 5893 CXFA_FM2JSContext* pContext = |
| 5854 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5894 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 5855 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 5895 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| 5856 } | 5896 } |
| 5857 } | 5897 } |
| 5858 void CXFA_FM2JSContext::greater_operator(FXJSE_HOBJECT hThis, | 5898 void CXFA_FM2JSContext::greater_operator(FXJSE_HOBJECT hThis, |
| 5859 const CFX_ByteStringC& szFuncName, | 5899 const CFX_ByteStringC& szFuncName, |
| 5860 CFXJSE_Arguments& args) { | 5900 CFXJSE_Arguments& args) { |
| 5861 if (args.GetLength() == 2) { | 5901 if (args.GetLength() == 2) { |
| 5862 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); | 5902 FXJSE_HVALUE argFirst = GetSimpleHValue(hThis, args, 0); |
| 5863 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); | 5903 FXJSE_HVALUE argSecond = GetSimpleHValue(hThis, args, 1); |
| 5864 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { | 5904 if (FXJSE_Value_IsNull(argFirst) || FXJSE_Value_IsNull(argSecond)) { |
| 5865 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); | 5905 FXJSE_Value_SetInteger(args.GetReturnValue(), 0); |
| 5866 } else if (FXJSE_Value_IsUTF8String(argFirst) && | 5906 } else if (FXJSE_Value_IsUTF8String(argFirst) && |
| 5867 FXJSE_Value_IsUTF8String(argSecond)) { | 5907 FXJSE_Value_IsUTF8String(argSecond)) { |
| 5868 CFX_ByteString firstOutput; | 5908 CFX_ByteString firstOutput; |
| 5869 CFX_ByteString secondOutput; | 5909 CFX_ByteString secondOutput; |
| 5870 FXJSE_Value_ToUTF8String(argFirst, firstOutput); | 5910 FXJSE_Value_ToUTF8String(argFirst, firstOutput); |
| 5871 FXJSE_Value_ToUTF8String(argSecond, secondOutput); | 5911 FXJSE_Value_ToUTF8String(argSecond, secondOutput); |
| 5872 FXJSE_Value_SetInteger(args.GetReturnValue(), | 5912 FXJSE_Value_SetInteger( |
| 5873 (firstOutput.Compare(secondOutput) == 1) ? 1 : 0); | 5913 args.GetReturnValue(), |
| 5914 firstOutput.Compare(secondOutput.AsByteStringC()) == 1); |
| 5874 } else { | 5915 } else { |
| 5875 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5916 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
| 5876 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5917 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
| 5877 FXJSE_Value_SetInteger(args.GetReturnValue(), (first > second) ? 1 : 0); | 5918 FXJSE_Value_SetInteger(args.GetReturnValue(), (first > second) ? 1 : 0); |
| 5878 } | 5919 } |
| 5879 FXJSE_Value_Release(argFirst); | 5920 FXJSE_Value_Release(argFirst); |
| 5880 FXJSE_Value_Release(argSecond); | 5921 FXJSE_Value_Release(argSecond); |
| 5881 } else { | 5922 } else { |
| 5882 CXFA_FM2JSContext* pContext = | 5923 CXFA_FM2JSContext* pContext = |
| 5883 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5924 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 5894 FXJSE_Value_SetInteger( | 5935 FXJSE_Value_SetInteger( |
| 5895 args.GetReturnValue(), | 5936 args.GetReturnValue(), |
| 5896 (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) ? 1 | 5937 (FXJSE_Value_IsNull(argFirst) && FXJSE_Value_IsNull(argSecond)) ? 1 |
| 5897 : 0); | 5938 : 0); |
| 5898 } else if (FXJSE_Value_IsUTF8String(argFirst) && | 5939 } else if (FXJSE_Value_IsUTF8String(argFirst) && |
| 5899 FXJSE_Value_IsUTF8String(argSecond)) { | 5940 FXJSE_Value_IsUTF8String(argSecond)) { |
| 5900 CFX_ByteString firstOutput; | 5941 CFX_ByteString firstOutput; |
| 5901 CFX_ByteString secondOutput; | 5942 CFX_ByteString secondOutput; |
| 5902 FXJSE_Value_ToUTF8String(argFirst, firstOutput); | 5943 FXJSE_Value_ToUTF8String(argFirst, firstOutput); |
| 5903 FXJSE_Value_ToUTF8String(argSecond, secondOutput); | 5944 FXJSE_Value_ToUTF8String(argSecond, secondOutput); |
| 5904 FXJSE_Value_SetInteger(args.GetReturnValue(), | 5945 FXJSE_Value_SetInteger( |
| 5905 (firstOutput.Compare(secondOutput) != -1) ? 1 : 0); | 5946 args.GetReturnValue(), |
| 5947 firstOutput.Compare(secondOutput.AsByteStringC()) != -1); |
| 5906 } else { | 5948 } else { |
| 5907 FX_DOUBLE first = HValueToDouble(hThis, argFirst); | 5949 FX_DOUBLE first = HValueToDouble(hThis, argFirst); |
| 5908 FX_DOUBLE second = HValueToDouble(hThis, argSecond); | 5950 FX_DOUBLE second = HValueToDouble(hThis, argSecond); |
| 5909 FXJSE_Value_SetInteger(args.GetReturnValue(), (first >= second) ? 1 : 0); | 5951 FXJSE_Value_SetInteger(args.GetReturnValue(), (first >= second) ? 1 : 0); |
| 5910 } | 5952 } |
| 5911 FXJSE_Value_Release(argFirst); | 5953 FXJSE_Value_Release(argFirst); |
| 5912 FXJSE_Value_Release(argSecond); | 5954 FXJSE_Value_Release(argSecond); |
| 5913 } else { | 5955 } else { |
| 5914 CXFA_FM2JSContext* pContext = | 5956 CXFA_FM2JSContext* pContext = |
| 5915 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 5957 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6075 CFX_ByteString szName = args.GetUTF8String(2); | 6117 CFX_ByteString szName = args.GetUTF8String(2); |
| 6076 int32_t iIndexFlags = args.GetInt32(3); | 6118 int32_t iIndexFlags = args.GetInt32(3); |
| 6077 int32_t iIndexValue = 0; | 6119 int32_t iIndexValue = 0; |
| 6078 FXJSE_HVALUE argIndex = NULL; | 6120 FXJSE_HVALUE argIndex = NULL; |
| 6079 if (argc == 5) { | 6121 if (argc == 5) { |
| 6080 bIsStar = FALSE; | 6122 bIsStar = FALSE; |
| 6081 argIndex = args.GetValue(4); | 6123 argIndex = args.GetValue(4); |
| 6082 iIndexValue = HValueToInteger(hThis, argIndex); | 6124 iIndexValue = HValueToInteger(hThis, argIndex); |
| 6083 } | 6125 } |
| 6084 CFX_ByteString szSomExp; | 6126 CFX_ByteString szSomExp; |
| 6085 GenerateSomExpression(szName, iIndexFlags, iIndexValue, bIsStar, szSomExp); | 6127 GenerateSomExpression(szName.AsByteStringC(), iIndexFlags, iIndexValue, |
| 6128 bIsStar, szSomExp); |
| 6086 if (FXJSE_Value_IsArray(argAccessor)) { | 6129 if (FXJSE_Value_IsArray(argAccessor)) { |
| 6087 FXJSE_HVALUE hLengthValue = FXJSE_Value_Create(hruntime); | 6130 FXJSE_HVALUE hLengthValue = FXJSE_Value_Create(hruntime); |
| 6088 FXJSE_Value_GetObjectProp(argAccessor, "length", hLengthValue); | 6131 FXJSE_Value_GetObjectProp(argAccessor, "length", hLengthValue); |
| 6089 int32_t iLength = FXJSE_Value_ToInteger(hLengthValue); | 6132 int32_t iLength = FXJSE_Value_ToInteger(hLengthValue); |
| 6090 FXJSE_Value_Release(hLengthValue); | 6133 FXJSE_Value_Release(hLengthValue); |
| 6091 int32_t iCounter = 0; | 6134 int32_t iCounter = 0; |
| 6092 FXJSE_HVALUE** hResolveValues = FX_Alloc(FXJSE_HVALUE*, iLength - 2); | 6135 FXJSE_HVALUE** hResolveValues = FX_Alloc(FXJSE_HVALUE*, iLength - 2); |
| 6093 int32_t* iSizes = FX_Alloc(int32_t, iLength - 2); | 6136 int32_t* iSizes = FX_Alloc(int32_t, iLength - 2); |
| 6094 for (int32_t i = 0; i < (iLength - 2); i++) { | 6137 for (int32_t i = 0; i < (iLength - 2); i++) { |
| 6095 iSizes[i] = 0; | 6138 iSizes[i] = 0; |
| 6096 } | 6139 } |
| 6097 FXJSE_HVALUE hJSObjValue = FXJSE_Value_Create(hruntime); | 6140 FXJSE_HVALUE hJSObjValue = FXJSE_Value_Create(hruntime); |
| 6098 FX_BOOL bAttribute = FALSE; | 6141 FX_BOOL bAttribute = FALSE; |
| 6099 for (int32_t i = 2; i < iLength; i++) { | 6142 for (int32_t i = 2; i < iLength; i++) { |
| 6100 FXJSE_Value_GetObjectPropByIdx(argAccessor, i, hJSObjValue); | 6143 FXJSE_Value_GetObjectPropByIdx(argAccessor, i, hJSObjValue); |
| 6101 XFA_RESOLVENODE_RS resoveNodeRS; | 6144 XFA_RESOLVENODE_RS resoveNodeRS; |
| 6102 int32_t iRet = ResolveObjects(hThis, hJSObjValue, szSomExp, | 6145 int32_t iRet = |
| 6103 resoveNodeRS, TRUE, szName.IsEmpty()); | 6146 ResolveObjects(hThis, hJSObjValue, szSomExp.AsByteStringC(), |
| 6147 resoveNodeRS, TRUE, szName.IsEmpty()); |
| 6104 if (iRet > 0) { | 6148 if (iRet > 0) { |
| 6105 ParseResolveResult(hThis, resoveNodeRS, hJSObjValue, | 6149 ParseResolveResult(hThis, resoveNodeRS, hJSObjValue, |
| 6106 hResolveValues[i - 2], iSizes[i - 2], bAttribute); | 6150 hResolveValues[i - 2], iSizes[i - 2], bAttribute); |
| 6107 iCounter += iSizes[i - 2]; | 6151 iCounter += iSizes[i - 2]; |
| 6108 } | 6152 } |
| 6109 } | 6153 } |
| 6110 FXJSE_Value_Release(hJSObjValue); | 6154 FXJSE_Value_Release(hJSObjValue); |
| 6111 if (iCounter > 0) { | 6155 if (iCounter > 0) { |
| 6112 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iCounter + 2); | 6156 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iCounter + 2); |
| 6113 for (int32_t i = 0; i < (iCounter + 2); i++) { | 6157 for (int32_t i = 0; i < (iCounter + 2); i++) { |
| 6114 rgValues[i] = FXJSE_Value_Create(hruntime); | 6158 rgValues[i] = FXJSE_Value_Create(hruntime); |
| 6115 } | 6159 } |
| 6116 FXJSE_Value_SetInteger(rgValues[0], 1); | 6160 FXJSE_Value_SetInteger(rgValues[0], 1); |
| 6117 if (bAttribute) { | 6161 if (bAttribute) { |
| 6118 FXJSE_Value_SetUTF8String(rgValues[1], szName); | 6162 FXJSE_Value_SetUTF8String(rgValues[1], szName.AsByteStringC()); |
| 6119 } else { | 6163 } else { |
| 6120 FXJSE_Value_SetNull(rgValues[1]); | 6164 FXJSE_Value_SetNull(rgValues[1]); |
| 6121 } | 6165 } |
| 6122 int32_t iIndex = 2; | 6166 int32_t iIndex = 2; |
| 6123 for (int32_t i = 0; i < iLength - 2; i++) { | 6167 for (int32_t i = 0; i < iLength - 2; i++) { |
| 6124 for (int32_t j = 0; j < iSizes[i]; j++) { | 6168 for (int32_t j = 0; j < iSizes[i]; j++) { |
| 6125 FXJSE_Value_Set(rgValues[iIndex], hResolveValues[i][j]); | 6169 FXJSE_Value_Set(rgValues[iIndex], hResolveValues[i][j]); |
| 6126 iIndex++; | 6170 iIndex++; |
| 6127 } | 6171 } |
| 6128 } | 6172 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6148 FX_Free(hResolveValues[i]); | 6192 FX_Free(hResolveValues[i]); |
| 6149 } | 6193 } |
| 6150 } | 6194 } |
| 6151 FX_Free(hResolveValues); | 6195 FX_Free(hResolveValues); |
| 6152 FX_Free(iSizes); | 6196 FX_Free(iSizes); |
| 6153 } else { | 6197 } else { |
| 6154 XFA_RESOLVENODE_RS resoveNodeRS; | 6198 XFA_RESOLVENODE_RS resoveNodeRS; |
| 6155 int32_t iRet = 0; | 6199 int32_t iRet = 0; |
| 6156 if (FXJSE_Value_IsObject(argAccessor) || | 6200 if (FXJSE_Value_IsObject(argAccessor) || |
| 6157 (FXJSE_Value_IsNull(argAccessor) && bsAccessorName.IsEmpty())) { | 6201 (FXJSE_Value_IsNull(argAccessor) && bsAccessorName.IsEmpty())) { |
| 6158 iRet = ResolveObjects(hThis, argAccessor, szSomExp, resoveNodeRS, TRUE, | 6202 iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsByteStringC(), |
| 6159 szName.IsEmpty()); | 6203 resoveNodeRS, TRUE, szName.IsEmpty()); |
| 6160 } else if (!FXJSE_Value_IsObject(argAccessor) && | 6204 } else if (!FXJSE_Value_IsObject(argAccessor) && |
| 6161 !bsAccessorName.IsEmpty()) { | 6205 !bsAccessorName.IsEmpty()) { |
| 6162 FX_BOOL bGetObject = | 6206 FX_BOOL bGetObject = |
| 6163 GetObjectByName(hThis, argAccessor, bsAccessorName); | 6207 GetObjectByName(hThis, argAccessor, bsAccessorName.AsByteStringC()); |
| 6164 if (bGetObject) { | 6208 if (bGetObject) { |
| 6165 iRet = ResolveObjects(hThis, argAccessor, szSomExp, resoveNodeRS, | 6209 iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsByteStringC(), |
| 6166 TRUE, szName.IsEmpty()); | 6210 resoveNodeRS, TRUE, szName.IsEmpty()); |
| 6167 } | 6211 } |
| 6168 } | 6212 } |
| 6169 if (iRet > 0) { | 6213 if (iRet > 0) { |
| 6170 FXJSE_HVALUE* hResolveValues; | 6214 FXJSE_HVALUE* hResolveValues; |
| 6171 int32_t iSize = 0; | 6215 int32_t iSize = 0; |
| 6172 FX_BOOL bAttribute = FALSE; | 6216 FX_BOOL bAttribute = FALSE; |
| 6173 ParseResolveResult(hThis, resoveNodeRS, argAccessor, hResolveValues, | 6217 ParseResolveResult(hThis, resoveNodeRS, argAccessor, hResolveValues, |
| 6174 iSize, bAttribute); | 6218 iSize, bAttribute); |
| 6175 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iSize + 2); | 6219 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iSize + 2); |
| 6176 for (int32_t i = 0; i < (iSize + 2); i++) { | 6220 for (int32_t i = 0; i < (iSize + 2); i++) { |
| 6177 rgValues[i] = FXJSE_Value_Create(hruntime); | 6221 rgValues[i] = FXJSE_Value_Create(hruntime); |
| 6178 } | 6222 } |
| 6179 FXJSE_Value_SetInteger(rgValues[0], 1); | 6223 FXJSE_Value_SetInteger(rgValues[0], 1); |
| 6180 if (bAttribute) { | 6224 if (bAttribute) { |
| 6181 FXJSE_Value_SetUTF8String(rgValues[1], szName); | 6225 FXJSE_Value_SetUTF8String(rgValues[1], szName.AsByteStringC()); |
| 6182 } else { | 6226 } else { |
| 6183 FXJSE_Value_SetNull(rgValues[1]); | 6227 FXJSE_Value_SetNull(rgValues[1]); |
| 6184 } | 6228 } |
| 6185 for (int32_t i = 0; i < iSize; i++) { | 6229 for (int32_t i = 0; i < iSize; i++) { |
| 6186 FXJSE_Value_Set(rgValues[i + 2], hResolveValues[i]); | 6230 FXJSE_Value_Set(rgValues[i + 2], hResolveValues[i]); |
| 6187 } | 6231 } |
| 6188 FXJSE_Value_SetArray(args.GetReturnValue(), (iSize + 2), rgValues); | 6232 FXJSE_Value_SetArray(args.GetReturnValue(), (iSize + 2), rgValues); |
| 6189 for (int32_t i = 0; i < (iSize + 2); i++) { | 6233 for (int32_t i = 0; i < (iSize + 2); i++) { |
| 6190 FXJSE_Value_Release(rgValues[i]); | 6234 FXJSE_Value_Release(rgValues[i]); |
| 6191 } | 6235 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6226 CFX_ByteString szName = args.GetUTF8String(2); | 6270 CFX_ByteString szName = args.GetUTF8String(2); |
| 6227 int32_t iIndexFlags = args.GetInt32(3); | 6271 int32_t iIndexFlags = args.GetInt32(3); |
| 6228 int32_t iIndexValue = 0; | 6272 int32_t iIndexValue = 0; |
| 6229 FXJSE_HVALUE argIndex = NULL; | 6273 FXJSE_HVALUE argIndex = NULL; |
| 6230 if (argc == 5) { | 6274 if (argc == 5) { |
| 6231 bIsStar = FALSE; | 6275 bIsStar = FALSE; |
| 6232 argIndex = args.GetValue(4); | 6276 argIndex = args.GetValue(4); |
| 6233 iIndexValue = HValueToInteger(hThis, argIndex); | 6277 iIndexValue = HValueToInteger(hThis, argIndex); |
| 6234 } | 6278 } |
| 6235 CFX_ByteString szSomExp; | 6279 CFX_ByteString szSomExp; |
| 6236 GenerateSomExpression(szName, iIndexFlags, iIndexValue, bIsStar, szSomExp); | 6280 GenerateSomExpression(szName.AsByteStringC(), iIndexFlags, iIndexValue, |
| 6281 bIsStar, szSomExp); |
| 6237 if (FXJSE_Value_IsArray(argAccessor)) { | 6282 if (FXJSE_Value_IsArray(argAccessor)) { |
| 6238 FXJSE_HVALUE hLengthValue = FXJSE_Value_Create(hruntime); | 6283 FXJSE_HVALUE hLengthValue = FXJSE_Value_Create(hruntime); |
| 6239 FXJSE_Value_GetObjectProp(argAccessor, "length", hLengthValue); | 6284 FXJSE_Value_GetObjectProp(argAccessor, "length", hLengthValue); |
| 6240 int32_t iLength = FXJSE_Value_ToInteger(hLengthValue); | 6285 int32_t iLength = FXJSE_Value_ToInteger(hLengthValue); |
| 6241 int32_t iCounter = 0; | 6286 int32_t iCounter = 0; |
| 6242 FXJSE_HVALUE** hResolveValues = FX_Alloc(FXJSE_HVALUE*, iLength - 2); | 6287 FXJSE_HVALUE** hResolveValues = FX_Alloc(FXJSE_HVALUE*, iLength - 2); |
| 6243 int32_t* iSizes = FX_Alloc(int32_t, iLength - 2); | 6288 int32_t* iSizes = FX_Alloc(int32_t, iLength - 2); |
| 6244 FXJSE_HVALUE hJSObjValue = FXJSE_Value_Create(hruntime); | 6289 FXJSE_HVALUE hJSObjValue = FXJSE_Value_Create(hruntime); |
| 6245 FX_BOOL bAttribute = FALSE; | 6290 FX_BOOL bAttribute = FALSE; |
| 6246 for (int32_t i = 2; i < iLength; i++) { | 6291 for (int32_t i = 2; i < iLength; i++) { |
| 6247 FXJSE_Value_GetObjectPropByIdx(argAccessor, i, hJSObjValue); | 6292 FXJSE_Value_GetObjectPropByIdx(argAccessor, i, hJSObjValue); |
| 6248 XFA_RESOLVENODE_RS resoveNodeRS; | 6293 XFA_RESOLVENODE_RS resoveNodeRS; |
| 6249 int32_t iRet = | 6294 int32_t iRet = ResolveObjects( |
| 6250 ResolveObjects(hThis, hJSObjValue, szSomExp, resoveNodeRS, FALSE); | 6295 hThis, hJSObjValue, szSomExp.AsByteStringC(), resoveNodeRS, FALSE); |
| 6251 if (iRet > 0) { | 6296 if (iRet > 0) { |
| 6252 ParseResolveResult(hThis, resoveNodeRS, hJSObjValue, | 6297 ParseResolveResult(hThis, resoveNodeRS, hJSObjValue, |
| 6253 hResolveValues[i - 2], iSizes[i - 2], bAttribute); | 6298 hResolveValues[i - 2], iSizes[i - 2], bAttribute); |
| 6254 iCounter += iSizes[i - 2]; | 6299 iCounter += iSizes[i - 2]; |
| 6255 } | 6300 } |
| 6256 } | 6301 } |
| 6257 FXJSE_Value_Release(hJSObjValue); | 6302 FXJSE_Value_Release(hJSObjValue); |
| 6258 if (iCounter > 0) { | 6303 if (iCounter > 0) { |
| 6259 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iCounter + 2); | 6304 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iCounter + 2); |
| 6260 for (int32_t i = 0; i < (iCounter + 2); i++) { | 6305 for (int32_t i = 0; i < (iCounter + 2); i++) { |
| 6261 rgValues[i] = FXJSE_Value_Create(hruntime); | 6306 rgValues[i] = FXJSE_Value_Create(hruntime); |
| 6262 } | 6307 } |
| 6263 FXJSE_Value_SetInteger(rgValues[0], 1); | 6308 FXJSE_Value_SetInteger(rgValues[0], 1); |
| 6264 if (bAttribute) { | 6309 if (bAttribute) { |
| 6265 FXJSE_Value_SetUTF8String(rgValues[1], szName); | 6310 FXJSE_Value_SetUTF8String(rgValues[1], szName.AsByteStringC()); |
| 6266 } else { | 6311 } else { |
| 6267 FXJSE_Value_SetNull(rgValues[1]); | 6312 FXJSE_Value_SetNull(rgValues[1]); |
| 6268 } | 6313 } |
| 6269 int32_t iIndex = 2; | 6314 int32_t iIndex = 2; |
| 6270 for (int32_t i = 0; i < iLength - 2; i++) { | 6315 for (int32_t i = 0; i < iLength - 2; i++) { |
| 6271 for (int32_t j = 0; j < iSizes[i]; j++) { | 6316 for (int32_t j = 0; j < iSizes[i]; j++) { |
| 6272 FXJSE_Value_Set(rgValues[iIndex], hResolveValues[i][j]); | 6317 FXJSE_Value_Set(rgValues[iIndex], hResolveValues[i][j]); |
| 6273 iIndex++; | 6318 iIndex++; |
| 6274 } | 6319 } |
| 6275 } | 6320 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 6294 FX_Free(hResolveValues[i]); | 6339 FX_Free(hResolveValues[i]); |
| 6295 } | 6340 } |
| 6296 FX_Free(hResolveValues); | 6341 FX_Free(hResolveValues); |
| 6297 FX_Free(iSizes); | 6342 FX_Free(iSizes); |
| 6298 FXJSE_Value_Release(hLengthValue); | 6343 FXJSE_Value_Release(hLengthValue); |
| 6299 } else { | 6344 } else { |
| 6300 XFA_RESOLVENODE_RS resoveNodeRS; | 6345 XFA_RESOLVENODE_RS resoveNodeRS; |
| 6301 int32_t iRet = 0; | 6346 int32_t iRet = 0; |
| 6302 if (FXJSE_Value_IsObject(argAccessor) || | 6347 if (FXJSE_Value_IsObject(argAccessor) || |
| 6303 (FXJSE_Value_IsNull(argAccessor) && bsAccessorName.IsEmpty())) { | 6348 (FXJSE_Value_IsNull(argAccessor) && bsAccessorName.IsEmpty())) { |
| 6304 iRet = | 6349 iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsByteStringC(), |
| 6305 ResolveObjects(hThis, argAccessor, szSomExp, resoveNodeRS, FALSE); | 6350 resoveNodeRS, FALSE); |
| 6306 } else if (!FXJSE_Value_IsObject(argAccessor) && | 6351 } else if (!FXJSE_Value_IsObject(argAccessor) && |
| 6307 !bsAccessorName.IsEmpty()) { | 6352 !bsAccessorName.IsEmpty()) { |
| 6308 FX_BOOL bGetObject = | 6353 FX_BOOL bGetObject = |
| 6309 GetObjectByName(hThis, argAccessor, bsAccessorName); | 6354 GetObjectByName(hThis, argAccessor, bsAccessorName.AsByteStringC()); |
| 6310 if (bGetObject) { | 6355 if (bGetObject) { |
| 6311 iRet = | 6356 iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsByteStringC(), |
| 6312 ResolveObjects(hThis, argAccessor, szSomExp, resoveNodeRS, FALSE); | 6357 resoveNodeRS, FALSE); |
| 6313 } | 6358 } |
| 6314 } | 6359 } |
| 6315 if (iRet > 0) { | 6360 if (iRet > 0) { |
| 6316 FXJSE_HVALUE* hResolveValues; | 6361 FXJSE_HVALUE* hResolveValues; |
| 6317 int32_t iSize = 0; | 6362 int32_t iSize = 0; |
| 6318 FX_BOOL bAttribute = FALSE; | 6363 FX_BOOL bAttribute = FALSE; |
| 6319 ParseResolveResult(hThis, resoveNodeRS, argAccessor, hResolveValues, | 6364 ParseResolveResult(hThis, resoveNodeRS, argAccessor, hResolveValues, |
| 6320 iSize, bAttribute); | 6365 iSize, bAttribute); |
| 6321 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iSize + 2); | 6366 FXJSE_HVALUE* rgValues = FX_Alloc(FXJSE_HVALUE, iSize + 2); |
| 6322 for (int32_t i = 0; i < (iSize + 2); i++) { | 6367 for (int32_t i = 0; i < (iSize + 2); i++) { |
| 6323 rgValues[i] = FXJSE_Value_Create(hruntime); | 6368 rgValues[i] = FXJSE_Value_Create(hruntime); |
| 6324 } | 6369 } |
| 6325 FXJSE_Value_SetInteger(rgValues[0], 1); | 6370 FXJSE_Value_SetInteger(rgValues[0], 1); |
| 6326 if (bAttribute) { | 6371 if (bAttribute) { |
| 6327 FXJSE_Value_SetUTF8String(rgValues[1], szName); | 6372 FXJSE_Value_SetUTF8String(rgValues[1], szName.AsByteStringC()); |
| 6328 } else { | 6373 } else { |
| 6329 FXJSE_Value_SetNull(rgValues[1]); | 6374 FXJSE_Value_SetNull(rgValues[1]); |
| 6330 } | 6375 } |
| 6331 for (int32_t i = 0; i < iSize; i++) { | 6376 for (int32_t i = 0; i < iSize; i++) { |
| 6332 FXJSE_Value_Set(rgValues[i + 2], hResolveValues[i]); | 6377 FXJSE_Value_Set(rgValues[i + 2], hResolveValues[i]); |
| 6333 } | 6378 } |
| 6334 FXJSE_Value_SetArray(args.GetReturnValue(), (iSize + 2), rgValues); | 6379 FXJSE_Value_SetArray(args.GetReturnValue(), (iSize + 2), rgValues); |
| 6335 for (int32_t i = 0; i < (iSize + 2); i++) { | 6380 for (int32_t i = 0; i < (iSize + 2); i++) { |
| 6336 FXJSE_Value_Release(rgValues[i]); | 6381 FXJSE_Value_Release(rgValues[i]); |
| 6337 } | 6382 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6373 } else { | 6418 } else { |
| 6374 CFX_WideString scriptString = | 6419 CFX_WideString scriptString = |
| 6375 CFX_WideString::FromUTF8(argString, argString.GetLength()); | 6420 CFX_WideString::FromUTF8(argString, argString.GetLength()); |
| 6376 CFX_WideTextBuf wsJavaScriptBuf; | 6421 CFX_WideTextBuf wsJavaScriptBuf; |
| 6377 CFX_WideString wsError; | 6422 CFX_WideString wsError; |
| 6378 XFA_FM2JS_Translate(scriptString, wsJavaScriptBuf, wsError); | 6423 XFA_FM2JS_Translate(scriptString, wsJavaScriptBuf, wsError); |
| 6379 if (wsError.IsEmpty()) { | 6424 if (wsError.IsEmpty()) { |
| 6380 CFX_WideString javaScript = wsJavaScriptBuf.GetWideString(); | 6425 CFX_WideString javaScript = wsJavaScriptBuf.GetWideString(); |
| 6381 FXJSE_Value_SetUTF8String( | 6426 FXJSE_Value_SetUTF8String( |
| 6382 args.GetReturnValue(), | 6427 args.GetReturnValue(), |
| 6383 FX_UTF8Encode(javaScript, javaScript.GetLength())); | 6428 FX_UTF8Encode(javaScript, javaScript.GetLength()).AsByteStringC()); |
| 6384 } else { | 6429 } else { |
| 6385 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); | 6430 pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR); |
| 6386 } | 6431 } |
| 6387 } | 6432 } |
| 6388 FXJSE_Value_Release(argOne); | 6433 FXJSE_Value_Release(argOne); |
| 6389 } else { | 6434 } else { |
| 6390 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 6435 pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
| 6391 L"Eval"); | 6436 L"Eval"); |
| 6392 } | 6437 } |
| 6393 } | 6438 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6428 if (FXJSE_Value_IsArray(argOne)) { | 6473 if (FXJSE_Value_IsArray(argOne)) { |
| 6429 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 6474 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 6430 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); | 6475 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); |
| 6431 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); | 6476 FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue); |
| 6432 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsobjectValue); | 6477 FXJSE_Value_GetObjectPropByIdx(argOne, 2, jsobjectValue); |
| 6433 if (FXJSE_Value_IsNull(propertyValue)) { | 6478 if (FXJSE_Value_IsNull(propertyValue)) { |
| 6434 GetObjectDefaultValue(jsobjectValue, args.GetReturnValue()); | 6479 GetObjectDefaultValue(jsobjectValue, args.GetReturnValue()); |
| 6435 } else { | 6480 } else { |
| 6436 CFX_ByteString propertyStr; | 6481 CFX_ByteString propertyStr; |
| 6437 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 6482 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 6438 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr, | 6483 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(), |
| 6439 args.GetReturnValue()); | 6484 args.GetReturnValue()); |
| 6440 } | 6485 } |
| 6441 FXJSE_Value_Release(propertyValue); | 6486 FXJSE_Value_Release(propertyValue); |
| 6442 FXJSE_Value_Release(jsobjectValue); | 6487 FXJSE_Value_Release(jsobjectValue); |
| 6443 } else if (FXJSE_Value_IsObject(argOne)) { | 6488 } else if (FXJSE_Value_IsObject(argOne)) { |
| 6444 GetObjectDefaultValue(argOne, args.GetReturnValue()); | 6489 GetObjectDefaultValue(argOne, args.GetReturnValue()); |
| 6445 } else { | 6490 } else { |
| 6446 FXJSE_Value_Set(args.GetReturnValue(), argOne); | 6491 FXJSE_Value_Set(args.GetReturnValue(), argOne); |
| 6447 } | 6492 } |
| 6448 FXJSE_Value_Release(argOne); | 6493 FXJSE_Value_Release(argOne); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6597 if (iLength > 2) { | 6642 if (iLength > 2) { |
| 6598 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 6643 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 6599 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); | 6644 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); |
| 6600 FXJSE_Value_GetObjectPropByIdx(argIndex, 1, propertyValue); | 6645 FXJSE_Value_GetObjectPropByIdx(argIndex, 1, propertyValue); |
| 6601 FXJSE_Value_GetObjectPropByIdx(argIndex, 2, jsobjectValue); | 6646 FXJSE_Value_GetObjectPropByIdx(argIndex, 2, jsobjectValue); |
| 6602 if (FXJSE_Value_IsNull(propertyValue)) { | 6647 if (FXJSE_Value_IsNull(propertyValue)) { |
| 6603 GetObjectDefaultValue(jsobjectValue, simpleValue); | 6648 GetObjectDefaultValue(jsobjectValue, simpleValue); |
| 6604 } else { | 6649 } else { |
| 6605 CFX_ByteString propertyStr; | 6650 CFX_ByteString propertyStr; |
| 6606 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 6651 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 6607 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr, simpleValue); | 6652 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(), |
| 6653 simpleValue); |
| 6608 } | 6654 } |
| 6609 FXJSE_Value_Release(propertyValue); | 6655 FXJSE_Value_Release(propertyValue); |
| 6610 FXJSE_Value_Release(jsobjectValue); | 6656 FXJSE_Value_Release(jsobjectValue); |
| 6611 } else { | 6657 } else { |
| 6612 FXJSE_Value_SetUndefined(simpleValue); | 6658 FXJSE_Value_SetUndefined(simpleValue); |
| 6613 } | 6659 } |
| 6614 FXJSE_Value_Release(argIndex); | 6660 FXJSE_Value_Release(argIndex); |
| 6615 return simpleValue; | 6661 return simpleValue; |
| 6616 } else if (FXJSE_Value_IsObject(argIndex)) { | 6662 } else if (FXJSE_Value_IsObject(argIndex)) { |
| 6617 FXJSE_HVALUE defaultValue = FXJSE_Value_Create(hruntime); | 6663 FXJSE_HVALUE defaultValue = FXJSE_Value_Create(hruntime); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 6640 FXJSE_HVALUE defaultValue = FXJSE_Value_Create(hruntime); | 6686 FXJSE_HVALUE defaultValue = FXJSE_Value_Create(hruntime); |
| 6641 GetObjectDefaultValue(jsObjectValue, defaultValue); | 6687 GetObjectDefaultValue(jsObjectValue, defaultValue); |
| 6642 if (FXJSE_Value_IsNull(defaultValue)) { | 6688 if (FXJSE_Value_IsNull(defaultValue)) { |
| 6643 isNull = TRUE; | 6689 isNull = TRUE; |
| 6644 } | 6690 } |
| 6645 FXJSE_Value_Release(defaultValue); | 6691 FXJSE_Value_Release(defaultValue); |
| 6646 } else { | 6692 } else { |
| 6647 CFX_ByteString propertyStr; | 6693 CFX_ByteString propertyStr; |
| 6648 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 6694 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 6649 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); | 6695 FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime); |
| 6650 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr, newPropertyValue); | 6696 FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsByteStringC(), |
| 6697 newPropertyValue); |
| 6651 if (FXJSE_Value_IsNull(newPropertyValue)) { | 6698 if (FXJSE_Value_IsNull(newPropertyValue)) { |
| 6652 isNull = TRUE; | 6699 isNull = TRUE; |
| 6653 } | 6700 } |
| 6654 FXJSE_Value_Release(newPropertyValue); | 6701 FXJSE_Value_Release(newPropertyValue); |
| 6655 } | 6702 } |
| 6656 FXJSE_Value_Release(propertyValue); | 6703 FXJSE_Value_Release(propertyValue); |
| 6657 FXJSE_Value_Release(jsObjectValue); | 6704 FXJSE_Value_Release(jsObjectValue); |
| 6658 } else { | 6705 } else { |
| 6659 isNull = TRUE; | 6706 isNull = TRUE; |
| 6660 } | 6707 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6746 for (int32_t j = 2; j < iLength; j++) { | 6793 for (int32_t j = 2; j < iLength; j++) { |
| 6747 FXJSE_Value_GetObjectPropByIdx(argsValue[i], j, jsObjectValue); | 6794 FXJSE_Value_GetObjectPropByIdx(argsValue[i], j, jsObjectValue); |
| 6748 GetObjectDefaultValue(jsObjectValue, resultValues[index]); | 6795 GetObjectDefaultValue(jsObjectValue, resultValues[index]); |
| 6749 index++; | 6796 index++; |
| 6750 } | 6797 } |
| 6751 } else { | 6798 } else { |
| 6752 CFX_ByteString propertyString; | 6799 CFX_ByteString propertyString; |
| 6753 FXJSE_Value_ToUTF8String(propertyValue, propertyString); | 6800 FXJSE_Value_ToUTF8String(propertyValue, propertyString); |
| 6754 for (int32_t j = 2; j < iLength; j++) { | 6801 for (int32_t j = 2; j < iLength; j++) { |
| 6755 FXJSE_Value_GetObjectPropByIdx(argsValue[i], j, jsObjectValue); | 6802 FXJSE_Value_GetObjectPropByIdx(argsValue[i], j, jsObjectValue); |
| 6756 FXJSE_Value_GetObjectProp(jsObjectValue, propertyString, | 6803 FXJSE_Value_GetObjectProp(jsObjectValue, |
| 6804 propertyString.AsByteStringC(), |
| 6757 resultValues[index]); | 6805 resultValues[index]); |
| 6758 index++; | 6806 index++; |
| 6759 } | 6807 } |
| 6760 } | 6808 } |
| 6761 FXJSE_Value_Release(propertyValue); | 6809 FXJSE_Value_Release(propertyValue); |
| 6762 FXJSE_Value_Release(jsObjectValue); | 6810 FXJSE_Value_Release(jsObjectValue); |
| 6763 } | 6811 } |
| 6764 } else if (FXJSE_Value_IsObject(argsValue[i])) { | 6812 } else if (FXJSE_Value_IsObject(argsValue[i])) { |
| 6765 GetObjectDefaultValue(argsValue[i], resultValues[index]); | 6813 GetObjectDefaultValue(argsValue[i], resultValues[index]); |
| 6766 index++; | 6814 index++; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6956 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 7004 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 6957 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); | 7005 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); |
| 6958 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 7006 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 6959 FXJSE_Value_GetObjectPropByIdx(hValue, 1, propertyValue); | 7007 FXJSE_Value_GetObjectPropByIdx(hValue, 1, propertyValue); |
| 6960 FXJSE_Value_GetObjectPropByIdx(hValue, 2, jsobjectValue); | 7008 FXJSE_Value_GetObjectPropByIdx(hValue, 2, jsobjectValue); |
| 6961 if (FXJSE_Value_IsNull(propertyValue)) { | 7009 if (FXJSE_Value_IsNull(propertyValue)) { |
| 6962 GetObjectDefaultValue(jsobjectValue, newProperty); | 7010 GetObjectDefaultValue(jsobjectValue, newProperty); |
| 6963 } else { | 7011 } else { |
| 6964 CFX_ByteString propertyStr; | 7012 CFX_ByteString propertyStr; |
| 6965 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 7013 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 6966 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr, newProperty); | 7014 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(), |
| 7015 newProperty); |
| 6967 } | 7016 } |
| 6968 iValue = HValueToInteger(hThis, newProperty); | 7017 iValue = HValueToInteger(hThis, newProperty); |
| 6969 FXJSE_Value_Release(newProperty); | 7018 FXJSE_Value_Release(newProperty); |
| 6970 FXJSE_Value_Release(jsobjectValue); | 7019 FXJSE_Value_Release(jsobjectValue); |
| 6971 FXJSE_Value_Release(propertyValue); | 7020 FXJSE_Value_Release(propertyValue); |
| 6972 return iValue; | 7021 return iValue; |
| 6973 } else if (FXJSE_Value_IsObject(hValue)) { | 7022 } else if (FXJSE_Value_IsObject(hValue)) { |
| 6974 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 7023 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 6975 GetObjectDefaultValue(hValue, newProperty); | 7024 GetObjectDefaultValue(hValue, newProperty); |
| 6976 iValue = HValueToInteger(hThis, newProperty); | 7025 iValue = HValueToInteger(hThis, newProperty); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 6999 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 7048 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 7000 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); | 7049 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); |
| 7001 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 7050 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 7002 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); | 7051 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); |
| 7003 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsobjectValue); | 7052 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsobjectValue); |
| 7004 if (FXJSE_Value_IsNull(propertyValue)) { | 7053 if (FXJSE_Value_IsNull(propertyValue)) { |
| 7005 GetObjectDefaultValue(jsobjectValue, newProperty); | 7054 GetObjectDefaultValue(jsobjectValue, newProperty); |
| 7006 } else { | 7055 } else { |
| 7007 CFX_ByteString propertyStr; | 7056 CFX_ByteString propertyStr; |
| 7008 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 7057 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 7009 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr, newProperty); | 7058 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(), |
| 7059 newProperty); |
| 7010 } | 7060 } |
| 7011 fRet = HValueToFloat(hThis, newProperty); | 7061 fRet = HValueToFloat(hThis, newProperty); |
| 7012 FXJSE_Value_Release(newProperty); | 7062 FXJSE_Value_Release(newProperty); |
| 7013 FXJSE_Value_Release(jsobjectValue); | 7063 FXJSE_Value_Release(jsobjectValue); |
| 7014 FXJSE_Value_Release(propertyValue); | 7064 FXJSE_Value_Release(propertyValue); |
| 7015 } else if (FXJSE_Value_IsObject(arg)) { | 7065 } else if (FXJSE_Value_IsObject(arg)) { |
| 7016 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 7066 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 7017 GetObjectDefaultValue(arg, newProperty); | 7067 GetObjectDefaultValue(arg, newProperty); |
| 7018 fRet = HValueToFloat(hThis, newProperty); | 7068 fRet = HValueToFloat(hThis, newProperty); |
| 7019 FXJSE_Value_Release(newProperty); | 7069 FXJSE_Value_Release(newProperty); |
| 7020 } else if (FXJSE_Value_IsUTF8String(arg)) { | 7070 } else if (FXJSE_Value_IsUTF8String(arg)) { |
| 7021 CFX_ByteString bsOutput; | 7071 CFX_ByteString bsOutput; |
| 7022 FXJSE_Value_ToUTF8String(arg, bsOutput); | 7072 FXJSE_Value_ToUTF8String(arg, bsOutput); |
| 7023 fRet = (FX_FLOAT)StringToDouble(bsOutput); | 7073 fRet = (FX_FLOAT)StringToDouble(bsOutput.AsByteStringC()); |
| 7024 } else if (FXJSE_Value_IsUndefined(arg)) { | 7074 } else if (FXJSE_Value_IsUndefined(arg)) { |
| 7025 fRet = 0; | 7075 fRet = 0; |
| 7026 } else { | 7076 } else { |
| 7027 fRet = FXJSE_Value_ToFloat(arg); | 7077 fRet = FXJSE_Value_ToFloat(arg); |
| 7028 } | 7078 } |
| 7029 return fRet; | 7079 return fRet; |
| 7030 } | 7080 } |
| 7031 FX_DOUBLE CXFA_FM2JSContext::HValueToDouble(FXJSE_HOBJECT hThis, | 7081 FX_DOUBLE CXFA_FM2JSContext::HValueToDouble(FXJSE_HOBJECT hThis, |
| 7032 FXJSE_HVALUE arg) { | 7082 FXJSE_HVALUE arg) { |
| 7033 CXFA_FM2JSContext* pContext = | 7083 CXFA_FM2JSContext* pContext = |
| 7034 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); | 7084 (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL); |
| 7035 FXJSE_HRUNTIME hruntime = pContext->GetScriptRuntime(); | 7085 FXJSE_HRUNTIME hruntime = pContext->GetScriptRuntime(); |
| 7036 FX_DOUBLE dRet = 0; | 7086 FX_DOUBLE dRet = 0; |
| 7037 if (FXJSE_Value_IsArray(arg)) { | 7087 if (FXJSE_Value_IsArray(arg)) { |
| 7038 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); | 7088 FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime); |
| 7039 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); | 7089 FXJSE_HVALUE jsobjectValue = FXJSE_Value_Create(hruntime); |
| 7040 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 7090 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 7041 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); | 7091 FXJSE_Value_GetObjectPropByIdx(arg, 1, propertyValue); |
| 7042 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsobjectValue); | 7092 FXJSE_Value_GetObjectPropByIdx(arg, 2, jsobjectValue); |
| 7043 if (FXJSE_Value_IsNull(propertyValue)) { | 7093 if (FXJSE_Value_IsNull(propertyValue)) { |
| 7044 GetObjectDefaultValue(jsobjectValue, newProperty); | 7094 GetObjectDefaultValue(jsobjectValue, newProperty); |
| 7045 } else { | 7095 } else { |
| 7046 CFX_ByteString propertyStr; | 7096 CFX_ByteString propertyStr; |
| 7047 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); | 7097 FXJSE_Value_ToUTF8String(propertyValue, propertyStr); |
| 7048 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr, newProperty); | 7098 FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(), |
| 7099 newProperty); |
| 7049 } | 7100 } |
| 7050 dRet = HValueToDouble(hThis, newProperty); | 7101 dRet = HValueToDouble(hThis, newProperty); |
| 7051 FXJSE_Value_Release(newProperty); | 7102 FXJSE_Value_Release(newProperty); |
| 7052 FXJSE_Value_Release(jsobjectValue); | 7103 FXJSE_Value_Release(jsobjectValue); |
| 7053 FXJSE_Value_Release(propertyValue); | 7104 FXJSE_Value_Release(propertyValue); |
| 7054 } else if (FXJSE_Value_IsObject(arg)) { | 7105 } else if (FXJSE_Value_IsObject(arg)) { |
| 7055 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); | 7106 FXJSE_HVALUE newProperty = FXJSE_Value_Create(hruntime); |
| 7056 GetObjectDefaultValue(arg, newProperty); | 7107 GetObjectDefaultValue(arg, newProperty); |
| 7057 dRet = HValueToDouble(hThis, newProperty); | 7108 dRet = HValueToDouble(hThis, newProperty); |
| 7058 FXJSE_Value_Release(newProperty); | 7109 FXJSE_Value_Release(newProperty); |
| 7059 } else if (FXJSE_Value_IsUTF8String(arg)) { | 7110 } else if (FXJSE_Value_IsUTF8String(arg)) { |
| 7060 CFX_ByteString bsOutput; | 7111 CFX_ByteString bsOutput; |
| 7061 FXJSE_Value_ToUTF8String(arg, bsOutput); | 7112 FXJSE_Value_ToUTF8String(arg, bsOutput); |
| 7062 dRet = StringToDouble(bsOutput); | 7113 dRet = StringToDouble(bsOutput.AsByteStringC()); |
| 7063 } else if (FXJSE_Value_IsUndefined(arg)) { | 7114 } else if (FXJSE_Value_IsUndefined(arg)) { |
| 7064 dRet = 0; | 7115 dRet = 0; |
| 7065 } else { | 7116 } else { |
| 7066 dRet = FXJSE_Value_ToDouble(arg); | 7117 dRet = FXJSE_Value_ToDouble(arg); |
| 7067 } | 7118 } |
| 7068 return dRet; | 7119 return dRet; |
| 7069 } | 7120 } |
| 7070 void CXFA_FM2JSContext::HValueToUTF8String(FXJSE_HVALUE arg, | 7121 void CXFA_FM2JSContext::HValueToUTF8String(FXJSE_HVALUE arg, |
| 7071 CFX_ByteString& szOutputString) { | 7122 CFX_ByteString& szOutputString) { |
| 7072 if (FXJSE_Value_IsNull(arg) || FXJSE_Value_IsUndefined(arg)) { | 7123 if (FXJSE_Value_IsNull(arg) || FXJSE_Value_IsUndefined(arg)) { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7212 void CXFA_FM2JSContext::ThrowScriptErrorMessage(int32_t iStringID, ...) { | 7263 void CXFA_FM2JSContext::ThrowScriptErrorMessage(int32_t iStringID, ...) { |
| 7213 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); | 7264 IXFA_AppProvider* pAppProvider = m_pDocument->GetNotify()->GetAppProvider(); |
| 7214 FXSYS_assert(pAppProvider); | 7265 FXSYS_assert(pAppProvider); |
| 7215 CFX_WideString wsFormat; | 7266 CFX_WideString wsFormat; |
| 7216 pAppProvider->LoadString(iStringID, wsFormat); | 7267 pAppProvider->LoadString(iStringID, wsFormat); |
| 7217 CFX_WideString wsMessage; | 7268 CFX_WideString wsMessage; |
| 7218 va_list arg_ptr; | 7269 va_list arg_ptr; |
| 7219 va_start(arg_ptr, iStringID); | 7270 va_start(arg_ptr, iStringID); |
| 7220 wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr); | 7271 wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr); |
| 7221 va_end(arg_ptr); | 7272 va_end(arg_ptr); |
| 7222 FXJSE_ThrowMessage("", FX_UTF8Encode(wsMessage, wsMessage.GetLength())); | 7273 FXJSE_ThrowMessage( |
| 7274 "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsByteStringC()); |
| 7223 } | 7275 } |
| OLD | NEW |