summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.cpp14
-rw-r--r--core/fpdftext/cpdf_textpage.cpp8
-rw-r--r--core/fxcodec/bmp/cfx_bmpdecompressor.cpp4
-rw-r--r--core/fxge/android/cfpf_skiafontmgr.cpp19
-rw-r--r--core/fxge/cfx_fontmapper.cpp41
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.cpp3
-rw-r--r--fpdfsdk/fpdf_transformpage.cpp2
-rw-r--r--fxjs/cfxjs_engine_embeddertest.cpp10
-rw-r--r--fxjs/cfxjse_engine.cpp1
-rw-r--r--fxjs/cfxjse_formcalc_context.cpp6
-rw-r--r--fxjs/xfa/cjx_tree.cpp6
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp6
-rw-r--r--xfa/fxfa/parser/cxfa_document_parser.cpp3
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp15
14 files changed, 71 insertions, 67 deletions
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 3acad525f7..89bf991cd4 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -477,22 +477,22 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectBodyInternal(
std::unique_ptr<CPDF_Dictionary> pDict =
pdfium::MakeUnique<CPDF_Dictionary>(m_pPool);
while (1) {
- ByteString word = GetNextWord(nullptr);
- if (word.IsEmpty())
+ ByteString inner_word = GetNextWord(nullptr);
+ if (inner_word.IsEmpty())
return nullptr;
- FX_FILESIZE SavedPos = m_Pos - word.GetLength();
- if (word == ">>")
+ FX_FILESIZE SavedPos = m_Pos - inner_word.GetLength();
+ if (inner_word == ">>")
break;
- if (word == "endobj") {
+ if (inner_word == "endobj") {
m_Pos = SavedPos;
break;
}
- if (word[0] != '/')
+ if (inner_word[0] != '/')
continue;
- ByteString key = PDF_NameDecode(word.AsStringView());
+ ByteString key = PDF_NameDecode(inner_word.AsStringView());
if (key.IsEmpty() && parse_type == ParseType::kLoose)
continue;
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 2353317796..8375d1f8cc 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -494,11 +494,11 @@ void CPDF_TextPage::CheckMarkedContentObject(int32_t* pStart,
if (FPDFTEXT_CHAR_PIECE == charinfo2.m_Flag) {
PAGECHAR_INFO charinfo3 = charinfo2;
int endIndex = start + nCount - 1;
- const int nCount = CountChars();
+ const int innerCount = CountChars();
while (FPDFTEXT_CHAR_PIECE == charinfo3.m_Flag &&
charinfo3.m_Index == charinfo2.m_Index) {
endIndex++;
- if (endIndex >= nCount)
+ if (endIndex >= innerCount)
break;
charinfo3 = m_CharList[endIndex];
}
@@ -1316,8 +1316,8 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
if (re.Contains(pObj->GetPos())) {
bNewline = false;
} else {
- CFX_FloatRect rect(0, pObj->m_Bottom, 1000, pObj->m_Top);
- if (rect.Contains(m_pPreTextObj->GetPos()))
+ if (CFX_FloatRect(0, pObj->m_Bottom, 1000, pObj->m_Top)
+ .Contains(m_pPreTextObj->GetPos()))
bNewline = false;
}
}
diff --git a/core/fxcodec/bmp/cfx_bmpdecompressor.cpp b/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
index 739853aa13..383955624c 100644
--- a/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
+++ b/core/fxcodec/bmp/cfx_bmpdecompressor.cpp
@@ -65,9 +65,9 @@ void CFX_BmpDecompressor::Error() {
longjmp(jmpbuf_, 1);
}
-void CFX_BmpDecompressor::ReadScanline(uint32_t row_num_,
+void CFX_BmpDecompressor::ReadScanline(uint32_t row_num,
const std::vector<uint8_t>& row_buf) {
- context_ptr_->m_pDelegate->BmpReadScanline(row_num_, row_buf);
+ context_ptr_->m_pDelegate->BmpReadScanline(row_num, row_buf);
}
bool CFX_BmpDecompressor::GetDataPosition(uint32_t rcd_pos) {
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index f9afdabb93..2288a86e92 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -252,9 +252,9 @@ CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const ByteStringView& bsFamilyname,
uint8_t uCharset,
uint32_t dwStyle) {
uint32_t dwHash = FPF_SKIAGetFamilyHash(bsFamilyname, dwStyle, uCharset);
- auto it = m_FamilyFonts.find(dwHash);
- if (it != m_FamilyFonts.end())
- return it->second.get();
+ auto family_iter = m_FamilyFonts.find(dwHash);
+ if (family_iter != m_FamilyFonts.end())
+ return family_iter->second.get();
uint32_t dwFaceName = FPF_SKIANormalizeFontName(bsFamilyname);
uint32_t dwSubst = FPF_SkiaGetSubstFont(dwFaceName, g_SkiaFontmap,
@@ -273,8 +273,9 @@ CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const ByteStringView& bsFamilyname,
const CFPF_SkiaPathFont* pBestFont = nullptr;
int32_t nMax = -1;
int32_t nGlyphNum = 0;
- for (auto it = m_FontFaces.rbegin(); it != m_FontFaces.rend(); ++it) {
- const CFPF_SkiaPathFont* pFont = it->get();
+ for (auto face_iter = m_FontFaces.rbegin(); face_iter != m_FontFaces.rend();
+ ++face_iter) {
+ const CFPF_SkiaPathFont* pFont = face_iter->get();
if (!(pFont->charsets() & FPF_SkiaGetCharset(uCharset)))
continue;
int32_t nFind = 0;
@@ -301,19 +302,19 @@ CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const ByteStringView& bsFamilyname,
if (uCharset == FX_CHARSET_Default || bMaybeSymbol) {
if (nFind > nMax && bMatchedName) {
nMax = nFind;
- pBestFont = it->get();
+ pBestFont = face_iter->get();
}
} else if (FPF_SkiaIsCJK(uCharset)) {
if (bMatchedName || pFont->glyph_num() > nGlyphNum) {
- pBestFont = it->get();
+ pBestFont = face_iter->get();
nGlyphNum = pFont->glyph_num();
}
} else if (nFind > nMax) {
nMax = nFind;
- pBestFont = it->get();
+ pBestFont = face_iter->get();
}
if (nExpectVal <= nFind) {
- pBestFont = it->get();
+ pBestFont = face_iter->get();
break;
}
}
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index c7a7015680..461094d81e 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -149,6 +149,14 @@ const AltFontFamily g_AltFontFamilies[] = {
{"ForteMT", "Forte"},
};
+#if _FX_PLATFORM_ == _FX_PLATFORM_LINUX_
+const char kNarrowFamily[] = "LiberationSansNarrow";
+#elif _FX_PLATFORM_ == _FX_PLATFORM_ANDROID_
+const char kNarrowFamily[] = "RobotoCondensed";
+#else
+const char kNarrowFamily[] = "ArialNarrow";
+#endif // _FX_PLATFORM_ == _FX_PLATFORM_LINUX_
+
ByteString TT_NormalizeName(const char* family) {
ByteString norm(family);
norm.Remove(' ');
@@ -415,14 +423,16 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const ByteString& name,
ByteString style;
bool bHasComma = false;
bool bHasHyphen = false;
- auto pos = SubstName.Find(",", 0);
- if (pos.has_value()) {
- family = SubstName.Left(pos.value());
- PDF_GetStandardFontName(&family);
- style = SubstName.Right(SubstName.GetLength() - (pos.value() + 1));
- bHasComma = true;
- } else {
- family = SubstName;
+ {
+ Optional<size_t> pos = SubstName.Find(",", 0);
+ if (pos.has_value()) {
+ family = SubstName.Left(pos.value());
+ PDF_GetStandardFontName(&family);
+ style = SubstName.Right(SubstName.GetLength() - (pos.value() + 1));
+ bHasComma = true;
+ } else {
+ family = SubstName;
+ }
}
for (; iBaseFont < 12; iBaseFont++) {
if (family == ByteStringView(g_Base14FontNames[iBaseFont]))
@@ -443,7 +453,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const ByteString& name,
} else {
iBaseFont = kNumStandardFonts;
if (!bHasComma) {
- pos = family.ReverseFind('-');
+ Optional<size_t> pos = family.ReverseFind('-');
if (pos.has_value()) {
style = family.Right(family.GetLength() - (pos.value() + 1));
family = family.Left(pos.value());
@@ -540,19 +550,12 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const ByteString& name,
bItalic = italic_angle != 0;
weight = old_weight;
}
-#if _FX_PLATFORM_ == _FX_PLATFORM_LINUX_
- const char* narrow_family = "LiberationSansNarrow";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_ANDROID_
- const char* narrow_family = "RobotoCondensed";
-#else
- const char* narrow_family = "ArialNarrow";
-#endif // _FX_PLATFORM_ == _FX_PLATFORM_LINUX_
- auto pos = SubstName.Find("Narrow");
+ Optional<size_t> pos = SubstName.Find("Narrow");
if (pos.has_value() && pos.value() != 0)
- family = narrow_family;
+ family = kNarrowFamily;
pos = SubstName.Find("Condensed");
if (pos.has_value() && pos.value() != 0)
- family = narrow_family;
+ family = kNarrowFamily;
} else {
pSubstFont->m_bSubstCJK = true;
if (nStyle)
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
index 98464cb6d6..577f1e0638 100644
--- a/fpdfsdk/formfiller/cba_fontmap.cpp
+++ b/fpdfsdk/formfiller/cba_fontmap.cpp
@@ -154,8 +154,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
pAPDict = m_pAnnotDict->SetNewFor<CPDF_Dictionary>("AP");
// to avoid checkbox and radiobutton
- CPDF_Object* pObject = pAPDict->GetObjectFor(m_sAPType);
- if (ToDictionary(pObject))
+ if (ToDictionary(pAPDict->GetObjectFor(m_sAPType)))
return;
CPDF_Stream* pStream = pAPDict->GetStreamFor(m_sAPType);
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index d20b28fe81..2458e939d2 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -147,7 +147,7 @@ FPDFPage_TransFormWithClip(FPDF_PAGE page,
pContentArray->InsertAt(0, pStream->MakeReference(pDoc));
pContentArray->Add(pEndStream->MakeReference(pDoc));
} else if (pContentObj->IsStream() && !pContentObj->IsInline()) {
- CPDF_Array* pContentArray = pDoc->NewIndirect<CPDF_Array>();
+ pContentArray = pDoc->NewIndirect<CPDF_Array>();
pContentArray->Add(pStream->MakeReference(pDoc));
pContentArray->Add(pContentObj->MakeReference(pDoc));
pContentArray->Add(pEndStream->MakeReference(pDoc));
diff --git a/fxjs/cfxjs_engine_embeddertest.cpp b/fxjs/cfxjs_engine_embeddertest.cpp
index ff866d3ee0..a9422ece98 100644
--- a/fxjs/cfxjs_engine_embeddertest.cpp
+++ b/fxjs/cfxjs_engine_embeddertest.cpp
@@ -51,10 +51,12 @@ TEST_F(CFXJSEngineEmbedderTest, MultipleEngines) {
engine2.InitializeEngine();
v8::Context::Scope context_scope(GetV8Context());
- Optional<IJS_Runtime::JS_Error> err = engine()->Execute(WideString(kScript0));
- EXPECT_FALSE(err);
- CheckAssignmentInEngineContext(engine(), kExpected0);
-
+ {
+ Optional<IJS_Runtime::JS_Error> err =
+ engine()->Execute(WideString(kScript0));
+ EXPECT_FALSE(err);
+ CheckAssignmentInEngineContext(engine(), kExpected0);
+ }
{
// engine1 executing in engine1's context doesn't affect main.
v8::Context::Scope context_scope1(engine1.GetV8Context());
diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp
index 3b60989f32..c3b9dd3639 100644
--- a/fxjs/cfxjse_engine.cpp
+++ b/fxjs/cfxjse_engine.cpp
@@ -334,7 +334,6 @@ void CFXJSE_Engine::NormalPropertyGetter(CFXJSE_Value* pOriginalValue,
szPropName, pReturnValue, true);
if (!bRet) {
- WideString wsPropName = WideString::FromUTF8(szPropName);
const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo =
XFA_GetScriptAttributeByName(pObject->GetElementType(),
wsPropName.AsStringView());
diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp
index 34f5642844..41ec5783ff 100644
--- a/fxjs/cfxjse_formcalc_context.cpp
+++ b/fxjs/cfxjse_formcalc_context.cpp
@@ -780,11 +780,11 @@ bool IsIsoTimeFormat(const char* pData,
++iIndex;
char strSec[kSubSecondLength + 1];
- for (int i = 0; i < kSubSecondLength; ++i) {
- char c = pData[iIndex + i];
+ for (int j = 0; j < kSubSecondLength; ++j) {
+ char c = pData[iIndex + j];
if (!std::isdigit(c))
return false;
- strSec[i] = c;
+ strSec[j] = c;
}
strSec[kSubSecondLength] = '\0';
diff --git a/fxjs/xfa/cjx_tree.cpp b/fxjs/xfa/cjx_tree.cpp
index 23f76583ed..5921f8bbe8 100644
--- a/fxjs/xfa/cjx_tree.cpp
+++ b/fxjs/xfa/cjx_tree.cpp
@@ -239,13 +239,13 @@ void CJX_Tree::ResolveNodeList(CFXJSE_Value* pValue,
if (resolveNodeRS.pScriptAttribute &&
resolveNodeRS.pScriptAttribute->eValueType == XFA_ScriptType::Object) {
for (auto& pObject : resolveNodeRS.objects) {
- auto pValue =
+ auto innerValue =
pdfium::MakeUnique<CFXJSE_Value>(pScriptContext->GetIsolate());
CJX_Object* jsObject = pObject->JSObject();
(jsObject->*(resolveNodeRS.pScriptAttribute->callback))(
- pValue.get(), false, resolveNodeRS.pScriptAttribute->attribute);
+ innerValue.get(), false, resolveNodeRS.pScriptAttribute->attribute);
- CXFA_Object* obj = CFXJSE_Engine::ToObject(pValue.get());
+ CXFA_Object* obj = CFXJSE_Engine::ToObject(innerValue.get());
if (obj->IsNode())
pNodeList->Append(obj->AsNode());
}
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index affdca2b6e..e4beae4dfc 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -235,9 +235,9 @@ void CXFA_FFDocView::ResetNode(CXFA_Node* pNode) {
if (pFormNode->GetElementType() != XFA_Element::Field &&
pFormNode->GetElementType() != XFA_Element::ExclGroup) {
CXFA_ReadyNodeIterator it(pFormNode);
- while (CXFA_Node* pNode = it.MoveToNext()) {
- bChanged |= ResetSingleNodeData(pNode);
- if (pNode->GetElementType() == XFA_Element::ExclGroup)
+ while (CXFA_Node* next_node = it.MoveToNext()) {
+ bChanged |= ResetSingleNodeData(next_node);
+ if (next_node->GetElementType() == XFA_Element::ExclGroup)
it.SkipTree();
}
}
diff --git a/xfa/fxfa/parser/cxfa_document_parser.cpp b/xfa/fxfa/parser/cxfa_document_parser.cpp
index d0f137da7c..7fd4ff1570 100644
--- a/xfa/fxfa/parser/cxfa_document_parser.cpp
+++ b/xfa/fxfa/parser/cxfa_document_parser.cpp
@@ -447,8 +447,7 @@ CXFA_Node* CXFA_DocumentParser::ParseAsXDPPacket_XDP(
m_pRootNode = pXFARootNode;
pXFARootNode->JSObject()->SetCData(XFA_Attribute::Name, L"xfa", false, false);
- CFX_XMLElement* pElement = ToXMLElement(pXMLDocumentNode);
- for (auto it : pElement->GetAttributes()) {
+ for (auto it : ToXMLElement(pXMLDocumentNode)->GetAttributes()) {
if (it.first == L"uuid")
pXFARootNode->JSObject()->SetCData(XFA_Attribute::Uuid, it.second, false,
false);
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index c41a1ac97a..7e582c0518 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -3985,10 +3985,10 @@ void CXFA_Node::SetItemState(int32_t nIndex,
int32_t iSel = -1;
std::vector<WideString> wsValueArray = GetSelectedItemsValue();
- auto it = std::find(wsValueArray.begin(), wsValueArray.end(),
- wsSaveTextArray[nIndex]);
- if (it != wsValueArray.end())
- iSel = it - wsValueArray.begin();
+ auto value_iter = std::find(wsValueArray.begin(), wsValueArray.end(),
+ wsSaveTextArray[nIndex]);
+ if (value_iter != wsValueArray.end())
+ iSel = value_iter - wsValueArray.begin();
if (IsChoiceListMultiSelect()) {
if (bSelected) {
@@ -4003,9 +4003,10 @@ void CXFA_Node::SetItemState(int32_t nIndex,
}
} else if (iSel >= 0) {
std::vector<int32_t> iSelArray = GetSelectedItems();
- auto it = std::find(iSelArray.begin(), iSelArray.end(), nIndex);
- if (it != iSelArray.end())
- iSelArray.erase(it);
+ auto selected_iter =
+ std::find(iSelArray.begin(), iSelArray.end(), nIndex);
+ if (selected_iter != iSelArray.end())
+ iSelArray.erase(selected_iter);
SetSelectedItems(iSelArray, bNotify, bScriptModify, bSyncData);
}
} else {