From 03c35f6065f45346634cdcd8a9d13e4f167549c0 Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Sat, 6 Oct 2018 13:28:39 +0000 Subject: SPAttributeEnum typed function arguments --- src/attributes.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/attributes.cpp') 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(static_cast(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; } -- cgit v1.2.3