summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_occurdata.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-21 21:57:35 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-21 21:57:35 +0000
commitb06d3f8d7658eeab6624f66aef690a7f4b44936e (patch)
tree7780958ea43c869938dfd538ecb3e53ffbf2c723 /xfa/fxfa/parser/cxfa_occurdata.cpp
parent36261b631e1847bcfdda6d381ae414c954d73e88 (diff)
downloadpdfium-b06d3f8d7658eeab6624f66aef690a7f4b44936e.tar.xz
Cleanup CXFA_OccurData
Make methods const, use return instead of out params. Change-Id: Idfdae8df5cd74ba0bce08c05a6fc34b168d25f79 Reviewed-on: https://pdfium-review.googlesource.com/19050 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser/cxfa_occurdata.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_occurdata.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/xfa/fxfa/parser/cxfa_occurdata.cpp b/xfa/fxfa/parser/cxfa_occurdata.cpp
index 4538919d10..ffad9fdf00 100644
--- a/xfa/fxfa/parser/cxfa_occurdata.cpp
+++ b/xfa/fxfa/parser/cxfa_occurdata.cpp
@@ -10,7 +10,7 @@
CXFA_OccurData::CXFA_OccurData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}
-int32_t CXFA_OccurData::GetMax() {
+int32_t CXFA_OccurData::GetMax() const {
if (!m_pNode)
return 1;
@@ -19,7 +19,7 @@ int32_t CXFA_OccurData::GetMax() {
return max ? *max : GetMin();
}
-int32_t CXFA_OccurData::GetMin() {
+int32_t CXFA_OccurData::GetMin() const {
if (!m_pNode)
return 1;
@@ -28,25 +28,21 @@ int32_t CXFA_OccurData::GetMin() {
return min && *min >= 0 ? *min : 1;
}
-bool CXFA_OccurData::GetOccurInfo(int32_t& iMin,
- int32_t& iMax,
- int32_t& iInit) {
- if (!m_pNode)
- return false;
+std::tuple<int32_t, int32_t, int32_t> CXFA_OccurData::GetOccurInfo() const {
+ ASSERT(m_pNode);
- iMin = GetMin();
- iMax = GetMax();
+ int32_t iMin = GetMin();
+ int32_t iMax = GetMax();
pdfium::Optional<int32_t> init =
m_pNode->JSNode()->TryInteger(XFA_Attribute::Initial, false);
- iInit = init && *init >= iMin ? *init : iMin;
-
- return true;
+ return {iMin, iMax, init && *init >= iMin ? *init : iMin};
}
void CXFA_OccurData::SetMax(int32_t iMax) {
iMax = (iMax != -1 && iMax < 1) ? 1 : iMax;
m_pNode->JSNode()->SetInteger(XFA_Attribute::Max, iMax, false);
+
int32_t iMin = GetMin();
if (iMax != -1 && iMax < iMin) {
iMin = iMax;
@@ -57,6 +53,7 @@ void CXFA_OccurData::SetMax(int32_t iMax) {
void CXFA_OccurData::SetMin(int32_t iMin) {
iMin = (iMin < 0) ? 1 : iMin;
m_pNode->JSNode()->SetInteger(XFA_Attribute::Min, iMin, false);
+
int32_t iMax = GetMax();
if (iMax > 0 && iMax < iMin) {
iMax = iMin;