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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void FXJSE_Value_SetFloat(FXJSE_HVALUE hValue, FX_FLOAT fFloat) { | 100 void FXJSE_Value_SetFloat(FXJSE_HVALUE hValue, FX_FLOAT fFloat) { |
101 reinterpret_cast<CFXJSE_Value*>(hValue)->SetFloat(fFloat); | 101 reinterpret_cast<CFXJSE_Value*>(hValue)->SetFloat(fFloat); |
102 } | 102 } |
103 | 103 |
104 void FXJSE_Value_SetDouble(FXJSE_HVALUE hValue, double dDouble) { | 104 void FXJSE_Value_SetDouble(FXJSE_HVALUE hValue, double dDouble) { |
105 reinterpret_cast<CFXJSE_Value*>(hValue)->SetDouble(dDouble); | 105 reinterpret_cast<CFXJSE_Value*>(hValue)->SetDouble(dDouble); |
106 } | 106 } |
107 | 107 |
108 void FXJSE_Value_SetObject(FXJSE_HVALUE hValue, | 108 void FXJSE_Value_SetObject(FXJSE_HVALUE hValue, |
109 void* lpObject, | 109 void* lpObject, |
110 FXJSE_HCLASS hClass) { | 110 CFXJSE_Class* pClass) { |
111 CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue); | 111 CFXJSE_Value* lpValue = reinterpret_cast<CFXJSE_Value*>(hValue); |
112 CFXJSE_Class* lpClass = reinterpret_cast<CFXJSE_Class*>(hClass); | 112 if (!pClass) { |
113 if (!lpClass) { | |
114 ASSERT(!lpObject); | 113 ASSERT(!lpObject); |
115 lpValue->SetJSObject(); | 114 lpValue->SetJSObject(); |
116 } else { | 115 } else { |
117 lpValue->SetHostObject(lpObject, lpClass); | 116 lpValue->SetHostObject(lpObject, pClass); |
118 } | 117 } |
119 } | 118 } |
120 | 119 |
121 void FXJSE_Value_SetArray(FXJSE_HVALUE hValue, | 120 void FXJSE_Value_SetArray(FXJSE_HVALUE hValue, |
122 uint32_t uValueCount, | 121 uint32_t uValueCount, |
123 FXJSE_HVALUE* rgValues) { | 122 FXJSE_HVALUE* rgValues) { |
124 reinterpret_cast<CFXJSE_Value*>(hValue) | 123 reinterpret_cast<CFXJSE_Value*>(hValue) |
125 ->SetArray(uValueCount, reinterpret_cast<CFXJSE_Value**>(rgValues)); | 124 ->SetArray(uValueCount, reinterpret_cast<CFXJSE_Value**>(rgValues)); |
126 } | 125 } |
127 | 126 |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 if (lpRetValue) | 531 if (lpRetValue) |
533 lpRetValue->ForceSetValue(hReturnValue); | 532 lpRetValue->ForceSetValue(hReturnValue); |
534 | 533 |
535 if (lpLocalArgs) { | 534 if (lpLocalArgs) { |
536 for (uint32_t i = 0; i < nArgCount; i++) | 535 for (uint32_t i = 0; i < nArgCount; i++) |
537 lpLocalArgs[i].~Local(); | 536 lpLocalArgs[i].~Local(); |
538 FX_Free(lpLocalArgs); | 537 FX_Free(lpLocalArgs); |
539 } | 538 } |
540 return bRetValue; | 539 return bRetValue; |
541 } | 540 } |
OLD | NEW |