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 --- core/fpdfdoc/cpdf_pagelabel.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'core/fpdfdoc') diff --git a/core/fpdfdoc/cpdf_pagelabel.cpp b/core/fpdfdoc/cpdf_pagelabel.cpp index 5efb18ef3d..d0693086ab 100644 --- a/core/fpdfdoc/cpdf_pagelabel.cpp +++ b/core/fpdfdoc/cpdf_pagelabel.cpp @@ -50,23 +50,25 @@ WideString MakeLetters(int num) { } WideString GetLabelNumPortion(int num, const ByteString& bsStyle) { - WideString wsNumPortion; if (bsStyle.IsEmpty()) - return wsNumPortion; - if (bsStyle == "D") { - wsNumPortion.Format(L"%d", num); - } else if (bsStyle == "R") { - wsNumPortion = MakeRoman(num); + return L""; + if (bsStyle == "D") + return WideString::Format(L"%d", num); + if (bsStyle == "R") { + WideString wsNumPortion = MakeRoman(num); wsNumPortion.MakeUpper(); - } else if (bsStyle == "r") { - wsNumPortion = MakeRoman(num); - } else if (bsStyle == "A") { - wsNumPortion = MakeLetters(num); + return wsNumPortion; + } + if (bsStyle == "r") + return MakeRoman(num); + if (bsStyle == "A") { + WideString wsNumPortion = MakeLetters(num); wsNumPortion.MakeUpper(); - } else if (bsStyle == "a") { - wsNumPortion = MakeLetters(num); + return wsNumPortion; } - return wsNumPortion; + if (bsStyle == "a") + return MakeLetters(num); + return L""; } } // namespace @@ -114,7 +116,7 @@ bool CPDF_PageLabel::GetLabel(int nPage, WideString* wsLabel) const { return true; } } - wsLabel->Format(L"%d", nPage + 1); + *wsLabel = WideString::Format(L"%d", nPage + 1); return true; } -- cgit v1.2.3