| 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 "fpdfsdk/src/javascript/global.h" | 7 #include "fpdfsdk/src/javascript/global.h" |
| 8 | 8 |
| 9 #include "core/include/fxcrt/fx_ext.h" | 9 #include "core/include/fxcrt/fx_ext.h" |
| 10 #include "fpdfsdk/include/javascript/IJavaScript.h" | 10 #include "fpdfsdk/include/javascript/IJavaScript.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 CHash<'o', 'b', 'j', 'e', 'c', 't'>::value; | 50 CHash<'o', 'b', 'j', 'e', 'c', 't'>::value; |
| 51 const unsigned int JSCONST_nFXobjHash = CHash<'f', 'x', 'o', 'b', 'j'>::value; | 51 const unsigned int JSCONST_nFXobjHash = CHash<'f', 'x', 'o', 'b', 'j'>::value; |
| 52 const unsigned int JSCONST_nNullHash = CHash<'n', 'u', 'l', 'l'>::value; | 52 const unsigned int JSCONST_nNullHash = CHash<'n', 'u', 'l', 'l'>::value; |
| 53 const unsigned int JSCONST_nUndefHash = | 53 const unsigned int JSCONST_nUndefHash = |
| 54 CHash<'u', 'n', 'd', 'e', 'f', 'i', 'n', 'e', 'd'>::value; | 54 CHash<'u', 'n', 'd', 'e', 'f', 'i', 'n', 'e', 'd'>::value; |
| 55 | 55 |
| 56 static unsigned JS_CalcHash(const wchar_t* main) { | 56 static unsigned JS_CalcHash(const wchar_t* main) { |
| 57 return (unsigned)FX_HashCode_String_GetW(main, FXSYS_wcslen(main)); | 57 return (unsigned)FX_HashCode_String_GetW(main, FXSYS_wcslen(main)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 #ifdef _DEBUG | 60 #if !defined(NDEBUG) |
| 61 class HashVerify { | 61 class HashVerify { |
| 62 public: | 62 public: |
| 63 HashVerify(); | 63 HashVerify(); |
| 64 } g_hashVerify; | 64 } g_hashVerify; |
| 65 | 65 |
| 66 HashVerify::HashVerify() { | 66 HashVerify::HashVerify() { |
| 67 ASSERT(JSCONST_nStringHash == JS_CalcHash(kFXJSValueNameString)); | 67 ASSERT(JSCONST_nStringHash == JS_CalcHash(kFXJSValueNameString)); |
| 68 ASSERT(JSCONST_nNumberHash == JS_CalcHash(kFXJSValueNameNumber)); | 68 ASSERT(JSCONST_nNumberHash == JS_CalcHash(kFXJSValueNameNumber)); |
| 69 ASSERT(JSCONST_nBoolHash == JS_CalcHash(kFXJSValueNameBoolean)); | 69 ASSERT(JSCONST_nBoolHash == JS_CalcHash(kFXJSValueNameBoolean)); |
| 70 ASSERT(JSCONST_nDateHash == JS_CalcHash(kFXJSValueNameDate)); | 70 ASSERT(JSCONST_nDateHash == JS_CalcHash(kFXJSValueNameDate)); |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 return CJS_Value::VT_boolean; | 510 return CJS_Value::VT_boolean; |
| 511 if (nHash == JSCONST_nDateHash) | 511 if (nHash == JSCONST_nDateHash) |
| 512 return CJS_Value::VT_date; | 512 return CJS_Value::VT_date; |
| 513 if (nHash == JSCONST_nObjectHash) | 513 if (nHash == JSCONST_nObjectHash) |
| 514 return CJS_Value::VT_object; | 514 return CJS_Value::VT_object; |
| 515 if (nHash == JSCONST_nFXobjHash) | 515 if (nHash == JSCONST_nFXobjHash) |
| 516 return CJS_Value::VT_fxobject; | 516 return CJS_Value::VT_fxobject; |
| 517 | 517 |
| 518 return CJS_Value::VT_unknown; | 518 return CJS_Value::VT_unknown; |
| 519 } | 519 } |
| OLD | NEW |