summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_pagelabel.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-16 21:45:18 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-16 21:45:18 +0000
commit3f1c832dda209cf6682bb75316c07d71332fe6c3 (patch)
tree79e274e65a500bc7964fe4328a6185c805274640 /core/fpdfdoc/cpdf_pagelabel.cpp
parent40d522134a11867adb95f77c0b7891932e0739a2 (diff)
downloadpdfium-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 'core/fpdfdoc/cpdf_pagelabel.cpp')
-rw-r--r--core/fpdfdoc/cpdf_pagelabel.cpp30
1 files changed, 16 insertions, 14 deletions
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;
}