summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfdoc/cpdf_variabletext.cpp5
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp8
-rw-r--r--core/fpdfdoc/include/cpdf_variabletext.h2
-rw-r--r--fpdfsdk/fsdk_baseform.cpp17
-rw-r--r--fpdfsdk/fxedit/fxet_list.cpp9
-rw-r--r--fpdfsdk/fxedit/fxet_pageobjs.cpp7
-rw-r--r--fpdfsdk/pdfwindow/PWL_EditCtrl.cpp6
7 files changed, 22 insertions, 32 deletions
diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index 118efa6a10..a8b9c3c778 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -1112,9 +1112,8 @@ int32_t CPDF_VariableText::GetCharWidth(int32_t nFontIndex,
int32_t nWordStyle) {
if (!m_pVTProvider)
return 0;
- if (SubWord > 0)
- return m_pVTProvider->GetCharWidth(nFontIndex, SubWord, nWordStyle);
- return m_pVTProvider->GetCharWidth(nFontIndex, Word, nWordStyle);
+ uint16_t word = SubWord ? SubWord : Word;
+ return m_pVTProvider->GetCharWidth(nFontIndex, word, nWordStyle);
}
int32_t CPDF_VariableText::GetTypeAscent(int32_t nFontIndex) {
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index 7fcd90969e..2fc0644bcc 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -504,9 +504,13 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
const CFX_FloatPoint& ptOffset,
FX_BOOL bContinuous,
uint16_t SubWord) {
- CFX_ByteTextBuf sEditStream, sLineStream, sWords;
- CFX_FloatPoint ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f);
+ CFX_ByteTextBuf sEditStream;
+ CFX_ByteTextBuf sLineStream;
+ CFX_ByteTextBuf sWords;
+ CFX_FloatPoint ptOld(0.0f, 0.0f);
+ CFX_FloatPoint ptNew(0.0f, 0.0f);
int32_t nCurFontIndex = -1;
+
pIterator->SetAt(0);
CPVT_WordPlace oldplace;
diff --git a/core/fpdfdoc/include/cpdf_variabletext.h b/core/fpdfdoc/include/cpdf_variabletext.h
index 30bff84811..faa5036469 100644
--- a/core/fpdfdoc/include/cpdf_variabletext.h
+++ b/core/fpdfdoc/include/cpdf_variabletext.h
@@ -77,7 +77,7 @@ class CPDF_VariableText : private CPDF_EditContainer {
virtual int32_t GetDefaultFontIndex();
private:
- IPVT_FontMap* m_pFontMap;
+ IPVT_FontMap* const m_pFontMap;
};
CPDF_VariableText();
diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp
index 46e9c46fb1..177e7de978 100644
--- a/fpdfsdk/fsdk_baseform.cpp
+++ b/fpdfsdk/fsdk_baseform.cpp
@@ -1434,10 +1434,7 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() {
FX_FLOAT fFontSize = GetFontSize();
- if (IsFloatZero(fFontSize))
- pEdit->SetFontSize(12.0f);
- else
- pEdit->SetFontSize(fFontSize);
+ pEdit->SetFontSize(IsFloatZero(fFontSize) ? 12.0f : fFontSize);
pEdit->Initialize();
@@ -1448,11 +1445,11 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() {
int32_t nCount = pField->CountOptions();
int32_t nSelCount = pField->CountSelectedItems();
- for (int32_t i = nTop; i < nCount; i++) {
- FX_BOOL bSelected = FALSE;
- for (int32_t j = 0; j < nSelCount; j++) {
+ for (int32_t i = nTop; i < nCount; ++i) {
+ bool bSelected = false;
+ for (int32_t j = 0; j < nSelCount; ++j) {
if (pField->GetSelectedIndex(j) == i) {
- bSelected = TRUE;
+ bSelected = true;
break;
}
}
@@ -1609,7 +1606,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) {
<< CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE)
<< " 2 J 0 j\n";
- for (int32_t i = 1; i < nMaxLen; i++) {
+ for (int32_t i = 1; i < nMaxLen; ++i) {
sLines << rcClient.left +
((rcClient.right - rcClient.left) / nMaxLen) * i
<< " " << rcClient.bottom << " m\n"
@@ -1633,7 +1630,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) {
<< "[" << dsBorder.nDash << " " << dsBorder.nGap << "] "
<< dsBorder.nPhase << " d\n";
- for (int32_t i = 1; i < nMaxLen; i++) {
+ for (int32_t i = 1; i < nMaxLen; ++i) {
sLines << rcClient.left +
((rcClient.right - rcClient.left) / nMaxLen) * i
<< " " << rcClient.bottom << " m\n"
diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp
index 639569898e..383b84f27f 100644
--- a/fpdfsdk/fxedit/fxet_list.cpp
+++ b/fpdfsdk/fxedit/fxet_list.cpp
@@ -63,12 +63,9 @@ FX_FLOAT CFX_ListItem::GetItemHeight() const {
uint16_t CFX_ListItem::GetFirstChar() const {
CPVT_Word word;
-
- if (IFX_Edit_Iterator* pIterator = GetIterator()) {
- pIterator->SetAt(1);
- pIterator->GetWord(word);
- }
-
+ IFX_Edit_Iterator* pIterator = GetIterator();
+ pIterator->SetAt(1);
+ pIterator->GetWord(word);
return word.Word;
}
diff --git a/fpdfsdk/fxedit/fxet_pageobjs.cpp b/fpdfsdk/fxedit/fxet_pageobjs.cpp
index 6e7deed00d..1fe29af283 100644
--- a/fpdfsdk/fxedit/fxet_pageobjs.cpp
+++ b/fpdfsdk/fxedit/fxet_pageobjs.cpp
@@ -183,7 +183,6 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice,
pIterator->SetAt(0);
CPVT_WordPlace oldplace;
-
while (pIterator->NextWord()) {
CPVT_WordPlace place = pIterator->GetAt();
if (pRange && place.WordCmp(pRange->EndPos) > 0)
@@ -192,11 +191,7 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice,
if (wrSelect.IsExist()) {
bSelect = place.WordCmp(wrSelect.BeginPos) > 0 &&
place.WordCmp(wrSelect.EndPos) <= 0;
- if (bSelect) {
- crCurFill = crWhite;
- } else {
- crCurFill = crTextFill;
- }
+ crCurFill = bSelect ? crWhite : crTextFill;
}
if (pSystemHandler && pSystemHandler->IsSelectionImplemented()) {
crCurFill = crTextFill;
diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
index 8a0dea1980..88046a2d86 100644
--- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
+++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
@@ -173,10 +173,8 @@ FX_BOOL CPWL_EditCtrl::OnKeyDown(uint16_t nChar, uint32_t nFlag) {
break;
}
- if (nChar == FWL_VKEY_Delete) {
- if (m_pEdit->IsSelected())
- nChar = FWL_VKEY_Unknown;
- }
+ if (nChar == FWL_VKEY_Delete && m_pEdit->IsSelected())
+ nChar = FWL_VKEY_Unknown;
switch (nChar) {
case FWL_VKEY_Delete: