Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: xfa/fxfa/parser/cxfa_occur.cpp

Issue 2467203003: Remove FX_BOOL from xfa. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/cxfa_occur.h ('k') | xfa/fxfa/parser/cxfa_resolveprocessor.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/parser/cxfa_occur.h" 7 #include "xfa/fxfa/parser/cxfa_occur.h"
8 8
9 #include "xfa/fxfa/parser/xfa_object.h" 9 #include "xfa/fxfa/parser/xfa_object.h"
10 10
11 CXFA_Occur::CXFA_Occur(CXFA_Node* pNode) : CXFA_Data(pNode) {} 11 CXFA_Occur::CXFA_Occur(CXFA_Node* pNode) : CXFA_Data(pNode) {}
12 12
13 int32_t CXFA_Occur::GetMax() { 13 int32_t CXFA_Occur::GetMax() {
14 int32_t iMax = 1; 14 int32_t iMax = 1;
15 if (m_pNode) { 15 if (m_pNode) {
16 if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, TRUE)) 16 if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, true))
17 iMax = GetMin(); 17 iMax = GetMin();
18 } 18 }
19 return iMax; 19 return iMax;
20 } 20 }
21 21
22 int32_t CXFA_Occur::GetMin() { 22 int32_t CXFA_Occur::GetMin() {
23 int32_t iMin = 1; 23 int32_t iMin = 1;
24 if (m_pNode) { 24 if (m_pNode) {
25 if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, TRUE) || iMin < 0) 25 if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, true) || iMin < 0)
26 iMin = 1; 26 iMin = 1;
27 } 27 }
28 return iMin; 28 return iMin;
29 } 29 }
30 30
31 FX_BOOL CXFA_Occur::GetOccurInfo(int32_t& iMin, int32_t& iMax, int32_t& iInit) { 31 bool CXFA_Occur::GetOccurInfo(int32_t& iMin, int32_t& iMax, int32_t& iInit) {
32 if (!m_pNode) 32 if (!m_pNode)
33 return FALSE; 33 return false;
34 if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, FALSE) || iMin < 0) 34 if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Min, iMin, false) || iMin < 0)
35 iMin = 1; 35 iMin = 1;
36 if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, FALSE)) { 36 if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Max, iMax, false)) {
37 if (iMin == 0) 37 if (iMin == 0)
38 iMax = 1; 38 iMax = 1;
39 else 39 else
40 iMax = iMin; 40 iMax = iMin;
41 } 41 }
42 if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Initial, iInit, FALSE) || 42 if (!m_pNode->TryInteger(XFA_ATTRIBUTE_Initial, iInit, false) ||
43 iInit < iMin) { 43 iInit < iMin) {
44 iInit = iMin; 44 iInit = iMin;
45 } 45 }
46 return TRUE; 46 return true;
47 } 47 }
48 48
49 void CXFA_Occur::SetMax(int32_t iMax) { 49 void CXFA_Occur::SetMax(int32_t iMax) {
50 iMax = (iMax != -1 && iMax < 1) ? 1 : iMax; 50 iMax = (iMax != -1 && iMax < 1) ? 1 : iMax;
51 m_pNode->SetInteger(XFA_ATTRIBUTE_Max, iMax, FALSE); 51 m_pNode->SetInteger(XFA_ATTRIBUTE_Max, iMax, false);
52 int32_t iMin = GetMin(); 52 int32_t iMin = GetMin();
53 if (iMax != -1 && iMax < iMin) { 53 if (iMax != -1 && iMax < iMin) {
54 iMin = iMax; 54 iMin = iMax;
55 m_pNode->SetInteger(XFA_ATTRIBUTE_Min, iMin, FALSE); 55 m_pNode->SetInteger(XFA_ATTRIBUTE_Min, iMin, false);
56 } 56 }
57 } 57 }
58 58
59 void CXFA_Occur::SetMin(int32_t iMin) { 59 void CXFA_Occur::SetMin(int32_t iMin) {
60 iMin = (iMin < 0) ? 1 : iMin; 60 iMin = (iMin < 0) ? 1 : iMin;
61 m_pNode->SetInteger(XFA_ATTRIBUTE_Min, iMin, FALSE); 61 m_pNode->SetInteger(XFA_ATTRIBUTE_Min, iMin, false);
62 int32_t iMax = GetMax(); 62 int32_t iMax = GetMax();
63 if (iMax > 0 && iMax < iMin) { 63 if (iMax > 0 && iMax < iMin) {
64 iMax = iMin; 64 iMax = iMin;
65 m_pNode->SetInteger(XFA_ATTRIBUTE_Max, iMax, FALSE); 65 m_pNode->SetInteger(XFA_ATTRIBUTE_Max, iMax, false);
66 } 66 }
67 } 67 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/cxfa_occur.h ('k') | xfa/fxfa/parser/cxfa_resolveprocessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698