Fix compiler warnings (Issue #333)

This commit is contained in:
Michael R Sweet 2024-11-14 15:26:29 -05:00
parent 95445118c2
commit 5e35d50f75
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244
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
(Issue #329)
- Fixed some compiler warnings (Issue #333)
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
char *value) // I - Attribute value
{
int i; // Looping var
size_t i; // Looping var
_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_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

View File

@ -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,10 +835,19 @@ 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);
}
}
//