diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-02-12 15:21:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-02-13 10:06:21 +0100 |
commit | bbab991c70e2a1867493d701168f49a0d0dcbd48 (patch) | |
tree | cd7487e769dba2f826401fecf5005d197aefb436 /sd/uiconfig | |
parent | 91731a8674d764293e2988333027f82f15b2577e (diff) |
Avoid -fsanitize=implicit-signed-integer-truncation in weld::MetricSpinButton
Both of Draw's "Insert - Snap Guide..." and "Shape - Duplicate..." dialogs have
MetricSpinButtons with ranges set programmatically in the dialogs' ctors.
Computing the ranges' min and max values was done via SetMetricValue, which does
any necessary unit conversions and then sets the MetricSpinButton's current
value, which is then read back out in the dialog ctors (again, doing any
necessary unit conversions) and finally set as the min or max range value.
However, setting a MetricSpinButton's current value clamps it to the min and max
range values that are currently in effect (i.e., before they have been set
programmatically), so the corresponding .ui files specified very large initial
values for those. Large enough so that any actually set current values will not
artificially be clamped, but also so large that
weld::MetricSpinButton::ConvertValue, which indirectly gets called during the
above computations and converts from sal_Int64 to int, would produce Clang
-fsanitize=implicit-signed-integer-truncation warnings (e.g., "implicit
conversion from type 'sal_Int64' (aka 'long') of value -56692913386 (64-bit,
signed) to type 'int' changed the value to -858338538 (32-bit, signed)" from
within the CopyDlg ctor).
So don't use SetMetricValue to compute the min/max range values. That way, the
MetricSpinButton's current value is not set before the computed min/max range
values are actually set, so the .ui file doesn't need to contain any static
min/max range values. Also, both dialogs call SetFieldUnit, which also sets the
MetricSpinButtons' increment values, so those don't need to be set statically in
the .ui files, either.
Change-Id: I191cfc3837278530e0c3a87e00708c4c76a76361
Reviewed-on: https://gerrit.libreoffice.org/67734
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd/uiconfig')
-rw-r--r-- | sd/uiconfig/sdraw/ui/copydlg.ui | 28 | ||||
-rw-r--r-- | sd/uiconfig/sdraw/ui/dlgsnap.ui | 14 |
2 files changed, 0 insertions, 42 deletions
diff --git a/sd/uiconfig/sdraw/ui/copydlg.ui b/sd/uiconfig/sdraw/ui/copydlg.ui index 31f2a48f0cf9..1bb828ece646 100644 --- a/sd/uiconfig/sdraw/ui/copydlg.ui +++ b/sd/uiconfig/sdraw/ui/copydlg.ui @@ -15,30 +15,6 @@ <property name="step_increment">1</property> <property name="page_increment">10</property> </object> - <object class="GtkAdjustment" id="adjustment3"> - <property name="lower">-1000000</property> - <property name="upper">1000000</property> - <property name="step_increment">0.10000000000000001</property> - <property name="page_increment">1</property> - </object> - <object class="GtkAdjustment" id="adjustment4"> - <property name="lower">-1000000</property> - <property name="upper">1000000</property> - <property name="step_increment">0.10000000000000001</property> - <property name="page_increment">1</property> - </object> - <object class="GtkAdjustment" id="adjustment5"> - <property name="lower">-1000000</property> - <property name="upper">1000000</property> - <property name="step_increment">0.10000000000000001</property> - <property name="page_increment">1</property> - </object> - <object class="GtkAdjustment" id="adjustment6"> - <property name="lower">-1000000</property> - <property name="upper">1000000</property> - <property name="step_increment">0.10000000000000001</property> - <property name="page_increment">1</property> - </object> <object class="GtkImage" id="image1"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -269,7 +245,6 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="activates_default">True</property> - <property name="adjustment">adjustment3</property> <property name="digits">2</property> </object> <packing> @@ -283,7 +258,6 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="activates_default">True</property> - <property name="adjustment">adjustment4</property> <property name="digits">2</property> </object> <packing> @@ -381,7 +355,6 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="activates_default">True</property> - <property name="adjustment">adjustment5</property> <property name="digits">2</property> </object> <packing> @@ -395,7 +368,6 @@ <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="activates_default">True</property> - <property name="adjustment">adjustment6</property> <property name="digits">2</property> </object> <packing> diff --git a/sd/uiconfig/sdraw/ui/dlgsnap.ui b/sd/uiconfig/sdraw/ui/dlgsnap.ui index 0bb64dc9e5eb..3a766c1abc0a 100644 --- a/sd/uiconfig/sdraw/ui/dlgsnap.ui +++ b/sd/uiconfig/sdraw/ui/dlgsnap.ui @@ -2,18 +2,6 @@ <!-- Generated with glade 3.20.4 --> <interface domain="sd"> <requires lib="gtk+" version="3.18"/> - <object class="GtkAdjustment" id="adjustment1"> - <property name="lower">-5000000</property> - <property name="upper">5000000</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> - <object class="GtkAdjustment" id="adjustment2"> - <property name="lower">-5000000</property> - <property name="upper">5000000</property> - <property name="step_increment">1</property> - <property name="page_increment">10</property> - </object> <object class="GtkImage" id="image1"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -142,7 +130,6 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="activates_default">True</property> - <property name="adjustment">adjustment1</property> <property name="digits">2</property> </object> <packing> @@ -155,7 +142,6 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="activates_default">True</property> - <property name="adjustment">adjustment2</property> <property name="digits">2</property> </object> <packing> |