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/javascript/global.h" | 7 #include "fpdfsdk/javascript/global.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 CHash<'b', 'o', 'o', 'l', 'e', 'a', 'n'>::value; | 46 CHash<'b', 'o', 'o', 'l', 'e', 'a', 'n'>::value; |
47 const unsigned int JSCONST_nDateHash = CHash<'d', 'a', 't', 'e'>::value; | 47 const unsigned int JSCONST_nDateHash = CHash<'d', 'a', 't', 'e'>::value; |
48 const unsigned int JSCONST_nObjectHash = | 48 const unsigned int JSCONST_nObjectHash = |
49 CHash<'o', 'b', 'j', 'e', 'c', 't'>::value; | 49 CHash<'o', 'b', 'j', 'e', 'c', 't'>::value; |
50 const unsigned int JSCONST_nFXobjHash = CHash<'f', 'x', 'o', 'b', 'j'>::value; | 50 const unsigned int JSCONST_nFXobjHash = CHash<'f', 'x', 'o', 'b', 'j'>::value; |
51 const unsigned int JSCONST_nNullHash = CHash<'n', 'u', 'l', 'l'>::value; | 51 const unsigned int JSCONST_nNullHash = CHash<'n', 'u', 'l', 'l'>::value; |
52 const unsigned int JSCONST_nUndefHash = | 52 const unsigned int JSCONST_nUndefHash = |
53 CHash<'u', 'n', 'd', 'e', 'f', 'i', 'n', 'e', 'd'>::value; | 53 CHash<'u', 'n', 'd', 'e', 'f', 'i', 'n', 'e', 'd'>::value; |
54 | 54 |
55 static unsigned JS_CalcHash(const wchar_t* main) { | 55 static unsigned JS_CalcHash(const wchar_t* main) { |
56 return (unsigned)FX_HashCode_String_GetW(main, FXSYS_wcslen(main)); | 56 return (unsigned)FX_HashCode_GetW(CFX_WideStringC(main), false); |
57 } | 57 } |
58 | 58 |
59 #ifndef NDEBUG | 59 #ifndef NDEBUG |
60 class HashVerify { | 60 class HashVerify { |
61 public: | 61 public: |
62 HashVerify(); | 62 HashVerify(); |
63 } g_hashVerify; | 63 } g_hashVerify; |
64 | 64 |
65 HashVerify::HashVerify() { | 65 HashVerify::HashVerify() { |
66 ASSERT(JSCONST_nStringHash == JS_CalcHash(kFXJSValueNameString)); | 66 ASSERT(JSCONST_nStringHash == JS_CalcHash(kFXJSValueNameString)); |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 return CJS_Value::VT_boolean; | 502 return CJS_Value::VT_boolean; |
503 if (nHash == JSCONST_nDateHash) | 503 if (nHash == JSCONST_nDateHash) |
504 return CJS_Value::VT_date; | 504 return CJS_Value::VT_date; |
505 if (nHash == JSCONST_nObjectHash) | 505 if (nHash == JSCONST_nObjectHash) |
506 return CJS_Value::VT_object; | 506 return CJS_Value::VT_object; |
507 if (nHash == JSCONST_nFXobjHash) | 507 if (nHash == JSCONST_nFXobjHash) |
508 return CJS_Value::VT_fxobject; | 508 return CJS_Value::VT_fxobject; |
509 | 509 |
510 return CJS_Value::VT_unknown; | 510 return CJS_Value::VT_unknown; |
511 } | 511 } |
OLD | NEW |