summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-08-10 21:01:58 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-10 21:01:58 +0000
commitcdd4fa8b86fff5b967e180bcb36907bfccb935c6 (patch)
tree10d3acd7c916dfcf192a0bc5f619fa976e72d3f3
parentf42d570492e881600d6b0692fb2fe0c0ec89e181 (diff)
downloadpdfium-cdd4fa8b86fff5b967e180bcb36907bfccb935c6.tar.xz
Fix sign mismatch in CPDFXFA_DocEnvironment.
Fix some other nits as well. Change-Id: I837bd49526dd97ce666f8d8743fe5bd7653ae544 Reviewed-on: https://pdfium-review.googlesource.com/39410 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp29
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h1
2 files changed, 12 insertions, 18 deletions
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index 269b6d4b2f..5e00bff78e 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -471,8 +471,7 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
if (!pArray)
return;
- int size = pArray->GetCount();
- for (int i = 1; i < size; i += 2) {
+ for (size_t i = 1; i < pArray->GetCount(); i += 2) {
const CPDF_Object* pPDFObj = pArray->GetObjectAt(i);
const CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1);
if (!pPrePDFObj->IsString())
@@ -497,14 +496,14 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
fileWrite);
continue;
}
- if (i == size - 1) {
+ if (i == pArray->GetCount() - 1) {
WideString wPath = WideString::FromUTF16LE(
reinterpret_cast<const unsigned short*>(bs.c_str()),
bs.GetLength() / sizeof(unsigned short));
ByteString bPath = wPath.UTF8Encode();
- const char* szFormat =
+ static const char kFormat[] =
"\n<pdf href=\"%s\" xmlns=\"http://ns.adobe.com/xdp/pdf/\"/>";
- ByteString content = ByteString::Format(szFormat, bPath.c_str());
+ ByteString content = ByteString::Format(kFormat, bPath.c_str());
fileWrite->WriteBlock(content.c_str(), fileWrite->GetSize(),
content.GetLength());
}
@@ -535,22 +534,19 @@ void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc,
bool CPDFXFA_DocEnvironment::IsValidationsEnabled(CXFA_FFDoc* hDoc) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return false;
- if (m_pContext->GetFormFillEnv()->GetInterForm()) {
- return m_pContext->GetFormFillEnv()
- ->GetInterForm()
- ->IsXfaValidationsEnabled();
- }
- return true;
+
+ auto* interform = m_pContext->GetFormFillEnv()->GetInterForm();
+ return !interform || interform->IsXfaValidationsEnabled();
}
void CPDFXFA_DocEnvironment::SetValidationsEnabled(CXFA_FFDoc* hDoc,
bool bEnabled) {
if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetFormFillEnv())
return;
- if (m_pContext->GetFormFillEnv()->GetInterForm()) {
- m_pContext->GetFormFillEnv()->GetInterForm()->XfaSetValidationsEnabled(
- bEnabled);
- }
+
+ auto* interform = m_pContext->GetFormFillEnv()->GetInterForm();
+ if (interform)
+ interform->XfaSetValidationsEnabled(bEnabled);
}
void CPDFXFA_DocEnvironment::SetFocusWidget(CXFA_FFDoc* hDoc,
@@ -775,8 +771,7 @@ bool CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
return false;
}
- int size = pArray->GetCount();
- for (int i = 1; i < size; i += 2) {
+ for (size_t i = 1; i < pArray->GetCount(); i += 2) {
const CPDF_Object* pPDFObj = pArray->GetObjectAt(i);
const CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1);
if (!pPrePDFObj->IsString())
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
index 33e04ed376..dfc51e03e2 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h
@@ -13,7 +13,6 @@
#include "xfa/fxfa/fxfa.h"
class CPDFXFA_Context;
-class IJS_EventContext;
class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment {
public: