summaryrefslogtreecommitdiff
path: root/xfa/src
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-02-22 12:19:42 -0800
committerLei Zhang <thestig@chromium.org>2016-02-22 12:19:42 -0800
commitd6b15fc92cb30cfc346fe28379d0aa8a24cbf601 (patch)
treeb37e5c9851595ce5111438498a219d467720dd6e /xfa/src
parent2373da22a2e754ae9b0e7d913da0ce2e925f76a0 (diff)
downloadpdfium-d6b15fc92cb30cfc346fe28379d0aa8a24cbf601.tar.xz
Define NDEBUG for Release builds.
Also fix -Wunused warnings as a result of this change. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1717063002 .
Diffstat (limited to 'xfa/src')
-rw-r--r--xfa/src/fdp/src/css/fde_csscache.cpp4
-rw-r--r--xfa/src/fdp/src/css/fde_cssstyleselector.cpp4
-rw-r--r--xfa/src/fgas/src/crt/fx_utils.cpp15
-rw-r--r--xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp31
-rw-r--r--xfa/src/fxfa/src/parser/xfa_object_imp.cpp14
5 files changed, 44 insertions, 24 deletions
diff --git a/xfa/src/fdp/src/css/fde_csscache.cpp b/xfa/src/fdp/src/css/fde_csscache.cpp
index 5d98b98629..5909524dae 100644
--- a/xfa/src/fdp/src/css/fde_csscache.cpp
+++ b/xfa/src/fdp/src/css/fde_csscache.cpp
@@ -141,7 +141,7 @@ void CFDE_CSSAccelerator::OnEnterTag(IFDE_CSSTagProvider* pTag) {
m_Stack.Push(item);
}
void CFDE_CSSAccelerator::OnLeaveTag(IFDE_CSSTagProvider* pTag) {
- FDE_CSSTAGCACHE* pItem = m_Stack.GetTopElement();
- FXSYS_assert(pItem && pItem->GetTag() == pTag);
+ FXSYS_assert(m_Stack.GetTopElement());
+ FXSYS_assert(m_Stack.GetTopElement()->GetTag() == pTag);
m_Stack.Pop();
}
diff --git a/xfa/src/fdp/src/css/fde_cssstyleselector.cpp b/xfa/src/fdp/src/css/fde_cssstyleselector.cpp
index 815aaf5604..1bb0133e99 100644
--- a/xfa/src/fdp/src/css/fde_cssstyleselector.cpp
+++ b/xfa/src/fdp/src/css/fde_cssstyleselector.cpp
@@ -428,8 +428,8 @@ void CFDE_CSSStyleSelector::ComputeStyle(
const IFDE_CSSDeclaration** ppDeclArray,
int32_t iDeclCount,
IFDE_CSSComputedStyle* pDestStyle) {
- CFDE_CSSComputedStyle* pComputedStyle = (CFDE_CSSComputedStyle*)pDestStyle;
- FXSYS_assert(pTag && iDeclCount >= 0 && pComputedStyle != NULL);
+ FXSYS_assert(iDeclCount >= 0);
+ FXSYS_assert(pDestStyle);
FX_POSITION pos = pTag->GetFirstAttribute();
if (pos != NULL) {
if (m_pInlineStyleStore == NULL) {
diff --git a/xfa/src/fgas/src/crt/fx_utils.cpp b/xfa/src/fgas/src/crt/fx_utils.cpp
index 31fcb9e9b5..470abf4319 100644
--- a/xfa/src/fgas/src/crt/fx_utils.cpp
+++ b/xfa/src/fgas/src/crt/fx_utils.cpp
@@ -227,15 +227,20 @@ int32_t CFX_BaseMassArrayImp::Copy(const CFX_BaseMassArrayImp& src,
Append(0, src, iStart, iCount);
return m_iBlockCount;
}
+
void CFX_BaseMassArrayImp::Append(int32_t iDstStart,
const CFX_BaseMassArrayImp& src,
int32_t iSrcStart,
int32_t iSrcCount) {
- FXSYS_assert(iDstStart > -1 && m_iBlockSize == src.m_iBlockSize);
- int32_t iSrcTotal = src.m_iBlockCount;
- FXSYS_assert(iSrcTotal > 0 && m_iBlockCount >= iDstStart + iSrcCount);
- FXSYS_assert(iSrcStart > -1 && iSrcStart < iSrcTotal && iSrcCount > 0 &&
- iSrcStart + iSrcCount <= iSrcTotal);
+ FXSYS_assert(iDstStart > -1);
+ FXSYS_assert(m_iBlockSize == src.m_iBlockSize);
+ FXSYS_assert(src.m_iBlockCount > 0);
+ FXSYS_assert(m_iBlockCount >= iDstStart + iSrcCount);
+ FXSYS_assert(iSrcStart > -1);
+ FXSYS_assert(iSrcStart < src.m_iBlockCount);
+ FXSYS_assert(iSrcCount > 0);
+ FXSYS_assert(iSrcStart + iSrcCount <= src.m_iBlockCount);
+
int32_t iDstChunkIndex = iDstStart / m_iChunkSize;
int32_t iSrcChunkIndex = iSrcStart / src.m_iChunkSize;
uint8_t* pDstChunk = (uint8_t*)GetAt(iDstStart);
diff --git a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp
index 15d9531d8b..fd6b23d1ec 100644
--- a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp
@@ -9,6 +9,9 @@
#include "xfa/src/fxfa/src/fm2js/xfa_fm2js.h"
#define FINANCIAL_PRECISION 0.00000001
+
+namespace {
+
struct XFA_FMHtmlReserveCode {
uint32_t m_uCode;
const FX_WCHAR* m_htmlReserve;
@@ -18,7 +21,8 @@ struct XFA_FMHtmlHashedReserveCode {
const FX_WCHAR* m_htmlReserve;
uint32_t m_uCode;
};
-static XFA_FMHtmlHashedReserveCode reservesForDecode[] = {
+
+const XFA_FMHtmlHashedReserveCode reservesForDecode[] = {
{0x00018b62, L"Mu", 924}, {0x00019083, L"Nu", 925},
{0x00019ab9, L"Pi", 928}, {0x0001c3c1, L"Xi", 926},
{0x000210ac, L"ge", 8805}, {0x000210bb, L"gt", 62},
@@ -146,7 +150,8 @@ static XFA_FMHtmlHashedReserveCode reservesForDecode[] = {
{0xf88c8430, L"ocirc", 244}, {0xf9676178, L"frasl", 8260},
{0xfd01885e, L"igrave", 236}, {0xff3281da, L"egrave", 232},
};
-static XFA_FMHtmlReserveCode reservesForEncode[] = {
+
+const XFA_FMHtmlReserveCode reservesForEncode[] = {
{34, L"quot"}, {38, L"amp"}, {39, L"apos"},
{60, L"lt"}, {62, L"gt"}, {160, L"nbsp"},
{161, L"iexcl"}, {162, L"cent"}, {163, L"pund"},
@@ -232,6 +237,9 @@ static XFA_FMHtmlReserveCode reservesForEncode[] = {
{9002, L"rang"}, {9674, L"loz"}, {9824, L"spades"},
{9827, L"clubs"}, {9829, L"hearts"}, {9830, L"diams"},
};
+
+} // namespace
+
void CXFA_FM2JSContext::Abs(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args) {
@@ -3269,11 +3277,12 @@ void CXFA_FM2JSContext::Ref(FXJSE_HOBJECT hThis,
FXJSE_Value_Release(rgValues[i]);
}
} else if (FXJSE_Value_IsArray(argOne)) {
+#if defined(_DEBUG)
FXJSE_HVALUE lengthValue = FXJSE_Value_Create(hruntime);
FXJSE_Value_GetObjectProp(argOne, "length", lengthValue);
- int32_t iLength = FXJSE_Value_ToInteger(lengthValue);
+ FXSYS_assert(FXJSE_Value_ToInteger(lengthValue) >= 3);
FXJSE_Value_Release(lengthValue);
- FXSYS_assert(iLength >= 3);
+#endif
FXJSE_HVALUE propertyValue = FXJSE_Value_Create(hruntime);
FXJSE_HVALUE jsObjectValue = FXJSE_Value_Create(hruntime);
FXJSE_Value_GetObjectPropByIdx(argOne, 1, propertyValue);
@@ -6444,17 +6453,18 @@ void CXFA_FM2JSContext::get_fm_jsobj(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
CFXJSE_Arguments& args) {
CXFA_FM2JSContext* pContext =
- (CXFA_FM2JSContext*)FXJSE_Value_ToObject(hThis, NULL);
- FXJSE_HRUNTIME hruntime = pContext->GetScriptRuntime();
+ static_cast<CXFA_FM2JSContext*>(FXJSE_Value_ToObject(hThis, nullptr));
int32_t argc = args.GetLength();
if (argc == 1) {
FXJSE_HVALUE argOne = args.GetValue(0);
if (FXJSE_Value_IsArray(argOne)) {
+#if defined(_DEBUG)
+ FXJSE_HRUNTIME hruntime = pContext->GetScriptRuntime();
FXJSE_HVALUE lengthValue = FXJSE_Value_Create(hruntime);
FXJSE_Value_GetObjectProp(argOne, "length", lengthValue);
- int32_t iLength = FXJSE_Value_ToInteger(lengthValue);
- FXSYS_assert(iLength >= 3);
+ FXSYS_assert(FXJSE_Value_ToInteger(lengthValue) >= 3);
FXJSE_Value_Release(lengthValue);
+#endif
FXJSE_Value_GetObjectPropByIdx(argOne, 2, args.GetReturnValue());
} else {
FXJSE_Value_Set(args.GetReturnValue(), argOne);
@@ -6474,11 +6484,12 @@ void CXFA_FM2JSContext::fm_var_filter(FXJSE_HOBJECT hThis,
if (argc == 1) {
FXJSE_HVALUE argOne = args.GetValue(0);
if (FXJSE_Value_IsArray(argOne)) {
+#if defined(_DEBUG)
FXJSE_HVALUE lengthValue = FXJSE_Value_Create(hruntime);
FXJSE_Value_GetObjectProp(argOne, "length", lengthValue);
- int32_t iLength = FXJSE_Value_ToInteger(lengthValue);
- FXSYS_assert(iLength >= 3);
+ FXSYS_assert(FXJSE_Value_ToInteger(lengthValue) >= 3);
FXJSE_Value_Release(lengthValue);
+#endif
FXJSE_HVALUE flagsValue = FXJSE_Value_Create(hruntime);
FXJSE_Value_GetObjectPropByIdx(argOne, 0, flagsValue);
int32_t iFlags = FXJSE_Value_ToInteger(flagsValue);
diff --git a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp
index 5329a358bd..02e214de18 100644
--- a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp
+++ b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp
@@ -4611,10 +4611,12 @@ CXFA_Node* CXFA_Node::GetChild(int32_t index,
return NULL;
}
int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) {
- ASSERT(pNode != NULL && pNode->m_pNext == NULL);
+ ASSERT(!pNode->m_pNext);
pNode->m_pParent = this;
FX_BOOL bWasPurgeNode = m_pDocument->RemovePurgeNode(pNode);
- FXSYS_assert(bWasPurgeNode == TRUE);
+ if (!bWasPurgeNode)
+ FXSYS_assert(false);
+
if (m_pChild == NULL || index == 0) {
if (index > 0) {
return -1;
@@ -4654,13 +4656,15 @@ int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) {
return index;
}
FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) {
- if (!pNode || pNode->m_pParent != NULL ||
+ if (!pNode || pNode->m_pParent ||
(pBeforeNode && pBeforeNode->m_pParent != this)) {
- FXSYS_assert(FALSE);
+ FXSYS_assert(false);
return FALSE;
}
FX_BOOL bWasPurgeNode = m_pDocument->RemovePurgeNode(pNode);
- FXSYS_assert(bWasPurgeNode == TRUE);
+ if (!bWasPurgeNode)
+ FXSYS_assert(false);
+
int32_t nIndex = -1;
pNode->m_pParent = this;
if (m_pChild == NULL || pBeforeNode == m_pChild) {