diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/object/sp-item.cpp | 2 | ||||
| -rw-r--r-- | src/preferences-skeleton.h | 2 | ||||
| -rw-r--r-- | src/preferences.cpp | 18 |
3 files changed, 19 insertions, 3 deletions
diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp index 5adecf358..5a8e23e84 100644 --- a/src/object/sp-item.cpp +++ b/src/object/sp-item.cpp @@ -176,7 +176,7 @@ guint32 SPItem::highlight_color() const { else { static Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - return prefs->getInt("/tools/nodes/highlight_color", 0xff0000ff) | 0x00000000; + return prefs->getInt("/tools/nodes/highlight_color", 0xff0000ff); } } } diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 30ee465e5..72093ea70 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -133,7 +133,7 @@ R"=====( show_sample_in_list="1" use_svg2="0" style="fill:black;fill-opacity:1;stroke:none;font-family:sans-serif;font-style:normal;font-weight:normal;font-size:40px;" selcue="1"/> - <eventcontext id="nodes" selcue="1" gradientdrag="1" highlight_color="4278190335" pathflash_enabled="1" pathflash_unselected="0" pathflash_timeout="500" show_handles="1" show_outline="0" + <eventcontext id="nodes" selcue="1" gradientdrag="1" highlight_color="0xff0000ff" pathflash_enabled="1" pathflash_unselected="0" pathflash_timeout="500" show_handles="1" show_outline="0" sculpting_profile="1" single_node_transform_handles="0" show_transform_handles="0" live_outline="1" live_objects="1" show_helperpath="0" x="0" y="0" edit_clipping_paths="0" edit_masks="0" /> <eventcontext id="tweak" selcue="0" gradientdrag="0" show_handles="0" width="0.2" force="0.2" fidelity="0.5" usepressure="1" style="fill:red;stroke:none;" usecurrent="0"/> <eventcontext id="spray" selcue="1" gradientdrag="0" usepressure="1" width="15" population="70" mode="1" rotation_variation="0" scale_variation="0" standard_deviation="70" mean="0"/> diff --git a/src/preferences.cpp b/src/preferences.cpp index 7044f35ff..dc0c0d609 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -783,7 +783,23 @@ int Preferences::_extractInt(Entry const &v) v.value_int = 0; return false; } else { - v.value_int = (int)strtol(s, nullptr, 0); + int val = 0; + + // TODO: We happily save unsigned integers (notably RGBA values) as signed integers and overflow as needed. + // We should consider adding an unsigned integer type to preferences or use HTML colors where appropriate + // (the latter would breaks backwards compatibility, though) + errno = 0; + val = (int)strtol(s, nullptr, 0); + if (errno == ERANGE) { + errno = 0; + val = (int)strtoul(s, nullptr, 0); + if (errno == ERANGE) { + g_warning("Integer preference out of range: '%s' (raw value: %s)", v._pref_path.c_str(), s); + val = 0; + } + } + + v.value_int = val; return v.value_int; } } |
