Compare commits

...

2 Commits

Author SHA1 Message Date
Giovanni
492f93549b
Merge 992d8e57b8 into 5e35d50f75 2024-11-17 01:45:19 +08:00
Michael R Sweet
5e35d50f75
Fix compiler warnings (Issue #333) 2024-11-14 15:26:29 -05:00
4 changed files with 23 additions and 9 deletions

View File

@ -7,6 +7,7 @@ Changes in Mini-XML 4.0.4
- Fixed an issue when reporting errors with a `NULL` options pointer - Fixed an issue when reporting errors with a `NULL` options pointer
(Issue #329) (Issue #329)
- Fixed some compiler warnings (Issue #333)
Changes in Mini-XML 4.0.3 Changes in Mini-XML 4.0.3

View File

@ -232,7 +232,7 @@ mxml_set_attr(mxml_node_t *node, // I - Element node
const char *name, // I - Attribute name const char *name, // I - Attribute name
char *value) // I - Attribute value char *value) // I - Attribute value
{ {
int i; // Looping var size_t i; // Looping var
_mxml_attr_t *attr; // New attribute _mxml_attr_t *attr; // New attribute

View File

@ -18,7 +18,7 @@
static int index_compare(mxml_index_t *ind, mxml_node_t *first, mxml_node_t *second); 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 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 *element, // I - Element name to find, if any
const char *value) // I - Attribute value, if any const char *value) // I - Attribute value, if any
{ {
int diff, // Difference between names int diff; // Difference between names
current, // Current entity in search size_t current, // Current entity in search
first, // First entity in search first, // First entity in search
last; // Last entity in search last; // Last entity in search
@ -369,12 +369,12 @@ index_find(mxml_index_t *ind, // I - Index
static void static void
index_sort(mxml_index_t *ind, // I - Index to sort index_sort(mxml_index_t *ind, // I - Index to sort
int left, // I - Left node in partition size_t left, // I - Left node in partition
int right) // I - Right node in partition size_t right) // I - Right node in partition
{ {
mxml_node_t *pivot, // Pivot node mxml_node_t *pivot, // Pivot node
*temp; // Swap node *temp; // Swap node
int templ, // Temporary left node size_t templ, // Temporary left node
tempr; // Temporary right node tempr; // Temporary right node

View File

@ -811,9 +811,13 @@ mxmlRelease(mxml_node_t *node) // I - Node
mxmlDelete(node); mxmlDelete(node);
return (0); return (0);
} }
else if (node->ref_count < INT_MAX)
{
return ((int)node->ref_count);
}
else else
{ {
return (node->ref_count); return (INT_MAX);
} }
} }
else else
@ -831,9 +835,18 @@ int // O - New reference count
mxmlRetain(mxml_node_t *node) // I - Node mxmlRetain(mxml_node_t *node) // I - Node
{ {
if (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 else
{
return (-1); return (-1);
}
} }