summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2016-03-11 17:00:48 -0800
committerWei Li <weili@chromium.org>2016-03-11 17:00:48 -0800
commit97da97662417085774f75c26e535c6fbe70266ae (patch)
tree9654be693dfb20b49be80911fa8089ff319757f3 /fpdfsdk/src
parent55265016faac358266af280db6c62afa34ce2891 (diff)
downloadpdfium-97da97662417085774f75c26e535c6fbe70266ae.tar.xz
Re-enable MSVC warning 4800 for compiling with chromium_code
Mainly change the code to avoid the warnings; in a few cases we have to use explicit casts. BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1783023002 .
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/formfiller/FFL_CheckBox.cpp4
-rw-r--r--fpdfsdk/src/formfiller/FFL_RadioButton.cpp4
-rw-r--r--fpdfsdk/src/fpdfsave.cpp3
-rw-r--r--fpdfsdk/src/fsdk_baseannot.cpp6
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp14
-rw-r--r--fpdfsdk/src/javascript/Document.cpp4
-rw-r--r--fpdfsdk/src/javascript/Field.cpp8
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp12
8 files changed, 28 insertions, 27 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
index 78a689af64..485f86ba75 100644
--- a/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_CheckBox.cpp
@@ -96,7 +96,7 @@ FX_BOOL CFFL_CheckBox::IsDataChanged(CPDFSDK_PageView* pPageView) {
void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) {
if (CPWL_CheckBox* pWnd = (CPWL_CheckBox*)GetPDFWindow(pPageView, FALSE)) {
- FX_BOOL bNewChecked = pWnd->IsChecked();
+ bool bNewChecked = pWnd->IsChecked();
if (bNewChecked) {
CPDF_FormField* pField = m_pWidget->GetFormField();
@@ -109,7 +109,7 @@ void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) {
}
}
- m_pWidget->SetCheck(bNewChecked, FALSE);
+ m_pWidget->SetCheck(bNewChecked, false);
m_pWidget->UpdateField();
SetChangeMark();
}
diff --git a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
index 845df115ca..029bcf1a17 100644
--- a/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
+++ b/fpdfsdk/src/formfiller/FFL_RadioButton.cpp
@@ -101,7 +101,7 @@ FX_BOOL CFFL_RadioButton::IsDataChanged(CPDFSDK_PageView* pPageView) {
void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) {
if (CPWL_RadioButton* pWnd =
(CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) {
- FX_BOOL bNewChecked = pWnd->IsChecked();
+ bool bNewChecked = pWnd->IsChecked();
if (bNewChecked) {
CPDF_FormField* pField = m_pWidget->GetFormField();
@@ -114,7 +114,7 @@ void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) {
}
}
- m_pWidget->SetCheck(bNewChecked, FALSE);
+ m_pWidget->SetCheck(bNewChecked, false);
m_pWidget->UpdateField();
SetChangeMark();
}
diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp
index 1aa1651e47..81defbf0a7 100644
--- a/fpdfsdk/src/fpdfsave.cpp
+++ b/fpdfsdk/src/fpdfsave.cpp
@@ -302,10 +302,9 @@ bool FPDF_Doc_Save(FPDF_DOCUMENT document,
}
CFX_IFileWrite* pStreamWrite = NULL;
- FX_BOOL bRet;
pStreamWrite = new CFX_IFileWrite;
pStreamWrite->Init(pFileWrite);
- bRet = FileMaker.Create(pStreamWrite, flags);
+ bool bRet = FileMaker.Create(pStreamWrite, flags);
#ifdef PDF_ENABLE_XFA
SendPostSaveToXFADoc(pDoc);
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp
index b007e68fa1..276d302bdd 100644
--- a/fpdfsdk/src/fsdk_baseannot.cpp
+++ b/fpdfsdk/src/fsdk_baseannot.cpp
@@ -623,11 +623,11 @@ FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const {
return systime;
}
-void CPDFSDK_BAAnnot::SetFlags(int nFlags) {
+void CPDFSDK_BAAnnot::SetFlags(FX_DWORD nFlags) {
m_pAnnot->GetAnnotDict()->SetAtInteger("F", nFlags);
}
-int CPDFSDK_BAAnnot::GetFlags() const {
+FX_DWORD CPDFSDK_BAAnnot::GetFlags() const {
return m_pAnnot->GetAnnotDict()->GetIntegerBy("F");
}
@@ -885,7 +885,7 @@ FX_BOOL CPDFSDK_BAAnnot::CreateFormFiller() {
return TRUE;
}
FX_BOOL CPDFSDK_BAAnnot::IsVisible() const {
- int nFlags = GetFlags();
+ FX_DWORD nFlags = GetFlags();
return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) ||
(nFlags & ANNOTFLAG_NOVIEW));
}
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index 8541193bda..89d27726e8 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -663,7 +663,7 @@ int CPDFSDK_Widget::GetTopVisibleIndex() const {
return pFormField->GetTopVisibleIndex();
}
-FX_BOOL CPDFSDK_Widget::IsChecked() const {
+bool CPDFSDK_Widget::IsChecked() const {
#ifdef PDF_ENABLE_XFA
if (IXFA_WidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) {
if (IXFA_Widget* hWidget = GetMixXFAWidget()) {
@@ -686,7 +686,7 @@ int CPDFSDK_Widget::GetMaxLen() const {
return pFormField->GetMaxLen();
}
-void CPDFSDK_Widget::SetCheck(FX_BOOL bChecked, FX_BOOL bNotify) {
+void CPDFSDK_Widget::SetCheck(bool bChecked, bool bNotify) {
CPDF_FormControl* pFormCtrl = GetFormControl();
CPDF_FormField* pFormField = pFormCtrl->GetField();
pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecked,
@@ -2373,7 +2373,7 @@ FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) {
ASSERT(pControl);
if (CPDFSDK_Widget* pWidget = GetWidget(pControl)) {
- int nFlags = pWidget->GetFlags();
+ FX_DWORD nFlags = pWidget->GetFlags();
nFlags &= ~ANNOTFLAG_INVISIBLE;
nFlags &= ~ANNOTFLAG_NOVIEW;
if (bHide)
@@ -2406,7 +2406,7 @@ FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) {
if (m_pInterForm->CheckRequiredFields(&fields, bIncludeOrExclude))
return FALSE;
- return SubmitFields(sDestination, fields, bIncludeOrExclude, FALSE);
+ return SubmitFields(sDestination, fields, bIncludeOrExclude, false);
}
}
if (m_pInterForm->CheckRequiredFields(nullptr, true))
@@ -2418,8 +2418,8 @@ FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) {
FX_BOOL CPDFSDK_InterForm::SubmitFields(
const CFX_WideString& csDestination,
const std::vector<CPDF_FormField*>& fields,
- FX_BOOL bIncludeOrExclude,
- FX_BOOL bUrlEncoded) {
+ bool bIncludeOrExclude,
+ bool bUrlEncoded) {
CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
CFX_ByteTextBuf textBuf;
@@ -2483,7 +2483,7 @@ FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf,
FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(
const std::vector<CPDF_FormField*>& fields,
- FX_BOOL bIncludeOrExclude,
+ bool bIncludeOrExclude,
CFX_ByteTextBuf& textBuf) {
std::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF(
m_pDocument->GetPath(), fields, bIncludeOrExclude));
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 1c9c1f31f4..672a3a3874 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -652,7 +652,7 @@ FX_BOOL Document::submitForm(IJS_Context* cc,
if (pPDFInterForm->CheckRequiredFields(&fieldObjects, true)) {
pRuntime->BeginBlock();
- pInterForm->SubmitFields(strURL, fieldObjects, TRUE, !bFDF);
+ pInterForm->SubmitFields(strURL, fieldObjects, true, !bFDF);
pRuntime->EndBlock();
}
return TRUE;
@@ -803,7 +803,7 @@ FX_BOOL Document::info(IJS_Context* cc,
(float)pValueObj->GetNumber());
} else if (pValueObj->IsBoolean()) {
FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(),
- (bool)pValueObj->GetInteger());
+ !!pValueObj->GetInteger());
}
}
vp << pObj;
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp
index 35ef8b42da..0c0dfd17bf 100644
--- a/fpdfsdk/src/javascript/Field.cpp
+++ b/fpdfsdk/src/javascript/Field.cpp
@@ -3022,7 +3022,7 @@ FX_BOOL Field::checkThisBox(IJS_Context* cc,
int nWidget = params[0].ToInt();
- FX_BOOL bCheckit = TRUE;
+ bool bCheckit = true;
if (iSize >= 2)
bCheckit = params[1].ToBool();
@@ -3036,10 +3036,12 @@ FX_BOOL Field::checkThisBox(IJS_Context* cc,
return FALSE;
if (nWidget < 0 || nWidget >= pFormField->CountControls())
return FALSE;
+ // TODO(weili): Check whether anything special needed for radio button,
+ // otherwise merge these branches.
if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)
- pFormField->CheckControl(nWidget, bCheckit, TRUE);
+ pFormField->CheckControl(nWidget, bCheckit, true);
else
- pFormField->CheckControl(nWidget, bCheckit, TRUE);
+ pFormField->CheckControl(nWidget, bCheckit, true);
UpdateFormField(m_pDocument, pFormField, TRUE, TRUE, TRUE);
return TRUE;
diff --git a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp
index 44c3ec8a94..c19a233940 100644
--- a/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_SpecialButton.cpp
@@ -21,7 +21,7 @@ CFX_FloatRect CPWL_PushButton::GetFocusRect() const {
return CPWL_Utils::DeflateRect(GetWindowRect(), (FX_FLOAT)GetBorderWidth());
}
-CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(FALSE) {}
+CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(false) {}
CPWL_CheckBox::~CPWL_CheckBox() {}
@@ -29,11 +29,11 @@ CFX_ByteString CPWL_CheckBox::GetClassName() const {
return "CPWL_CheckBox";
}
-void CPWL_CheckBox::SetCheck(FX_BOOL bCheck) {
+void CPWL_CheckBox::SetCheck(bool bCheck) {
m_bChecked = bCheck;
}
-FX_BOOL CPWL_CheckBox::IsChecked() const {
+bool CPWL_CheckBox::IsChecked() const {
return m_bChecked;
}
@@ -51,7 +51,7 @@ FX_BOOL CPWL_CheckBox::OnChar(FX_WORD nChar, FX_DWORD nFlag) {
return TRUE;
}
-CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(FALSE) {}
+CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(false) {}
CPWL_RadioButton::~CPWL_RadioButton() {}
@@ -68,11 +68,11 @@ FX_BOOL CPWL_RadioButton::OnLButtonUp(const CFX_FloatPoint& point,
return TRUE;
}
-void CPWL_RadioButton::SetCheck(FX_BOOL bCheck) {
+void CPWL_RadioButton::SetCheck(bool bCheck) {
m_bChecked = bCheck;
}
-FX_BOOL CPWL_RadioButton::IsChecked() const {
+bool CPWL_RadioButton::IsChecked() const {
return m_bChecked;
}