| 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/include/fxcrt/fx_ext.h" | 9 #include "core/include/fxcrt/fx_ext.h" |
| 10 #include "xfa/fgas/crt/fgas_algorithm.h" | 10 #include "xfa/fgas/crt/fgas_algorithm.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 iEnd = iMid - 1; | 206 iEnd = iMid - 1; |
| 207 } else { | 207 } else { |
| 208 iStart = iMid + 1; | 208 iStart = iMid + 1; |
| 209 } | 209 } |
| 210 } while (iStart <= iEnd); | 210 } while (iStart <= iEnd); |
| 211 return NULL; | 211 return NULL; |
| 212 } | 212 } |
| 213 const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_ELEMENT eName) { | 213 const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_ELEMENT eName) { |
| 214 return (eName < g_iXFAElementCount) ? (g_XFAElementData + eName) : NULL; | 214 return (eName < g_iXFAElementCount) ? (g_XFAElementData + eName) : NULL; |
| 215 } | 215 } |
| 216 const FX_WORD* XFA_GetElementChildren(XFA_ELEMENT eElement, int32_t& iCount) { | 216 const uint16_t* XFA_GetElementChildren(XFA_ELEMENT eElement, int32_t& iCount) { |
| 217 if (eElement >= g_iXFAElementCount) { | 217 if (eElement >= g_iXFAElementCount) { |
| 218 return NULL; | 218 return NULL; |
| 219 } | 219 } |
| 220 const XFA_ELEMENTHIERARCHY* pElement = g_XFAElementChildrenIndex + eElement; | 220 const XFA_ELEMENTHIERARCHY* pElement = g_XFAElementChildrenIndex + eElement; |
| 221 iCount = pElement->wCount; | 221 iCount = pElement->wCount; |
| 222 return g_XFAElementChildrenData + pElement->wStart; | 222 return g_XFAElementChildrenData + pElement->wStart; |
| 223 } | 223 } |
| 224 const uint8_t* XFA_GetElementAttributes(XFA_ELEMENT eElement, int32_t& iCount) { | 224 const uint8_t* XFA_GetElementAttributes(XFA_ELEMENT eElement, int32_t& iCount) { |
| 225 if (eElement >= g_iXFAElementCount) { | 225 if (eElement >= g_iXFAElementCount) { |
| 226 return NULL; | 226 return NULL; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 245 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute); | 245 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute); |
| 246 ASSERT(pInfo); | 246 ASSERT(pInfo); |
| 247 if (dwPacket == XFA_XDPPACKET_UNKNOWN) | 247 if (dwPacket == XFA_XDPPACKET_UNKNOWN) |
| 248 return pInfo; | 248 return pInfo; |
| 249 return (dwPacket & pInfo->dwPackets) ? pInfo : NULL; | 249 return (dwPacket & pInfo->dwPackets) ? pInfo : NULL; |
| 250 } | 250 } |
| 251 const XFA_ELEMENTINFO* XFA_GetChildOfElement(XFA_ELEMENT eElement, | 251 const XFA_ELEMENTINFO* XFA_GetChildOfElement(XFA_ELEMENT eElement, |
| 252 XFA_ELEMENT eChild, | 252 XFA_ELEMENT eChild, |
| 253 FX_DWORD dwPacket) { | 253 FX_DWORD dwPacket) { |
| 254 int32_t iCount = 0; | 254 int32_t iCount = 0; |
| 255 const FX_WORD* pChild = XFA_GetElementChildren(eElement, iCount); | 255 const uint16_t* pChild = XFA_GetElementChildren(eElement, iCount); |
| 256 if (pChild == NULL || iCount < 1) { | 256 if (pChild == NULL || iCount < 1) { |
| 257 return NULL; | 257 return NULL; |
| 258 } | 258 } |
| 259 CFX_DSPATemplate<FX_WORD> search; | 259 CFX_DSPATemplate<uint16_t> search; |
| 260 int32_t index = search.Lookup(eChild, pChild, iCount); | 260 int32_t index = search.Lookup(eChild, pChild, iCount); |
| 261 if (index < 0) { | 261 if (index < 0) { |
| 262 return NULL; | 262 return NULL; |
| 263 } | 263 } |
| 264 const XFA_ELEMENTINFO* pInfo = XFA_GetElementByID(eChild); | 264 const XFA_ELEMENTINFO* pInfo = XFA_GetElementByID(eChild); |
| 265 ASSERT(pInfo); | 265 ASSERT(pInfo); |
| 266 if (dwPacket == XFA_XDPPACKET_UNKNOWN) | 266 if (dwPacket == XFA_XDPPACKET_UNKNOWN) |
| 267 return pInfo; | 267 return pInfo; |
| 268 return (dwPacket & pInfo->dwPackets) ? pInfo : NULL; | 268 return (dwPacket & pInfo->dwPackets) ? pInfo : NULL; |
| 269 } | 269 } |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 FX_BOOL& bEOS, | 597 FX_BOOL& bEOS, |
| 598 int32_t const* pByteSize) { | 598 int32_t const* pByteSize) { |
| 599 if (iMaxLength > m_wsBuffer.GetLength() - m_iPosition) { | 599 if (iMaxLength > m_wsBuffer.GetLength() - m_iPosition) { |
| 600 iMaxLength = m_wsBuffer.GetLength() - m_iPosition; | 600 iMaxLength = m_wsBuffer.GetLength() - m_iPosition; |
| 601 } | 601 } |
| 602 FXSYS_wcsncpy(pStr, (const FX_WCHAR*)m_wsBuffer + m_iPosition, iMaxLength); | 602 FXSYS_wcsncpy(pStr, (const FX_WCHAR*)m_wsBuffer + m_iPosition, iMaxLength); |
| 603 m_iPosition += iMaxLength; | 603 m_iPosition += iMaxLength; |
| 604 bEOS = IsEOF(); | 604 bEOS = IsEOF(); |
| 605 return iMaxLength; | 605 return iMaxLength; |
| 606 } | 606 } |
| 607 FX_WORD CXFA_WideTextRead::GetCodePage() const { | 607 uint16_t CXFA_WideTextRead::GetCodePage() const { |
| 608 return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; | 608 return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; |
| 609 } | 609 } |
| 610 FX_WORD CXFA_WideTextRead::SetCodePage(FX_WORD wCodePage) { | 610 uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { |
| 611 return GetCodePage(); | 611 return GetCodePage(); |
| 612 } | 612 } |
| OLD | NEW |