Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: fpdfsdk/javascript/global.cpp

Issue 1919563002: Pass CFX_*StringCs to FX_HashCode_GETA and _GETW hash functions. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: fix issue from c4 Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fxcrt/include/fx_ext.h ('k') | xfa/fde/css/fde_csscache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « core/fxcrt/include/fx_ext.h ('k') | xfa/fde/css/fde_csscache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698