Skip to content

Commit ccaec71

Browse files
committed
container/dictionary: avoid %d/%u sign confusion
1 parent 327b622 commit ccaec71

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/libmowgli/container/dictionary.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -844,10 +844,10 @@ mowgli_dictionary_size(mowgli_dictionary_t *dict)
844844
}
845845

846846
/* returns the sum of the depths of the subtree rooted in delem at depth depth */
847-
static int
848-
stats_recurse(mowgli_dictionary_elem_t *delem, int depth, int *pmaxdepth)
847+
static unsigned int
848+
stats_recurse(mowgli_dictionary_elem_t *delem, unsigned int depth, unsigned int *pmaxdepth)
849849
{
850-
int result;
850+
unsigned int result;
851851

852852
if (depth > *pmaxdepth)
853853
*pmaxdepth = depth;
@@ -883,15 +883,15 @@ void
883883
mowgli_dictionary_stats(mowgli_dictionary_t *dict, void (*cb)(const char *line, void *privdata), void *privdata)
884884
{
885885
char str[256];
886-
int sum, maxdepth;
886+
unsigned int sum, maxdepth;
887887

888888
return_if_fail(dict != NULL);
889889

890890
if (dict->id != NULL)
891-
snprintf(str, sizeof str, "Dictionary stats for %s (%d)",
891+
snprintf(str, sizeof str, "Dictionary stats for %s (%u)",
892892
dict->id, dict->count);
893893
else
894-
snprintf(str, sizeof str, "Dictionary stats for <%p> (%d)",
894+
snprintf(str, sizeof str, "Dictionary stats for <%p> (%u)",
895895
(void *) dict, dict->count);
896896

897897
cb(str, privdata);
@@ -900,7 +900,7 @@ mowgli_dictionary_stats(mowgli_dictionary_t *dict, void (*cb)(const char *line,
900900
if (dict->root != NULL)
901901
{
902902
sum = stats_recurse(dict->root, 0, &maxdepth);
903-
snprintf(str, sizeof str, "Depth sum %d Avg depth %d Max depth %d", sum, sum / dict->count, maxdepth);
903+
snprintf(str, sizeof str, "Depth sum %u Avg depth %u Max depth %u", sum, sum / dict->count, maxdepth);
904904
}
905905
else
906906
{

0 commit comments

Comments
 (0)