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

Side by Side Diff: xfa/fxfa/app/xfa_ffbarcode.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 | « xfa/fgas/localization/fgas_locale.cpp ('k') | xfa/fxfa/app/xfa_ffdoc.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 "xfa/fxfa/app/xfa_ffbarcode.h" 7 #include "xfa/fxfa/app/xfa_ffbarcode.h"
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "xfa/fwl/core/ifwl_app.h" 10 #include "xfa/fwl/core/ifwl_app.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 BC_UNKNOWN}, 87 BC_UNKNOWN},
88 {0xf2a18f7e, L"QRCode", XFA_BARCODETYPE_QRCode, BC_QR_CODE}, 88 {0xf2a18f7e, L"QRCode", XFA_BARCODETYPE_QRCode, BC_QR_CODE},
89 {0xfaeaf37f, L"postUSStandard", XFA_BARCODETYPE_postUSStandard, BC_UNKNOWN}, 89 {0xfaeaf37f, L"postUSStandard", XFA_BARCODETYPE_postUSStandard, BC_UNKNOWN},
90 {0xfb48155c, L"code3Of9", XFA_BARCODETYPE_code3Of9, BC_CODE39}, 90 {0xfb48155c, L"code3Of9", XFA_BARCODETYPE_code3Of9, BC_CODE39},
91 }; 91 };
92 const int32_t g_iXFABarcodeTypeCount = 92 const int32_t g_iXFABarcodeTypeCount =
93 sizeof(g_XFABarCodeTypeEnumData) / sizeof(XFA_BARCODETYPEENUMINFO); 93 sizeof(g_XFABarCodeTypeEnumData) / sizeof(XFA_BARCODETYPEENUMINFO);
94 94
95 XFA_LPCBARCODETYPEENUMINFO XFA_GetBarcodeTypeByName( 95 XFA_LPCBARCODETYPEENUMINFO XFA_GetBarcodeTypeByName(
96 const CFX_WideStringC& wsName) { 96 const CFX_WideStringC& wsName) {
97 int32_t iLength = wsName.GetLength(); 97 if (wsName.IsEmpty())
98 if (iLength == 0) { 98 return nullptr;
99 return NULL; 99
100 } 100 uint32_t uHash = FX_HashCode_GetW(wsName, true);
101 uint32_t uHash = FX_HashCode_String_GetW(wsName.c_str(), iLength, TRUE); 101 int32_t iStart = 0;
102 int32_t iStart = 0, iEnd = g_iXFABarcodeTypeCount - 1; 102 int32_t iEnd = g_iXFABarcodeTypeCount - 1;
103 do { 103 do {
104 int32_t iMid = (iStart + iEnd) / 2; 104 int32_t iMid = (iStart + iEnd) / 2;
105 XFA_LPCBARCODETYPEENUMINFO pInfo = g_XFABarCodeTypeEnumData + iMid; 105 XFA_LPCBARCODETYPEENUMINFO pInfo = g_XFABarCodeTypeEnumData + iMid;
106 if (uHash == pInfo->uHash) { 106 if (uHash == pInfo->uHash) {
107 return pInfo; 107 return pInfo;
108 } else if (uHash < pInfo->uHash) { 108 } else if (uHash < pInfo->uHash) {
109 iEnd = iMid - 1; 109 iEnd = iMid - 1;
110 } else { 110 } else {
111 iStart = iMid + 1; 111 iStart = iMid + 1;
112 } 112 }
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 231 }
232 FX_BOOL CXFA_FFBarcode::OnRButtonDown(uint32_t dwFlags, 232 FX_BOOL CXFA_FFBarcode::OnRButtonDown(uint32_t dwFlags,
233 FX_FLOAT fx, 233 FX_FLOAT fx,
234 FX_FLOAT fy) { 234 FX_FLOAT fy) {
235 CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; 235 CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget;
236 if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) { 236 if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) {
237 return FALSE; 237 return FALSE;
238 } 238 }
239 return CXFA_FFTextEdit::OnRButtonDown(dwFlags, fx, fy); 239 return CXFA_FFTextEdit::OnRButtonDown(dwFlags, fx, fy);
240 } 240 }
OLDNEW
« no previous file with comments | « xfa/fgas/localization/fgas_locale.cpp ('k') | xfa/fxfa/app/xfa_ffdoc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698