summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp6
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_cidfont.cpp19
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser.cpp35
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp38
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp14
-rw-r--r--core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp11
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp6
-rw-r--r--core/fpdfdoc/doc_annot.cpp4
-rw-r--r--core/fpdftext/fpdf_text_int.cpp21
-rw-r--r--core/fxcodec/codec/fx_codec_fax.cpp10
-rw-r--r--core/fxge/dib/fx_dib_composite.cpp107
-rw-r--r--core/fxge/dib/fx_dib_convert.cpp7
-rw-r--r--core/fxge/dib/fx_dib_transform.cpp2
-rw-r--r--core/fxge/ge/fx_ge_device.cpp4
-rw-r--r--fpdfsdk/formfiller/cffl_iformfiller.cpp6
-rw-r--r--fpdfsdk/fpdf_flatten.cpp4
-rw-r--r--fpdfsdk/fpdf_transformpage.cpp20
-rw-r--r--fpdfsdk/javascript/Field.cpp10
-rw-r--r--fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp4
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.cpp8
-rw-r--r--xfa/fde/cfde_txtedtengine.cpp8
-rw-r--r--xfa/fde/cfx_wordbreak.cpp12
-rw-r--r--xfa/fde/tto/fde_textout.cpp20
-rw-r--r--xfa/fgas/font/fgas_gefont.cpp8
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.cpp3
-rw-r--r--xfa/fgas/layout/fgas_textbreak.cpp8
-rw-r--r--xfa/fwl/basewidget/fwl_comboboximp.cpp28
-rw-r--r--xfa/fwl/basewidget/fwl_datetimepickerimp.cpp4
-rw-r--r--xfa/fwl/basewidget/fwl_listboximp.cpp4
-rw-r--r--xfa/fxbarcode/BC_TwoDimWriter.cpp5
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp8
-rw-r--r--xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp27
-rw-r--r--xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp10
-rw-r--r--xfa/fxbarcode/oned/BC_OneDimWriter.cpp5
-rw-r--r--xfa/fxfa/app/xfa_ffdocview.cpp7
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp22
-rw-r--r--xfa/fxfa/app/xfa_textlayout.cpp57
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.cpp104
-rw-r--r--xfa/fxfa/fm2js/xfa_fmparse.cpp6
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp8
-rw-r--r--xfa/fxfa/parser/xfa_document_serialize.cpp9
-rw-r--r--xfa/fxfa/parser/xfa_layout_itemlayout.cpp38
-rw-r--r--xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp35
-rw-r--r--xfa/fxfa/parser/xfa_object_imp.cpp26
-rw-r--r--xfa/fxfa/parser/xfa_script_imp.cpp14
45 files changed, 357 insertions, 455 deletions
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 994c1c8a5a..0a833a4835 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -779,11 +779,11 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator,
FX_CHAR offset_buf[20];
FXSYS_memset(offset_buf, 0, sizeof(offset_buf));
FXSYS_i64toa(m_PrevOffset, offset_buf, 10);
- int32_t len = (int32_t)FXSYS_strlen(offset_buf);
- if (pFile->AppendBlock(offset_buf, len) < 0) {
+ int32_t offset_len = (int32_t)FXSYS_strlen(offset_buf);
+ if (pFile->AppendBlock(offset_buf, offset_len) < 0) {
return FALSE;
}
- offset += len + 6;
+ offset += offset_len + 6;
}
FX_BOOL bPredictor = TRUE;
CPDF_FlateEncoder encoder(m_Buffer.GetBuffer(), m_Buffer.GetLength(), TRUE,
diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
index cde28fd534..194db8b25c 100644
--- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
@@ -682,17 +682,17 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph) {
if (!name) {
return charcode == 0 ? -1 : (int)charcode;
}
- uint16_t unicode = PDF_UnicodeFromAdobeName(name);
- if (unicode) {
+ uint16_t name_unicode = PDF_UnicodeFromAdobeName(name);
+ if (name_unicode) {
if (bMSUnicode) {
- index = FXFT_Get_Char_Index(face, unicode);
+ index = FXFT_Get_Char_Index(face, name_unicode);
} else if (bMacRoman) {
uint32_t maccode =
- FT_CharCodeFromUnicode(FXFT_ENCODING_APPLE_ROMAN, unicode);
+ FT_CharCodeFromUnicode(FXFT_ENCODING_APPLE_ROMAN, name_unicode);
index = !maccode ? FXFT_Get_Name_Index(face, (char*)name)
: FXFT_Get_Char_Index(face, maccode);
} else {
- return FXFT_Get_Char_Index(face, unicode);
+ return FXFT_Get_Char_Index(face, name_unicode);
}
} else {
return charcode == 0 ? -1 : (int)charcode;
@@ -815,16 +815,15 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray,
if (!pObj)
continue;
- if (CPDF_Array* pArray = pObj->AsArray()) {
+ if (CPDF_Array* pObjArray = pObj->AsArray()) {
if (width_status != 1)
return;
- for (size_t j = 0; j < pArray->GetCount(); j += nElements) {
+ for (size_t j = 0; j < pObjArray->GetCount(); j += nElements) {
result.Add(first_code);
result.Add(first_code);
- for (int k = 0; k < nElements; k++) {
- result.Add(pArray->GetIntegerAt(j + k));
- }
+ for (int k = 0; k < nElements; k++)
+ result.Add(pObjArray->GetIntegerAt(j + k));
first_code++;
}
width_status = 0;
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 52576043e3..4bd4a4d529 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -1139,31 +1139,16 @@ void CPDF_StreamContentParser::Handle_SetFont() {
CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
const CFX_ByteString& type,
const CFX_ByteString& name) {
- if (!m_pResources) {
- return NULL;
- }
- if (m_pResources == m_pPageResources) {
- CPDF_Dictionary* pList = m_pResources->GetDictBy(type);
- if (!pList) {
- return NULL;
- }
- CPDF_Object* pRes = pList->GetDirectObjectBy(name);
- return pRes;
- }
- CPDF_Dictionary* pList = m_pResources->GetDictBy(type);
- if (!pList) {
- if (!m_pPageResources) {
- return NULL;
- }
- CPDF_Dictionary* pList = m_pPageResources->GetDictBy(type);
- if (!pList) {
- return NULL;
- }
- CPDF_Object* pRes = pList->GetDirectObjectBy(name);
- return pRes;
- }
- CPDF_Object* pRes = pList->GetDirectObjectBy(name);
- return pRes;
+ if (!m_pResources)
+ return nullptr;
+ CPDF_Dictionary* pDict = m_pResources->GetDictBy(type);
+ if (pDict)
+ return pDict->GetDirectObjectBy(name);
+ if (m_pResources == m_pPageResources || !m_pPageResources)
+ return nullptr;
+
+ CPDF_Dictionary* pPageDict = m_pPageResources->GetDictBy(type);
+ return pPageDict ? pPageDict->GetDirectObjectBy(name) : nullptr;
}
CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) {
diff --git a/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp
index 054266765a..a4629dcf6b 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp
@@ -430,10 +430,9 @@ FX_BOOL CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
FXSYS_memset(test, 0, sizeof(test));
FXSYS_memset(tmpkey, 0, sizeof(tmpkey));
FXSYS_memcpy(test, ukey.c_str(), copy_len);
- for (int i = 19; i >= 0; i--) {
- for (int j = 0; j < key_len; j++) {
- tmpkey[j] = key[j] ^ i;
- }
+ for (int32_t i = 19; i >= 0; i--) {
+ for (int j = 0; j < key_len; j++)
+ tmpkey[j] = key[j] ^ static_cast<uint8_t>(i);
CRYPT_ArcFourCryptBlock(test, 32, tmpkey, key_len);
}
uint8_t md5[100];
@@ -457,14 +456,13 @@ CFX_ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
int32_t key_len) {
CFX_ByteString okey = m_pEncryptDict->GetStringBy("O");
uint8_t passcode[32];
- uint32_t i;
- for (i = 0; i < 32; i++) {
+ for (uint32_t i = 0; i < 32; i++) {
passcode[i] = i < pass_size ? owner_pass[i] : defpasscode[i - pass_size];
}
uint8_t digest[16];
CRYPT_MD5Generate(passcode, 32, digest);
if (m_Revision >= 3) {
- for (int i = 0; i < 50; i++) {
+ for (uint32_t i = 0; i < 50; i++) {
CRYPT_MD5Generate(digest, 16, digest);
}
}
@@ -485,12 +483,11 @@ CFX_ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
if (m_Revision == 2) {
CRYPT_ArcFourCryptBlock(okeybuf, okeylen, enckey, key_len);
} else {
- for (int i = 19; i >= 0; i--) {
+ for (int32_t i = 19; i >= 0; i--) {
uint8_t tempkey[32];
FXSYS_memset(tempkey, 0, sizeof(tempkey));
- for (int j = 0; j < m_KeyLen; j++) {
- tempkey[j] = enckey[j] ^ i;
- }
+ for (int j = 0; j < m_KeyLen; j++)
+ tempkey[j] = enckey[j] ^ static_cast<uint8_t>(i);
CRYPT_ArcFourCryptBlock(okeybuf, okeylen, tempkey, key_len);
}
}
@@ -553,30 +550,27 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
}
if (bDefault) {
uint8_t passcode[32];
- uint32_t i;
- for (i = 0; i < 32; i++) {
+ for (uint32_t i = 0; i < 32; i++) {
passcode[i] =
i < owner_size ? owner_pass[i] : defpasscode[i - owner_size];
}
uint8_t digest[16];
CRYPT_MD5Generate(passcode, 32, digest);
if (m_Revision >= 3) {
- for (int i = 0; i < 50; i++) {
+ for (uint32_t i = 0; i < 50; i++)
CRYPT_MD5Generate(digest, 16, digest);
- }
}
uint8_t enckey[32];
FXSYS_memcpy(enckey, digest, key_len);
- for (i = 0; i < 32; i++) {
+ for (uint32_t i = 0; i < 32; i++) {
passcode[i] = i < user_size ? user_pass[i] : defpasscode[i - user_size];
}
CRYPT_ArcFourCryptBlock(passcode, 32, enckey, key_len);
uint8_t tempkey[32];
if (m_Revision >= 3) {
- for (i = 1; i <= 19; i++) {
- for (int j = 0; j < key_len; j++) {
- tempkey[j] = enckey[j] ^ (uint8_t)i;
- }
+ for (uint8_t i = 1; i <= 19; i++) {
+ for (int j = 0; j < key_len; j++)
+ tempkey[j] = enckey[j] ^ i;
CRYPT_ArcFourCryptBlock(passcode, 32, tempkey, key_len);
}
}
@@ -601,9 +595,9 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CRYPT_MD5Finish(md5, digest);
CRYPT_ArcFourCryptBlock(digest, 16, m_EncryptKey, key_len);
uint8_t tempkey[32];
- for (int i = 1; i <= 19; i++) {
+ for (uint8_t i = 1; i <= 19; i++) {
for (int j = 0; j < key_len; j++) {
- tempkey[j] = m_EncryptKey[j] ^ (uint8_t)i;
+ tempkey[j] = m_EncryptKey[j] ^ i;
}
CRYPT_ArcFourCryptBlock(digest, 16, tempkey, key_len);
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
index 13a9972425..0eeb4a1afa 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
@@ -381,7 +381,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth)
return nullptr;
- FX_FILESIZE SavedPos = m_Pos;
+ FX_FILESIZE SavedObjPos = m_Pos;
bool bIsNumber;
CFX_ByteString word = GetNextWord(&bIsNumber);
if (word.GetLength() == 0)
@@ -392,10 +392,8 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
CFX_ByteString nextword = GetNextWord(&bIsNumber);
if (bIsNumber) {
CFX_ByteString nextword2 = GetNextWord(nullptr);
- if (nextword2 == "R") {
- uint32_t objnum = FXSYS_atoui(word.c_str());
- return new CPDF_Reference(pObjList, objnum);
- }
+ if (nextword2 == "R")
+ return new CPDF_Reference(pObjList, FXSYS_atoui(word.c_str()));
}
m_Pos = SavedPos;
return new CPDF_Number(word.AsStringC());
@@ -492,7 +490,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
}
if (word == ">>")
- m_Pos = SavedPos;
+ m_Pos = SavedObjPos;
return nullptr;
}
@@ -505,7 +503,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
if (++s_CurrentRecursionDepth > kParserMaxRecursionDepth)
return nullptr;
- FX_FILESIZE SavedPos = m_Pos;
+ FX_FILESIZE SavedObjPos = m_Pos;
bool bIsNumber;
CFX_ByteString word = GetNextWord(&bIsNumber);
if (word.GetLength() == 0)
@@ -605,7 +603,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
}
if (word == ">>")
- m_Pos = SavedPos;
+ m_Pos = SavedObjPos;
return nullptr;
}
diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index e9f5a6d468..7c489a35dc 100644
--- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -447,12 +447,11 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
if (unicode == 0x1b) {
i += 2;
while (i < max_chars * 2) {
- uint16_t unicode = bBE ? (uni_str[i] << 8 | uni_str[i + 1])
- : (uni_str[i + 1] << 8 | uni_str[i]);
+ uint16_t unicode2 = bBE ? (uni_str[i] << 8 | uni_str[i + 1])
+ : (uni_str[i + 1] << 8 | uni_str[i]);
i += 2;
- if (unicode == 0x1b) {
+ if (unicode2 == 0x1b)
break;
- }
}
} else {
dest_buf[dest_pos++] = unicode;
@@ -506,9 +505,9 @@ CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len) {
dest_buf2[0] = 0xfe;
dest_buf2[1] = 0xff;
dest_buf2 += 2;
- for (int i = 0; i < len; i++) {
+ for (int j = 0; j < len; j++) {
*dest_buf2++ = pString[i] >> 8;
- *dest_buf2++ = (uint8_t)pString[i];
+ *dest_buf2++ = (uint8_t)pString[j];
}
result.ReleaseBuffer(encLen);
return result;
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index 75f6a231a4..4071a115df 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -381,7 +381,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) {
}
return ret1;
}
- FXCODEC_STATUS ret = pJbig2Module->ContinueDecode(m_pJbig2Context, pPause);
+ ret = pJbig2Module->ContinueDecode(m_pJbig2Context, pPause);
if (ret < 0) {
m_pCachedBitmap.reset();
m_pGlobalStream.reset();
@@ -864,8 +864,8 @@ void CPDF_DIBSource::LoadPalette() {
m_pColorSpace->CountComponents() > 1) {
int nComponents = m_pColorSpace->CountComponents();
std::vector<FX_FLOAT> temp_buf(nComponents);
- for (int i = 0; i < nComponents; i++) {
- temp_buf[i] = *color_value;
+ for (int k = 0; k < nComponents; k++) {
+ temp_buf[k] = *color_value;
}
m_pColorSpace->GetRGB(temp_buf.data(), R, G, B);
} else {
diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp
index db0322c768..f8bad07ceb 100644
--- a/core/fpdfdoc/doc_annot.cpp
+++ b/core/fpdfdoc/doc_annot.cpp
@@ -179,8 +179,8 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict,
if (as.IsEmpty()) {
CFX_ByteString value = pAnnotDict->GetStringBy("V");
if (value.IsEmpty()) {
- CPDF_Dictionary* pDict = pAnnotDict->GetDictBy("Parent");
- value = pDict ? pDict->GetStringBy("V") : CFX_ByteString();
+ CPDF_Dictionary* pParentDict = pAnnotDict->GetDictBy("Parent");
+ value = pParentDict ? pParentDict->GetStringBy("V") : CFX_ByteString();
}
if (value.IsEmpty() || !pDict->KeyExist(value))
as = "Off";
diff --git a/core/fpdftext/fpdf_text_int.cpp b/core/fpdftext/fpdf_text_int.cpp
index 136c44b5ed..1f8ab75e85 100644
--- a/core/fpdftext/fpdf_text_int.cpp
+++ b/core/fpdftext/fpdf_text_int.cpp
@@ -988,19 +988,16 @@ void CPDF_TextPage::ProcessTextObject(
}
int i = 0;
for (i = count - 1; i >= 0; i--) {
- PDFTEXT_Obj prev_Obj = m_LineObj.GetAt(i);
- CFX_Matrix prev_matrix;
- prev_Obj.m_pTextObj->GetTextMatrix(&prev_matrix);
- FX_FLOAT Prev_x = prev_Obj.m_pTextObj->GetPosX(),
- Prev_y = prev_Obj.m_pTextObj->GetPosY();
- prev_Obj.m_formMatrix.Transform(Prev_x, Prev_y);
+ PDFTEXT_Obj prev_text_obj = m_LineObj.GetAt(i);
+ FX_FLOAT Prev_x = prev_text_obj.m_pTextObj->GetPosX(),
+ Prev_y = prev_text_obj.m_pTextObj->GetPosY();
+ prev_text_obj.m_formMatrix.Transform(Prev_x, Prev_y);
m_DisplayMatrix.Transform(Prev_x, Prev_y);
if (this_x >= Prev_x) {
- if (i == count - 1) {
+ if (i == count - 1)
m_LineObj.Add(Obj);
- } else {
+ else
m_LineObj.InsertAt(i + 1, Obj);
- }
break;
}
}
@@ -1611,9 +1608,9 @@ int CPDF_TextPage::ProcessInsertObject(const CPDF_TextObject* pObj,
if (re.Contains(pObj->GetPosX(), pObj->GetPosY())) {
bNewline = FALSE;
} else {
- CFX_FloatRect re(0, pObj->m_Bottom, 1000, pObj->m_Top);
- if (re.Contains(m_pPreTextObj->GetPosX(),
- m_pPreTextObj->GetPosY())) {
+ CFX_FloatRect rect(0, pObj->m_Bottom, 1000, pObj->m_Top);
+ if (rect.Contains(m_pPreTextObj->GetPosX(),
+ m_pPreTextObj->GetPosY())) {
bNewline = FALSE;
}
}
diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp
index 97b7ee2ad6..59010391c5 100644
--- a/core/fxcodec/codec/fx_codec_fax.cpp
+++ b/core/fxcodec/codec/fx_codec_fax.cpp
@@ -359,16 +359,16 @@ FX_BOOL FaxG4GetRow(const uint8_t* src_buf,
if (bitpos >= bitsize) {
return FALSE;
}
- FX_BOOL bit1 = NEXTBIT;
+ FX_BOOL next_bit1 = NEXTBIT;
if (bitpos >= bitsize) {
return FALSE;
}
- FX_BOOL bit2 = NEXTBIT;
- if (bit1 && bit2) {
+ FX_BOOL next_bit2 = NEXTBIT;
+ if (next_bit1 && next_bit2) {
v_delta = 2;
- } else if (bit1) {
+ } else if (next_bit1) {
v_delta = -2;
- } else if (bit2) {
+ } else if (next_bit2) {
if (bitpos >= bitsize) {
return FALSE;
}
diff --git a/core/fxge/dib/fx_dib_composite.cpp b/core/fxge/dib/fx_dib_composite.cpp
index 282b93d6da..28f6e49044 100644
--- a/core/fxge/dib/fx_dib_composite.cpp
+++ b/core/fxge/dib/fx_dib_composite.cpp
@@ -2512,11 +2512,10 @@ void CompositeRow_ByteMask2Argb(uint8_t* dest_scan,
int alpha_ratio = src_alpha * 255 / dest_alpha;
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
int blended_colors[3];
- uint8_t src_scan[3];
- src_scan[0] = src_b;
- src_scan[1] = src_g;
- src_scan[2] = src_r;
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors);
*dest_scan =
FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio);
dest_scan++;
@@ -2583,11 +2582,10 @@ void CompositeRow_ByteMask2Rgba(uint8_t* dest_scan,
int alpha_ratio = src_alpha * 255 / dest_alpha;
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
int blended_colors[3];
- uint8_t src_scan[3];
- src_scan[0] = src_b;
- src_scan[1] = src_g;
- src_scan[2] = src_r;
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors);
*dest_scan =
FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio);
dest_scan++;
@@ -2644,11 +2642,10 @@ void CompositeRow_ByteMask2Rgb(uint8_t* dest_scan,
}
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
int blended_colors[3];
- uint8_t src_scan[3];
- src_scan[0] = src_b;
- src_scan[1] = src_g;
- src_scan[2] = src_r;
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors);
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha);
dest_scan++;
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha);
@@ -2791,11 +2788,10 @@ void CompositeRow_BitMask2Argb(uint8_t* dest_scan,
int alpha_ratio = src_alpha * 255 / dest_alpha;
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
int blended_colors[3];
- uint8_t src_scan[3];
- src_scan[0] = src_b;
- src_scan[1] = src_g;
- src_scan[2] = src_r;
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors);
*dest_scan =
FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], alpha_ratio);
dest_scan++;
@@ -2866,11 +2862,10 @@ void CompositeRow_BitMask2Rgb(uint8_t* dest_scan,
}
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
int blended_colors[3];
- uint8_t src_scan[3];
- src_scan[0] = src_b;
- src_scan[1] = src_g;
- src_scan[2] = src_r;
- RGB_Blend(blend_type, src_scan, dest_scan, blended_colors);
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ RGB_Blend(blend_type, scan, dest_scan, blended_colors);
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[0], src_alpha);
dest_scan++;
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, blended_colors[1], src_alpha);
@@ -3584,15 +3579,11 @@ void CompositeRow_ByteMask2Argb_RgbByteOrder(uint8_t* dest_scan,
int alpha_ratio = src_alpha * 255 / dest_alpha;
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
int blended_colors[3];
- uint8_t src_scan[3];
- uint8_t dest_scan_o[3];
- src_scan[0] = src_b;
- src_scan[1] = src_g;
- src_scan[2] = src_r;
- dest_scan_o[0] = dest_scan[2];
- dest_scan_o[1] = dest_scan[1];
- dest_scan_o[2] = dest_scan[0];
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]};
+ RGB_Blend(blend_type, scan, dest_scan_o, blended_colors);
dest_scan[2] =
FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio);
dest_scan[1] =
@@ -3641,15 +3632,11 @@ void CompositeRow_ByteMask2Rgb_RgbByteOrder(uint8_t* dest_scan,
}
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
int blended_colors[3];
- uint8_t src_scan[3];
- uint8_t dest_scan_o[3];
- src_scan[0] = src_b;
- src_scan[1] = src_g;
- src_scan[2] = src_r;
- dest_scan_o[0] = dest_scan[2];
- dest_scan_o[1] = dest_scan[1];
- dest_scan_o[2] = dest_scan[0];
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]};
+ RGB_Blend(blend_type, scan, dest_scan_o, blended_colors);
dest_scan[2] =
FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha);
dest_scan[1] =
@@ -3715,15 +3702,11 @@ void CompositeRow_BitMask2Argb_RgbByteOrder(uint8_t* dest_scan,
int alpha_ratio = src_alpha * 255 / dest_alpha;
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
int blended_colors[3];
- uint8_t src_scan[3];
- uint8_t dest_scan_o[3];
- src_scan[0] = src_b;
- src_scan[1] = src_g;
- src_scan[2] = src_r;
- dest_scan_o[0] = dest_scan[2];
- dest_scan_o[1] = dest_scan[1];
- dest_scan_o[2] = dest_scan[0];
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]};
+ RGB_Blend(blend_type, scan, dest_scan_o, blended_colors);
dest_scan[2] =
FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], alpha_ratio);
dest_scan[1] =
@@ -3788,15 +3771,11 @@ void CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan,
}
if (blend_type >= FXDIB_BLEND_NONSEPARABLE) {
int blended_colors[3];
- uint8_t src_scan[3];
- uint8_t dest_scan_o[3];
- src_scan[0] = src_b;
- src_scan[1] = src_g;
- src_scan[2] = src_r;
- dest_scan_o[0] = dest_scan[2];
- dest_scan_o[1] = dest_scan[1];
- dest_scan_o[2] = dest_scan[0];
- RGB_Blend(blend_type, src_scan, dest_scan_o, blended_colors);
+ uint8_t scan[3] = {static_cast<uint8_t>(src_b),
+ static_cast<uint8_t>(src_g),
+ static_cast<uint8_t>(src_r)};
+ uint8_t dest_scan_o[3] = {dest_scan[2], dest_scan[1], dest_scan[0]};
+ RGB_Blend(blend_type, scan, dest_scan_o, blended_colors);
dest_scan[2] =
FXDIB_ALPHA_MERGE(dest_scan[2], blended_colors[0], src_alpha);
dest_scan[1] =
@@ -4710,7 +4689,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left,
ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0);
int left_shift = rect.left % 8;
int right_shift = rect.right % 8;
- int width = rect.right / 8 - rect.left / 8;
+ int new_width = rect.right / 8 - rect.left / 8;
int index = 0;
if (m_pPalette) {
for (int i = 0; i < 2; i++) {
@@ -4726,8 +4705,8 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left,
uint8_t* dest_scan_top_r = (uint8_t*)GetScanline(row) + rect.right / 8;
uint8_t left_flag = *dest_scan_top & (255 << (8 - left_shift));
uint8_t right_flag = *dest_scan_top_r & (255 >> right_shift);
- if (width) {
- FXSYS_memset(dest_scan_top + 1, index ? 255 : 0, width - 1);
+ if (new_width) {
+ FXSYS_memset(dest_scan_top + 1, index ? 255 : 0, new_width - 1);
if (!index) {
*dest_scan_top &= left_flag;
*dest_scan_top_r &= right_flag;
diff --git a/core/fxge/dib/fx_dib_convert.cpp b/core/fxge/dib/fx_dib_convert.cpp
index da380ee567..8937816531 100644
--- a/core/fxge/dib/fx_dib_convert.cpp
+++ b/core/fxge/dib/fx_dib_convert.cpp
@@ -433,7 +433,6 @@ FX_BOOL ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf,
int src_top,
uint32_t* dst_plt) {
int bpp = pSrcBitmap->GetBPP() / 8;
- int row, col;
CFX_Palette palette;
palette.BuildPalette(pSrcBitmap);
uint32_t* cLut = palette.GetColorLut();
@@ -446,7 +445,7 @@ FX_BOOL ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf,
if (lut > 256) {
int err, min_err;
int lut_256 = lut - 256;
- for (row = 0; row < lut_256; row++) {
+ for (int row = 0; row < lut_256; row++) {
min_err = 1000000;
uint8_t r, g, b;
_ColorDecode(cLut[row], r, g, b);
@@ -466,11 +465,11 @@ FX_BOOL ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf,
}
}
int32_t lut_1 = lut - 1;
- for (row = 0; row < height; row++) {
+ for (int row = 0; row < height; row++) {
uint8_t* src_scan =
(uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left;
uint8_t* dest_scan = dest_buf + row * dest_pitch;
- for (col = 0; col < width; col++) {
+ for (int col = 0; col < width; col++) {
uint8_t* src_port = src_scan + col * bpp;
int r = src_port[2] & 0xf0;
int g = src_port[1] & 0xf0;
diff --git a/core/fxge/dib/fx_dib_transform.cpp b/core/fxge/dib/fx_dib_transform.cpp
index f9b4250deb..914ca58013 100644
--- a/core/fxge/dib/fx_dib_transform.cpp
+++ b/core/fxge/dib/fx_dib_transform.cpp
@@ -624,7 +624,6 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) {
}
} else {
int Bpp = m_Storer.GetBitmap()->GetBPP() / 8;
- int destBpp = pTransformed->GetBPP() / 8;
if (Bpp == 1) {
uint32_t argb[256];
FX_ARGB* pPal = m_Storer.GetBitmap()->GetPalette();
@@ -643,6 +642,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) {
}
}
}
+ int destBpp = pTransformed->GetBPP() / 8;
if (!(m_Flags & FXDIB_DOWNSAMPLE) &&
!(m_Flags & FXDIB_BICUBIC_INTERPOL)) {
CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
diff --git a/core/fxge/ge/fx_ge_device.cpp b/core/fxge/ge/fx_ge_device.cpp
index b9bd133e57..96e0e55cd1 100644
--- a/core/fxge/ge/fx_ge_device.cpp
+++ b/core/fxge/ge/fx_ge_device.cpp
@@ -388,8 +388,8 @@ FX_BOOL CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
blend_mode, nullptr, FALSE, nullptr)) {
return FALSE;
}
- FX_RECT src_rect(0, 0, bg_pixel_width, bg_pixel_height);
- return m_pDeviceDriver->SetDIBits(&background, 0, &src_rect, dest_rect.left,
+ FX_RECT rect(0, 0, bg_pixel_width, bg_pixel_height);
+ return m_pDeviceDriver->SetDIBits(&background, 0, &rect, dest_rect.left,
dest_rect.top, FXDIB_BLEND_NORMAL);
}
return m_pDeviceDriver->SetDIBits(pBitmap, 0, &src_rect, dest_rect.left,
diff --git a/fpdfsdk/formfiller/cffl_iformfiller.cpp b/fpdfsdk/formfiller/cffl_iformfiller.cpp
index 06f24182ce..9dcc734a24 100644
--- a/fpdfsdk/formfiller/cffl_iformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_iformfiller.cpp
@@ -440,9 +440,9 @@ FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
m_bNotifying = FALSE;
if (pWidget->IsAppModified()) {
- if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) {
- pFormFiller->ResetPDFWindow(pPageView,
- nValueAge == pWidget->GetValueAge());
+ if (CFFL_FormFiller* pFiller = GetFormFiller(pWidget, FALSE)) {
+ pFiller->ResetPDFWindow(pPageView,
+ nValueAge == pWidget->GetValueAge());
}
}
}
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index fe81246a0b..2d11bfee7b 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -482,8 +482,8 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
CFX_ByteString sFormName;
sFormName.Format("F%d", i);
- uint32_t dwObjNum = pDocument->AddIndirectObject(pObj);
- pXObject->SetAtReference(sFormName, pDocument, dwObjNum);
+ uint32_t dwStreamObjNum = pDocument->AddIndirectObject(pObj);
+ pXObject->SetAtReference(sFormName, pDocument, dwStreamObjNum);
CPDF_StreamAcc acc;
acc.LoadAllData(pNewXObject);
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index 5fe6e4ebcc..b78c79c3fc 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -138,7 +138,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
pDoc->AddIndirectObject(pEndStream);
CPDF_Array* pContentArray = nullptr;
- if (CPDF_Array* pArray = ToArray(pContentObj)) {
+ CPDF_Array* pArray = ToArray(pContentObj);
+ if (pArray) {
pContentArray = pArray;
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
@@ -146,8 +147,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
} else if (CPDF_Reference* pReference = ToReference(pContentObj)) {
CPDF_Object* pDirectObj = pReference->GetDirect();
if (pDirectObj) {
- if (CPDF_Array* pArray = pDirectObj->AsArray()) {
- pContentArray = pArray;
+ CPDF_Array* pObjArray = pDirectObj->AsArray();
+ if (pObjArray) {
+ pContentArray = pObjArray;
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
pContentArray->AddReference(pDoc, pEndStream);
@@ -175,8 +177,8 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
CPDF_Dictionary* pDict = nullptr;
if (pObj->IsDictionary())
pDict = pObj->AsDictionary();
- else if (CPDF_Stream* pStream = pObj->AsStream())
- pDict = pStream->GetDict();
+ else if (CPDF_Stream* pObjStream = pObj->AsStream())
+ pDict = pObjStream->GetDict();
else
continue;
@@ -307,15 +309,17 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,
pDoc->AddIndirectObject(pStream);
CPDF_Array* pContentArray = nullptr;
- if (CPDF_Array* pArray = ToArray(pContentObj)) {
+ CPDF_Array* pArray = ToArray(pContentObj);
+ if (pArray) {
pContentArray = pArray;
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
} else if (CPDF_Reference* pReference = ToReference(pContentObj)) {
CPDF_Object* pDirectObj = pReference->GetDirect();
if (pDirectObj) {
- if (CPDF_Array* pArray = pDirectObj->AsArray()) {
- pContentArray = pArray;
+ CPDF_Array* pObjArray = pDirectObj->AsArray();
+ if (pObjArray) {
+ pContentArray = pObjArray;
CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
} else if (pDirectObj->IsStream()) {
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index 2a739deed0..5808982b43 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -144,9 +144,9 @@ void Field::ParseFieldName(const std::wstring& strFieldNameParsed,
std::wstring suffixal = strFieldNameParsed.substr(iStart + 1);
iControlNo = FXSYS_wtoi(suffixal.c_str());
if (iControlNo == 0) {
- int iStart;
- while ((iStart = suffixal.find_last_of(L" ")) != -1) {
- suffixal.erase(iStart, 1);
+ int iSpaceStart;
+ while ((iSpaceStart = suffixal.find_last_of(L" ")) != -1) {
+ suffixal.erase(iSpaceStart, 1);
}
if (suffixal.compare(L"0") != 0) {
@@ -249,8 +249,8 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument,
FX_BOOL bRefresh) {
ASSERT(pFormControl);
- CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl);
+ CPDFSDK_InterForm* pForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
+ CPDFSDK_Widget* pWidget = pForm->GetWidget(pFormControl);
if (pWidget) {
if (bResetAP) {
diff --git a/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp b/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp
index 161487f356..a8358c4ee9 100644
--- a/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp
+++ b/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp
@@ -64,7 +64,7 @@ TEST_F(FXJSV8EmbedderTest, MultipleRutimes) {
{
v8::Local<v8::Context> context1 =
v8::Local<v8::Context>::New(isolate(), global_context1);
- v8::Context::Scope context_scope(context1);
+ v8::Context::Scope context_scope1(context1);
ExecuteInCurrentContext(kScript1);
CheckAssignmentInCurrentContext(kExpected1);
}
@@ -73,7 +73,7 @@ TEST_F(FXJSV8EmbedderTest, MultipleRutimes) {
{
v8::Local<v8::Context> context2 =
v8::Local<v8::Context>::New(isolate(), global_context2);
- v8::Context::Scope context_scope(context2);
+ v8::Context::Scope context_scope2(context2);
ExecuteInCurrentContext(kScript2);
CheckAssignmentInCurrentContext(kExpected2);
}
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp
index e39b6c13c7..eec1fd98c7 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp
@@ -294,13 +294,13 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
<< sEditAfter.AsStringC() << "ET\n";
if (sText.GetLength() > 0) {
- CFX_FloatRect rcClient = GetClientRect();
+ CFX_FloatRect rect = GetClientRect();
sAppStream << "q\n/Tx BMC\n";
if (!HasFlag(PES_TEXTOVERFLOW))
- sAppStream << rcClient.left << " " << rcClient.bottom << " "
- << rcClient.right - rcClient.left << " "
- << rcClient.top - rcClient.bottom << " re W n\n";
+ sAppStream << rect.left << " " << rect.bottom << " "
+ << rect.right - rect.left << " " << rect.top - rect.bottom
+ << " re W n\n";
sAppStream << sText;
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp
index ecdaf67120..4bdf8df1c0 100644
--- a/xfa/fde/cfde_txtedtengine.cpp
+++ b/xfa/fde/cfde_txtedtengine.cpp
@@ -899,10 +899,10 @@ void CFDE_TxtEdtEngine::Inner_DeleteRange(int32_t nStart, int32_t nCount) {
int32_t nTotalCharCount = 0;
int32_t i = 0;
for (i = ParagPosBgn.nParagIndex; i <= ParagPosEnd.nParagIndex; i++) {
- CFDE_TxtEdtParag* pParag = m_ParagPtrArray[i];
- pParag->CalcLines();
- nTotalLineCount += pParag->GetLineCount();
- nTotalCharCount += pParag->GetTextLength();
+ CFDE_TxtEdtParag* pTextParag = m_ParagPtrArray[i];
+ pTextParag->CalcLines();
+ nTotalLineCount += pTextParag->GetLineCount();
+ nTotalCharCount += pTextParag->GetTextLength();
}
m_pTxtBuf->Delete(nStart, nCount);
int32_t nNextParagIndex = (ParagPosBgn.nCharIndex == 0 && bLastParag)
diff --git a/xfa/fde/cfx_wordbreak.cpp b/xfa/fde/cfx_wordbreak.cpp
index 5b220df60e..a9aa75b622 100644
--- a/xfa/fde/cfx_wordbreak.cpp
+++ b/xfa/fde/cfx_wordbreak.cpp
@@ -2859,17 +2859,14 @@ FX_BOOL CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter,
}
if (!(bFromNext || pIter->IsEOF(bPrev))) {
pIter->Next(!bPrev);
- FX_WCHAR wcTemp = pIter->GetChar();
- ePreType = GetWordBreakProperty(wcTemp);
+ ePreType = GetWordBreakProperty(pIter->GetChar());
pIter->Next(bPrev);
}
- FX_WCHAR wcTemp = pIter->GetChar();
- eCurType = GetWordBreakProperty(wcTemp);
+ eCurType = GetWordBreakProperty(pIter->GetChar());
FX_BOOL bFirst = TRUE;
do {
pIter->Next(bPrev);
- FX_WCHAR wcTemp = pIter->GetChar();
- eNextType = GetWordBreakProperty(wcTemp);
+ eNextType = GetWordBreakProperty(pIter->GetChar());
uint16_t wBreak =
gs_FX_WordBreak_Table[eCurType] & ((uint16_t)(1 << eNextType));
if (wBreak) {
@@ -2929,8 +2926,7 @@ FX_BOOL CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter,
}
ASSERT(nFlags <= 2);
pIter->Next(bPrev);
- wcTemp = pIter->GetChar();
- eNextType = (FX_WordBreakProp)GetWordBreakProperty(wcTemp);
+ eNextType = (FX_WordBreakProp)GetWordBreakProperty(pIter->GetChar());
if (!((nFlags == 1 && eNextType == FX_WordBreakProp_ALetter) ||
(nFlags == 2 && eNextType == FX_WordBreakProp_Numberic))) {
pIter->Next(!bPrev);
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp
index c7d82ac0f4..1cf9226409 100644
--- a/xfa/fde/tto/fde_textout.cpp
+++ b/xfa/fde/tto/fde_textout.cpp
@@ -735,16 +735,14 @@ void CFDE_TextOut::DoAlignment(const CFX_RectF& rect) {
FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout);
FX_FLOAT fLineStopS = bVertical ? rect.right() : rect.bottom();
int32_t iLines = m_ttoLines.GetSize();
- if (iLines < 1) {
+ if (iLines < 1)
return;
- }
- CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(iLines - 1);
- FDE_TTOPIECE* pPiece = pLine->GetPtrAt(0);
- if (pPiece == NULL) {
+ FDE_TTOPIECE* pFirstPiece = m_ttoLines.GetPtrAt(iLines - 1)->GetPtrAt(0);
+ if (!pFirstPiece)
return;
- }
+
FX_FLOAT fLineStopD =
- bVertical ? pPiece->rtPiece.right() : pPiece->rtPiece.bottom();
+ bVertical ? pFirstPiece->rtPiece.right() : pFirstPiece->rtPiece.bottom();
FX_FLOAT fInc = fLineStopS - fLineStopD;
if (m_iAlignment >= FDE_TTOALIGNMENT_CenterLeft &&
m_iAlignment < FDE_TTOALIGNMENT_BottomLeft) {
@@ -752,19 +750,17 @@ void CFDE_TextOut::DoAlignment(const CFX_RectF& rect) {
} else if (m_iAlignment < FDE_TTOALIGNMENT_CenterLeft) {
fInc = 0.0f;
}
- if (fInc < 1.0f) {
+ if (fInc < 1.0f)
return;
- }
for (int32_t i = 0; i < iLines; i++) {
CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(i);
int32_t iPieces = pLine->GetSize();
for (int32_t j = 0; j < iPieces; j++) {
FDE_TTOPIECE* pPiece = pLine->GetPtrAt(j);
- if (bVertical) {
+ if (bVertical)
pPiece->rtPiece.left += fInc;
- } else {
+ else
pPiece->rtPiece.top += fInc;
- }
}
}
}
diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp
index 803bede6e5..5432e527d2 100644
--- a/xfa/fgas/font/fgas_gefont.cpp
+++ b/xfa/fgas/font/fgas_gefont.cpp
@@ -494,11 +494,11 @@ int32_t CFX_GEFont::GetGlyphIndex(FX_WCHAR wUnicode,
CFX_WideString wsFamily;
GetFamilyName(wsFamily);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- IFX_Font* pFont = m_pFontMgr->GetDefFontByUnicode(wUnicode, GetFontStyles(),
- wsFamily.c_str());
+ pFont = m_pFontMgr->GetDefFontByUnicode(wUnicode, GetFontStyles(),
+ wsFamily.c_str());
#else
- IFX_Font* pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(),
- wsFamily.c_str());
+ pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(),
+ wsFamily.c_str());
if (!pFont)
pFont = m_pFontMgr->GetFontByUnicode(wUnicode, GetFontStyles(), NULL);
#endif
diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp
index dcb3c3953a..30a9c5a150 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.cpp
+++ b/xfa/fgas/layout/fgas_rtfbreak.cpp
@@ -1095,8 +1095,7 @@ void CFX_RTFBreak::SplitTextLine(CFX_RTFLine* pCurLine,
pNextLine->m_iStart = pCurLine->m_iStart;
pNextLine->m_iWidth = pCurLine->GetLineEnd() - iEndPos;
pCurLine->m_iWidth = iEndPos;
- CFX_RTFChar* tc = curChars.GetDataPtr(iCharPos - 1);
- tc->m_nBreakType = FX_LBT_UNKNOWN;
+ curChars.GetDataPtr(iCharPos - 1)->m_nBreakType = FX_LBT_UNKNOWN;
iCount = nextChars.GetSize();
CFX_RTFChar* pNextChars = nextChars.GetData();
for (int32_t i = 0; i < iCount; i++) {
diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp
index c5a1c2fdcc..d30d105253 100644
--- a/xfa/fgas/layout/fgas_textbreak.cpp
+++ b/xfa/fgas/layout/fgas_textbreak.cpp
@@ -1439,10 +1439,10 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun,
uint32_t dwLastProps = FX_GetUnicodeProperties(wLast);
if ((dwLastProps & FX_CHARTYPEBITSMASK) ==
FX_CHARTYPE_Combination) {
- CFX_Rect rtBBox;
- rtBBox.Reset();
- if (pFont->GetCharBBox(wLast, rtBBox, FALSE)) {
- pCharPos->m_OriginY -= fFontSize * rtBBox.height / iMaxHeight;
+ CFX_Rect rtBox;
+ rtBox.Reset();
+ if (pFont->GetCharBBox(wLast, rtBox, FALSE)) {
+ pCharPos->m_OriginY -= fFontSize * rtBox.height / iMaxHeight;
}
}
}
diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp
index 34e98fa38a..8d4ac452f7 100644
--- a/xfa/fwl/basewidget/fwl_comboboximp.cpp
+++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp
@@ -660,20 +660,20 @@ FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics,
IFWL_ListItem* hItem = pData->GetItem(m_pInterface, m_iCurSel);
static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
->GetItemText(hItem, wsText);
- CFWL_ThemeText param;
- param.m_pWidget = m_pInterface;
- param.m_iPart = CFWL_Part::Caption;
- param.m_dwStates = m_iBtnState;
- param.m_pGraphics = pGraphics;
- param.m_matrix.Concat(*pMatrix);
- param.m_rtPart = rtTextBk;
- param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused)
- ? CFWL_PartState_Selected
- : CFWL_PartState_Normal;
- param.m_wsText = wsText;
- param.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine;
- param.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft;
- pTheme->DrawText(&param);
+ CFWL_ThemeText theme_text;
+ theme_text.m_pWidget = m_pInterface;
+ theme_text.m_iPart = CFWL_Part::Caption;
+ theme_text.m_dwStates = m_iBtnState;
+ theme_text.m_pGraphics = pGraphics;
+ theme_text.m_matrix.Concat(*pMatrix);
+ theme_text.m_rtPart = rtTextBk;
+ theme_text.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused)
+ ? CFWL_PartState_Selected
+ : CFWL_PartState_Normal;
+ theme_text.m_wsText = wsText;
+ theme_text.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine;
+ theme_text.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft;
+ pTheme->DrawText(&theme_text);
}
}
{
diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp
index 6e2b4dee99..c6cef1c37d 100644
--- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp
+++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp
@@ -326,10 +326,6 @@ void CFWL_DateTimeCalendarImpDelegate::OnLButtonUpEx(CFWL_MsgMouse* pMsg) {
iCurSel);
pPicker->ShowMonthCalendar(FALSE);
} else if (m_bFlag && (!rt.Contains(pMsg->m_fx, pMsg->m_fy))) {
- IFWL_DateTimePicker* pIPicker =
- static_cast<IFWL_DateTimePicker*>(m_pOwner->m_pOuter);
- CFWL_DateTimePickerImp* pPicker =
- static_cast<CFWL_DateTimePickerImp*>(pIPicker->GetImpl());
pPicker->ShowMonthCalendar(FALSE);
}
m_bFlag = 0;
diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp
index 639a46c87b..34628aa82c 100644
--- a/xfa/fwl/basewidget/fwl_listboximp.cpp
+++ b/xfa/fwl/basewidget/fwl_listboximp.cpp
@@ -743,9 +743,9 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) {
if (!bAutoSize) {
CFX_RectF rtItem;
rtItem.Set(m_rtClient.left, m_rtClient.top + fs.y, r.width, r.height);
- IFWL_ListBoxDP* pData =
+ IFWL_ListBoxDP* pBox =
static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
- pData->SetItemRect(m_pInterface, pItem, rtItem);
+ pBox->SetItemRect(m_pInterface, pItem, rtItem);
}
fs.y += r.height;
if (fs.x < r.width) {
diff --git a/xfa/fxbarcode/BC_TwoDimWriter.cpp b/xfa/fxbarcode/BC_TwoDimWriter.cpp
index efab589ddc..c2fb37e091 100644
--- a/xfa/fxbarcode/BC_TwoDimWriter.cpp
+++ b/xfa/fxbarcode/BC_TwoDimWriter.cpp
@@ -46,10 +46,9 @@ void CBC_TwoDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
CFX_PathData rect;
rect.AppendRect((FX_FLOAT)leftPos + x, (FX_FLOAT)topPos + y,
(FX_FLOAT)(leftPos + x + 1), (FX_FLOAT)(topPos + y + 1));
- CFX_GraphStateData stateData;
if (m_output->Get(x, y)) {
- device->DrawPath(&rect, &matri, &stateData, m_barColor, 0,
- FXFILL_WINDING);
+ CFX_GraphStateData data;
+ device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING);
}
}
}
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp
index 81abd56370..f31a54747f 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonDecoder.cpp
@@ -197,9 +197,9 @@ CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorMagnitudes(
FX_BOOL dataMatrix,
int32_t& e) {
int32_t s = errorLocations->GetSize();
- CFX_Int32Array* temp = new CFX_Int32Array;
- temp->SetSize(s);
- std::unique_ptr<CFX_Int32Array> result(temp);
+ CFX_Int32Array* tempArray = new CFX_Int32Array;
+ tempArray->SetSize(s);
+ std::unique_ptr<CFX_Int32Array> result(tempArray);
for (int32_t i = 0; i < s; i++) {
int32_t xiInverse = m_field->Inverse(errorLocations->operator[](i), e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
@@ -212,7 +212,7 @@ CFX_Int32Array* CBC_ReedSolomonDecoder::FindErrorMagnitudes(
xiInverse)));
}
}
- int32_t temp = m_field->Inverse(denominator, temp);
+ int32_t temp = m_field->Inverse(denominator, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
(*result)[i] =
m_field->Multiply(errorEvaluator->EvaluateAt(xiInverse), temp);
diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp
index 6b7680d1a8..a41e46afc9 100644
--- a/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixDataBlock.cpp
@@ -40,17 +40,15 @@ CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords,
ECBlocks* ecBlocks = version->GetECBlocks();
int32_t totalBlocks = 0;
const CFX_ArrayTemplate<ECB*>& ecBlockArray = ecBlocks->GetECBlocks();
- int32_t i;
- for (i = 0; i < ecBlockArray.GetSize(); i++) {
+ for (int32_t i = 0; i < ecBlockArray.GetSize(); i++) {
totalBlocks += ecBlockArray[i]->GetCount();
}
std::unique_ptr<CFX_ArrayTemplate<CBC_DataMatrixDataBlock*>> result(
new CFX_ArrayTemplate<CBC_DataMatrixDataBlock*>());
result->SetSize(totalBlocks);
int32_t numResultBlocks = 0;
- int32_t j;
- for (j = 0; j < ecBlockArray.GetSize(); j++) {
- for (i = 0; i < ((ECB*)ecBlockArray[j])->GetCount(); i++) {
+ for (int32_t j = 0; j < ecBlockArray.GetSize(); j++) {
+ for (int32_t i = 0; i < ((ECB*)ecBlockArray[j])->GetCount(); i++) {
int32_t numDataCodewords = ((ECB*)ecBlockArray[j])->GetDataCodewords();
int32_t numBlockCodewords = ecBlocks->GetECCodewords() + numDataCodewords;
CFX_ByteArray codewords;
@@ -60,14 +58,11 @@ CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords,
codewords.SetSize(0);
}
}
- int32_t longerBlocksTotalCodewords = (*result)[0]->GetCodewords()->GetSize();
int32_t longerBlocksNumDataCodewords =
- longerBlocksTotalCodewords - ecBlocks->GetECCodewords();
- int32_t shorterBlocksNumDataCodewords = longerBlocksNumDataCodewords - 1;
+ (*result)[0]->GetCodewords()->GetSize() - ecBlocks->GetECCodewords();
int32_t rawCodewordsOffset = 0;
- for (i = 0; i < shorterBlocksNumDataCodewords; i++) {
- int32_t j;
- for (j = 0; j < numResultBlocks; j++) {
+ for (int32_t i = 0; i < longerBlocksNumDataCodewords - 1; i++) {
+ for (int32_t j = 0; j < numResultBlocks; j++) {
if (rawCodewordsOffset < rawCodewords->GetSize()) {
(*result)[j]->GetCodewords()->operator[](i) =
(*rawCodewords)[rawCodewordsOffset++];
@@ -76,17 +71,16 @@ CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords,
}
const bool specialVersion = version->GetVersionNumber() == 24;
int32_t numLongerBlocks = specialVersion ? 8 : numResultBlocks;
- for (j = 0; j < numLongerBlocks; j++) {
+ for (int32_t j = 0; j < numLongerBlocks; j++) {
if (rawCodewordsOffset < rawCodewords->GetSize()) {
(*result)[j]->GetCodewords()->operator[](longerBlocksNumDataCodewords -
1) =
(*rawCodewords)[rawCodewordsOffset++];
}
}
- int32_t max = (*result)[0]->GetCodewords()->GetSize();
- for (i = longerBlocksNumDataCodewords; i < max; i++) {
- int32_t j;
- for (j = 0; j < numResultBlocks; j++) {
+ for (int32_t i = longerBlocksNumDataCodewords;
+ i < (*result)[0]->GetCodewords()->GetSize(); i++) {
+ for (int32_t j = 0; j < numResultBlocks; j++) {
int32_t iOffset = specialVersion && j > 7 ? i - 1 : i;
if (rawCodewordsOffset < rawCodewords->GetSize()) {
(*result)[j]->GetCodewords()->operator[](iOffset) =
@@ -100,6 +94,7 @@ CBC_DataMatrixDataBlock::GetDataBlocks(CFX_ByteArray* rawCodewords,
}
return result.release();
}
+
int32_t CBC_DataMatrixDataBlock::GetNumDataCodewords() {
return m_numDataCodewords;
}
diff --git a/xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp b/xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp
index 4276066444..ffa0a4d9d1 100644
--- a/xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_DataMatrixDecoder.cpp
@@ -57,13 +57,12 @@ CBC_CommonDecoderResult* CBC_DataMatrixDecoder::Decode(
BC_EXCEPTION_CHECK_ReturnValue(e, nullptr);
int32_t dataBlocksCount = dataBlocks->GetSize();
int32_t totalBytes = 0;
- int32_t i, j;
- for (i = 0; i < dataBlocksCount; i++) {
+ for (int32_t i = 0; i < dataBlocksCount; i++) {
totalBytes += (*dataBlocks)[i]->GetNumDataCodewords();
}
CFX_ByteArray resultBytes;
resultBytes.SetSize(totalBytes);
- for (j = 0; j < dataBlocksCount; j++) {
+ for (int32_t j = 0; j < dataBlocksCount; j++) {
CFX_ByteArray* codewordBytes = (*dataBlocks)[j]->GetCodewords();
int32_t numDataCodewords = (*dataBlocks)[j]->GetNumDataCodewords();
CorrectErrors(*codewordBytes, numDataCodewords, e);
@@ -74,12 +73,11 @@ CBC_CommonDecoderResult* CBC_DataMatrixDecoder::Decode(
delete dataBlocks;
return nullptr;
}
- int32_t i;
- for (i = 0; i < numDataCodewords; i++) {
+ for (int32_t i = 0; i < numDataCodewords; i++) {
resultBytes[i * dataBlocksCount + j] = (*codewordBytes)[i];
}
}
- for (i = 0; i < (dataBlocks->GetSize()); i++) {
+ for (int32_t i = 0; i < (dataBlocks->GetSize()); i++) {
delete (*dataBlocks)[i];
}
delete dataBlocks;
diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
index 7b1cc50d72..8580650223 100644
--- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -345,10 +345,9 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device,
CFX_PathData rect;
rect.AppendRect((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)(x + 1),
(FX_FLOAT)(y + 1));
- CFX_GraphStateData stateData;
if (m_output->Get(x, y)) {
- device->DrawPath(&rect, &matri, &stateData, m_barColor, 0,
- FXFILL_WINDING);
+ CFX_GraphStateData data;
+ device->DrawPath(&rect, &matri, &data, m_barColor, 0, FXFILL_WINDING);
}
}
}
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp
index beb7dec1a3..d8b65c4c5b 100644
--- a/xfa/fxfa/app/xfa_ffdocview.cpp
+++ b/xfa/fxfa/app/xfa_ffdocview.cpp
@@ -721,8 +721,7 @@ FX_BOOL CXFA_FFDocView::RunEventLayoutReady() {
return TRUE;
}
void CXFA_FFDocView::RunBindItems() {
- int32_t iCount = m_BindItems.GetSize();
- for (int32_t i = 0; i < iCount; i++) {
+ for (int32_t i = 0; i < m_BindItems.GetSize(); i++) {
if (m_BindItems[i]->HasFlag(XFA_NODEFLAG_HasRemoved))
continue;
@@ -757,8 +756,8 @@ void CXFA_FFDocView::RunBindItems() {
CFX_WideString wsValue;
CFX_WideString wsLabel;
uint32_t uValueHash = FX_HashCode_GetW(wsValueRef, false);
- for (int32_t i = 0; i < iCount; i++) {
- CXFA_Object* refObj = rs.nodes[i];
+ for (int32_t j = 0; j < iCount; j++) {
+ CXFA_Object* refObj = rs.nodes[j];
if (!refObj->IsNode()) {
continue;
}
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index 2a9638e817..8e10189f8c 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -1345,9 +1345,8 @@ static void XFA_BOX_GetFillPath(CXFA_Box box,
return;
}
FX_BOOL bSameStyles = TRUE;
- int32_t i;
CXFA_Stroke stroke1 = strokes[0];
- for (i = 1; i < 8; i++) {
+ for (int32_t i = 1; i < 8; i++) {
CXFA_Stroke stroke2 = strokes[i];
if (!stroke1.SameStyles(stroke2)) {
bSameStyles = FALSE;
@@ -1357,7 +1356,7 @@ static void XFA_BOX_GetFillPath(CXFA_Box box,
}
if (bSameStyles) {
stroke1 = strokes[0];
- for (i = 2; i < 8; i += 2) {
+ for (int32_t i = 2; i < 8; i += 2) {
CXFA_Stroke stroke2 = strokes[i];
if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence |
XFA_STROKE_SAMESTYLE_Corner)) {
@@ -1839,9 +1838,8 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box,
}
FX_BOOL bClose = FALSE;
FX_BOOL bSameStyles = TRUE;
- int32_t i;
CXFA_Stroke stroke1 = strokes[0];
- for (i = 1; i < 8; i++) {
+ for (int32_t i = 1; i < 8; i++) {
CXFA_Stroke stroke2 = strokes[i];
if (!stroke1.SameStyles(stroke2)) {
bSameStyles = FALSE;
@@ -1852,7 +1850,7 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box,
if (bSameStyles) {
stroke1 = strokes[0];
bClose = TRUE;
- for (i = 2; i < 8; i += 2) {
+ for (int32_t i = 2; i < 8; i += 2) {
CXFA_Stroke stroke2 = strokes[i];
if (!stroke1.SameStyles(stroke2, XFA_STROKE_SAMESTYLE_NoPresence |
XFA_STROKE_SAMESTYLE_Corner)) {
@@ -1874,12 +1872,12 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box,
FX_BOOL bStart = TRUE;
CFX_Path path;
path.Create();
- for (i = 0; i < 8; i++) {
- CXFA_Stroke stroke1 = strokes[i];
- if ((i % 1) == 0 && stroke1.GetRadius() < 0) {
+ for (int32_t i = 0; i < 8; i++) {
+ CXFA_Stroke stroke = strokes[i];
+ if ((i % 1) == 0 && stroke.GetRadius() < 0) {
FX_BOOL bEmpty = path.IsEmpty();
if (!bEmpty) {
- XFA_BOX_StrokePath(stroke1, &path, pGS, pMatrix);
+ XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix);
path.Clear();
}
bStart = TRUE;
@@ -1887,9 +1885,9 @@ static void XFA_BOX_Stroke_Rect(CXFA_Box box,
}
XFA_BOX_GetPath(box, strokes, rtWidget, path, i, bStart, !bSameStyles);
CXFA_Stroke stroke2 = strokes[(i + 1) % 8];
- bStart = !stroke1.SameStyles(stroke2);
+ bStart = !stroke.SameStyles(stroke2);
if (bStart) {
- XFA_BOX_StrokePath(stroke1, &path, pGS, pMatrix);
+ XFA_BOX_StrokePath(stroke, &path, pGS, pMatrix);
path.Clear();
}
}
diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp
index fe72e29c05..fa300f1721 100644
--- a/xfa/fxfa/app/xfa_textlayout.cpp
+++ b/xfa/fxfa/app/xfa_textlayout.cpp
@@ -1042,12 +1042,11 @@ FX_BOOL CXFA_TextLayout::Layout(const CFX_SizeF& size, FX_FLOAT* fHeight) {
}
FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) {
- if (m_pLoader == NULL || iBlock < 0 || iBlock >= CountBlocks()) {
+ if (m_pLoader == NULL || iBlock < 0 || iBlock >= CountBlocks())
return FALSE;
- }
- if (m_pLoader->m_fWidth < 1) {
+ if (m_pLoader->m_fWidth < 1)
return FALSE;
- }
+
m_pLoader->m_iTotalLines = -1;
m_iLines = 0;
FX_FLOAT fLinePos = 0;
@@ -1056,9 +1055,8 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) {
int32_t iCount = m_Blocks.GetSize();
int32_t iBlocksHeightCount = m_pLoader->m_BlocksHeight.GetSize();
iBlocksHeightCount /= 2;
- if (iBlock < iBlocksHeightCount) {
+ if (iBlock < iBlocksHeightCount)
return TRUE;
- }
if (iBlock == iBlocksHeightCount) {
Unload();
m_pBreak.reset(CreateBreak(TRUE));
@@ -1067,18 +1065,15 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) {
fLinePos -= m_pLoader->m_BlocksHeight.ElementAt(i * 2 + 1);
}
m_pLoader->m_iChar = 0;
- if (iCount > 1) {
+ if (iCount > 1)
m_pLoader->m_iTotalLines = m_Blocks.ElementAt(iBlock * 2 + 1);
- }
Loader(szText, fLinePos, TRUE);
- if (iCount == 0 && m_pLoader->m_fStartLineOffset < 0.1f) {
+ if (iCount == 0 && m_pLoader->m_fStartLineOffset < 0.1f)
UpdateAlign(szText.y, fLinePos);
- }
} else if (m_pTextDataNode) {
iBlock *= 2;
- if (iBlock < iCount - 2) {
+ if (iBlock < iCount - 2)
m_pLoader->m_iTotalLines = m_Blocks.ElementAt(iBlock + 1);
- }
m_pBreak->Reset();
if (m_bRichText) {
CFDE_XMLNode* pContainerNode = GetXMLContainerNode();
@@ -1086,48 +1081,40 @@ FX_BOOL CXFA_TextLayout::Layout(int32_t iBlock) {
return TRUE;
}
CFDE_XMLNode* pXMLNode = m_pLoader->m_pXMLNode;
- if (pXMLNode == NULL) {
+ if (!pXMLNode)
return TRUE;
- }
CFDE_XMLNode* pSaveXMLNode = m_pLoader->m_pXMLNode;
for (; pXMLNode;
pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- FX_BOOL bFlag = LoadRichText(pXMLNode, szText, fLinePos,
- m_pLoader->m_pParentStyle, TRUE);
- if (!bFlag) {
+ if (!LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle,
+ TRUE)) {
break;
}
}
- while (pXMLNode == NULL) {
+ while (!pXMLNode) {
pXMLNode = pSaveXMLNode->GetNodeItem(CFDE_XMLNode::Parent);
- if (pXMLNode == pContainerNode) {
+ if (pXMLNode == pContainerNode)
break;
- }
- FX_BOOL bFlag =
- LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle,
- TRUE, NULL, FALSE);
- if (!bFlag) {
+ if (!LoadRichText(pXMLNode, szText, fLinePos, m_pLoader->m_pParentStyle,
+ TRUE, NULL, FALSE)) {
break;
}
pSaveXMLNode = pXMLNode;
pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling);
- if (!pXMLNode) {
+ if (!pXMLNode)
continue;
- }
for (; pXMLNode;
pXMLNode = pXMLNode->GetNodeItem(CFDE_XMLNode::NextSibling)) {
- FX_BOOL bFlag = LoadRichText(pXMLNode, szText, fLinePos,
- m_pLoader->m_pParentStyle, TRUE);
- if (!bFlag) {
+ if (!LoadRichText(pXMLNode, szText, fLinePos,
+ m_pLoader->m_pParentStyle, TRUE)) {
break;
}
}
}
} else {
pNode = m_pLoader->m_pNode;
- if (pNode == NULL) {
+ if (!pNode)
return TRUE;
- }
LoadText(pNode, szText, fLinePos, TRUE);
}
}
@@ -1839,7 +1826,6 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice,
if (iChars > 0) {
CFX_PointF pt1, pt2;
FX_FLOAT fEndY = pCharPos[0].m_OriginY + 1.05f;
- int32_t i = 0;
if (pPiece->iPeriod == XFA_ATTRIBUTEENUM_Word) {
for (int32_t i = 0; i < pPiece->iUnderline; i++) {
for (int32_t j = 0; j < iChars; j++) {
@@ -1866,7 +1852,7 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice,
pt1.x = pCharPos[0].m_OriginX;
pt2.x = pCharPos[iChars - 1].m_OriginX +
pCharPos[iChars - 1].m_FontCharWidth * pPiece->fFontSize / 1000.0f;
- for (i = 0; i < pPiece->iLineThrough; i++) {
+ for (int32_t i = 0; i < pPiece->iLineThrough; i++) {
pt1.y = pt2.y = fEndY;
pPath->AddLine(pt1, pt2);
fEndY += 2.0f;
@@ -1917,14 +1903,13 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice,
CFX_PointF pt1, pt2;
pt1.x = fOrgX, pt2.x = fEndX;
FX_FLOAT fEndY = pCharPos[0].m_OriginY + 1.05f;
- int32_t i = 0;
- for (i = 0; i < pPiece->iUnderline; i++) {
+ for (int32_t i = 0; i < pPiece->iUnderline; i++) {
pt1.y = pt2.y = fEndY;
pPath->AddLine(pt1, pt2);
fEndY += 2.0f;
}
fEndY = pCharPos[0].m_OriginY - pPiece->rtPiece.height * 0.25f;
- for (i = 0; i < pPiece->iLineThrough; i++) {
+ for (int32_t i = 0; i < pPiece->iLineThrough; i++) {
pt1.y = pt2.y = fEndY;
pPath->AddLine(pt1, pt2);
fEndY += 2.0f;
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index a31a5a189a..a9b296eb3f 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -647,8 +647,8 @@ void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis,
FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get());
FXJSE_Value_GetObjectPropByIdx(argValue.get(), 2, jsObjectValue.get());
if (FXJSE_Value_IsNull(propertyValue.get())) {
- for (int32_t i = 2; i < iLength; i++) {
- FXJSE_Value_GetObjectPropByIdx(argValue.get(), i,
+ for (int32_t j = 2; j < iLength; j++) {
+ FXJSE_Value_GetObjectPropByIdx(argValue.get(), j,
jsObjectValue.get());
GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get());
if (!FXJSE_Value_IsNull(newPropertyValue.get()))
@@ -657,8 +657,8 @@ void CXFA_FM2JSContext::Count(CFXJSE_Value* pThis,
} else {
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr);
- for (int32_t i = 2; i < iLength; i++) {
- FXJSE_Value_GetObjectPropByIdx(argValue.get(), i,
+ for (int32_t j = 2; j < iLength; j++) {
+ FXJSE_Value_GetObjectPropByIdx(argValue.get(), j,
jsObjectValue.get());
FXJSE_Value_GetObjectProp(jsObjectValue.get(),
propertyStr.AsStringC(),
@@ -730,8 +730,8 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis,
FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get());
FXJSE_Value_GetObjectPropByIdx(argValue.get(), 2, jsObjectValue.get());
if (FXJSE_Value_IsNull(propertyValue.get())) {
- for (int32_t i = 2; i < iLength; i++) {
- FXJSE_Value_GetObjectPropByIdx(argValue.get(), i,
+ for (int32_t j = 2; j < iLength; j++) {
+ FXJSE_Value_GetObjectPropByIdx(argValue.get(), j,
jsObjectValue.get());
GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get());
if (FXJSE_Value_IsNull(newPropertyValue.get()))
@@ -744,8 +744,8 @@ void CXFA_FM2JSContext::Max(CFXJSE_Value* pThis,
} else {
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr);
- for (int32_t i = 2; i < iLength; i++) {
- FXJSE_Value_GetObjectPropByIdx(argValue.get(), i,
+ for (int32_t j = 2; j < iLength; j++) {
+ FXJSE_Value_GetObjectPropByIdx(argValue.get(), j,
jsObjectValue.get());
FXJSE_Value_GetObjectProp(jsObjectValue.get(),
propertyStr.AsStringC(),
@@ -812,8 +812,8 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis,
FXJSE_Value_GetObjectPropByIdx(argValue.get(), 1, propertyValue.get());
FXJSE_Value_GetObjectPropByIdx(argValue.get(), 2, jsObjectValue.get());
if (FXJSE_Value_IsNull(propertyValue.get())) {
- for (int32_t i = 2; i < iLength; i++) {
- FXJSE_Value_GetObjectPropByIdx(argValue.get(), i,
+ for (int32_t j = 2; j < iLength; j++) {
+ FXJSE_Value_GetObjectPropByIdx(argValue.get(), j,
jsObjectValue.get());
GetObjectDefaultValue(jsObjectValue.get(), newPropertyValue.get());
if (FXJSE_Value_IsNull(newPropertyValue.get()))
@@ -826,8 +826,8 @@ void CXFA_FM2JSContext::Min(CFXJSE_Value* pThis,
} else {
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue.get(), propertyStr);
- for (int32_t i = 2; i < iLength; i++) {
- FXJSE_Value_GetObjectPropByIdx(argValue.get(), i,
+ for (int32_t j = 2; j < iLength; j++) {
+ FXJSE_Value_GetObjectPropByIdx(argValue.get(), j,
jsObjectValue.get());
FXJSE_Value_GetObjectProp(jsObjectValue.get(),
propertyStr.AsStringC(),
@@ -1943,21 +1943,21 @@ FX_BOOL CXFA_FM2JSContext::IsIsoTimeFormat(const FX_CHAR* pData,
}
if (*(pData + iIndex) == '.') {
++iIndex;
- FX_CHAR strTemp[4];
- strTemp[3] = '\0';
+ FX_CHAR strSec[4];
+ strSec[3] = '\0';
if (*(pData + iIndex) > '9' || *(pData + iIndex) < '0') {
return iRet;
}
- strTemp[0] = *(pData + iIndex);
+ strSec[0] = *(pData + iIndex);
if (*(pData + iIndex + 1) > '9' || *(pData + iIndex + 1) < '0') {
return iRet;
}
- strTemp[1] = *(pData + iIndex + 1);
+ strSec[1] = *(pData + iIndex + 1);
if (*(pData + iIndex + 2) > '9' || *(pData + iIndex + 2) < '0') {
return iRet;
}
- strTemp[2] = *(pData + iIndex + 2);
- iMilliSecond = FXSYS_atoi(strTemp);
+ strSec[2] = *(pData + iIndex + 2);
+ iMilliSecond = FXSYS_atoi(strSec);
if (iMilliSecond > 100) {
iMilliSecond = 0;
return iRet;
@@ -3033,9 +3033,9 @@ void CXFA_FM2JSContext::Choose(CFXJSE_Value* pThis,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext =
static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr));
- v8::Isolate* pIsolate = pContext->GetScriptRuntime();
int32_t argc = args.GetLength();
if (argc > 1) {
+ v8::Isolate* pIsolate = pContext->GetScriptRuntime();
std::unique_ptr<CFXJSE_Value> argOne = args.GetValue(0);
FX_BOOL argOneIsNull = FALSE;
int32_t iIndex = 0;
@@ -3245,8 +3245,8 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext =
static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(pThis, nullptr));
- v8::Isolate* pIsolate = pContext->GetScriptRuntime();
if (args.GetLength() == 1) {
+ v8::Isolate* pIsolate = pContext->GetScriptRuntime();
std::unique_ptr<CFXJSE_Value> scriptValue = GetSimpleValue(pThis, args, 0);
CFX_ByteString utf8ScriptString;
ValueToUTF8String(scriptValue.get(), utf8ScriptString);
@@ -3259,16 +3259,16 @@ void CXFA_FM2JSContext::Eval(CFXJSE_Value* pThis,
CXFA_FM2JSContext::Translate(
CFX_WideString::FromUTF8(utf8ScriptString.AsStringC()).AsStringC(),
wsJavaScriptBuf, wsError);
- CFXJSE_Context* pContext =
+ CFXJSE_Context* pNewContext =
FXJSE_Context_Create(pIsolate, nullptr, nullptr);
std::unique_ptr<CFXJSE_Value> returnValue(new CFXJSE_Value(pIsolate));
javaScript = wsJavaScriptBuf.AsStringC();
FXJSE_ExecuteScript(
- pContext,
+ pNewContext,
FX_UTF8Encode(javaScript.c_str(), javaScript.GetLength()).c_str(),
returnValue.get());
FXJSE_Value_Set(args.GetReturnValue(), returnValue.get());
- FXJSE_Context_Release(pContext);
+ FXJSE_Context_Release(pNewContext);
}
} else {
pContext->ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"Eval");
@@ -3517,32 +3517,32 @@ void CXFA_FM2JSContext::UnitValue(CFXJSE_Value* pThis,
GetSimpleValue(pThis, args, 1);
CFX_ByteString unitTempString;
ValueToUTF8String(unitValue.get(), unitTempString);
- const FX_CHAR* pData = unitTempString.c_str();
- int32_t u = 0;
- while (*(pData + u) == ' ' || *(pData + u) == 0x09 ||
- *(pData + u) == 0x0B || *(pData + u) == 0x0C ||
- *(pData + u) == 0x0A || *(pData + u) == 0x0D) {
- ++u;
+ const FX_CHAR* pChar = unitTempString.c_str();
+ int32_t uVal = 0;
+ while (*(pChar + uVal) == ' ' || *(pChar + uVal) == 0x09 ||
+ *(pChar + uVal) == 0x0B || *(pChar + uVal) == 0x0C ||
+ *(pChar + uVal) == 0x0A || *(pChar + uVal) == 0x0D) {
+ ++uVal;
}
- while (u < unitTempString.GetLength()) {
- if ((*(pData + u) > '9' || *(pData + u) < '0') &&
- *(pData + u) != '.') {
+ while (uVal < unitTempString.GetLength()) {
+ if ((*(pChar + uVal) > '9' || *(pChar + uVal) < '0') &&
+ *(pChar + uVal) != '.') {
break;
}
- ++u;
+ ++uVal;
}
- while (*(pData + u) == ' ' || *(pData + u) == 0x09 ||
- *(pData + u) == 0x0B || *(pData + u) == 0x0C ||
- *(pData + u) == 0x0A || *(pData + u) == 0x0D) {
- ++u;
+ while (*(pChar + uVal) == ' ' || *(pChar + uVal) == 0x09 ||
+ *(pChar + uVal) == 0x0B || *(pChar + uVal) == 0x0C ||
+ *(pChar + uVal) == 0x0A || *(pChar + uVal) == 0x0D) {
+ ++uVal;
}
- int32_t uLen = unitTempString.GetLength();
- while (u < uLen) {
- if (*(pData + u) == ' ') {
+ int32_t uValLen = unitTempString.GetLength();
+ while (uVal < uValLen) {
+ if (*(pChar + uVal) == ' ') {
break;
}
- strUnit += (*(pData + u));
- ++u;
+ strUnit += (*(pChar + uVal));
+ ++uVal;
}
strUnit.MakeLower();
} else {
@@ -4614,10 +4614,10 @@ void CXFA_FM2JSContext::Parse(CFXJSE_Value* pThis,
} else {
wsTestPattern = FX_WSTRC(L"text{") + wsPattern;
wsTestPattern += FX_WSTRC(L"}");
- CXFA_LocaleValue localeValue(XFA_VT_TEXT, wsValue, wsTestPattern,
- pLocale, (CXFA_LocaleMgr*)pMgr);
- if (localeValue.IsValid()) {
- szParsedValue = FX_UTF8Encode(localeValue.GetValue());
+ CXFA_LocaleValue localeValue2(XFA_VT_TEXT, wsValue, wsTestPattern,
+ pLocale, (CXFA_LocaleMgr*)pMgr);
+ if (localeValue2.IsValid()) {
+ szParsedValue = FX_UTF8Encode(localeValue2.GetValue());
FXJSE_Value_SetUTF8String(args.GetReturnValue(),
szParsedValue.AsStringC());
} else {
@@ -5296,14 +5296,12 @@ void CXFA_FM2JSContext::WordUS(const CFX_ByteStringC& szData,
if (iInteger < iLength) {
strBuf << " And ";
iIndex = iInteger + 1;
- int32_t iCount = 0;
while (iIndex < iLength) {
- iCount = (iLength - iIndex) % 12;
- if (!iCount && iLength - iIndex > 0) {
- iCount = 12;
- }
- TrillionUS(CFX_ByteStringC(pData + iIndex, iCount), strBuf);
- iIndex += iCount;
+ int32_t iSize = (iLength - iIndex) % 12;
+ if (!iSize && iLength - iIndex > 0)
+ iSize = 12;
+ TrillionUS(CFX_ByteStringC(pData + iIndex, iSize), strBuf);
+ iIndex += iSize;
if (iIndex < iLength) {
strBuf << " Trillion ";
}
diff --git a/xfa/fxfa/fm2js/xfa_fmparse.cpp b/xfa/fxfa/fm2js/xfa_fmparse.cpp
index efbf224a40..5fd6c06613 100644
--- a/xfa/fxfa/fm2js/xfa_fmparse.cpp
+++ b/xfa/fxfa/fm2js/xfa_fmparse.cpp
@@ -555,10 +555,8 @@ CXFA_FMSimpleExpression* CXFA_FMParse::ParsePostExpression(
if (m_pToken->m_type != TOKrparen) {
pArray.reset(new CFX_ArrayTemplate<CXFA_FMSimpleExpression*>());
while (m_pToken->m_type != TOKrparen) {
- CXFA_FMSimpleExpression* e = ParseSimpleExpression();
- if (e) {
- pArray->Add(e);
- }
+ if (CXFA_FMSimpleExpression* expr = ParseSimpleExpression())
+ pArray->Add(expr);
if (m_pToken->m_type == TOKcomma) {
NextToken();
} else if (m_pToken->m_type == TOKeof ||
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 03643cd988..7d7b50fb3f 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -811,7 +811,7 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet(
sNodeIterator.MoveToNext();
} else {
CFX_MapPtrTemplate<CXFA_Node*, CXFA_Node*> subformMapArray;
- CXFA_NodeArray subformArray;
+ CXFA_NodeArray nodeArray;
for (; iMax < 0 || iCurRepeatIndex < iMax; iCurRepeatIndex++) {
FX_BOOL bSelfMatch = FALSE;
XFA_ATTRIBUTEENUM eBindMatch = XFA_ATTRIBUTEENUM_None;
@@ -830,11 +830,11 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet(
XFA_DataMerge_CreateDataBinding(pSubformNode, pDataNode);
ASSERT(pSubformNode);
subformMapArray.SetAt(pSubformNode, pDataNode);
- subformArray.Add(pSubformNode);
+ nodeArray.Add(pSubformNode);
}
subformMapArray.GetStartPosition();
- for (int32_t iIndex = 0; iIndex < subformArray.GetSize(); iIndex++) {
- CXFA_Node* pSubform = subformArray[iIndex];
+ for (int32_t iIndex = 0; iIndex < nodeArray.GetSize(); iIndex++) {
+ CXFA_Node* pSubform = nodeArray[iIndex];
CXFA_Node* pDataNode =
reinterpret_cast<CXFA_Node*>(subformMapArray.GetValueAt(pSubform));
for (CXFA_Node* pTemplateChild =
diff --git a/xfa/fxfa/parser/xfa_document_serialize.cpp b/xfa/fxfa/parser/xfa_document_serialize.cpp
index 497c8216dd..d7b8bf04d9 100644
--- a/xfa/fxfa/parser/xfa_document_serialize.cpp
+++ b/xfa/fxfa/parser/xfa_document_serialize.cpp
@@ -336,13 +336,12 @@ static void XFA_DataExporter_RegenerateFormFile_Changed(
pNode->GetClassID() == XFA_ELEMENT_Items) {
wsChildren.clear();
bSaveXML = TRUE;
- CXFA_Node* pChildNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
- while (pChildNode) {
- XFA_DataExporter_RegenerateFormFile_Changed(pChildNode, newBuf,
- bSaveXML);
+ CXFA_Node* pChild = pNode->GetNodeItem(XFA_NODEITEM_FirstChild);
+ while (pChild) {
+ XFA_DataExporter_RegenerateFormFile_Changed(pChild, newBuf, bSaveXML);
wsChildren += newBuf.AsStringC();
newBuf.Clear();
- pChildNode = pChildNode->GetNodeItem(XFA_NODEITEM_NextSibling);
+ pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
}
}
break;
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
index 7b7ecf4ba7..509bf630e9 100644
--- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
@@ -154,11 +154,11 @@ FX_BOOL CXFA_ItemLayoutProcessor::FindLayoutItemSplitPos(
(CXFA_ContentLayoutItem*)pChildItem->m_pNextSibling) {
FX_FLOAT fChildOffset =
fCurVerticalOffset + fCurTopMargin + pChildItem->m_sPos.y;
- FX_BOOL bAppChange = FALSE;
+ FX_BOOL bChange = FALSE;
if (FindLayoutItemSplitPos(pChildItem, fChildOffset, fRelSplitPos,
- bAppChange, bCalculateMargin)) {
+ bChange, bCalculateMargin)) {
if (fRelSplitPos - fChildOffset < XFA_LAYOUT_FLOAT_PERCISION &&
- bAppChange) {
+ bChange) {
fProposedSplitPos = fRelSplitPos - fCurTopMargin;
} else {
fProposedSplitPos = fRelSplitPos + fCurBottomMargin;
@@ -1922,13 +1922,13 @@ void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow(
}
static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem(
CXFA_ItemLayoutProcessor* pThis,
- CXFA_ItemLayoutProcessor*& pProcessor,
+ CXFA_ItemLayoutProcessor* pProcessor,
FX_BOOL bContainerWidthAutoSize,
FX_BOOL bContainerHeightAutoSize,
FX_FLOAT fContainerHeight,
XFA_ATTRIBUTEENUM eFlowStrategy,
uint8_t& uCurHAlignState,
- CFX_ArrayTemplate<CXFA_ContentLayoutItem*>(&rgCurLineLayoutItems)[3],
+ CFX_ArrayTemplate<CXFA_ContentLayoutItem*> (&rgCurLineLayoutItems)[3],
FX_BOOL bUseBreakControl,
FX_FLOAT fAvailHeight,
FX_FLOAT fRealHeight,
@@ -2266,6 +2266,7 @@ static XFA_ItemLayoutProcessorResult XFA_ItemLayoutProcessor_InsertFlowedItem(
}
return XFA_ItemLayoutProcessorResult_Done;
}
+
XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
FX_BOOL bUseBreakControl,
XFA_ATTRIBUTEENUM eFlowStrategy,
@@ -2445,7 +2446,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
pLayoutChild = NULL;
}
while (m_pCurChildNode) {
- CXFA_ItemLayoutProcessor* pProcessor = NULL;
+ CXFA_ItemLayoutProcessor* pProcessor = nullptr;
FX_BOOL bAddedItemInRow = FALSE;
fContentCurRowY +=
XFA_ItemLayoutProcessor_InsertPendingItems(this, m_pFormNode);
@@ -2477,18 +2478,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
XFA_ItemLayoutProcessor_AddPendingNode(this, pTrailerNode,
TRUE);
} else {
- CXFA_ItemLayoutProcessor* pProcessor =
- new CXFA_ItemLayoutProcessor(pTrailerNode, NULL);
+ std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor(
+ new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr));
XFA_ItemLayoutProcessor_InsertFlowedItem(
- this, pProcessor, bContainerWidthAutoSize,
+ this, pTempProcessor.get(), bContainerWidthAutoSize,
bContainerHeightAutoSize, fContainerHeight, eFlowStrategy,
uCurHAlignState, rgCurLineLayoutItems, FALSE,
XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY,
fContentWidthLimit, fContentCurRowAvailWidth,
fContentCurRowHeight, bAddedItemInRow, bForceEndPage,
pContext);
- delete pProcessor;
- pProcessor = NULL;
}
}
XFA_ItemLayoutProcessor_GotoNextContainerNode(
@@ -2507,18 +2506,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
bCreatePage) &&
m_pFormNode->GetClassID() != XFA_ELEMENT_Form) {
if (JudgeLeaderOrTrailerForOccur(pTrailerNode)) {
- CXFA_ItemLayoutProcessor* pProcessor =
- new CXFA_ItemLayoutProcessor(pTrailerNode, NULL);
+ std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor(
+ new CXFA_ItemLayoutProcessor(pTrailerNode, nullptr));
XFA_ItemLayoutProcessor_InsertFlowedItem(
- this, pProcessor, bContainerWidthAutoSize,
+ this, pTempProcessor.get(), bContainerWidthAutoSize,
bContainerHeightAutoSize, fContainerHeight, eFlowStrategy,
uCurHAlignState, rgCurLineLayoutItems, FALSE,
XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY,
fContentWidthLimit, fContentCurRowAvailWidth,
fContentCurRowHeight, bAddedItemInRow, bForceEndPage,
pContext);
- delete pProcessor;
- pProcessor = NULL;
}
if (!bCreatePage) {
if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) {
@@ -2528,18 +2525,16 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
fContentCalculatedWidth, fContentCalculatedHeight,
fContentCurRowY, fContentCurRowHeight, fContentWidthLimit);
rgCurLineLayoutItems->RemoveAll();
- CXFA_ItemLayoutProcessor* pProcessor =
- new CXFA_ItemLayoutProcessor(pLeaderNode, NULL);
+ std::unique_ptr<CXFA_ItemLayoutProcessor> pTempProcessor(
+ new CXFA_ItemLayoutProcessor(pLeaderNode, nullptr));
XFA_ItemLayoutProcessor_InsertFlowedItem(
- this, pProcessor, bContainerWidthAutoSize,
+ this, pTempProcessor.get(), bContainerWidthAutoSize,
bContainerHeightAutoSize, fContainerHeight, eFlowStrategy,
uCurHAlignState, rgCurLineLayoutItems, FALSE,
XFA_LAYOUT_FLOAT_MAX, XFA_LAYOUT_FLOAT_MAX, fContentCurRowY,
fContentWidthLimit, fContentCurRowAvailWidth,
fContentCurRowHeight, bAddedItemInRow, bForceEndPage,
pContext);
- delete pProcessor;
- pProcessor = NULL;
}
} else {
if (JudgeLeaderOrTrailerForOccur(pLeaderNode)) {
@@ -2715,6 +2710,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer(
: (bIsManualBreak ? XFA_ItemLayoutProcessorResult_ManualBreak
: XFA_ItemLayoutProcessorResult_PageFullBreak);
}
+
FX_BOOL CXFA_ItemLayoutProcessor::CalculateRowChildPosition(
CFX_ArrayTemplate<CXFA_ContentLayoutItem*>(&rgCurLineLayoutItems)[3],
XFA_ATTRIBUTEENUM eFlowStrategy,
diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
index 02bc0a8469..4b36bc8e4c 100644
--- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
+++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
@@ -140,30 +140,29 @@ CXFA_Node* ResolveBreakTarget(CXFA_Node* pPageSetRoot,
int32_t iSpliteIndex = 0;
FX_BOOL bTargetAllFind = TRUE;
while (iSpliteIndex != -1) {
- CFX_WideString wsTargetExpr;
+ CFX_WideString wsExpr;
int32_t iSpliteNextIndex = 0;
if (!bTargetAllFind) {
iSpliteNextIndex = wsTargetAll.Find(' ', iSpliteIndex);
- wsTargetExpr =
- wsTargetAll.Mid(iSpliteIndex, iSpliteNextIndex - iSpliteIndex);
+ wsExpr = wsTargetAll.Mid(iSpliteIndex, iSpliteNextIndex - iSpliteIndex);
} else {
- wsTargetExpr = wsTargetAll;
+ wsExpr = wsTargetAll;
}
- if (wsTargetExpr.IsEmpty())
+ if (wsExpr.IsEmpty())
return nullptr;
bTargetAllFind = FALSE;
- if (wsTargetExpr.GetAt(0) == '#') {
+ if (wsExpr.GetAt(0) == '#') {
CXFA_Node* pNode = pDocument->GetNodeByID(
ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Template)),
- wsTargetExpr.Mid(1).AsStringC());
+ wsExpr.Mid(1).AsStringC());
if (pNode)
return pNode;
} else if (bNewExprStyle) {
- CFX_WideString wsProcessedTarget = wsTargetExpr;
- if (wsTargetExpr.Left(4) == FX_WSTRC(L"som(") &&
- wsTargetExpr.Right(1) == FX_WSTRC(L")")) {
- wsProcessedTarget = wsTargetExpr.Mid(4, wsTargetExpr.GetLength() - 5);
+ CFX_WideString wsProcessedTarget = wsExpr;
+ if (wsExpr.Left(4) == FX_WSTRC(L"som(") &&
+ wsExpr.Right(1) == FX_WSTRC(L")")) {
+ wsProcessedTarget = wsExpr.Mid(4, wsExpr.GetLength() - 5);
}
XFA_RESOLVENODE_RS rs;
int32_t iCount = pDocument->GetScriptContext()->ResolveObjects(
@@ -893,7 +892,6 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode,
CXFA_Node*& pLeaderTemplate,
CXFA_Node*& pTrailerTemplate,
FX_BOOL bCreatePage) {
- CFX_WideStringC wsOverflowLeader, wsOverflowTrailer;
CXFA_Node* pContainer =
pOverflowNode->GetNodeItem(XFA_NODEITEM_Parent,
XFA_OBJECTTYPE_ContainerNode)
@@ -937,6 +935,8 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode,
}
return NULL;
} else if (pOverflowNode->GetClassID() == XFA_ELEMENT_Overflow) {
+ CFX_WideStringC wsOverflowLeader;
+ CFX_WideStringC wsOverflowTrailer;
CFX_WideStringC wsOverflowTarget;
pOverflowNode->TryCData(XFA_ATTRIBUTE_Leader, wsOverflowLeader);
pOverflowNode->TryCData(XFA_ATTRIBUTE_Trailer, wsOverflowTrailer);
@@ -967,8 +967,9 @@ CXFA_Node* CXFA_LayoutPageMgr::BreakOverflow(CXFA_Node* pOverflowNode,
}
return pOverflowNode;
}
- return NULL;
+ return nullptr;
}
+
FX_BOOL CXFA_LayoutPageMgr::ProcessOverflow(CXFA_Node* pFormNode,
CXFA_Node*& pLeaderNode,
CXFA_Node*& pTrailerNode,
@@ -1718,11 +1719,11 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
pDocument, pContainerItem->m_pFormNode->GetClassID(),
pContainerItem->m_pFormNode->GetNameHash(), pParentNode);
CXFA_ContainerIterator sIterator(pExistingNode);
- for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
- pNode = sIterator.MoveToNext()) {
- if (pNode->GetClassID() != XFA_ELEMENT_ContentArea) {
+ for (CXFA_Node* pIter = sIterator.GetCurrent(); pIter;
+ pIter = sIterator.MoveToNext()) {
+ if (pIter->GetClassID() != XFA_ELEMENT_ContentArea) {
CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>(
- pNode->GetUserData(XFA_LAYOUTITEMKEY));
+ pIter->GetUserData(XFA_LAYOUTITEMKEY));
if (pLayoutItem) {
pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem);
delete pLayoutItem;
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index f3bb4fefb2..cfe65ed864 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -1393,8 +1393,8 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage(
if (!pValueNode) {
return;
}
- XFA_ELEMENT eType = pValueNode->GetClassID();
- if (eType == XFA_ELEMENT_Value) {
+ XFA_ELEMENT eNodeType = pValueNode->GetClassID();
+ if (eNodeType == XFA_ELEMENT_Value) {
bNeedFindContainer = true;
CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
if (pNode && pNode->IsContainerNode()) {
@@ -1407,7 +1407,7 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage(
pNode->GetNodeItem(XFA_NODEITEM_Parent));
}
} else {
- if (eType == XFA_ELEMENT_Items) {
+ if (eNodeType == XFA_ELEMENT_Items) {
CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
if (pNode && pNode->IsContainerNode()) {
pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode);
@@ -4190,12 +4190,10 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
CXFA_NodeArray nodeArray;
pBind->GetBindItems(nodeArray);
for (int32_t i = 0; i < nodeArray.GetSize(); i++) {
- CXFA_Node* pNode = nodeArray[i];
- if (pNode == this) {
- continue;
+ if (nodeArray[i] != this) {
+ nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify,
+ bScriptModify, FALSE);
}
- pNode->SetScriptContent(wsContent, wsContent, bNotify,
- bScriptModify, FALSE);
}
}
break;
@@ -4215,11 +4213,10 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
CXFA_NodeArray nodeArray;
pBindNode->GetBindItems(nodeArray);
for (int32_t i = 0; i < nodeArray.GetSize(); i++) {
- CXFA_Node* pNode = nodeArray[i];
- if (pNode == this) {
- continue;
+ if (nodeArray[i] != this) {
+ nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, true,
+ FALSE);
}
- pNode->SetScriptContent(wsContent, wsContent, bNotify, true, FALSE);
}
}
pBindNode = nullptr;
@@ -4280,9 +4277,8 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
CXFA_NodeArray nodeArray;
pBindNode->GetBindItems(nodeArray);
for (int32_t i = 0; i < nodeArray.GetSize(); i++) {
- CXFA_Node* pNode = nodeArray[i];
- pNode->SetScriptContent(wsContent, wsContent, bNotify, bScriptModify,
- FALSE);
+ nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify,
+ bScriptModify, FALSE);
}
}
return TRUE;
diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp
index 357566ed9c..528758f6f8 100644
--- a/xfa/fxfa/parser/xfa_script_imp.cpp
+++ b/xfa/fxfa/parser/xfa_script_imp.cpp
@@ -219,10 +219,10 @@ void CXFA_ScriptContext::GlobalPropertyGetter(CFXJSE_Value* pObject,
XFA_HashCode uHashCode = static_cast<XFA_HashCode>(
FX_HashCode_GetW(wsPropName.AsStringC(), false));
if (uHashCode != XFA_HASHCODE_Layout) {
- CXFA_Object* pObject =
+ CXFA_Object* pObj =
lpScriptContext->GetDocument()->GetXFAObject(uHashCode);
- if (pObject) {
- FXJSE_Value_Set(pValue, lpScriptContext->GetJSValueFromMap(pObject));
+ if (pObj) {
+ FXJSE_Value_Set(pValue, lpScriptContext->GetJSValueFromMap(pObj));
return;
}
}
@@ -335,12 +335,12 @@ void CXFA_ScriptContext::NormalPropertySetter(CFXJSE_Value* pOriginalValue,
}
if (pPropOrChild) {
CFX_WideString wsDefaultName(L"{default}");
- const XFA_SCRIPTATTRIBUTEINFO* lpAttributeInfo =
+ const XFA_SCRIPTATTRIBUTEINFO* lpAttrInfo =
XFA_GetScriptAttributeByName(pPropOrChild->GetClassID(),
wsDefaultName.AsStringC());
- if (lpAttributeInfo) {
- (pPropOrChild->*(lpAttributeInfo->lpfnCallback))(
- pReturnValue, TRUE, (XFA_ATTRIBUTE)lpAttributeInfo->eAttribute);
+ if (lpAttrInfo) {
+ (pPropOrChild->*(lpAttrInfo->lpfnCallback))(
+ pReturnValue, TRUE, (XFA_ATTRIBUTE)lpAttrInfo->eAttribute);
return;
}
}