summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-11-20 15:15:34 -0800
committerTom Sepez <tsepez@chromium.org>2015-11-20 15:15:34 -0800
commit7711b60efc62db14748711727560367d948745f1 (patch)
tree71aaa6747b81ffed60068daa20559e20b0fc427c /fpdfsdk
parent54bc568bb41c5c258e95c24ef9d7355dcdc20f9e (diff)
downloadpdfium-7711b60efc62db14748711727560367d948745f1.tar.xz
Add constant CPDFSDK_InterForm::kNumFieldTypes
Bumping this one line from 6 to 7 in XFA saves a bunch of diffs. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1458363005 .
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/include/fsdk_baseform.h5
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp14
2 files changed, 11 insertions, 8 deletions
diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h
index 90c0238e5e..b908efa488 100644
--- a/fpdfsdk/include/fsdk_baseform.h
+++ b/fpdfsdk/include/fsdk_baseform.h
@@ -271,9 +271,10 @@ class CPDFSDK_InterForm : public CPDF_FormNotify {
FX_COLORREF GetHighlightColor(int nFieldType);
private:
- FX_COLORREF m_aHighlightColor[6];
+ static const int kNumFieldTypes = 6;
+ FX_COLORREF m_aHighlightColor[kNumFieldTypes];
uint8_t m_iHighlightAlpha;
- FX_BOOL m_bNeedHightlight[6];
+ FX_BOOL m_bNeedHightlight[kNumFieldTypes];
};
#define BAI_STRUCTURE 0
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index 9f8b35dcb1..3a304986d4 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -1519,7 +1519,7 @@ CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_Document* pDocument)
ASSERT(m_pInterForm != NULL);
m_pInterForm->SetFormNotify(this);
- for (int i = 0; i < 6; i++)
+ for (int i = 0; i < kNumFieldTypes; ++i)
m_bNeedHightlight[i] = FALSE;
m_iHighlightAlpha = 0;
}
@@ -2239,20 +2239,22 @@ int CPDFSDK_InterForm::AfterFormImportData(const CPDF_InterForm* pForm) {
}
FX_BOOL CPDFSDK_InterForm::IsNeedHighLight(int nFieldType) {
- if (nFieldType < 1 || nFieldType > 6)
+ if (nFieldType < 1 || nFieldType > kNumFieldTypes)
return FALSE;
return m_bNeedHightlight[nFieldType - 1];
}
void CPDFSDK_InterForm::RemoveAllHighLight() {
- memset((void*)m_bNeedHightlight, 0, 6 * sizeof(FX_BOOL));
+ for (int i = 0; i < kNumFieldTypes; ++i)
+ m_bNeedHightlight[i] = FALSE;
}
+
void CPDFSDK_InterForm::SetHighlightColor(FX_COLORREF clr, int nFieldType) {
- if (nFieldType < 0 || nFieldType > 6)
+ if (nFieldType < 0 || nFieldType > kNumFieldTypes)
return;
switch (nFieldType) {
case 0: {
- for (int i = 0; i < 6; i++) {
+ for (int i = 0; i < kNumFieldTypes; ++i) {
m_aHighlightColor[i] = clr;
m_bNeedHightlight[i] = TRUE;
}
@@ -2267,7 +2269,7 @@ void CPDFSDK_InterForm::SetHighlightColor(FX_COLORREF clr, int nFieldType) {
}
FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) {
- if (nFieldType < 0 || nFieldType > 6)
+ if (nFieldType < 0 || nFieldType > kNumFieldTypes)
return FXSYS_RGB(255, 255, 255);
if (nFieldType == 0)
return m_aHighlightColor[0];