diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-16 22:08:07 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-16 22:08:07 +0000 |
commit | 1c4735aed9442a8e442214a23a3df94bd8fc99b5 (patch) | |
tree | 37264efcc3a1d90e3a9f05384d283923c828242f /core/fpdfdoc/cpvt_generateap.cpp | |
parent | 3f1c832dda209cf6682bb75316c07d71332fe6c3 (diff) | |
download | pdfium-1c4735aed9442a8e442214a23a3df94bd8fc99b5.tar.xz |
Convert ByteString::{Format|FormatV} to static methods
This CL moves the Format and FormatV methods of ByteString to be static.
Bug: pdfium:934
Change-Id: I9c30455a789aff9f619b9d5bf89c0712644f2d9a
Reviewed-on: https://pdfium-review.googlesource.com/18650
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfdoc/cpvt_generateap.cpp')
-rw-r--r-- | core/fpdfdoc/cpvt_generateap.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index c7b551f953..c0f9927229 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -44,25 +44,25 @@ ByteString GetPDFWordString(IPVT_FontMap* pFontMap, int32_t nFontIndex, uint16_t Word, uint16_t SubWord) { - ByteString sWord; - if (SubWord > 0) { - sWord.Format("%c", SubWord); - return sWord; - } + if (SubWord > 0) + return ByteString::Format("%c", SubWord); if (!pFontMap) - return sWord; + return ""; - if (CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex)) { - if (pPDFFont->GetBaseFont().Compare("Symbol") == 0 || - pPDFFont->GetBaseFont().Compare("ZapfDingbats") == 0) { - sWord.Format("%c", Word); - } else { - uint32_t dwCharCode = pPDFFont->CharCodeFromUnicode(Word); - if (dwCharCode != CPDF_Font::kInvalidCharCode) - pPDFFont->AppendChar(&sWord, dwCharCode); - } + CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex); + if (!pPDFFont) + return ""; + + if (pPDFFont->GetBaseFont().Compare("Symbol") == 0 || + pPDFFont->GetBaseFont().Compare("ZapfDingbats") == 0) { + return ByteString::Format("%c", Word); } + + ByteString sWord; + uint32_t dwCharCode = pPDFFont->CharCodeFromUnicode(Word); + if (dwCharCode != CPDF_Font::kInvalidCharCode) + pPDFFont->AppendChar(&sWord, dwCharCode); return sWord; } |