From 9092fa64659033e70bf914a5d83d5470d31cbc27 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Wed, 25 Oct 2006 05:33:24 +0000 Subject: [PATCH] switch pref/repr utility methods to using long long ints; with out it, we cannot even store an rgba32 color in an attribute\! --- src/prefs-utils.cpp | 12 ++++++------ src/prefs-utils.h | 6 +++--- src/xml/repr-util.cpp | 4 ++-- src/xml/repr.h | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/prefs-utils.cpp b/src/prefs-utils.cpp index a0851a354..e365966bd 100644 --- a/src/prefs-utils.cpp +++ b/src/prefs-utils.cpp @@ -19,7 +19,7 @@ void -prefs_set_int_attribute(gchar const *path, gchar const *attr, gint value) +prefs_set_int_attribute(gchar const *path, gchar const *attr, long long int value) { Inkscape::XML::Node *repr = inkscape_get_repr(INKSCAPE, path); if (repr) { @@ -27,8 +27,8 @@ prefs_set_int_attribute(gchar const *path, gchar const *attr, gint value) } } -gint -prefs_get_int_attribute(gchar const *path, gchar const *attr, gint def) +long long int +prefs_get_int_attribute(gchar const *path, gchar const *attr, long long int def) { Inkscape::XML::Node *repr = inkscape_get_repr(INKSCAPE, path); if (repr) { @@ -41,12 +41,12 @@ prefs_get_int_attribute(gchar const *path, gchar const *attr, gint def) /** \brief Retrieves an int attribute guarding against screwed-up data; if the value is beyond limits, default is returned */ -gint -prefs_get_int_attribute_limited(gchar const *path, gchar const *attr, gint def, gint min, gint max) +long long int +prefs_get_int_attribute_limited(gchar const *path, gchar const *attr, long long int def, long long int min, long long int max) { Inkscape::XML::Node *repr = inkscape_get_repr(INKSCAPE, path); if (repr) { - gint const v = sp_repr_get_int_attribute(repr, attr, def); + long long int const v = sp_repr_get_int_attribute(repr, attr, def); if (v >= min && v <= max) { return v; } else { diff --git a/src/prefs-utils.h b/src/prefs-utils.h index 3cd2998e5..1293ca5b8 100644 --- a/src/prefs-utils.h +++ b/src/prefs-utils.h @@ -14,9 +14,9 @@ #include -void prefs_set_int_attribute(gchar const *path, gchar const *attr, gint value); -gint prefs_get_int_attribute(gchar const *path, gchar const *attr, gint def); -gint prefs_get_int_attribute_limited(gchar const *path, gchar const *attr, gint def, gint min, gint max); +void prefs_set_int_attribute(gchar const *path, gchar const *attr, long long int value); +long long int prefs_get_int_attribute(gchar const *path, gchar const *attr, long long int def); +long long int prefs_get_int_attribute_limited(gchar const *path, gchar const *attr, long long int def, long long int min, long long int max); void prefs_set_double_attribute(gchar const *path, gchar const *attr, double value); double prefs_get_double_attribute(gchar const *path, gchar const *attr, double def); diff --git a/src/xml/repr-util.cpp b/src/xml/repr-util.cpp index 83231e5da..42b957d43 100644 --- a/src/xml/repr-util.cpp +++ b/src/xml/repr-util.cpp @@ -319,7 +319,7 @@ double sp_repr_get_double_attribute(Inkscape::XML::Node *repr, char const *key, return g_ascii_strtod(result, NULL); } -int sp_repr_get_int_attribute(Inkscape::XML::Node *repr, char const *key, int def) +long long int sp_repr_get_int_attribute(Inkscape::XML::Node *repr, char const *key, long long int def) { char *result; @@ -330,7 +330,7 @@ int sp_repr_get_int_attribute(Inkscape::XML::Node *repr, char const *key, int de if (result == NULL) return def; - return atoi(result); + return atoll(result); } /** diff --git a/src/xml/repr.h b/src/xml/repr.h index c30dcf66a..dc96cb3e6 100644 --- a/src/xml/repr.h +++ b/src/xml/repr.h @@ -227,7 +227,7 @@ unsigned sp_repr_set_svg_double(Inkscape::XML::Node *repr, gchar const *key, dou /// \deprecated ! double sp_repr_get_double_attribute(Inkscape::XML::Node *repr, gchar const *key, double def); /// \deprecated ! -int sp_repr_get_int_attribute(Inkscape::XML::Node *repr, gchar const *key, int def); +long long int sp_repr_get_int_attribute(Inkscape::XML::Node *repr, gchar const *key, long long int def); /* End Deprecated? */ int sp_repr_compare_position(Inkscape::XML::Node *first, Inkscape::XML::Node *second); -- 2.30.2