diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-16 21:45:18 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-16 21:45:18 +0000 |
commit | 3f1c832dda209cf6682bb75316c07d71332fe6c3 (patch) | |
tree | 79e274e65a500bc7964fe4328a6185c805274640 /xfa/fwl | |
parent | 40d522134a11867adb95f77c0b7891932e0739a2 (diff) | |
download | pdfium-3f1c832dda209cf6682bb75316c07d71332fe6c3.tar.xz |
Make WideString::{Format|FormatV} static
This CL moves the Format and FormatV methods from WideString to be
static.
Bug: pdfium:934
Change-Id: I9941d6a2a5bbf0a82087cd0ea5d0f8fc42eecd3e
Reviewed-on: https://pdfium-review.googlesource.com/18630
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fwl')
-rw-r--r-- | xfa/fwl/cfwl_datetimepicker.cpp | 5 | ||||
-rw-r--r-- | xfa/fwl/cfwl_monthcalendar.cpp | 21 | ||||
-rw-r--r-- | xfa/fwl/cfwl_monthcalendar.h | 2 |
3 files changed, 11 insertions, 17 deletions
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp index cd58dc7f92..8dcdf887f7 100644 --- a/xfa/fwl/cfwl_datetimepicker.cpp +++ b/xfa/fwl/cfwl_datetimepicker.cpp @@ -214,10 +214,11 @@ void CFWL_DateTimePicker::FormatDateString(int32_t iYear, WideString& wsText) { if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_ShortDateFormat) == FWL_STYLEEXT_DTP_ShortDateFormat) { - wsText.Format(L"%d-%d-%d", iYear, iMonth, iDay); + wsText = WideString::Format(L"%d-%d-%d", iYear, iMonth, iDay); } else if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_DTP_LongDateFormat) == FWL_STYLEEXT_DTP_LongDateFormat) { - wsText.Format(L"%d Year %d Month %d Day", iYear, iMonth, iDay); + wsText = + WideString::Format(L"%d Year %d Month %d Day", iYear, iMonth, iDay); } } diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp index 82cef65c3c..5f23a1e8e9 100644 --- a/xfa/fwl/cfwl_monthcalendar.cpp +++ b/xfa/fwl/cfwl_monthcalendar.cpp @@ -430,9 +430,8 @@ CFX_SizeF CFWL_MonthCalendar::CalcSize() { float fDayMaxW = 0.0f; float fDayMaxH = 0.0f; for (int day = 10; day <= 31; day++) { - WideString wsDay; - wsDay.Format(L"%d", day); - CFX_SizeF sz = CalcTextSize(wsDay, m_pProperties->m_pThemeProvider, false); + CFX_SizeF sz = CalcTextSize(WideString::Format(L"%d", day), + m_pProperties->m_pThemeProvider, false); fDayMaxW = (fDayMaxW >= sz.width) ? fDayMaxW : sz.width; fDayMaxH = (fDayMaxH >= sz.height) ? fDayMaxH : sz.height; } @@ -579,8 +578,6 @@ void CFWL_MonthCalendar::ResetDateItem() { if (iDayOfWeek >= 7) iDayOfWeek = 0; - WideString wsDay; - wsDay.Format(L"%d", i + 1); uint32_t dwStates = 0; if (m_iYear == m_iCurYear && m_iMonth == m_iCurMonth && m_iDay == (i + 1)) dwStates |= FWL_ITEMSTATE_MCD_Flag; @@ -588,8 +585,8 @@ void CFWL_MonthCalendar::ResetDateItem() { dwStates |= FWL_ITEMSTATE_MCD_Selected; CFX_RectF rtDate; - m_arrDates.push_back(pdfium::MakeUnique<DATEINFO>(i + 1, iDayOfWeek, - dwStates, rtDate, wsDay)); + m_arrDates.push_back(pdfium::MakeUnique<DATEINFO>( + i + 1, iDayOfWeek, dwStates, rtDate, WideString::Format(L"%d", i + 1))); iDayOfWeek++; } } @@ -680,17 +677,13 @@ WideString CFWL_MonthCalendar::GetHeadText(int32_t iYear, int32_t iMonth) { L"April", L"May", L"June", L"July", L"August", L"September", L"October", L"November", L"December"}; - WideString wsHead; - wsHead.Format(L"%s, %d", pMonth[iMonth - 1], iYear); - return wsHead; + return WideString::Format(L"%s, %d", pMonth[iMonth - 1], iYear); } WideString CFWL_MonthCalendar::GetTodayText(int32_t iYear, int32_t iMonth, int32_t iDay) { - WideString wsToday; - wsToday.Format(L", %d/%d/%d", iDay, iMonth, iYear); - return wsToday; + return WideString::Format(L", %d/%d/%d", iDay, iMonth, iYear); } int32_t CFWL_MonthCalendar::GetDayAtPoint(const CFX_PointF& point) const { @@ -893,7 +886,7 @@ CFWL_MonthCalendar::DATEINFO::DATEINFO(int32_t day, int32_t dayofweek, uint32_t dwSt, CFX_RectF rc, - WideString& wsday) + const WideString& wsday) : iDay(day), iDayOfWeek(dayofweek), dwStates(dwSt), diff --git a/xfa/fwl/cfwl_monthcalendar.h b/xfa/fwl/cfwl_monthcalendar.h index 325fa96158..7b68600bbc 100644 --- a/xfa/fwl/cfwl_monthcalendar.h +++ b/xfa/fwl/cfwl_monthcalendar.h @@ -79,7 +79,7 @@ class CFWL_MonthCalendar : public CFWL_Widget { int32_t dayofweek, uint32_t dwSt, CFX_RectF rc, - WideString& wsday); + const WideString& wsday); ~DATEINFO(); int32_t iDay; |