summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/src/formfiller/FFL_ListBox.cpp4
-rw-r--r--fpdfsdk/src/fpdfdoc_embeddertest.cpp10
-rw-r--r--fpdfsdk/src/javascript/Document.cpp2
-rw-r--r--fpdfsdk/src/javascript/PublicMethods.cpp6
-rw-r--r--fpdfsdk/src/javascript/util.cpp48
5 files changed, 27 insertions, 43 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp
index 0735f48cf3..0f478fe7e0 100644
--- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_ListBox.cpp
@@ -101,13 +101,13 @@ FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) {
return FALSE;
if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) {
- int nSelCount = 0;
+ size_t nSelCount = 0;
for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; ++i) {
if (pListBox->IsItemSelected(i)) {
if (m_OriginSelections.count(i) == 0)
return TRUE;
- nSelCount++;
+ ++nSelCount;
}
}
diff --git a/fpdfsdk/src/fpdfdoc_embeddertest.cpp b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
index 9c9fac8d15..b263fafe16 100644
--- a/fpdfsdk/src/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
@@ -13,25 +13,25 @@ TEST_F(FPDFDocEmbeddertest, DestGetPageIndex) {
EXPECT_TRUE(OpenDocument("testing/resources/named_dests.pdf"));
// NULL FPDF_DEST case.
- EXPECT_EQ(0, FPDFDest_GetPageIndex(document(), nullptr));
+ EXPECT_EQ(0U, FPDFDest_GetPageIndex(document(), nullptr));
// Page number directly in item from Dests NameTree.
FPDF_DEST dest = FPDF_GetNamedDestByName(document(), "First");
EXPECT_NE(nullptr, dest);
- EXPECT_EQ(1, FPDFDest_GetPageIndex(document(), dest));
+ EXPECT_EQ(1U, FPDFDest_GetPageIndex(document(), dest));
// Page number via object reference in item from Dests NameTree.
dest = FPDF_GetNamedDestByName(document(), "Next");
EXPECT_NE(nullptr, dest);
- EXPECT_EQ(1, FPDFDest_GetPageIndex(document(), dest));
+ EXPECT_EQ(1U, FPDFDest_GetPageIndex(document(), dest));
// Page number directly in item from Dests dictionary.
dest = FPDF_GetNamedDestByName(document(), "FirstAlternate");
EXPECT_NE(nullptr, dest);
- EXPECT_EQ(11, FPDFDest_GetPageIndex(document(), dest));
+ EXPECT_EQ(11U, FPDFDest_GetPageIndex(document(), dest));
// Invalid object reference in item from Dests NameTree.
dest = FPDF_GetNamedDestByName(document(), "LastAlternate");
EXPECT_NE(nullptr, dest);
- EXPECT_EQ(0, FPDFDest_GetPageIndex(document(), dest));
+ EXPECT_EQ(0U, FPDFDest_GetPageIndex(document(), dest));
}
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 7ce8449f3c..a8797095d8 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -1201,7 +1201,7 @@ CFX_WideString Document::CutString(CFX_WideString cbFrom) {
wchar_t* pResult = (wchar_t*)malloc(iSize.ValueOrDie());
wchar_t* pFrom = (wchar_t*)cbFrom.GetBuffer(iLength);
- for (int i = 0; i < iLength; i++) {
+ for (size_t i = 0; i < iLength; i++) {
if (pFrom[i] == L'\\' || pFrom[i] == L'/') {
pResult[i] = L'\0';
break;
diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp
index 30400789b8..d0ecd2987e 100644
--- a/fpdfsdk/src/javascript/PublicMethods.cpp
+++ b/fpdfsdk/src/javascript/PublicMethods.cpp
@@ -1134,8 +1134,8 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(IFXJS_Context* cc,
if (-1 != pEvent->SelStart())
w_strSelected = w_strValue2.substr(pEvent->SelStart(),
(pEvent->SelEnd() - pEvent->SelStart()));
- FX_BOOL bHasSign =
- (w_strValue2.find('-') != -1) && (w_strSelected.find('-') == -1);
+ bool bHasSign = (w_strValue2.find('-') != std::wstring::npos) &&
+ (w_strSelected.find('-') == std::wstring::npos);
if (bHasSign) {
// can't insert "change" in front to sign postion.
if (pEvent->SelStart() == 0) {
@@ -1158,7 +1158,7 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(IFXJS_Context* cc,
break;
}
- FX_BOOL bHasSep = (w_strValue2.find(cSep) != -1);
+ bool bHasSep = (w_strValue2.find(cSep) != std::wstring::npos);
for (std::wstring::iterator it = w_strChange2.begin();
it != w_strChange2.end(); it++) {
if (*it == cSep) {
diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp
index 858af0079c..c735b971dc 100644
--- a/fpdfsdk/src/javascript/util.cpp
+++ b/fpdfsdk/src/javascript/util.cpp
@@ -253,14 +253,12 @@ FX_BOOL util::printd(IFXJS_Context* cc,
return FALSE; // currently, it doesn't support XFAPicture.
}
- int iIndex;
- for (iIndex = 0; iIndex < sizeof(fcTable) / sizeof(stru_TbConvert);
- iIndex++) {
+ for (size_t i = 0; i < sizeof(fcTable) / sizeof(stru_TbConvert); ++i) {
int iStart = 0;
int iEnd;
- while ((iEnd = cFormat.find(fcTable[iIndex].lpszJSMark, iStart)) != -1) {
- cFormat.replace(iEnd, FXSYS_wcslen(fcTable[iIndex].lpszJSMark),
- fcTable[iIndex].lpszCppMark);
+ while ((iEnd = cFormat.find(fcTable[i].lpszJSMark, iStart)) != -1) {
+ cFormat.replace(iEnd, FXSYS_wcslen(fcTable[i].lpszJSMark),
+ fcTable[i].lpszCppMark);
iStart = iEnd;
}
}
@@ -292,25 +290,23 @@ FX_BOOL util::printd(IFXJS_Context* cc,
{L"M", iMin}, {L"s", iSec},
};
- for (iIndex = 0; iIndex < sizeof(cTableAd) / sizeof(stru_TbConvertAd);
- iIndex++) {
+ for (size_t i = 0; i < sizeof(cTableAd) / sizeof(stru_TbConvertAd); ++i) {
wchar_t tszValue[10];
CFX_WideString sValue;
- sValue.Format(L"%d", cTableAd[iIndex].iValue);
+ sValue.Format(L"%d", cTableAd[i].iValue);
memcpy(tszValue, (wchar_t*)sValue.GetBuffer(sValue.GetLength() + 1),
(sValue.GetLength() + 1) * sizeof(wchar_t));
int iStart = 0;
int iEnd;
- while ((iEnd = cFormat.find(cTableAd[iIndex].lpszJSMark, iStart)) != -1) {
+ while ((iEnd = cFormat.find(cTableAd[i].lpszJSMark, iStart)) != -1) {
if (iEnd > 0) {
if (cFormat[iEnd - 1] == L'%') {
iStart = iEnd + 1;
continue;
}
}
- cFormat.replace(iEnd, FXSYS_wcslen(cTableAd[iIndex].lpszJSMark),
- tszValue);
+ cFormat.replace(iEnd, FXSYS_wcslen(cTableAd[i].lpszJSMark), tszValue);
iStart = iEnd;
}
}
@@ -335,14 +331,12 @@ void util::printd(const std::wstring& cFormat2,
return; // currently, it doesn't support XFAPicture.
}
- int iIndex;
- for (iIndex = 0; iIndex < sizeof(fcTable) / sizeof(stru_TbConvert);
- iIndex++) {
+ for (size_t i = 0; i < sizeof(fcTable) / sizeof(stru_TbConvert); ++i) {
int iStart = 0;
int iEnd;
- while ((iEnd = cFormat.find(fcTable[iIndex].lpszJSMark, iStart)) != -1) {
- cFormat.replace(iEnd, FXSYS_wcslen(fcTable[iIndex].lpszJSMark),
- fcTable[iIndex].lpszCppMark);
+ while ((iEnd = cFormat.find(fcTable[i].lpszJSMark, iStart)) != -1) {
+ cFormat.replace(iEnd, FXSYS_wcslen(fcTable[i].lpszJSMark),
+ fcTable[i].lpszCppMark);
iStart = iEnd;
}
}
@@ -377,28 +371,23 @@ void util::printd(const std::wstring& cFormat2,
};
// cFormat = strFormat.GetBuffer(strFormat.GetLength()+1);
- for (iIndex = 0; iIndex < sizeof(cTableAd) / sizeof(stru_TbConvertAd);
- iIndex++) {
+ for (size_t i = 0; i < sizeof(cTableAd) / sizeof(stru_TbConvertAd); ++i) {
wchar_t tszValue[10];
- //_itot(cTableAd[iIndex].iValue,tszValue,10);
CFX_WideString sValue;
- sValue.Format(L"%d", cTableAd[iIndex].iValue);
+ sValue.Format(L"%d", cTableAd[i].iValue);
memcpy(tszValue, (wchar_t*)sValue.GetBuffer(sValue.GetLength() + 1),
sValue.GetLength() * sizeof(wchar_t));
- // strFormat.Replace(cTableAd[iIndex].lpszJSMark,"%d");
- // strFormat.Format(strFormat,cTableAd[iIndex].iValue);
int iStart = 0;
int iEnd;
- while ((iEnd = cFormat.find(cTableAd[iIndex].lpszJSMark, iStart)) != -1) {
+ while ((iEnd = cFormat.find(cTableAd[i].lpszJSMark, iStart)) != -1) {
if (iEnd > 0) {
if (cFormat[iEnd - 1] == L'%') {
iStart = iEnd + 1;
continue;
}
}
- cFormat.replace(iEnd, FXSYS_wcslen(cTableAd[iIndex].lpszJSMark),
- tszValue);
+ cFormat.replace(iEnd, FXSYS_wcslen(cTableAd[i].lpszJSMark), tszValue);
iStart = iEnd;
}
}
@@ -441,7 +430,6 @@ void util::printx(const std::string& cFormat,
char letter = cFormat[iIndex];
switch (letter) {
case '?':
- // cPurpose.push_back(cSource[itSource]);
cPurpose += cSource[itSource];
itSource++;
break;
@@ -450,7 +438,6 @@ void util::printx(const std::string& cFormat,
if ((cSource[itSource] >= '0' && cSource[itSource] <= '9') ||
(cSource[itSource] >= 'a' && cSource[itSource] <= 'z') ||
(cSource[itSource] >= 'A' && cSource[itSource] <= 'Z')) {
- // cPurpose.push_back(cSource[itSource]);
cPurpose += cSource[itSource];
itSource++;
break;
@@ -463,7 +450,6 @@ void util::printx(const std::string& cFormat,
while (itSource < iSize) {
if ((cSource[itSource] >= 'a' && cSource[itSource] <= 'z') ||
(cSource[itSource] >= 'A' && cSource[itSource] <= 'Z')) {
- // cPurpose.push_back(cSource[itSource]);
cPurpose += cSource[itSource];
itSource++;
break;
@@ -475,7 +461,6 @@ void util::printx(const std::string& cFormat,
case '9': {
while (itSource < iSize) {
if (cSource[itSource] >= '0' && cSource[itSource] <= '9') {
- // cPurpose.push_back(cSource[itSource]);
cPurpose += cSource[itSource];
itSource++;
break;
@@ -508,7 +493,6 @@ void util::printx(const std::string& cFormat,
case '=':
break;
default:
- // cPurpose.push_back(letter);
cPurpose += letter;
break;
}