Initialize all scalars in header for CFWL_DateTimePicker.
Avoid potential uninitialized reads.
- Tidy/pack members by size/complexity while at it.
Bug: chromium:1041303
Change-Id: I51f4514809783262b5179553a2e93a5329867e97
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/65011
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index 75e71b1..11ea810 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -25,12 +25,7 @@
} // namespace
CFWL_DateTimePicker::CFWL_DateTimePicker(const CFWL_App* app)
- : CFWL_Widget(app, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr),
- m_iBtnState(1),
- m_iYear(-1),
- m_iMonth(-1),
- m_iDay(-1),
- m_bLBtnDown(false) {
+ : CFWL_Widget(app, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr) {
m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat;
auto monthProp = pdfium::MakeUnique<CFWL_WidgetProperties>();
diff --git a/xfa/fwl/cfwl_datetimepicker.h b/xfa/fwl/cfwl_datetimepicker.h
index eccde82..69520eb 100644
--- a/xfa/fwl/cfwl_datetimepicker.h
+++ b/xfa/fwl/cfwl_datetimepicker.h
@@ -93,16 +93,16 @@
bool NeedsToShowButton() const;
+ bool m_bLBtnDown = false;
+ int32_t m_iBtnState = 1;
+ int32_t m_iYear = -1;
+ int32_t m_iMonth = -1;
+ int32_t m_iDay = -1;
+ float m_fBtn = 0.0f;
CFX_RectF m_rtBtn;
CFX_RectF m_rtClient;
- int32_t m_iBtnState;
- int32_t m_iYear;
- int32_t m_iMonth;
- int32_t m_iDay;
- bool m_bLBtnDown;
std::unique_ptr<CFWL_DateTimeEdit> m_pEdit;
std::unique_ptr<CFWL_MonthCalendar> m_pMonthCal;
- float m_fBtn;
};
#endif // XFA_FWL_CFWL_DATETIMEPICKER_H_