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

Side by Side Diff: xfa/fxfa/fm2js/xfa_fm2jscontext.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, 8 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/fxfa/app/xfa_textlayout.cpp ('k') | xfa/fxfa/fm2js/xfa_lexer.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/fm2js/xfa_fm2jscontext.h" 7 #include "xfa/fxfa/fm2js/xfa_fm2jscontext.h"
8 8
9 #include <time.h> 9 #include <time.h>
10 10
(...skipping 4220 matching lines...) Expand 10 before | Expand all | Expand 10 after
4231 } break; 4231 } break;
4232 } 4232 }
4233 } 4233 }
4234 wsResultBuf.AppendChar(0); 4234 wsResultBuf.AppendChar(0);
4235 szResultBuf.Clear(); 4235 szResultBuf.Clear();
4236 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength()) 4236 szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength())
4237 .AsStringC(); 4237 .AsStringC();
4238 } 4238 }
4239 FX_BOOL CXFA_FM2JSContext::HTMLSTR2Code(const CFX_WideStringC& pData, 4239 FX_BOOL CXFA_FM2JSContext::HTMLSTR2Code(const CFX_WideStringC& pData,
4240 uint32_t& iCode) { 4240 uint32_t& iCode) {
4241 int32_t iLength = pData.GetLength(); 4241 uint32_t uHash = FX_HashCode_GetW(pData, false);
4242 uint32_t uHash = FX_HashCode_String_GetW(pData.c_str(), iLength); 4242 int32_t iStart = 0;
4243 XFA_FMHtmlHashedReserveCode htmlhashedreservecode; 4243 int32_t iEnd = FX_ArraySize(reservesForDecode) - 1;
4244 int32_t iStart = 0,
4245 iEnd = (sizeof(reservesForDecode) / sizeof(reservesForDecode[0])) - 1;
4246 int32_t iMid = (iStart + iEnd) / 2;
4247 do { 4244 do {
4248 iMid = (iStart + iEnd) / 2; 4245 int32_t iMid = (iStart + iEnd) / 2;
4249 htmlhashedreservecode = reservesForDecode[iMid]; 4246 XFA_FMHtmlHashedReserveCode htmlhashedreservecode = reservesForDecode[iMid];
4250 if (uHash == htmlhashedreservecode.m_uHash) { 4247 if (uHash == htmlhashedreservecode.m_uHash) {
4251 iCode = htmlhashedreservecode.m_uCode; 4248 iCode = htmlhashedreservecode.m_uCode;
4252 return TRUE; 4249 return TRUE;
4253 } else if (uHash < htmlhashedreservecode.m_uHash) { 4250 }
4251 if (uHash < htmlhashedreservecode.m_uHash) {
4254 iEnd = iMid - 1; 4252 iEnd = iMid - 1;
4255 } else { 4253 } else {
4256 iStart = iMid + 1; 4254 iStart = iMid + 1;
4257 } 4255 }
4258 } while (iStart <= iEnd); 4256 } while (iStart <= iEnd);
4259 return FALSE; 4257 return FALSE;
4260 } 4258 }
4261 FX_BOOL CXFA_FM2JSContext::HTMLCode2STR(uint32_t iCode, 4259 FX_BOOL CXFA_FM2JSContext::HTMLCode2STR(uint32_t iCode,
4262 CFX_WideString& wsHTMLReserve) { 4260 CFX_WideString& wsHTMLReserve) {
4263 XFA_FMHtmlReserveCode htmlreservecode; 4261 XFA_FMHtmlReserveCode htmlreservecode;
(...skipping 2957 matching lines...) Expand 10 before | Expand all | Expand 10 after
7221 CFX_WideString wsFormat; 7219 CFX_WideString wsFormat;
7222 pAppProvider->LoadString(iStringID, wsFormat); 7220 pAppProvider->LoadString(iStringID, wsFormat);
7223 CFX_WideString wsMessage; 7221 CFX_WideString wsMessage;
7224 va_list arg_ptr; 7222 va_list arg_ptr;
7225 va_start(arg_ptr, iStringID); 7223 va_start(arg_ptr, iStringID);
7226 wsMessage.FormatV(wsFormat.c_str(), arg_ptr); 7224 wsMessage.FormatV(wsFormat.c_str(), arg_ptr);
7227 va_end(arg_ptr); 7225 va_end(arg_ptr);
7228 FXJSE_ThrowMessage( 7226 FXJSE_ThrowMessage(
7229 "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC()); 7227 "", FX_UTF8Encode(wsMessage.c_str(), wsMessage.GetLength()).AsStringC());
7230 } 7228 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_textlayout.cpp ('k') | xfa/fxfa/fm2js/xfa_lexer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698