From 215507d8d612d4269723b49aaf28468b634f68ac Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 9 Jun 2016 19:05:47 -0700 Subject: Avoid casts via correct types in fgas_textbreak FLW_DATEINFO cast not required. Review-Url: https://codereview.chromium.org/2053963002 --- xfa/fwl/basewidget/fwl_monthcalendarimp.cpp | 33 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'xfa/fwl/basewidget') diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp index e8672e67dc..ae5e71780b 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp @@ -391,7 +391,7 @@ void CFWL_MonthCalendarImp::DrawDatesInBK(CFX_Graphics* pGraphics, } int32_t iCount = m_arrDates.GetSize(); for (int32_t j = 0; j < iCount; j++) { - FWL_DATEINFO* pDataInfo = (FWL_DATEINFO*)m_arrDates.GetAt(j); + FWL_DATEINFO* pDataInfo = m_arrDates.GetAt(j); if (pDataInfo->dwStates & FWL_ITEMSTATE_MCD_Selected) { params.m_dwStates |= CFWL_PartState_Selected; if (((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_NoTodayCircle) == @@ -521,7 +521,7 @@ void CFWL_MonthCalendarImp::DrawDatesIn(CFX_Graphics* pGraphics, } int32_t iCount = m_arrDates.GetSize(); for (int32_t j = 0; j < iCount; j++) { - FWL_DATEINFO* pDataInfo = (FWL_DATEINFO*)m_arrDates.GetAt(j); + FWL_DATEINFO* pDataInfo = m_arrDates.GetAt(j); params.m_wsText = pDataInfo->wsDay; params.m_rtPart = pDataInfo->rect; params.m_dwStates = pDataInfo->dwStates; @@ -558,7 +558,7 @@ void CFWL_MonthCalendarImp::DrawDatesInCircle(CFX_Graphics* pGraphics, if (m_iDay < 1 || m_iDay > m_arrDates.GetSize()) { return; } - FWL_DATEINFO* pDate = (FWL_DATEINFO*)m_arrDates[m_iDay - 1]; + FWL_DATEINFO* pDate = m_arrDates[m_iDay - 1]; if (!pDate) return; CFWL_ThemeBackground params; @@ -715,7 +715,7 @@ void CFWL_MonthCalendarImp::CalDateItem() { FX_FLOAT fTop = m_rtDates.top; int32_t iCount = m_arrDates.GetSize(); for (int32_t i = 0; i < iCount; i++) { - FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(i); + FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(i); if (bNewWeek) { iWeekOfMonth++; bNewWeek = FALSE; @@ -851,14 +851,14 @@ FX_BOOL CFWL_MonthCalendarImp::InitDate() { m_dtMax = DATE(2200, 1, 1); return TRUE; } + void CFWL_MonthCalendarImp::ClearDateItem() { - int32_t iCount = m_arrDates.GetSize(); - for (int32_t i = 0; i < iCount; i++) { - FWL_DATEINFO* pData = (FWL_DATEINFO*)m_arrDates.GetAt(i); - delete pData; - } + for (int32_t i = 0; i < m_arrDates.GetSize(); i++) + delete m_arrDates.GetAt(i); + m_arrDates.RemoveAll(); } + void CFWL_MonthCalendarImp::ReSetDateItem() { m_pDateTime->Set(m_iCurYear, m_iCurMonth, 1); int32_t iDays = FX_DaysInMonth(m_iCurYear, m_iCurMonth); @@ -934,7 +934,7 @@ FX_BOOL CFWL_MonthCalendarImp::RemoveSelDay(int32_t iDay, FX_BOOL bAll) { for (int32_t i = 0; i < iCount; i++) { int32_t iSelDay = m_arrSelDays.GetAt(i); if (iSelDay <= iDatesCount) { - FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(iSelDay - 1); + FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(iSelDay - 1); pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected; } } @@ -947,7 +947,7 @@ FX_BOOL CFWL_MonthCalendarImp::RemoveSelDay(int32_t iDay, FX_BOOL bAll) { int32_t iSelDay = m_arrSelDays.GetAt(iDay); int32_t iDatesCount = m_arrDates.GetSize(); if (iSelDay <= iDatesCount) { - FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(iSelDay - 1); + FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(iSelDay - 1); pDateInfo->dwStates &= ~FWL_ITEMSTATE_MCD_Selected; } m_arrSelDays.RemoveAt(index); @@ -961,7 +961,7 @@ FX_BOOL CFWL_MonthCalendarImp::AddSelDay(int32_t iDay) { if (m_arrSelDays.Find(iDay) == -1) { RemoveSelDay(-1, TRUE); if (iDay <= m_arrDates.GetSize()) { - FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(iDay - 1); + FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(iDay - 1); pDateInfo->dwStates |= FWL_ITEMSTATE_MCD_Selected; } m_arrSelDays.Add(iDay); @@ -1001,7 +1001,7 @@ void CFWL_MonthCalendarImp::GetTodayText(int32_t iYear, int32_t CFWL_MonthCalendarImp::GetDayAtPoint(FX_FLOAT x, FX_FLOAT y) { int32_t iCount = m_arrDates.GetSize(); for (int32_t i = 0; i < iCount; i++) { - FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates.GetAt(i); + FWL_DATEINFO* pDateInfo = m_arrDates.GetAt(i); if (pDateInfo->rect.Contains(x, y)) { return ++i; } @@ -1012,7 +1012,7 @@ FX_BOOL CFWL_MonthCalendarImp::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { if (iDay <= 0 || iDay > m_arrDates.GetSize()) { return FALSE; } - FWL_DATEINFO* pDateInfo = (FWL_DATEINFO*)m_arrDates[iDay - 1]; + FWL_DATEINFO* pDateInfo = m_arrDates[iDay - 1]; if (!pDateInfo) return FALSE; rtDay = pDateInfo->rect; @@ -1114,11 +1114,10 @@ void CFWL_MonthCalendarImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { int32_t iCurSel = m_pOwner->GetDayAtPoint(pMsg->m_fx, pMsg->m_fy); FX_BOOL bSelChanged = iCurSel > 0 && iCurSel != iOldSel; if (bSelChanged) { - 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) { - 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); -- cgit v1.2.3