summaryrefslogtreecommitdiff
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
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
-rw-r--r--xfa/fde/xml/fde_xml_imp.cpp7
-rw-r--r--xfa/fde/xml/fde_xml_imp.h2
-rw-r--r--xfa/fee/fde_txtedtbuf.cpp43
-rw-r--r--xfa/fee/fde_txtedtbuf.h2
-rw-r--r--xfa/fgas/font/fgas_gefont.cpp45
-rw-r--r--xfa/fgas/font/fgas_gefont.h2
-rw-r--r--xfa/fwl/basewidget/fwl_datetimepickerimp.cpp10
-rw-r--r--xfa/fwl/basewidget/fwl_monthcalendarimp.h4
-rw-r--r--xfa/fwl/core/fwl_noteimp.cpp11
-rw-r--r--xfa/fwl/core/fwl_noteimp.h3
10 files changed, 58 insertions, 71 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;
diff --git a/xfa/fee/fde_txtedtbuf.cpp b/xfa/fee/fde_txtedtbuf.cpp
index 9029806d3b..4464a0f515 100644
--- a/xfa/fee/fde_txtedtbuf.cpp
+++ b/xfa/fee/fde_txtedtbuf.cpp
@@ -40,8 +40,7 @@ FX_BOOL CFDE_TxtEdtBufIter::Next(FX_BOOL bPrev) {
} else {
while (m_nCurChunk > 0) {
--m_nCurChunk;
- lpChunk =
- (CFDE_TxtEdtBuf::FDE_LPCHUNKHEADER)m_pBuf->m_Chunks[m_nCurChunk];
+ lpChunk = m_pBuf->m_Chunks[m_nCurChunk];
if (lpChunk->nUsed > 0) {
m_nCurIndex = lpChunk->nUsed - 1;
break;
@@ -56,8 +55,7 @@ FX_BOOL CFDE_TxtEdtBufIter::Next(FX_BOOL bPrev) {
return FALSE;
}
ASSERT(m_nCurChunk < m_pBuf->m_Chunks.GetSize());
- CFDE_TxtEdtBuf::FDE_LPCHUNKHEADER lpChunk =
- (CFDE_TxtEdtBuf::FDE_LPCHUNKHEADER)m_pBuf->m_Chunks[m_nCurChunk];
+ CFDE_TxtEdtBuf::FDE_LPCHUNKHEADER lpChunk = m_pBuf->m_Chunks[m_nCurChunk];
if (lpChunk->nUsed != (m_nCurIndex + 1)) {
m_nCurIndex++;
} else {
@@ -65,7 +63,7 @@ FX_BOOL CFDE_TxtEdtBufIter::Next(FX_BOOL bPrev) {
while (m_nCurChunk < nEnd) {
m_nCurChunk++;
CFDE_TxtEdtBuf::FDE_LPCHUNKHEADER lpChunkTemp =
- (CFDE_TxtEdtBuf::FDE_LPCHUNKHEADER)m_pBuf->m_Chunks[m_nCurChunk];
+ m_pBuf->m_Chunks[m_nCurChunk];
if (lpChunkTemp->nUsed > 0) {
m_nCurIndex = 0;
break;
@@ -90,8 +88,7 @@ int32_t CFDE_TxtEdtBufIter::GetAt() const {
FX_WCHAR CFDE_TxtEdtBufIter::GetChar() {
ASSERT(m_nIndex >= 0 && m_nIndex < m_pBuf->m_nTotal);
if (m_Alias == 0 || m_nIndex == (m_pBuf->m_nTotal - 1)) {
- return ((CFDE_TxtEdtBuf::FDE_LPCHUNKHEADER)m_pBuf->m_Chunks[m_nCurChunk])
- ->wChars[m_nCurIndex];
+ return m_pBuf->m_Chunks[m_nCurChunk]->wChars[m_nCurIndex];
}
return m_Alias;
}
@@ -154,7 +151,7 @@ void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) {
if (nLeave < nCopyedLength) {
nCopyedLength = nLeave;
}
- FDE_LPCHUNKHEADER lpChunk = (FDE_LPCHUNKHEADER)m_Chunks[i];
+ FDE_LPCHUNKHEADER lpChunk = m_Chunks[i];
FXSYS_memcpy(lpChunk->wChars, lpSrcBuf, nCopyedLength * sizeof(FX_WCHAR));
nLeave -= nCopyedLength;
lpSrcBuf += nCopyedLength;
@@ -173,7 +170,7 @@ FX_WCHAR CFDE_TxtEdtBuf::GetCharByIndex(int32_t nIndex) const {
int32_t nCount = m_Chunks.GetSize();
int32_t i = 0;
for (i = 0; i < nCount; i++) {
- pChunkHeader = (FDE_LPCHUNKHEADER)m_Chunks[i];
+ pChunkHeader = m_Chunks[i];
nTotal += pChunkHeader->nUsed;
if (nTotal > nIndex) {
break;
@@ -191,7 +188,7 @@ void CFDE_TxtEdtBuf::GetRange(CFX_WideString& wsText,
int32_t nCount = m_Chunks.GetSize();
FX_WCHAR* lpDstBuf = wsText.GetBuffer(nLength);
int32_t nChunkIndex = cp.nChunkIndex;
- FDE_LPCHUNKHEADER lpChunkHeader = (FDE_LPCHUNKHEADER)m_Chunks[nChunkIndex];
+ FDE_LPCHUNKHEADER lpChunkHeader = m_Chunks[nChunkIndex];
int32_t nCopyLength = lpChunkHeader->nUsed - cp.nCharIndex;
FX_WCHAR* lpSrcBuf = lpChunkHeader->wChars + cp.nCharIndex;
while (nLeave > 0) {
@@ -203,7 +200,7 @@ void CFDE_TxtEdtBuf::GetRange(CFX_WideString& wsText,
if (nChunkIndex >= nCount) {
break;
}
- lpChunkHeader = (FDE_LPCHUNKHEADER)m_Chunks[nChunkIndex];
+ lpChunkHeader = m_Chunks[nChunkIndex];
lpSrcBuf = lpChunkHeader->wChars;
nLeave -= nCopyLength;
lpDstBuf += nCopyLength;
@@ -221,7 +218,7 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos,
if (cp.nCharIndex != 0) {
FDE_LPCHUNKHEADER lpNewChunk = (FDE_LPCHUNKHEADER)m_pAllocator->Alloc(
sizeof(FDE_CHUNKHEADER) + (m_nChunkSize - 1) * sizeof(FX_WCHAR));
- FDE_LPCHUNKHEADER lpChunk = (FDE_LPCHUNKHEADER)m_Chunks[cp.nChunkIndex];
+ FDE_LPCHUNKHEADER lpChunk = m_Chunks[cp.nChunkIndex];
int32_t nCopy = lpChunk->nUsed - cp.nCharIndex;
FXSYS_memcpy(lpNewChunk->wChars, lpChunk->wChars + cp.nCharIndex,
nCopy * sizeof(FX_WCHAR));
@@ -232,7 +229,7 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos,
cp.nCharIndex = 0;
}
if (cp.nChunkIndex != 0) {
- FDE_LPCHUNKHEADER lpChunk = (FDE_LPCHUNKHEADER)m_Chunks[cp.nChunkIndex - 1];
+ FDE_LPCHUNKHEADER lpChunk = m_Chunks[cp.nChunkIndex - 1];
if (lpChunk->nUsed != m_nChunkSize) {
cp.nChunkIndex--;
int32_t nFree = m_nChunkSize - lpChunk->nUsed;
@@ -265,7 +262,7 @@ void CFDE_TxtEdtBuf::Delete(int32_t nIndex, int32_t nLength) {
FDE_CHUNKPLACE cpEnd;
Index2CP(nIndex + nLength - 1, cpEnd);
m_nTotal -= nLength;
- FDE_LPCHUNKHEADER lpChunk = (FDE_LPCHUNKHEADER)m_Chunks[cpEnd.nChunkIndex];
+ FDE_LPCHUNKHEADER lpChunk = m_Chunks[cpEnd.nChunkIndex];
int32_t nFirstPart = cpEnd.nCharIndex + 1;
int32_t nMovePart = lpChunk->nUsed - nFirstPart;
if (nMovePart != 0) {
@@ -277,7 +274,7 @@ void CFDE_TxtEdtBuf::Delete(int32_t nIndex, int32_t nLength) {
cpEnd.nChunkIndex--;
}
while (nLength > 0) {
- lpChunk = (FDE_LPCHUNKHEADER)m_Chunks[cpEnd.nChunkIndex];
+ lpChunk = m_Chunks[cpEnd.nChunkIndex];
int32_t nDeleted = std::min(lpChunk->nUsed, nLength);
lpChunk->nUsed -= nDeleted;
if (lpChunk->nUsed == 0) {
@@ -300,7 +297,7 @@ void CFDE_TxtEdtBuf::Clear(FX_BOOL bRelease) {
m_Chunks.RemoveAll();
} else {
while (i < nCount) {
- ((FDE_LPCHUNKHEADER)m_Chunks[i++])->nUsed = 0;
+ m_Chunks[i++]->nUsed = 0;
}
}
m_nTotal = 0;
@@ -319,7 +316,7 @@ FX_BOOL CFDE_TxtEdtBuf::Optimize(IFX_Pause* pPause) {
}
int32_t i = 0;
for (; i < nCount; i++) {
- FDE_LPCHUNKHEADER lpChunk = (FDE_LPCHUNKHEADER)m_Chunks[i];
+ FDE_LPCHUNKHEADER lpChunk = m_Chunks[i];
if (lpChunk->nUsed == 0) {
m_pAllocator->Free(lpChunk);
m_Chunks.RemoveAt(i);
@@ -330,10 +327,10 @@ FX_BOOL CFDE_TxtEdtBuf::Optimize(IFX_Pause* pPause) {
if (pPause != NULL && pPause->NeedToPauseNow()) {
return FALSE;
}
- FDE_LPCHUNKHEADER lpPreChunk = (FDE_LPCHUNKHEADER)m_Chunks[0];
+ FDE_LPCHUNKHEADER lpPreChunk = m_Chunks[0];
FDE_LPCHUNKHEADER lpCurChunk = NULL;
for (i = 1; i < nCount; i++) {
- lpCurChunk = (FDE_LPCHUNKHEADER)m_Chunks[i];
+ lpCurChunk = m_Chunks[i];
if (lpPreChunk->nUsed + lpCurChunk->nUsed <= m_nChunkSize) {
FXSYS_memcpy(lpPreChunk->wChars + lpPreChunk->nUsed, lpCurChunk->wChars,
lpCurChunk->nUsed * sizeof(FX_WCHAR));
@@ -378,7 +375,7 @@ int32_t CFDE_TxtEdtBuf::CP2Index(const FDE_CHUNKPLACE& cp) const {
int32_t nTotal = cp.nCharIndex;
int32_t i = 0;
for (i = 0; i < cp.nChunkIndex; i++) {
- nTotal += ((FDE_LPCHUNKHEADER)m_Chunks[i])->nUsed;
+ nTotal += m_Chunks[i]->nUsed;
}
return nTotal;
}
@@ -386,18 +383,18 @@ void CFDE_TxtEdtBuf::Index2CP(int32_t nIndex, FDE_CHUNKPLACE& cp) const {
ASSERT(nIndex <= GetTextLength());
if (nIndex == m_nTotal) {
cp.nChunkIndex = m_Chunks.GetSize() - 1;
- cp.nCharIndex = ((FDE_LPCHUNKHEADER)m_Chunks[cp.nChunkIndex])->nUsed;
+ cp.nCharIndex = m_Chunks[cp.nChunkIndex]->nUsed;
return;
}
int32_t i = 0;
int32_t nTotal = 0;
int32_t nCount = m_Chunks.GetSize();
for (; i < nCount; i++) {
- nTotal += ((FDE_LPCHUNKHEADER)m_Chunks[i])->nUsed;
+ nTotal += m_Chunks[i]->nUsed;
if (nTotal > nIndex) {
break;
}
}
cp.nChunkIndex = i;
- cp.nCharIndex = ((FDE_LPCHUNKHEADER)m_Chunks[i])->nUsed - (nTotal - nIndex);
+ cp.nCharIndex = m_Chunks[i]->nUsed - (nTotal - nIndex);
}
diff --git a/xfa/fee/fde_txtedtbuf.h b/xfa/fee/fde_txtedtbuf.h
index e0598f5244..102217da87 100644
--- a/xfa/fee/fde_txtedtbuf.h
+++ b/xfa/fee/fde_txtedtbuf.h
@@ -85,7 +85,7 @@ class CFDE_TxtEdtBuf : public IFDE_TxtEdtBuf {
int32_t m_nTotal;
FX_BOOL m_bChanged;
- CFX_PtrArray m_Chunks;
+ CFX_ArrayTemplate<FDE_CHUNKHEADER*> m_Chunks;
IFX_MEMAllocator* m_pAllocator;
};
diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp
index 495ac7d69d..5dfdb70018 100644
--- a/xfa/fgas/font/fgas_gefont.cpp
+++ b/xfa/fgas/font/fgas_gefont.cpp
@@ -106,7 +106,6 @@ CFX_GEFont::CFX_GEFont(IFX_FontMgr* pFontMgr)
m_pBBoxMap(NULL),
m_pProvider(NULL),
m_wCharSet(0xFFFF),
- m_SubstFonts(),
m_FontMapper(16) {
}
@@ -128,7 +127,6 @@ CFX_GEFont::CFX_GEFont(const CFX_GEFont& src, uint32_t dwFontStyles)
m_pBBoxMap(NULL),
m_pProvider(NULL),
m_wCharSet(0xFFFF),
- m_SubstFonts(),
m_FontMapper(16) {
m_pFont = new CFX_Font;
ASSERT(m_pFont != NULL);
@@ -146,36 +144,27 @@ CFX_GEFont::CFX_GEFont(const CFX_GEFont& src, uint32_t dwFontStyles)
}
InitFont();
}
+
CFX_GEFont::~CFX_GEFont() {
- int32_t iCount = m_SubstFonts.GetSize();
- for (int32_t i = 0; i < iCount; i++) {
- IFX_Font* pFont = (IFX_Font*)m_SubstFonts[i];
- pFont->Release();
- }
+ for (int32_t i = 0; i < m_SubstFonts.GetSize(); i++)
+ m_SubstFonts[i]->Release();
+
m_SubstFonts.RemoveAll();
m_FontMapper.RemoveAll();
- if (m_pFileRead != NULL) {
+ if (m_pFileRead)
m_pFileRead->Release();
- }
- if (m_pStream != NULL) {
+
+ if (m_pStream)
m_pStream->Release();
- }
- if (m_pFontEncoding != NULL) {
- delete m_pFontEncoding;
- }
- if (m_pCharWidthMap != NULL) {
- delete m_pCharWidthMap;
- }
- if (m_pRectArray != NULL) {
- delete m_pRectArray;
- }
- if (m_pBBoxMap != NULL) {
- delete m_pBBoxMap;
- }
- if (m_pFont != NULL && !m_bExtFont) {
+
+ delete m_pFontEncoding;
+ delete m_pCharWidthMap;
+ delete m_pRectArray;
+ delete m_pBBoxMap;
+ if (!m_bExtFont)
delete m_pFont;
- }
}
+
void CFX_GEFont::Release() {
if (--m_iRefCount < 1) {
if (m_pFontMgr != NULL) {
@@ -554,7 +543,7 @@ int32_t CFX_GEFont::GetDescent() const {
void CFX_GEFont::Reset() {
int32_t iCount = m_SubstFonts.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- IFX_Font* pFont = (IFX_Font*)m_SubstFonts[i];
+ IFX_Font* pFont = m_SubstFonts[i];
((CFX_GEFont*)pFont)->Reset();
}
if (m_pCharWidthMap != NULL) {
@@ -569,6 +558,6 @@ void CFX_GEFont::Reset() {
}
IFX_Font* CFX_GEFont::GetSubstFont(int32_t iGlyphIndex) const {
iGlyphIndex = ((uint32_t)iGlyphIndex) >> 24;
- return iGlyphIndex == 0 ? (IFX_Font*)this
- : (IFX_Font*)m_SubstFonts[iGlyphIndex - 1];
+ return iGlyphIndex == 0 ? const_cast<CFX_GEFont*>(this)
+ : m_SubstFonts[iGlyphIndex - 1];
}
diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h
index 43b5c5876e..491f38bc89 100644
--- a/xfa/fgas/font/fgas_gefont.h
+++ b/xfa/fgas/font/fgas_gefont.h
@@ -74,7 +74,7 @@ class CFX_GEFont : public IFX_Font {
CFX_MapPtrToPtr* m_pBBoxMap;
CXFA_PDFFontMgr* m_pProvider;
uint16_t m_wCharSet;
- CFX_PtrArray m_SubstFonts;
+ CFX_ArrayTemplate<IFX_Font*> m_SubstFonts;
CFX_MapPtrToPtr m_FontMapper;
FX_BOOL InitFont();
FX_BOOL GetCharBBox(FX_WCHAR wUnicode,
diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp
index c70ad691a4..94fa549fe4 100644
--- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp
+++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp
@@ -311,11 +311,10 @@ void CFWL_DateTimeCalendarImpDelegate::OnLButtonUpEx(CFWL_MsgMouse* pMsg) {
pPicker->m_pForm->GetWidgetRect(rt);
rt.Set(0, 0, rt.width, rt.height);
if (iCurSel > 0) {
- FWL_DATEINFO* lpDatesInfo =
- (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iCurSel - 1);
+ FWL_DATEINFO* lpDatesInfo = m_pOwner->m_arrDates.GetAt(iCurSel - 1);
CFX_RectF rtInvalidate(lpDatesInfo->rect);
if (iOldSel > 0 && iOldSel <= m_pOwner->m_arrDates.GetSize()) {
- lpDatesInfo = (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iOldSel - 1);
+ lpDatesInfo = m_pOwner->m_arrDates.GetAt(iOldSel - 1);
rtInvalidate.Union(lpDatesInfo->rect);
}
m_pOwner->AddSelDay(iCurSel);
@@ -406,11 +405,10 @@ void CFWL_DateTimeCalendarImpDelegate::DisForm_OnLButtonUpEx(
}
int32_t iCurSel = m_pOwner->GetDayAtPoint(pMsg->m_fx, pMsg->m_fy);
if (iCurSel > 0) {
- FWL_DATEINFO* lpDatesInfo =
- (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iCurSel - 1);
+ FWL_DATEINFO* lpDatesInfo = m_pOwner->m_arrDates.GetAt(iCurSel - 1);
CFX_RectF rtInvalidate(lpDatesInfo->rect);
if (iOldSel > 0 && iOldSel <= m_pOwner->m_arrDates.GetSize()) {
- lpDatesInfo = (FWL_DATEINFO*)m_pOwner->m_arrDates.GetAt(iOldSel - 1);
+ lpDatesInfo = m_pOwner->m_arrDates.GetAt(iOldSel - 1);
rtInvalidate.Union(lpDatesInfo->rect);
}
m_pOwner->AddSelDay(iCurSel);
diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.h b/xfa/fwl/basewidget/fwl_monthcalendarimp.h
index c67848fd1d..a7deb9a098 100644
--- a/xfa/fwl/basewidget/fwl_monthcalendarimp.h
+++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.h
@@ -15,6 +15,8 @@ class CFWL_MsgMouse;
class CFWL_WidgetImpProperties;
class IFWL_Widget;
+struct FWL_DATEINFO;
+
extern uint8_t FX_DaysInMonth(int32_t iYear, uint8_t iMonth);
class CFWL_MonthCalendarImp : public CFWL_WidgetImp {
@@ -160,7 +162,7 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp {
CFX_WideString m_wsHead;
CFX_WideString m_wsToday;
CFX_DateTime* m_pDateTime;
- CFX_PtrArray m_arrDates;
+ CFX_ArrayTemplate<FWL_DATEINFO*> m_arrDates;
int32_t m_iCurYear;
int32_t m_iCurMonth;
int32_t m_iYear;
diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp
index b2e7440761..5cd643a81b 100644
--- a/xfa/fwl/core/fwl_noteimp.cpp
+++ b/xfa/fwl/core/fwl_noteimp.cpp
@@ -698,25 +698,26 @@ FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) {
IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) {
int32_t iTrackLoop = m_noteLoopQueue.GetSize();
if (iTrackLoop <= 0)
- return NULL;
- IFWL_Widget* pMessageForm = NULL;
+ return nullptr;
+ IFWL_Widget* pMessageForm = nullptr;
if (iTrackLoop > 1) {
CFWL_NoteLoop* pNootLoop =
static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]);
pMessageForm = pNootLoop->GetForm()->GetInterface();
- } else {
- pMessageForm = (m_forms.Find(pDstTarget) < 0) ? NULL : pDstTarget;
+ } else if (m_forms.Find(pDstTarget->GetImpl()) < 0) {
+ pMessageForm = pDstTarget;
}
if (!pMessageForm && pDstTarget) {
CFWL_WidgetMgr* pWidgetMgr =
static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
- return NULL;
+ return nullptr;
pMessageForm =
pWidgetMgr->GetWidget(pDstTarget, FWL_WGTRELATION_SystemForm);
}
return pMessageForm;
}
+
void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) {
FX_POSITION pos = m_eventTargets.GetStartPosition();
while (pos) {
diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h
index 334c70535b..927afd6c9d 100644
--- a/xfa/fwl/core/fwl_noteimp.h
+++ b/xfa/fwl/core/fwl_noteimp.h
@@ -22,6 +22,7 @@ class CFWL_MsgMouseWheel;
class CFWL_MsgSetFocus;
class CFWL_MsgSize;
class CFWL_MsgWindowMove;
+class CFWL_TargetImp;
class CFWL_ToolTipImp;
class CFWL_WidgetImp;
class IFWL_ToolTipTarget;
@@ -95,7 +96,7 @@ class CFWL_NoteDriver : public IFWL_NoteDriver {
FX_BOOL IsValidMessage(CFWL_Message* pMessage);
IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget);
void ClearInvalidEventTargets(FX_BOOL bRemoveAll);
- CFX_PtrArray m_forms;
+ CFX_ArrayTemplate<CFWL_TargetImp*> m_forms;
CFX_PtrArray m_noteQueue;
CFX_PtrArray m_noteLoopQueue;
CFX_MapPtrToPtr m_eventTargets;