summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/cpdf_formcontrol.cpp6
-rw-r--r--core/fpdfdoc/cpdf_formfield.cpp4
-rw-r--r--core/fpdfdoc/cpdf_interform.cpp2
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp30
4 files changed, 19 insertions, 23 deletions
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index 7d4067b52f..5e24c5fb9e 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -101,10 +101,8 @@ ByteString CPDF_FormControl::GetCheckedAPState() {
ByteString csOn = GetOnStateName();
if (GetType() == CPDF_FormField::RadioButton ||
GetType() == CPDF_FormField::CheckBox) {
- if (ToArray(FPDF_GetFieldAttr(m_pField->GetDict(), "Opt"))) {
- int iIndex = m_pField->GetControlIndex(this);
- csOn.Format("%d", iIndex);
- }
+ if (ToArray(FPDF_GetFieldAttr(m_pField->GetDict(), "Opt")))
+ csOn = ByteString::Format("%d", m_pField->GetControlIndex(this));
}
if (csOn.IsEmpty())
csOn = "Yes";
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index 637cb9eece..395b5c5713 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -749,9 +749,7 @@ bool CPDF_FormField::CheckControl(int iControlIndex,
m_pDict->SetNewFor<CPDF_Name>("V", "Off");
}
} else if (bChecked) {
- ByteString csIndex;
- csIndex.Format("%d", iControlIndex);
- m_pDict->SetNewFor<CPDF_Name>("V", csIndex);
+ m_pDict->SetNewFor<CPDF_Name>("V", ByteString::Format("%d", iControlIndex));
}
if (bNotify && m_pForm->GetFormNotify())
m_pForm->GetFormNotify()->AfterCheckedStatusChange(this);
diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp
index 50db639a4f..e42095c048 100644
--- a/core/fpdfdoc/cpdf_interform.cpp
+++ b/core/fpdfdoc/cpdf_interform.cpp
@@ -717,7 +717,7 @@ ByteString CPDF_InterForm::GenerateNewResourceName(
if (m < iCount)
csTmp += csStr[m++];
else
- bsNum.Format("%d", num++);
+ bsNum = ByteString::Format("%d", num++);
m++;
}
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;
}