| 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_codepage.h" | 10 #include "xfa/fgas/crt/fgas_codepage.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 int32_t iMid = (iStart + iEnd) / 2; | 29 int32_t iMid = (iStart + iEnd) / 2; |
| 30 const XFA_PACKETINFO* pInfo = g_XFAPacketData + iMid; | 30 const XFA_PACKETINFO* pInfo = g_XFAPacketData + iMid; |
| 31 if (uHash == pInfo->uHash) { | 31 if (uHash == pInfo->uHash) { |
| 32 return pInfo; | 32 return pInfo; |
| 33 } else if (uHash < pInfo->uHash) { | 33 } else if (uHash < pInfo->uHash) { |
| 34 iEnd = iMid - 1; | 34 iEnd = iMid - 1; |
| 35 } else { | 35 } else { |
| 36 iStart = iMid + 1; | 36 iStart = iMid + 1; |
| 37 } | 37 } |
| 38 } while (iStart <= iEnd); | 38 } while (iStart <= iEnd); |
| 39 return NULL; | 39 return nullptr; |
| 40 } | 40 } |
| 41 | 41 |
| 42 const XFA_PACKETINFO* XFA_GetPacketByID(uint32_t dwPacket) { | 42 const XFA_PACKETINFO* XFA_GetPacketByID(uint32_t dwPacket) { |
| 43 int32_t iStart = 0, iEnd = g_iXFAPacketCount - 1; | 43 int32_t iStart = 0, iEnd = g_iXFAPacketCount - 1; |
| 44 do { | 44 do { |
| 45 int32_t iMid = (iStart + iEnd) / 2; | 45 int32_t iMid = (iStart + iEnd) / 2; |
| 46 uint32_t dwFind = (g_XFAPacketData + iMid)->eName; | 46 uint32_t dwFind = (g_XFAPacketData + iMid)->eName; |
| 47 if (dwPacket == dwFind) { | 47 if (dwPacket == dwFind) { |
| 48 return g_XFAPacketData + iMid; | 48 return g_XFAPacketData + iMid; |
| 49 } else if (dwPacket < dwFind) { | 49 } else if (dwPacket < dwFind) { |
| 50 iEnd = iMid - 1; | 50 iEnd = iMid - 1; |
| 51 } else { | 51 } else { |
| 52 iStart = iMid + 1; | 52 iStart = iMid + 1; |
| 53 } | 53 } |
| 54 } while (iStart <= iEnd); | 54 } while (iStart <= iEnd); |
| 55 return NULL; | 55 return nullptr; |
| 56 } | 56 } |
| 57 | 57 |
| 58 const XFA_PACKETINFO* XFA_GetPacketByIndex(XFA_PACKET ePacket) { | 58 const XFA_PACKETINFO* XFA_GetPacketByIndex(XFA_PACKET ePacket) { |
| 59 return g_XFAPacketData + ePacket; | 59 return g_XFAPacketData + ePacket; |
| 60 } | 60 } |
| 61 | 61 |
| 62 const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName( | 62 const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName( |
| 63 const CFX_WideStringC& wsName) { | 63 const CFX_WideStringC& wsName) { |
| 64 if (wsName.IsEmpty()) | 64 if (wsName.IsEmpty()) |
| 65 return nullptr; | 65 return nullptr; |
| 66 | 66 |
| 67 uint32_t uHash = FX_HashCode_GetW(wsName, false); | 67 uint32_t uHash = FX_HashCode_GetW(wsName, false); |
| 68 int32_t iStart = 0; | 68 int32_t iStart = 0; |
| 69 int32_t iEnd = g_iXFAEnumCount - 1; | 69 int32_t iEnd = g_iXFAEnumCount - 1; |
| 70 do { | 70 do { |
| 71 int32_t iMid = (iStart + iEnd) / 2; | 71 int32_t iMid = (iStart + iEnd) / 2; |
| 72 const XFA_ATTRIBUTEENUMINFO* pInfo = g_XFAEnumData + iMid; | 72 const XFA_ATTRIBUTEENUMINFO* pInfo = g_XFAEnumData + iMid; |
| 73 if (uHash == pInfo->uHash) { | 73 if (uHash == pInfo->uHash) { |
| 74 return pInfo; | 74 return pInfo; |
| 75 } else if (uHash < pInfo->uHash) { | 75 } else if (uHash < pInfo->uHash) { |
| 76 iEnd = iMid - 1; | 76 iEnd = iMid - 1; |
| 77 } else { | 77 } else { |
| 78 iStart = iMid + 1; | 78 iStart = iMid + 1; |
| 79 } | 79 } |
| 80 } while (iStart <= iEnd); | 80 } while (iStart <= iEnd); |
| 81 return NULL; | 81 return nullptr; |
| 82 } | 82 } |
| 83 const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByID(XFA_ATTRIBUTEENUM eName) { | 83 const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByID(XFA_ATTRIBUTEENUM eName) { |
| 84 return g_XFAEnumData + eName; | 84 return g_XFAEnumData + eName; |
| 85 } | 85 } |
| 86 | 86 |
| 87 const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName) { | 87 const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName) { |
| 88 if (wsName.IsEmpty()) | 88 if (wsName.IsEmpty()) |
| 89 return nullptr; | 89 return nullptr; |
| 90 | 90 |
| 91 uint32_t uHash = FX_HashCode_GetW(wsName, false); | 91 uint32_t uHash = FX_HashCode_GetW(wsName, false); |
| 92 int32_t iStart = 0; | 92 int32_t iStart = 0; |
| 93 int32_t iEnd = g_iXFAAttributeCount - 1; | 93 int32_t iEnd = g_iXFAAttributeCount - 1; |
| 94 do { | 94 do { |
| 95 int32_t iMid = (iStart + iEnd) / 2; | 95 int32_t iMid = (iStart + iEnd) / 2; |
| 96 const XFA_ATTRIBUTEINFO* pInfo = g_XFAAttributeData + iMid; | 96 const XFA_ATTRIBUTEINFO* pInfo = g_XFAAttributeData + iMid; |
| 97 if (uHash == pInfo->uHash) { | 97 if (uHash == pInfo->uHash) { |
| 98 return pInfo; | 98 return pInfo; |
| 99 } else if (uHash < pInfo->uHash) { | 99 } else if (uHash < pInfo->uHash) { |
| 100 iEnd = iMid - 1; | 100 iEnd = iMid - 1; |
| 101 } else { | 101 } else { |
| 102 iStart = iMid + 1; | 102 iStart = iMid + 1; |
| 103 } | 103 } |
| 104 } while (iStart <= iEnd); | 104 } while (iStart <= iEnd); |
| 105 return nullptr; | 105 return nullptr; |
| 106 } | 106 } |
| 107 const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName) { | 107 const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName) { |
| 108 return (eName < g_iXFAAttributeCount) ? (g_XFAAttributeData + eName) : NULL; | 108 return (eName < g_iXFAAttributeCount) ? (g_XFAAttributeData + eName) |
| 109 : nullptr; |
| 109 } | 110 } |
| 110 FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue, | 111 FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue, |
| 111 XFA_Element eElement, | 112 XFA_Element eElement, |
| 112 XFA_ATTRIBUTE eAttribute, | 113 XFA_ATTRIBUTE eAttribute, |
| 113 XFA_ATTRIBUTETYPE eType, | 114 XFA_ATTRIBUTETYPE eType, |
| 114 uint32_t dwPacket) { | 115 uint32_t dwPacket) { |
| 115 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute); | 116 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute); |
| 116 if (pInfo == NULL) { | 117 if (!pInfo) { |
| 117 return FALSE; | 118 return FALSE; |
| 118 } | 119 } |
| 119 if (dwPacket && (dwPacket & pInfo->dwPackets) == 0) { | 120 if (dwPacket && (dwPacket & pInfo->dwPackets) == 0) { |
| 120 return FALSE; | 121 return FALSE; |
| 121 } | 122 } |
| 122 if (pInfo->eType == eType) { | 123 if (pInfo->eType == eType) { |
| 123 pValue = pInfo->pDefValue; | 124 pValue = pInfo->pDefValue; |
| 124 return TRUE; | 125 return TRUE; |
| 125 } else if (pInfo->eType == XFA_ATTRIBUTETYPE_NOTSURE) { | 126 } else if (pInfo->eType == XFA_ATTRIBUTETYPE_NOTSURE) { |
| 126 const XFA_NOTSUREATTRIBUTE* pAttr = | 127 const XFA_NOTSUREATTRIBUTE* pAttr = |
| (...skipping 16 matching lines...) Expand all Loading... |
| 143 return XFA_ATTRIBUTEENUM_Unknown; | 144 return XFA_ATTRIBUTEENUM_Unknown; |
| 144 } | 145 } |
| 145 CFX_WideStringC XFA_GetAttributeDefaultValue_Cdata(XFA_Element eElement, | 146 CFX_WideStringC XFA_GetAttributeDefaultValue_Cdata(XFA_Element eElement, |
| 146 XFA_ATTRIBUTE eAttribute, | 147 XFA_ATTRIBUTE eAttribute, |
| 147 uint32_t dwPacket) { | 148 uint32_t dwPacket) { |
| 148 void* pValue; | 149 void* pValue; |
| 149 if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute, | 150 if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute, |
| 150 XFA_ATTRIBUTETYPE_Cdata, dwPacket)) { | 151 XFA_ATTRIBUTETYPE_Cdata, dwPacket)) { |
| 151 return (const FX_WCHAR*)pValue; | 152 return (const FX_WCHAR*)pValue; |
| 152 } | 153 } |
| 153 return NULL; | 154 return nullptr; |
| 154 } | 155 } |
| 155 FX_BOOL XFA_GetAttributeDefaultValue_Boolean(XFA_Element eElement, | 156 FX_BOOL XFA_GetAttributeDefaultValue_Boolean(XFA_Element eElement, |
| 156 XFA_ATTRIBUTE eAttribute, | 157 XFA_ATTRIBUTE eAttribute, |
| 157 uint32_t dwPacket) { | 158 uint32_t dwPacket) { |
| 158 void* pValue; | 159 void* pValue; |
| 159 if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute, | 160 if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute, |
| 160 XFA_ATTRIBUTETYPE_Boolean, dwPacket)) { | 161 XFA_ATTRIBUTETYPE_Boolean, dwPacket)) { |
| 161 return (FX_BOOL)(uintptr_t)pValue; | 162 return (FX_BOOL)(uintptr_t)pValue; |
| 162 } | 163 } |
| 163 return FALSE; | 164 return FALSE; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute); | 225 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute); |
| 225 ASSERT(pInfo); | 226 ASSERT(pInfo); |
| 226 if (dwPacket == XFA_XDPPACKET_UNKNOWN) | 227 if (dwPacket == XFA_XDPPACKET_UNKNOWN) |
| 227 return pInfo; | 228 return pInfo; |
| 228 return (dwPacket & pInfo->dwPackets) ? pInfo : nullptr; | 229 return (dwPacket & pInfo->dwPackets) ? pInfo : nullptr; |
| 229 } | 230 } |
| 230 | 231 |
| 231 const XFA_PROPERTY* XFA_GetElementProperties(XFA_Element eElement, | 232 const XFA_PROPERTY* XFA_GetElementProperties(XFA_Element eElement, |
| 232 int32_t& iCount) { | 233 int32_t& iCount) { |
| 233 if (eElement == XFA_Element::Unknown) | 234 if (eElement == XFA_Element::Unknown) |
| 234 return NULL; | 235 return nullptr; |
| 235 | 236 |
| 236 const XFA_ELEMENTHIERARCHY* pElement = | 237 const XFA_ELEMENTHIERARCHY* pElement = |
| 237 g_XFAElementPropertyIndex + static_cast<int32_t>(eElement); | 238 g_XFAElementPropertyIndex + static_cast<int32_t>(eElement); |
| 238 iCount = pElement->wCount; | 239 iCount = pElement->wCount; |
| 239 return g_XFAElementPropertyData + pElement->wStart; | 240 return g_XFAElementPropertyData + pElement->wStart; |
| 240 } | 241 } |
| 241 const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_Element eElement, | 242 const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_Element eElement, |
| 242 XFA_Element eProperty, | 243 XFA_Element eProperty, |
| 243 uint32_t dwPacket) { | 244 uint32_t dwPacket) { |
| 244 int32_t iCount = 0; | 245 int32_t iCount = 0; |
| 245 const XFA_PROPERTY* pProperty = XFA_GetElementProperties(eElement, iCount); | 246 const XFA_PROPERTY* pProperty = XFA_GetElementProperties(eElement, iCount); |
| 246 if (pProperty == NULL || iCount < 1) { | 247 if (!pProperty || iCount < 1) { |
| 247 return NULL; | 248 return nullptr; |
| 248 } | 249 } |
| 249 int32_t iStart = 0, iEnd = iCount - 1, iMid; | 250 int32_t iStart = 0, iEnd = iCount - 1, iMid; |
| 250 do { | 251 do { |
| 251 iMid = (iStart + iEnd) / 2; | 252 iMid = (iStart + iEnd) / 2; |
| 252 XFA_Element eName = pProperty[iMid].eName; | 253 XFA_Element eName = pProperty[iMid].eName; |
| 253 if (eProperty == eName) { | 254 if (eProperty == eName) { |
| 254 break; | 255 break; |
| 255 } else if (eProperty < eName) { | 256 } else if (eProperty < eName) { |
| 256 iEnd = iMid - 1; | 257 iEnd = iMid - 1; |
| 257 } else { | 258 } else { |
| 258 iStart = iMid + 1; | 259 iStart = iMid + 1; |
| 259 } | 260 } |
| 260 } while (iStart <= iEnd); | 261 } while (iStart <= iEnd); |
| 261 if (iStart > iEnd) { | 262 if (iStart > iEnd) { |
| 262 return NULL; | 263 return nullptr; |
| 263 } | 264 } |
| 264 const XFA_ELEMENTINFO* pInfo = XFA_GetElementByID(eProperty); | 265 const XFA_ELEMENTINFO* pInfo = XFA_GetElementByID(eProperty); |
| 265 ASSERT(pInfo); | 266 ASSERT(pInfo); |
| 266 if (dwPacket == XFA_XDPPACKET_UNKNOWN) | 267 if (dwPacket == XFA_XDPPACKET_UNKNOWN) |
| 267 return pProperty + iMid; | 268 return pProperty + iMid; |
| 268 return (dwPacket & pInfo->dwPackets) ? (pProperty + iMid) : NULL; | 269 return (dwPacket & pInfo->dwPackets) ? (pProperty + iMid) : nullptr; |
| 269 } | 270 } |
| 270 const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_Element eElement, | 271 const XFA_NOTSUREATTRIBUTE* XFA_GetNotsureAttribute(XFA_Element eElement, |
| 271 XFA_ATTRIBUTE eAttribute, | 272 XFA_ATTRIBUTE eAttribute, |
| 272 XFA_ATTRIBUTETYPE eType) { | 273 XFA_ATTRIBUTETYPE eType) { |
| 273 int32_t iStart = 0, iEnd = g_iXFANotsureCount - 1; | 274 int32_t iStart = 0, iEnd = g_iXFANotsureCount - 1; |
| 274 do { | 275 do { |
| 275 int32_t iMid = (iStart + iEnd) / 2; | 276 int32_t iMid = (iStart + iEnd) / 2; |
| 276 const XFA_NOTSUREATTRIBUTE* pAttr = g_XFANotsureAttributes + iMid; | 277 const XFA_NOTSUREATTRIBUTE* pAttr = g_XFANotsureAttributes + iMid; |
| 277 if (eElement == pAttr->eElement) { | 278 if (eElement == pAttr->eElement) { |
| 278 if (pAttr->eAttribute == eAttribute) { | 279 if (pAttr->eAttribute == eAttribute) { |
| 279 if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) { | 280 if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) { |
| 280 return pAttr; | 281 return pAttr; |
| 281 } | 282 } |
| 282 return NULL; | 283 return nullptr; |
| 283 } else { | 284 } else { |
| 284 int32_t iBefore = iMid - 1; | 285 int32_t iBefore = iMid - 1; |
| 285 if (iBefore >= 0) { | 286 if (iBefore >= 0) { |
| 286 pAttr = g_XFANotsureAttributes + iBefore; | 287 pAttr = g_XFANotsureAttributes + iBefore; |
| 287 while (eElement == pAttr->eElement) { | 288 while (eElement == pAttr->eElement) { |
| 288 if (pAttr->eAttribute == eAttribute) { | 289 if (pAttr->eAttribute == eAttribute) { |
| 289 if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) { | 290 if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) { |
| 290 return pAttr; | 291 return pAttr; |
| 291 } | 292 } |
| 292 return NULL; | 293 return nullptr; |
| 293 } | 294 } |
| 294 iBefore--; | 295 iBefore--; |
| 295 if (iBefore < 0) { | 296 if (iBefore < 0) { |
| 296 break; | 297 break; |
| 297 } | 298 } |
| 298 pAttr = g_XFANotsureAttributes + iBefore; | 299 pAttr = g_XFANotsureAttributes + iBefore; |
| 299 } | 300 } |
| 300 } | 301 } |
| 301 int32_t iAfter = iMid + 1; | 302 int32_t iAfter = iMid + 1; |
| 302 if (iAfter <= g_iXFANotsureCount - 1) { | 303 if (iAfter <= g_iXFANotsureCount - 1) { |
| 303 pAttr = g_XFANotsureAttributes + iAfter; | 304 pAttr = g_XFANotsureAttributes + iAfter; |
| 304 while (eElement == pAttr->eElement) { | 305 while (eElement == pAttr->eElement) { |
| 305 if (pAttr->eAttribute == eAttribute) { | 306 if (pAttr->eAttribute == eAttribute) { |
| 306 if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) { | 307 if (eType == XFA_ATTRIBUTETYPE_NOTSURE || eType == pAttr->eType) { |
| 307 return pAttr; | 308 return pAttr; |
| 308 } | 309 } |
| 309 return NULL; | 310 return nullptr; |
| 310 } | 311 } |
| 311 iAfter++; | 312 iAfter++; |
| 312 if (iAfter > g_iXFANotsureCount - 1) { | 313 if (iAfter > g_iXFANotsureCount - 1) { |
| 313 break; | 314 break; |
| 314 } | 315 } |
| 315 pAttr = g_XFANotsureAttributes + iAfter; | 316 pAttr = g_XFANotsureAttributes + iAfter; |
| 316 } | 317 } |
| 317 } | 318 } |
| 318 return NULL; | 319 return nullptr; |
| 319 } | 320 } |
| 320 } else if (eElement < pAttr->eElement) { | 321 } else if (eElement < pAttr->eElement) { |
| 321 iEnd = iMid - 1; | 322 iEnd = iMid - 1; |
| 322 } else { | 323 } else { |
| 323 iStart = iMid + 1; | 324 iStart = iMid + 1; |
| 324 } | 325 } |
| 325 } while (iStart <= iEnd); | 326 } while (iStart <= iEnd); |
| 326 return NULL; | 327 return nullptr; |
| 327 } | 328 } |
| 328 | 329 |
| 329 const XFA_METHODINFO* XFA_GetMethodByName(XFA_Element eElement, | 330 const XFA_METHODINFO* XFA_GetMethodByName(XFA_Element eElement, |
| 330 const CFX_WideStringC& wsMethodName) { | 331 const CFX_WideStringC& wsMethodName) { |
| 331 if (wsMethodName.IsEmpty()) | 332 if (wsMethodName.IsEmpty()) |
| 332 return nullptr; | 333 return nullptr; |
| 333 | 334 |
| 334 int32_t iElementIndex = static_cast<int32_t>(eElement); | 335 int32_t iElementIndex = static_cast<int32_t>(eElement); |
| 335 while (iElementIndex != -1) { | 336 while (iElementIndex != -1) { |
| 336 const XFA_SCRIPTHIERARCHY* scriptIndex = g_XFAScriptIndex + iElementIndex; | 337 const XFA_SCRIPTHIERARCHY* scriptIndex = g_XFAScriptIndex + iElementIndex; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 348 if (uHash == pInfo->uHash) { | 349 if (uHash == pInfo->uHash) { |
| 349 return pInfo; | 350 return pInfo; |
| 350 } else if (uHash < pInfo->uHash) { | 351 } else if (uHash < pInfo->uHash) { |
| 351 iEnd = iMid - 1; | 352 iEnd = iMid - 1; |
| 352 } else { | 353 } else { |
| 353 iStart = iMid + 1; | 354 iStart = iMid + 1; |
| 354 } | 355 } |
| 355 } while (iStart <= iEnd); | 356 } while (iStart <= iEnd); |
| 356 iElementIndex = scriptIndex->wParentIndex; | 357 iElementIndex = scriptIndex->wParentIndex; |
| 357 } | 358 } |
| 358 return NULL; | 359 return nullptr; |
| 359 } | 360 } |
| 360 const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( | 361 const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( |
| 361 XFA_Element eElement, | 362 XFA_Element eElement, |
| 362 const CFX_WideStringC& wsAttributeName) { | 363 const CFX_WideStringC& wsAttributeName) { |
| 363 if (wsAttributeName.IsEmpty()) | 364 if (wsAttributeName.IsEmpty()) |
| 364 return nullptr; | 365 return nullptr; |
| 365 | 366 |
| 366 int32_t iElementIndex = static_cast<int32_t>(eElement); | 367 int32_t iElementIndex = static_cast<int32_t>(eElement); |
| 367 while (iElementIndex != -1) { | 368 while (iElementIndex != -1) { |
| 368 const XFA_SCRIPTHIERARCHY* scriptIndex = g_XFAScriptIndex + iElementIndex; | 369 const XFA_SCRIPTHIERARCHY* scriptIndex = g_XFAScriptIndex + iElementIndex; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 379 if (uHash == pInfo->uHash) { | 380 if (uHash == pInfo->uHash) { |
| 380 return pInfo; | 381 return pInfo; |
| 381 } else if (uHash < pInfo->uHash) { | 382 } else if (uHash < pInfo->uHash) { |
| 382 iEnd = iMid - 1; | 383 iEnd = iMid - 1; |
| 383 } else { | 384 } else { |
| 384 iStart = iMid + 1; | 385 iStart = iMid + 1; |
| 385 } | 386 } |
| 386 } while (iStart <= iEnd); | 387 } while (iStart <= iEnd); |
| 387 iElementIndex = scriptIndex->wParentIndex; | 388 iElementIndex = scriptIndex->wParentIndex; |
| 388 } | 389 } |
| 389 return NULL; | 390 return nullptr; |
| 390 } | 391 } |
| 391 void CXFA_Measurement::Set(const CFX_WideStringC& wsMeasure) { | 392 void CXFA_Measurement::Set(const CFX_WideStringC& wsMeasure) { |
| 392 if (wsMeasure.IsEmpty()) { | 393 if (wsMeasure.IsEmpty()) { |
| 393 m_fValue = 0; | 394 m_fValue = 0; |
| 394 m_eUnit = XFA_UNIT_Unknown; | 395 m_eUnit = XFA_UNIT_Unknown; |
| 395 return; | 396 return; |
| 396 } | 397 } |
| 397 int32_t iUsedLen = 0; | 398 int32_t iUsedLen = 0; |
| 398 int32_t iOffset = (wsMeasure.GetAt(0) == L'=') ? 1 : 0; | 399 int32_t iOffset = (wsMeasure.GetAt(0) == L'=') ? 1 : 0; |
| 399 FX_FLOAT fValue = FX_wcstof(wsMeasure.c_str() + iOffset, | 400 FX_FLOAT fValue = FX_wcstof(wsMeasure.c_str() + iOffset, |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 uint16_t CXFA_WideTextRead::GetCodePage() const { | 583 uint16_t CXFA_WideTextRead::GetCodePage() const { |
| 583 return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; | 584 return (sizeof(FX_WCHAR) == 2) ? FX_CODEPAGE_UTF16LE : FX_CODEPAGE_UTF32LE; |
| 584 } | 585 } |
| 585 uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { | 586 uint16_t CXFA_WideTextRead::SetCodePage(uint16_t wCodePage) { |
| 586 return GetCodePage(); | 587 return GetCodePage(); |
| 587 } | 588 } |
| 588 | 589 |
| 589 IFX_Stream* CXFA_WideTextRead::CreateSharedStream(uint32_t dwAccess, | 590 IFX_Stream* CXFA_WideTextRead::CreateSharedStream(uint32_t dwAccess, |
| 590 int32_t iOffset, | 591 int32_t iOffset, |
| 591 int32_t iLength) { | 592 int32_t iLength) { |
| 592 return NULL; | 593 return nullptr; |
| 593 } | 594 } |
| 594 | 595 |
| 595 void CXFA_WideTextRead::Lock() {} | 596 void CXFA_WideTextRead::Lock() {} |
| 596 | 597 |
| 597 void CXFA_WideTextRead::Unlock() {} | 598 void CXFA_WideTextRead::Unlock() {} |
| 598 | 599 |
| 599 CFX_WideString CXFA_WideTextRead::GetSrcText() const { | 600 CFX_WideString CXFA_WideTextRead::GetSrcText() const { |
| 600 return m_wsBuffer; | 601 return m_wsBuffer; |
| 601 } | 602 } |
| OLD | NEW |