diff options
| author | Thomas Holder <thomas@thomas-holder.de> | 2018-10-06 13:28:39 +0000 |
|---|---|---|
| committer | Thomas Holder <thomas@thomas-holder.de> | 2018-10-06 13:28:39 +0000 |
| commit | 03c35f6065f45346634cdcd8a9d13e4f167549c0 (patch) | |
| tree | 3a892c439d37cff565592d93e124137e70a42c31 /src/attributes.cpp | |
| parent | Add new style register style property for stop color and opacity (diff) | |
| download | inkscape-03c35f6065f45346634cdcd8a9d13e4f167549c0.tar.gz inkscape-03c35f6065f45346634cdcd8a9d13e4f167549c0.zip | |
SPAttributeEnum typed function arguments
Diffstat (limited to 'src/attributes.cpp')
| -rw-r--r-- | src/attributes.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/attributes.cpp b/src/attributes.cpp index ccaeb4f8f..4347517cb 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -12,7 +12,7 @@ #include "attributes.h" struct SPStyleProp { - gint code; + SPAttributeEnum code; gchar const *name; }; @@ -558,28 +558,28 @@ static SPStyleProp const props[] = { #define n_attrs (sizeof(props) / sizeof(props[0])) /** Returns an SPAttributeEnum; SP_ATTR_INVALID (of value 0) if key isn't recognized. */ -unsigned +SPAttributeEnum sp_attribute_lookup(gchar const *key) { for (unsigned int i = 1; i < n_attrs; i++) { g_assert(props[i].code == static_cast< gint >(i) ); // If this g_assert fails, then the sort order of SPAttributeEnum does not match the order in props[]! if(g_str_equal(const_cast<void *>(static_cast<void const *>(props[i].name)), key)) - return GPOINTER_TO_UINT(GINT_TO_POINTER(props[i].code)); + return props[i].code; } // std::cerr << "sp_attribute_lookup: invalid attribute: " // << (key?key:"Null") << std::endl; return SP_ATTR_INVALID; } -unsigned char const * -sp_attribute_name(unsigned int id) +gchar const * +sp_attribute_name(SPAttributeEnum id) { if (id >= n_attrs) { return nullptr; } - return (unsigned char*)props[id].name; + return props[id].name; } |
