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 "fxjs/include/cfxjse_value.h" | 7 #include "fxjs/cfxjse_value.h" |
8 | 8 |
9 #include <math.h> | 9 #include <math.h> |
10 | 10 |
11 #include "fxjs/include/cfxjse_class.h" | 11 #include "fxjs/cfxjse_class.h" |
12 #include "fxjs/include/cfxjse_context.h" | 12 #include "fxjs/cfxjse_context.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 double ftod(FX_FLOAT fNumber) { | 16 double ftod(FX_FLOAT fNumber) { |
17 static_assert(sizeof(FX_FLOAT) == 4, "FX_FLOAT of incorrect size"); | 17 static_assert(sizeof(FX_FLOAT) == 4, "FX_FLOAT of incorrect size"); |
18 | 18 |
19 uint32_t nFloatBits = (uint32_t&)fNumber; | 19 uint32_t nFloatBits = (uint32_t&)fNumber; |
20 uint8_t nExponent = (uint8_t)(nFloatBits >> 23); | 20 uint8_t nExponent = (uint8_t)(nFloatBits >> 23); |
21 if (nExponent == 0 || nExponent == 255) | 21 if (nExponent == 0 || nExponent == 255) |
22 return fNumber; | 22 return fNumber; |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 m_pIsolate, reinterpret_cast<const char*>(szString.raw_str()), | 510 m_pIsolate, reinterpret_cast<const char*>(szString.raw_str()), |
511 v8::String::kNormalString, szString.GetLength()); | 511 v8::String::kNormalString, szString.GetLength()); |
512 m_hValue.Reset(m_pIsolate, hValue); | 512 m_hValue.Reset(m_pIsolate, hValue); |
513 } | 513 } |
514 | 514 |
515 void CFXJSE_Value::SetJSObject() { | 515 void CFXJSE_Value::SetJSObject() { |
516 CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); | 516 CFXJSE_ScopeUtil_IsolateHandleRootContext scope(m_pIsolate); |
517 v8::Local<v8::Value> hValue = v8::Object::New(m_pIsolate); | 517 v8::Local<v8::Value> hValue = v8::Object::New(m_pIsolate); |
518 m_hValue.Reset(m_pIsolate, hValue); | 518 m_hValue.Reset(m_pIsolate, hValue); |
519 } | 519 } |
OLD | NEW |