From 3f1c832dda209cf6682bb75316c07d71332fe6c3 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 16 Nov 2017 21:45:18 +0000 Subject: 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 Commit-Queue: dsinclair --- xfa/fgas/crt/cfgas_formatstring.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'xfa/fgas/crt') diff --git a/xfa/fgas/crt/cfgas_formatstring.cpp b/xfa/fgas/crt/cfgas_formatstring.cpp index 87b07691a4..eaac969fd8 100644 --- a/xfa/fgas/crt/cfgas_formatstring.cpp +++ b/xfa/fgas/crt/cfgas_formatstring.cpp @@ -554,9 +554,8 @@ uint16_t GetWeekOfYear(uint16_t year, uint16_t month, uint16_t day) { } WideString NumToString(size_t fmt_size, int32_t value) { - WideString str; - str.Format(fmt_size == 1 ? L"%d" : fmt_size == 2 ? L"%02d" : L"%03d", value); - return str; + return WideString::Format( + fmt_size == 1 ? L"%d" : fmt_size == 2 ? L"%02d" : L"%03d", value); } WideString DateFormat(const WideString& wsDatePattern, @@ -684,10 +683,8 @@ WideString TimeFormat(const WideString& wsTimePattern, FX_TIMEZONE tz = pLocale->GetTimeZone(); if (tz.tzHour != 0 || tz.tzMinute != 0) { wsResult += tz.tzHour < 0 ? L"-" : L"+"; - - WideString wsTimezone; - wsTimezone.Format(L"%02d:%02d", abs(tz.tzHour), tz.tzMinute); - wsResult += wsTimezone; + wsResult += + WideString::Format(L"%02d:%02d", abs(tz.tzHour), tz.tzMinute); } } } @@ -2006,9 +2003,7 @@ bool CFGAS_FormatString::FormatStrNum(const WideStringView& wsInputNum, ccf--; break; case 'E': { - WideString wsExp; - wsExp.Format(L"E%+d", exponent); - *wsOutput = wsExp + *wsOutput; + *wsOutput = WideString::Format(L"E%+d", exponent) + *wsOutput; ccf--; break; } @@ -2164,9 +2159,7 @@ bool CFGAS_FormatString::FormatStrNum(const WideStringView& wsInputNum, ccf++; break; case 'E': { - WideString wsExp; - wsExp.Format(L"E%+d", exponent); - *wsOutput += wsExp; + *wsOutput += WideString::Format(L"E%+d", exponent); ccf++; break; } -- cgit v1.2.3