summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-05-26 22:00:29 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-26 22:00:29 -0700
commit800222e01e3fcdd57536fc987e773677829dd708 (patch)
tree2c7e62ba05fa9855de3090dbab6f61169055372b /xfa/fxfa/parser
parentbefa4506dc9d2a679c526aff96c09bcb0e9daecb (diff)
downloadpdfium-800222e01e3fcdd57536fc987e773677829dd708.tar.xz
Fix MSVC C4800 build warnings.
TBR=weili@chromium.org Review-Url: https://codereview.chromium.org/2017863002
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp39
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.h25
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp3
-rw-r--r--xfa/fxfa/parser/xfa_object_imp.cpp66
4 files changed, 65 insertions, 68 deletions
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 6ef88cdc74..33dcb475e7 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -380,8 +380,7 @@ XFA_CHECKSTATE CXFA_WidgetData::GetCheckState() {
return XFA_CHECKSTATE_Off;
}
-void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState,
- FX_BOOL bNotify) {
+void CXFA_WidgetData::SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify) {
CXFA_WidgetData exclGroup(GetExclGroupNode());
if (exclGroup) {
CFX_WideString wsValue;
@@ -464,23 +463,21 @@ CXFA_Node* CXFA_WidgetData::GetSelectedMember() {
}
CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName,
- FX_BOOL bNotify) {
- CXFA_Node* pSelectedMember = NULL;
+ bool bNotify) {
uint32_t nameHash = FX_HashCode_GetW(wsName, false);
for (CXFA_Node* pNode = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild));
pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
if (pNode->GetNameHash() == nameHash) {
CXFA_WidgetData widgetData(pNode);
widgetData.SetCheckState(XFA_CHECKSTATE_On, bNotify);
- pSelectedMember = pNode;
- break;
+ return pNode;
}
}
- return pSelectedMember;
+ return nullptr;
}
void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue,
- FX_BOOL bNotify,
+ bool bNotify,
FX_BOOL bScriptModify,
FX_BOOL bSyncData) {
CFX_WideString wsExclGroup;
@@ -771,7 +768,7 @@ FX_BOOL CXFA_WidgetData::GetItemState(int32_t nIndex) {
void CXFA_WidgetData::SetItemState(int32_t nIndex,
FX_BOOL bSelected,
- FX_BOOL bNotify,
+ bool bNotify,
FX_BOOL bScriptModify,
FX_BOOL bSyncData) {
if (nIndex < 0)
@@ -831,7 +828,7 @@ void CXFA_WidgetData::SetItemState(int32_t nIndex,
}
void CXFA_WidgetData::SetSelectedItems(CFX_Int32Array& iSelArray,
- FX_BOOL bNotify,
+ bool bNotify,
FX_BOOL bScriptModify,
FX_BOOL bSyncData) {
CFX_WideString wsValue;
@@ -856,14 +853,13 @@ void CXFA_WidgetData::SetSelectedItems(CFX_Int32Array& iSelArray,
void CXFA_WidgetData::ClearAllSelections() {
CXFA_Node* pBind = m_pNode->GetBindData();
- if (pBind && GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
- while (CXFA_Node* pChildNode =
- pBind->GetNodeItem(XFA_NODEITEM_FirstChild)) {
- pBind->RemoveChild(pChildNode);
- }
- } else {
- SyncValue(CFX_WideString(), FALSE);
+ if (!pBind || GetChoiceListOpen() != XFA_ATTRIBUTEENUM_MultiSelect) {
+ SyncValue(CFX_WideString(), false);
+ return;
}
+
+ while (CXFA_Node* pChildNode = pBind->GetNodeItem(XFA_NODEITEM_FirstChild))
+ pBind->RemoveChild(pChildNode);
}
void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel,
@@ -1036,7 +1032,7 @@ FX_BOOL CXFA_WidgetData::DeleteItem(int32_t nIndex,
}
} else {
if (!bSetValue && pItems->GetBoolean(XFA_ATTRIBUTE_Save)) {
- SetItemState(nIndex, FALSE, TRUE, bScriptModify, bSyncData);
+ SetItemState(nIndex, FALSE, true, bScriptModify, bSyncData);
bSetValue = TRUE;
}
int32_t i = 0;
@@ -1318,7 +1314,7 @@ FX_BOOL CXFA_WidgetData::GetLeadDigits(int32_t& iLeadDigits) {
FX_BOOL CXFA_WidgetData::SetValue(const CFX_WideString& wsValue,
XFA_VALUEPICTURE eValueType) {
if (wsValue.IsEmpty()) {
- SyncValue(wsValue, TRUE);
+ SyncValue(wsValue, true);
return TRUE;
}
m_bPreNull = m_bIsNull;
@@ -1365,7 +1361,7 @@ FX_BOOL CXFA_WidgetData::SetValue(const CFX_WideString& wsValue,
}
}
if (uiType != XFA_ELEMENT_NumericEdit || bSyncData)
- SyncValue(wsNewText, TRUE);
+ SyncValue(wsNewText, true);
return bValidate;
}
@@ -1727,8 +1723,7 @@ void CXFA_WidgetData::FormatNumStr(const CFX_WideString& wsValue,
}
}
-void CXFA_WidgetData::SyncValue(const CFX_WideString& wsValue,
- FX_BOOL bNotify) {
+void CXFA_WidgetData::SyncValue(const CFX_WideString& wsValue, bool bNotify) {
if (!m_pNode)
return;
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h
index c0d06e353c..d2054cf145 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.h
+++ b/xfa/fxfa/parser/cxfa_widgetdata.h
@@ -80,15 +80,14 @@ class CXFA_WidgetData : public CXFA_Data {
FX_BOOL IsAllowNeutral();
FX_BOOL IsRadioButton();
XFA_CHECKSTATE GetCheckState();
- void SetCheckState(XFA_CHECKSTATE eCheckState, FX_BOOL bNotify = TRUE);
+ void SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify);
CXFA_Node* GetExclGroupNode();
CXFA_Node* GetSelectedMember();
- CXFA_Node* SetSelectedMember(const CFX_WideStringC& wsName,
- FX_BOOL bNotify = TRUE);
+ CXFA_Node* SetSelectedMember(const CFX_WideStringC& wsName, bool bNotify);
void SetSelectedMemberByValue(const CFX_WideStringC& wsValue,
- FX_BOOL bNotify = TRUE,
- FX_BOOL bScriptModify = FALSE,
- FX_BOOL bSyncData = TRUE);
+ bool bNotify,
+ FX_BOOL bScriptModify,
+ FX_BOOL bSyncData);
CXFA_Node* GetExclGroupFirstMember();
CXFA_Node* GetExclGroupNextMember(CXFA_Node* pNode);
int32_t GetChoiceListCommitOn();
@@ -108,13 +107,13 @@ class CXFA_WidgetData : public CXFA_Data {
FX_BOOL GetItemState(int32_t nIndex);
void SetItemState(int32_t nIndex,
FX_BOOL bSelected,
- FX_BOOL bNotify = FALSE,
- FX_BOOL bScriptModify = FALSE,
- FX_BOOL bSyncData = TRUE);
+ bool bNotify,
+ FX_BOOL bScriptModify,
+ FX_BOOL bSyncData);
void SetSelectedItems(CFX_Int32Array& iSelArray,
- FX_BOOL bNotify = FALSE,
- FX_BOOL bScriptModify = FALSE,
- FX_BOOL bSyncData = TRUE);
+ bool bNotify,
+ FX_BOOL bScriptModify,
+ FX_BOOL bSyncData);
void ClearAllSelections();
void InsertItem(const CFX_WideString& wsLabel,
const CFX_WideString& wsValue,
@@ -166,7 +165,7 @@ class CXFA_WidgetData : public CXFA_Data {
FX_BOOL m_bPreNull;
protected:
- void SyncValue(const CFX_WideString& wsValue, FX_BOOL bNotify);
+ void SyncValue(const CFX_WideString& wsValue, bool bNotify);
void InsertListTextItem(CXFA_Node* pItems,
const CFX_WideString& wsText,
int32_t nIndex = -1);
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 5bd8f08970..d3d5c7f27b 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -112,7 +112,6 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode,
}
CXFA_WidgetData* pWidgetData = pFormNode->GetWidgetData();
ASSERT(pWidgetData);
- FX_BOOL bNotify = FALSE;
XFA_ELEMENT eUIType = pWidgetData->GetUIType();
CXFA_Value defValue(pFormNode->GetProperty(0, XFA_ELEMENT_Value));
if (!bDataToForm) {
@@ -312,7 +311,7 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode,
break;
case XFA_ELEMENT_ExclGroup: {
pWidgetData->SetSelectedMemberByValue(wsNormailizeValue.AsStringC(),
- bNotify, FALSE, FALSE);
+ false, FALSE, FALSE);
} break;
case XFA_ELEMENT_DateTimeEdit:
XFA_DataMerge_FormValueNode_SetChildContent(
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index 3864c1a32c..53c8847be8 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -2143,7 +2143,7 @@ void CXFA_Node::Script_Field_SelectedIndex(CFXJSE_Value* pValue,
pWidgetData->ClearAllSelections();
return;
}
- pWidgetData->SetItemState(iIndex, TRUE, TRUE, TRUE);
+ pWidgetData->SetItemState(iIndex, TRUE, true, TRUE, TRUE);
} else {
FXJSE_Value_SetInteger(pValue, pWidgetData->GetSelectedItem());
}
@@ -2312,16 +2312,15 @@ void CXFA_Node::Script_Field_SetItemState(CFXJSE_Arguments* pArguments) {
return;
}
CXFA_WidgetData* pWidgetData = GetWidgetData();
- if (!pWidgetData) {
+ if (!pWidgetData)
return;
- }
+
int32_t iIndex = pArguments->GetInt32(0);
if (pArguments->GetInt32(1) != 0) {
- pWidgetData->SetItemState(iIndex, TRUE, TRUE, TRUE);
+ pWidgetData->SetItemState(iIndex, TRUE, true, TRUE, TRUE);
} else {
- if (pWidgetData->GetItemState(iIndex)) {
- pWidgetData->SetItemState(iIndex, FALSE, TRUE, TRUE);
- }
+ if (pWidgetData->GetItemState(iIndex))
+ pWidgetData->SetItemState(iIndex, FALSE, true, TRUE, TRUE);
}
}
void CXFA_Node::Script_Field_AddItem(CFXJSE_Arguments* pArguments) {
@@ -2382,7 +2381,8 @@ void CXFA_Node::Script_ExclGroup_DefaultAndRawValue(CFXJSE_Value* pValue,
CFX_ByteString bsValue;
FXJSE_Value_ToUTF8String(pValue, bsValue);
pWidgetData->SetSelectedMemberByValue(
- CFX_WideString::FromUTF8(bsValue.AsStringC()).AsStringC(), TRUE, TRUE);
+ CFX_WideString::FromUTF8(bsValue.AsStringC()).AsStringC(), true, TRUE,
+ TRUE);
} else {
CFX_WideString wsValue = GetScriptContent(TRUE);
XFA_VERSION curVersion = GetDocument()->GetCurVersionMode();
@@ -2407,35 +2407,39 @@ void CXFA_Node::Script_ExclGroup_ExecEvent(CFXJSE_Arguments* pArguments) {
ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"execEvent");
}
}
+
void CXFA_Node::Script_ExclGroup_SelectedMember(CFXJSE_Arguments* pArguments) {
int32_t argc = pArguments->GetLength();
- if ((argc == 0) || (argc == 1)) {
- CXFA_WidgetData* pWidgetData = GetWidgetData();
- if (!pWidgetData) {
- FXJSE_Value_SetNull(pArguments->GetReturnValue());
- } else {
- CXFA_Node* pReturnNode = NULL;
- if (argc == 0) {
- pReturnNode = pWidgetData->GetSelectedMember();
- } else {
- CFX_ByteString szName;
- szName = pArguments->GetUTF8String(0);
- pReturnNode = pWidgetData->SetSelectedMember(
- CFX_WideString::FromUTF8(szName.AsStringC()).AsStringC());
- }
- if (pReturnNode) {
- FXJSE_Value_Set(
- pArguments->GetReturnValue(),
- m_pDocument->GetScriptContext()->GetJSValueFromMap(pReturnNode));
- } else {
- FXJSE_Value_SetNull(pArguments->GetReturnValue());
- }
- }
- } else {
+ if (argc < 0 || argc > 1) {
ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
L"selectedMember");
+ return;
}
+
+ CXFA_WidgetData* pWidgetData = GetWidgetData();
+ if (!pWidgetData) {
+ FXJSE_Value_SetNull(pArguments->GetReturnValue());
+ return;
+ }
+
+ CXFA_Node* pReturnNode = nullptr;
+ if (argc == 0) {
+ pReturnNode = pWidgetData->GetSelectedMember();
+ } else {
+ CFX_ByteString szName;
+ szName = pArguments->GetUTF8String(0);
+ pReturnNode = pWidgetData->SetSelectedMember(
+ CFX_WideString::FromUTF8(szName.AsStringC()).AsStringC(), true);
+ }
+ if (!pReturnNode) {
+ FXJSE_Value_SetNull(pArguments->GetReturnValue());
+ return;
+ }
+ FXJSE_Value_Set(
+ pArguments->GetReturnValue(),
+ m_pDocument->GetScriptContext()->GetJSValueFromMap(pReturnNode));
}
+
void CXFA_Node::Script_ExclGroup_ExecInitialize(CFXJSE_Arguments* pArguments) {
int32_t argc = pArguments->GetLength();
if (argc == 0) {