summaryrefslogtreecommitdiff
path: root/xfa/fde/xml
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-27 15:28:25 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-27 15:28:25 -0700
commitb174aa37b6a99461dc581c63a93a1d706705dd16 (patch)
tree90167be30ea92203dfc48564af5c408cbcd1e4bd /xfa/fde/xml
parent590f2d9e057a0d5b17a9706affd3c6115265021b (diff)
downloadpdfium-b174aa37b6a99461dc581c63a93a1d706705dd16.tar.xz
Replace CFX_PtrArray with type-safe CFX_ArrayTemplate<>, Part 1.
Ideally, these will become std::vector<>, but in the mean time this is quicker and allow us to remove casts. Doing so has already turned up one place where the wrong type of object was being used. Review-Url: https://codereview.chromium.org/1924073002
Diffstat (limited to 'xfa/fde/xml')
-rw-r--r--xfa/fde/xml/fde_xml_imp.cpp7
-rw-r--r--xfa/fde/xml/fde_xml_imp.h2
2 files changed, 4 insertions, 5 deletions
diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp
index f4295600c7..446db86950 100644
--- a/xfa/fde/xml/fde_xml_imp.cpp
+++ b/xfa/fde/xml/fde_xml_imp.cpp
@@ -1328,7 +1328,7 @@ FX_WCHAR* CFDE_BlockBuffer::GetAvailableBlock(int32_t& iIndexInBlock) {
return pBlock;
}
iIndexInBlock = iRealIndex % m_iAllocStep;
- return (FX_WCHAR*)m_BlockArray[iRealIndex / m_iAllocStep];
+ return m_BlockArray[iRealIndex / m_iAllocStep];
}
FX_BOOL CFDE_BlockBuffer::InitBuffer(int32_t iBufferSize) {
ClearBuffer();
@@ -1355,7 +1355,7 @@ void CFDE_BlockBuffer::SetTextChar(int32_t iIndex, FX_WCHAR ch) {
m_iBufferSize += m_iAllocStep;
} while (--iNewBlocks);
}
- FX_WCHAR* pTextData = (FX_WCHAR*)m_BlockArray[iBlockIndex];
+ FX_WCHAR* pTextData = m_BlockArray[iBlockIndex];
*(pTextData + iInnerIndex) = ch;
if (m_iDataLength <= iIndex) {
m_iDataLength = iIndex + 1;
@@ -1412,7 +1412,7 @@ void CFDE_BlockBuffer::GetTextData(CFX_WideString& wsTextData,
if (i == iEndBlockIndex) {
iCopyLength -= ((m_iAllocStep - 1) - iEndInnerIndex);
}
- FX_WCHAR* pBlockBuf = (FX_WCHAR*)m_BlockArray[i];
+ FX_WCHAR* pBlockBuf = m_BlockArray[i];
FXSYS_memcpy(pBuf + iPointer, pBlockBuf + iBufferPointer,
iCopyLength * sizeof(FX_WCHAR));
iPointer += iCopyLength;
@@ -1432,7 +1432,6 @@ void CFDE_BlockBuffer::ClearBuffer() {
int32_t iSize = m_BlockArray.GetSize();
for (int32_t i = 0; i < iSize; i++) {
FX_Free(m_BlockArray[i]);
- m_BlockArray[i] = NULL;
}
m_BlockArray.RemoveAll();
}
diff --git a/xfa/fde/xml/fde_xml_imp.h b/xfa/fde/xml/fde_xml_imp.h
index 396423a0c1..bad970e5be 100644
--- a/xfa/fde/xml/fde_xml_imp.h
+++ b/xfa/fde/xml/fde_xml_imp.h
@@ -284,7 +284,7 @@ class CFDE_BlockBuffer : public CFX_Target {
int32_t& iBlockIndex,
int32_t& iInnerIndex) const;
void ClearBuffer();
- CFX_PtrArray m_BlockArray;
+ CFX_ArrayTemplate<FX_WCHAR*> m_BlockArray;
int32_t m_iDataLength;
int32_t m_iBufferSize;
int32_t m_iAllocStep;