diff --git a/CHANGES.md b/CHANGES.md index 12fd597..0ea31e1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ Changes in Mini-XML 4.0.4 - Fixed an issue when reporting errors with a `NULL` options pointer (Issue #329) +- Fixed some compiler warnings (Issue #333) Changes in Mini-XML 4.0.3 diff --git a/mxml-attr.c b/mxml-attr.c index 98dd5f5..29f6c7e 100644 --- a/mxml-attr.c +++ b/mxml-attr.c @@ -232,7 +232,7 @@ mxml_set_attr(mxml_node_t *node, // I - Element node const char *name, // I - Attribute name char *value) // I - Attribute value { - int i; // Looping var + size_t i; // Looping var _mxml_attr_t *attr; // New attribute diff --git a/mxml-index.c b/mxml-index.c index 9da244b..52fe600 100644 --- a/mxml-index.c +++ b/mxml-index.c @@ -18,7 +18,7 @@ static int index_compare(mxml_index_t *ind, mxml_node_t *first, mxml_node_t *second); static int index_find(mxml_index_t *ind, const char *element, const char *value, mxml_node_t *node); -static void index_sort(mxml_index_t *ind, int left, int right); +static void index_sort(mxml_index_t *ind, size_t left, size_t right); // @@ -80,8 +80,8 @@ mxmlIndexFind(mxml_index_t *ind, // I - Index to search const char *element, // I - Element name to find, if any const char *value) // I - Attribute value, if any { - int diff, // Difference between names - current, // Current entity in search + int diff; // Difference between names + size_t current, // Current entity in search first, // First entity in search last; // Last entity in search @@ -369,12 +369,12 @@ index_find(mxml_index_t *ind, // I - Index static void index_sort(mxml_index_t *ind, // I - Index to sort - int left, // I - Left node in partition - int right) // I - Right node in partition + size_t left, // I - Left node in partition + size_t right) // I - Right node in partition { mxml_node_t *pivot, // Pivot node *temp; // Swap node - int templ, // Temporary left node + size_t templ, // Temporary left node tempr; // Temporary right node diff --git a/mxml-node.c b/mxml-node.c index a6978c9..f7ab9f0 100644 --- a/mxml-node.c +++ b/mxml-node.c @@ -811,9 +811,13 @@ mxmlRelease(mxml_node_t *node) // I - Node mxmlDelete(node); return (0); } + else if (node->ref_count < INT_MAX) + { + return ((int)node->ref_count); + } else { - return (node->ref_count); + return (INT_MAX); } } else @@ -831,9 +835,18 @@ int // O - New reference count mxmlRetain(mxml_node_t *node) // I - Node { if (node) - return (++ node->ref_count); + { + node->ref_count ++; + + if (node->ref_count < INT_MAX) + return ((int)node->ref_count); + else + return (INT_MAX); + } else + { return (-1); + } }