diff options
| author | Niko Kiirala <niko@kiirala.com> | 2007-12-06 19:02:55 +0000 |
|---|---|---|
| committer | kiirala <kiirala@users.sourceforge.net> | 2007-12-06 19:02:55 +0000 |
| commit | 729a0282b156b80c8cccd0a59fea480e8bbc40bb (patch) | |
| tree | ce0d08bec46ed2ecdde01348653c370d1e2f0ab6 /src/helper-fns.h | |
| parent | Removed conditional GTK+ < 2.6.0 code since 2.8.0 has been a requirement for ... (diff) | |
| download | inkscape-729a0282b156b80c8cccd0a59fea480e8bbc40bb.tar.gz inkscape-729a0282b156b80c8cccd0a59fea480e8bbc40bb.zip | |
Fixed several crashes when modifying filter effect parameters with XML editor
(bzr r4185)
Diffstat (limited to 'src/helper-fns.h')
| -rw-r--r-- | src/helper-fns.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/helper-fns.h b/src/helper-fns.h index b4976bad4..a4ce8e3b5 100644 --- a/src/helper-fns.h +++ b/src/helper-fns.h @@ -15,12 +15,23 @@ #include <sstream> -inline double helperfns_read_number(gchar const *value) { +// calling helperfns_read_number(string, false), it's not obvious, what +// that false stands for. helperfns_read_number(string, HELPERFNS_NO_WARNING) +// can be more clear. +#define HELPERFNS_NO_WARNING false + +/* Setting warning to false disables conversion error warnings from + * this function. This can be useful in places, where the input type + * is not known beforehand. For example, see sp_feColorMatrix_set in + * sp-fecolormatrix.cpp */ +inline double helperfns_read_number(gchar const *value, bool warning = true) { if (!value) return 0; char *end; double ret = g_ascii_strtod(value, &end); if (*end) { - g_warning("Unable to convert \"%s\" to number", value); + if (warning) { + g_warning("Unable to convert \"%s\" to number", value); + } // We could leave this out, too. If strtod can't convert // anything, it will return zero. ret = 0; |
