| 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 "xfa/fxfa/parser/xfa_basic_imp.h" | 7 #include "xfa/fxfa/parser/xfa_basic_imp.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "xfa/fgas/crt/fgas_algorithm.h" | 10 #include "xfa/fgas/crt/fgas_algorithm.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } | 333 } |
| 334 | 334 |
| 335 const XFA_METHODINFO* XFA_GetMethodByName(XFA_ELEMENT eElement, | 335 const XFA_METHODINFO* XFA_GetMethodByName(XFA_ELEMENT eElement, |
| 336 const CFX_WideStringC& wsMethodName) { | 336 const CFX_WideStringC& wsMethodName) { |
| 337 int32_t iLength = wsMethodName.GetLength(); | 337 int32_t iLength = wsMethodName.GetLength(); |
| 338 if (iLength == 0) { | 338 if (iLength == 0) { |
| 339 return NULL; | 339 return NULL; |
| 340 } | 340 } |
| 341 int32_t iElementIndex = eElement; | 341 int32_t iElementIndex = eElement; |
| 342 while (iElementIndex != -1) { | 342 while (iElementIndex != -1) { |
| 343 XFA_SCRIPTHIERARCHY const* scriptIndex = g_XFAScriptIndex + iElementIndex; | 343 const XFA_SCRIPTHIERARCHY* scriptIndex = g_XFAScriptIndex + iElementIndex; |
| 344 int32_t icount = scriptIndex->wMethodCount; | 344 int32_t icount = scriptIndex->wMethodCount; |
| 345 if (icount == 0) { | 345 if (icount == 0) { |
| 346 iElementIndex = scriptIndex->wParentIndex; | 346 iElementIndex = scriptIndex->wParentIndex; |
| 347 continue; | 347 continue; |
| 348 } | 348 } |
| 349 uint32_t uHash = FX_HashCode_String_GetW(wsMethodName.c_str(), iLength); | 349 uint32_t uHash = FX_HashCode_String_GetW(wsMethodName.c_str(), iLength); |
| 350 int32_t iStart = scriptIndex->wMethodStart, iEnd = iStart + icount - 1; | 350 int32_t iStart = scriptIndex->wMethodStart, iEnd = iStart + icount - 1; |
| 351 do { | 351 do { |
| 352 int32_t iMid = (iStart + iEnd) / 2; | 352 int32_t iMid = (iStart + iEnd) / 2; |
| 353 const XFA_METHODINFO* pInfo = g_SomMethodData + iMid; | 353 const XFA_METHODINFO* pInfo = g_SomMethodData + iMid; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 365 } | 365 } |
| 366 const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( | 366 const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( |
| 367 XFA_ELEMENT eElement, | 367 XFA_ELEMENT eElement, |
| 368 const CFX_WideStringC& wsAttributeName) { | 368 const CFX_WideStringC& wsAttributeName) { |
| 369 int32_t iLength = wsAttributeName.GetLength(); | 369 int32_t iLength = wsAttributeName.GetLength(); |
| 370 if (iLength == 0) { | 370 if (iLength == 0) { |
| 371 return NULL; | 371 return NULL; |
| 372 } | 372 } |
| 373 int32_t iElementIndex = eElement; | 373 int32_t iElementIndex = eElement; |
| 374 while (iElementIndex != -1) { | 374 while (iElementIndex != -1) { |
| 375 XFA_SCRIPTHIERARCHY const* scriptIndex = g_XFAScriptIndex + iElementIndex; | 375 const XFA_SCRIPTHIERARCHY* scriptIndex = g_XFAScriptIndex + iElementIndex; |
| 376 int32_t icount = scriptIndex->wAttributeCount; | 376 int32_t icount = scriptIndex->wAttributeCount; |
| 377 if (icount == 0) { | 377 if (icount == 0) { |
| 378 iElementIndex = scriptIndex->wParentIndex; | 378 iElementIndex = scriptIndex->wParentIndex; |
| 379 continue; | 379 continue; |
| 380 } | 380 } |
| 381 uint32_t uHash = FX_HashCode_String_GetW(wsAttributeName.c_str(), iLength); | 381 uint32_t uHash = FX_HashCode_String_GetW(wsAttributeName.c_str(), iLength); |
| 382 int32_t iStart = scriptIndex->wAttributeStart, iEnd = iStart + icount - 1; | 382 int32_t iStart = scriptIndex->wAttributeStart, iEnd = iStart + icount - 1; |
| 383 do { | 383 do { |
| 384 int32_t iMid = (iStart + iEnd) / 2; | 384 int32_t iMid = (iStart + iEnd) / 2; |
| 385 const XFA_SCRIPTATTRIBUTEINFO* pInfo = g_SomAttributeData + iMid; | 385 const XFA_SCRIPTATTRIBUTEINFO* pInfo = g_SomAttributeData + iMid; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 m_iPosition += iMaxLength; | 569 m_iPosition += iMaxLength; |
| 570 bEOS = IsEOF(); | 570 bEOS = IsEOF(); |
| 571 return iMaxLength; | 571 return iMaxLength; |
| 572 } | 572 } |
| 573 uint16_t CXFA_WideTextRead::GetCodePage() const { | 573 uint16_t CXFA_WideTextRead::GetCodePage() const { |
| 574 return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; | 574 return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; |
| 575 } | 575 } |
| 576 uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { | 576 uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { |
| 577 return GetCodePage(); | 577 return GetCodePage(); |
| 578 } | 578 } |
| OLD | NEW |