summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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: