CPWL_Dash: switch to universal init
E.g. clang-15 in -std=c++20 mode fails without this with the following
error message:
pdfium/fpdfsdk/pwl/cpwl_wnd.cpp:43:7: error: no matching constructor for initialization of 'CPWL_Dash'
sDash(3, 0, 0) {}
^ ~~~~~~~
pdfium/fpdfsdk/pwl/cpwl_wnd.h:61:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 3 were provided
struct CPWL_Dash {
^
pdfium/fpdfsdk/pwl/cpwl_wnd.h:61:8: note: candidate constructor (the implicit move constructor) not viable: requires 1 argument, but 3 were provided
pdfium/fpdfsdk/pwl/cpwl_wnd.h:61:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 3 were provided
1 error generated.
Switching to universal init restores the ability to build with this
compiler, as it was working in the past.
Change-Id: I48b2079b87cce9bc4e2ec7b813e21ea5bcb786d3
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/125170
Reviewed-by: Tom Sepez <tsepez@google.com>
Commit-Queue: Tom Sepez <tsepez@google.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_appstream.cpp b/fpdfsdk/cpdfsdk_appstream.cpp
index 3a9bfab..b7b06ca 100644
--- a/fpdfsdk/cpdfsdk_appstream.cpp
+++ b/fpdfsdk/cpdfsdk_appstream.cpp
@@ -1055,7 +1055,7 @@
rcBBox, 2, CFX_Color(CFX_Color::Type::kGray, 0),
CFX_Color(CFX_Color::Type::kGray, 1),
CFX_Color(CFX_Color::Type::kGray, 0.5), BorderStyle::kBeveled,
- CPWL_Dash(3, 0, 0));
+ CPWL_Dash{3, 0, 0});
}
CFX_PointF ptCenter = CFX_PointF((rcBBox.left + rcBBox.right) / 2,
@@ -1162,14 +1162,14 @@
CFX_Color crBorder = pControl->GetOriginalBorderColor();
float fBorderWidth = static_cast<float>(widget_->GetBorderWidth());
- CPWL_Dash dsBorder(3, 0, 0);
+ CPWL_Dash dsBorder{3, 0, 0};
CFX_Color crLeftTop;
CFX_Color crRightBottom;
BorderStyle nBorderStyle = widget_->GetBorderStyle();
switch (nBorderStyle) {
case BorderStyle::kDash:
- dsBorder = CPWL_Dash(3, 3, 0);
+ dsBorder = CPWL_Dash{3, 3, 0};
break;
case BorderStyle::kBeveled:
fBorderWidth *= 2;
@@ -1313,14 +1313,14 @@
CFX_Color crBackground = pControl->GetOriginalBackgroundColor();
CFX_Color crBorder = pControl->GetOriginalBorderColor();
float fBorderWidth = static_cast<float>(widget_->GetBorderWidth());
- CPWL_Dash dsBorder(3, 0, 0);
+ CPWL_Dash dsBorder{3, 0, 0};
CFX_Color crLeftTop;
CFX_Color crRightBottom;
BorderStyle nBorderStyle = widget_->GetBorderStyle();
switch (nBorderStyle) {
case BorderStyle::kDash:
- dsBorder = CPWL_Dash(3, 3, 0);
+ dsBorder = CPWL_Dash{3, 3, 0};
break;
case BorderStyle::kBeveled:
fBorderWidth *= 2;
@@ -1392,14 +1392,14 @@
CFX_Color crBackground = pControl->GetOriginalBackgroundColor();
CFX_Color crBorder = pControl->GetOriginalBorderColor();
float fBorderWidth = static_cast<float>(widget_->GetBorderWidth());
- CPWL_Dash dsBorder(3, 0, 0);
+ CPWL_Dash dsBorder{3, 0, 0};
CFX_Color crLeftTop;
CFX_Color crRightBottom;
BorderStyle nBorderStyle = widget_->GetBorderStyle();
switch (nBorderStyle) {
case BorderStyle::kDash:
- dsBorder = CPWL_Dash(3, 3, 0);
+ dsBorder = CPWL_Dash{3, 3, 0};
break;
case BorderStyle::kBeveled:
fBorderWidth *= 2;
@@ -1769,7 +1769,7 @@
ByteString sColor =
GetStrokeColorAppStream(widget_->GetBorderPWLColor());
if (sColor.GetLength() > 0) {
- CPWL_Dash dsBorder = CPWL_Dash(3, 3, 0);
+ CPWL_Dash dsBorder = CPWL_Dash{3, 3, 0};
AutoClosedQCommand q(&sLines);
sLines << widget_->GetBorderWidth() << " " << kSetLineWidthOperator
<< "\n"
@@ -1876,12 +1876,12 @@
CFX_Color crRightBottom;
float fBorderWidth = static_cast<float>(widget_->GetBorderWidth());
- CPWL_Dash dsBorder(3, 0, 0);
+ CPWL_Dash dsBorder{3, 0, 0};
BorderStyle nBorderStyle = widget_->GetBorderStyle();
switch (nBorderStyle) {
case BorderStyle::kDash:
- dsBorder = CPWL_Dash(3, 3, 0);
+ dsBorder = CPWL_Dash{3, 3, 0};
break;
case BorderStyle::kBeveled:
fBorderWidth *= 2;
diff --git a/fpdfsdk/formfiller/cffl_formfield.cpp b/fpdfsdk/formfiller/cffl_formfield.cpp
index 49edfda..bba78ed 100644
--- a/fpdfsdk/formfiller/cffl_formfield.cpp
+++ b/fpdfsdk/formfiller/cffl_formfield.cpp
@@ -336,7 +336,7 @@
cp.nBorderStyle = m_pWidget->GetBorderStyle();
switch (cp.nBorderStyle) {
case BorderStyle::kDash:
- cp.sDash = CPWL_Dash(3, 3, 0);
+ cp.sDash = CPWL_Dash{3, 3, 0};
break;
case BorderStyle::kBeveled:
case BorderStyle::kInset:
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index 5025687..88b0cf0 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -40,7 +40,7 @@
pFillerNotify(filler_notify),
pProvider(provider),
fFontSize(kDefaultFontSize),
- sDash(3, 0, 0) {}
+ sDash{3, 0, 0} {}
CPWL_Wnd::CreateParams::CreateParams(const CreateParams& other) = default;