| 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/fxjse/value.h" | 7 #include "xfa/fxjse/value.h" |
| 8 | 8 |
| 9 #include <math.h> | 9 #include <math.h> |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 void FXJSE_Value_ToUTF8String(FXJSE_HVALUE hValue, | 66 void FXJSE_Value_ToUTF8String(FXJSE_HVALUE hValue, |
| 67 CFX_ByteString& szStrOutput) { | 67 CFX_ByteString& szStrOutput) { |
| 68 return reinterpret_cast<CFXJSE_Value*>(hValue)->ToString(szStrOutput); | 68 return reinterpret_cast<CFXJSE_Value*>(hValue)->ToString(szStrOutput); |
| 69 } | 69 } |
| 70 | 70 |
| 71 int32_t FXJSE_Value_ToInteger(FXJSE_HVALUE hValue) { | 71 int32_t FXJSE_Value_ToInteger(FXJSE_HVALUE hValue) { |
| 72 return reinterpret_cast<CFXJSE_Value*>(hValue)->ToInteger(); | 72 return reinterpret_cast<CFXJSE_Value*>(hValue)->ToInteger(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void* FXJSE_Value_ToObject(FXJSE_HVALUE hValue, FXJSE_HCLASS hClass) { | 75 void* FXJSE_Value_ToObject(FXJSE_HVALUE hValue, CFXJSE_Class* pClass) { |
| 76 CFXJSE_Class* lpClass = reinterpret_cast<CFXJSE_Class*>(hClass); | 76 return reinterpret_cast<CFXJSE_Value*>(hValue)->ToObject(pClass); |
| 77 return reinterpret_cast<CFXJSE_Value*>(hValue)->ToObject(lpClass); | |
| 78 } | 77 } |
| 79 | 78 |
| 80 void FXJSE_Value_SetUndefined(FXJSE_HVALUE hValue) { | 79 void FXJSE_Value_SetUndefined(FXJSE_HVALUE hValue) { |
| 81 reinterpret_cast<CFXJSE_Value*>(hValue)->SetUndefined(); | 80 reinterpret_cast<CFXJSE_Value*>(hValue)->SetUndefined(); |
| 82 } | 81 } |
| 83 | 82 |
| 84 void FXJSE_Value_SetNull(FXJSE_HVALUE hValue) { | 83 void FXJSE_Value_SetNull(FXJSE_HVALUE hValue) { |
| 85 reinterpret_cast<CFXJSE_Value*>(hValue)->SetNull(); | 84 reinterpret_cast<CFXJSE_Value*>(hValue)->SetNull(); |
| 86 } | 85 } |
| 87 | 86 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 101 void FXJSE_Value_SetFloat(FXJSE_HVALUE hValue, FX_FLOAT fFloat) { | 100 void FXJSE_Value_SetFloat(FXJSE_HVALUE hValue, FX_FLOAT fFloat) { |
| 102 reinterpret_cast<CFXJSE_Value*>(hValue)->SetFloat(fFloat); | 101 reinterpret_cast<CFXJSE_Value*>(hValue)->SetFloat(fFloat); |
| 103 } | 102 } |
| 104 | 103 |
| 105 void FXJSE_Value_SetDouble(FXJSE_HVALUE hValue, double dDouble) { | 104 void FXJSE_Value_SetDouble(FXJSE_HVALUE hValue, double dDouble) { |
| 106 reinterpret_cast<CFXJSE_Value*>(hValue)->SetDouble(dDouble); | 105 reinterpret_cast<CFXJSE_Value*>(hValue)->SetDouble(dDouble); |
| 107 } | 106 } |
| 108 | 107 |
| 109 void FXJSE_Value_SetObject(FXJSE_HVALUE hValue, | 108 void FXJSE_Value_SetObject(FXJSE_HVALUE hValue, |
| 110 void* lpObject, | 109 void* lpObject, |
| 111 FXJSE_HCLASS hClass) { | 110 CFXJSE_Class* pClass) { |
| 112 CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue); | 111 CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue); |
| 113 CFXJSE_Class* lpClass = reinterpret_cast<CFXJSE_Class*>(hClass); | 112 if (!pClass) { |
| 114 if (!lpClass) { | |
| 115 ASSERT(!lpObject); | 113 ASSERT(!lpObject); |
| 116 lpValue->SetJSObject(); | 114 lpValue->SetJSObject(); |
| 117 } else { | 115 } else { |
| 118 lpValue->SetHostObject(lpObject, lpClass); | 116 lpValue->SetHostObject(lpObject, pClass); |
| 119 } | 117 } |
| 120 } | 118 } |
| 121 | 119 |
| 122 void FXJSE_Value_SetArray(FXJSE_HVALUE hValue, | 120 void FXJSE_Value_SetArray(FXJSE_HVALUE hValue, |
| 123 uint32_t uValueCount, | 121 uint32_t uValueCount, |
| 124 FXJSE_HVALUE* rgValues) { | 122 FXJSE_HVALUE* rgValues) { |
| 125 reinterpret_cast<CFXJSE_Value*>(hValue) | 123 reinterpret_cast<CFXJSE_Value*>(hValue) |
| 126 ->SetArray(uValueCount, reinterpret_cast<CFXJSE_Value**>(rgValues)); | 124 ->SetArray(uValueCount, reinterpret_cast<CFXJSE_Value**>(rgValues)); |
| 127 } | 125 } |
| 128 | 126 |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 if (lpRetValue) | 531 if (lpRetValue) |
| 534 lpRetValue->ForceSetValue(hReturnValue); | 532 lpRetValue->ForceSetValue(hReturnValue); |
| 535 | 533 |
| 536 if (lpLocalArgs) { | 534 if (lpLocalArgs) { |
| 537 for (uint32_t i = 0; i < nArgCount; i++) | 535 for (uint32_t i = 0; i < nArgCount; i++) |
| 538 lpLocalArgs[i].~Local(); | 536 lpLocalArgs[i].~Local(); |
| 539 FX_Free(lpLocalArgs); | 537 FX_Free(lpLocalArgs); |
| 540 } | 538 } |
| 541 return bRetValue; | 539 return bRetValue; |
| 542 } | 540 } |
| OLD | NEW |