summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-05-26 11:53:12 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-26 11:53:12 -0700
commit60607c3baaf52574cab748a97c213e447c9108c0 (patch)
treefb5ec2b56e97ef5019e4061d5cfd19eec7bfa0d6
parentfd6cfad310187631554613c375ec1b4c5ef887a3 (diff)
downloadpdfium-60607c3baaf52574cab748a97c213e447c9108c0.tar.xz
Enable chromium_code standard for XFA code
Clean up the left code which causes warnings. Enable using chromium_code for XFA compilation, also re-enable all the msvs warning flags except 4267 (same as the main pdfium code). BUG=pdfium:29,pdfium:475 Review-Url: https://codereview.chromium.org/2009813004
-rw-r--r--xfa.gyp8
-rw-r--r--xfa/fwl/core/cfwl_widgetmgr.cpp4
-rw-r--r--xfa/fxfa/parser/xfa_object_imp.cpp36
3 files changed, 31 insertions, 17 deletions
diff --git a/xfa.gyp b/xfa.gyp
index a4a6247694..ead79d3c15 100644
--- a/xfa.gyp
+++ b/xfa.gyp
@@ -1,5 +1,6 @@
{
"variables": {
+ "chromium_code": 1,
"pdf_enable_v8%": 1,
},
"target_defaults": {
@@ -7,9 +8,7 @@
"PDF_ENABLE_XFA",
],
'msvs_disabled_warnings': [
- 4005, 4018, 4146, 4333, 4345, 4267,
- # TODO(thestig): Fix all instances, remove this, pdfium:29
- 4245, 4310, 4389, 4701, 4702, 4706, 4800,
+ 4267,
],
},
"targets":[
@@ -699,6 +698,9 @@
"conditions": [
["clang==1" , {
}],
+ ["os_posix==1 and clang==0", { # When GCC
+ 'cflags': [ '-Wno-error=strict-overflow' ],
+ }],
["pdf_enable_v8==1", {
'dependencies': [
'<(DEPTH)/v8/src/v8.gyp:v8',
diff --git a/xfa/fwl/core/cfwl_widgetmgr.cpp b/xfa/fwl/core/cfwl_widgetmgr.cpp
index 760be7107b..90d621477a 100644
--- a/xfa/fwl/core/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/core/cfwl_widgetmgr.cpp
@@ -816,8 +816,8 @@ FX_BOOL CFWL_WidgetMgrDelegate::IsNeedRepaint(IFWL_Widget* pWidget,
if (r.Contains(hitPoint[i].hitPoint))
hitPoint[i].bNotNeedRepaint = true;
}
- } while (
- (pChild = CFWL_WidgetMgr::GetInstance()->GetNextSiblingWidget(pChild)));
+ pChild = CFWL_WidgetMgr::GetInstance()->GetNextSiblingWidget(pChild);
+ } while (pChild);
if (!bChildIntersectWithDirty)
return TRUE;
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index 6ee95eb8aa..3864c1a32c 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -829,8 +829,11 @@ void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) {
}
CFX_WideString wsExpression =
CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
- // TODO(tsepez): actually do something here?
+ // TODO(weili): check whether we need to implement this, pdfium:501.
+ // For now, just put the variables here to avoid unused variable warning.
+ (void)wsExpression;
}
+
void CXFA_Node::Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments) {
int32_t iLength = pArguments->GetLength();
if (iLength < 1 || iLength > 3) {
@@ -841,17 +844,22 @@ void CXFA_Node::Script_NodeClass_AssignNode(CFXJSE_Arguments* pArguments) {
CFX_WideString wsValue;
int32_t iAction = 0;
if (iLength >= 1) {
- CFX_ByteString bsExpression = pArguments->GetUTF8String(0);
- wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC());
+ wsExpression =
+ CFX_WideString::FromUTF8(pArguments->GetUTF8String(0).AsStringC());
}
if (iLength >= 2) {
- CFX_ByteString bsValue = pArguments->GetUTF8String(1);
- wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC());
+ wsValue =
+ CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC());
}
- if (iLength >= 3) {
+ if (iLength >= 3)
iAction = pArguments->GetInt32(2);
- }
+ // TODO(weili): check whether we need to implement this, pdfium:501.
+ // For now, just put the variables here to avoid unused variable warning.
+ (void)wsExpression;
+ (void)wsValue;
+ (void)iAction;
}
+
void CXFA_Node::Script_NodeClass_Clone(CFXJSE_Arguments* pArguments) {
int32_t iLength = pArguments->GetLength();
if (iLength != 1) {
@@ -1139,22 +1147,26 @@ void CXFA_Node::Script_NodeClass_SetAttribute(CFXJSE_Arguments* pArguments) {
CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC());
SetAttribute(wsAttribute.AsStringC(), wsAttributeValue.AsStringC(), TRUE);
}
+
void CXFA_Node::Script_NodeClass_SetElement(CFXJSE_Arguments* pArguments) {
int32_t iLength = pArguments->GetLength();
if (iLength != 1 && iLength != 2) {
ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"setElement");
return;
}
- CXFA_Node* pNode = NULL;
+ CXFA_Node* pNode = nullptr;
CFX_WideString wsName;
- if (iLength >= 1) {
+ if (iLength >= 1)
pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
- }
if (iLength >= 2) {
- CFX_ByteString bsName = pArguments->GetUTF8String(1);
- wsName = CFX_WideString::FromUTF8(bsName.AsStringC());
+ wsName = CFX_WideString::FromUTF8(pArguments->GetUTF8String(1).AsStringC());
}
+ // TODO(weili): check whether we need to implement this, pdfium:501.
+ // For now, just put the variables here to avoid unused variable warning.
+ (void)pNode;
+ (void)wsName;
}
+
void CXFA_Node::Script_NodeClass_Ns(CFXJSE_Value* pValue,
FX_BOOL bSetting,
XFA_ATTRIBUTE eAttribute) {