Skip to content

Commit 57e8f20

Browse files
committed
container/patricia: avoid %d/%u sign confusion
1 parent ccaec71 commit 57e8f20

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/libmowgli/container/patricia.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -1037,9 +1037,9 @@ mowgli_patricia_size(mowgli_patricia_t *dict)
10371037
/* returns the sum of the depths of the subtree rooted in delem at depth depth */
10381038
/* there is no need for this to be recursive, but it is easier... */
10391039
static int
1040-
stats_recurse(union patricia_elem *delem, int depth, int *pmaxdepth)
1040+
stats_recurse(union patricia_elem *delem, unsigned int depth, unsigned int *pmaxdepth)
10411041
{
1042-
int result = 0;
1042+
unsigned int result = 0;
10431043
int val;
10441044
union patricia_elem *next;
10451045

@@ -1103,15 +1103,15 @@ void
11031103
mowgli_patricia_stats(mowgli_patricia_t *dict, void (*cb)(const char *line, void *privdata), void *privdata)
11041104
{
11051105
char str[256];
1106-
int sum, maxdepth;
1106+
unsigned int sum, maxdepth;
11071107

11081108
return_if_fail(dict != NULL);
11091109

11101110
if (dict->id != NULL)
1111-
snprintf(str, sizeof str, "Dictionary stats for %s (%d)",
1111+
snprintf(str, sizeof str, "Dictionary stats for %s (%u)",
11121112
dict->id, dict->count);
11131113
else
1114-
snprintf(str, sizeof str, "Dictionary stats for <%p> (%d)",
1114+
snprintf(str, sizeof str, "Dictionary stats for <%p> (%u)",
11151115
(void *) dict, dict->count);
11161116

11171117
cb(str, privdata);
@@ -1120,7 +1120,7 @@ mowgli_patricia_stats(mowgli_patricia_t *dict, void (*cb)(const char *line, void
11201120
if (dict->count > 0)
11211121
{
11221122
sum = stats_recurse(dict->root, 0, &maxdepth);
1123-
snprintf(str, sizeof str, "Depth sum %d Avg depth %d Max depth %d", sum, sum / dict->count, maxdepth);
1123+
snprintf(str, sizeof str, "Depth sum %u Avg depth %u Max depth %u", sum, sum / dict->count, maxdepth);
11241124
}
11251125
else
11261126
{

0 commit comments

Comments
 (0)