Skip to content

Commit

Permalink
Fix compiler warnings (Issue #333)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Nov 14, 2024
1 parent 9544511 commit 5e35d50
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mxml-attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
12 changes: 6 additions & 6 deletions mxml-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);


//
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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


Expand Down
17 changes: 15 additions & 2 deletions mxml-node.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
}


Expand Down

0 comments on commit 5e35d50

Please sign in to comment.