spa: debug: SPA_TYPE_Id is unsigned

The underlying type of `SPA_TYPE_Id` is `uint32_t`, so access
and print it as such.
This commit is contained in:
Barnabás Pőcze 2025-07-12 21:00:38 +02:00 committed by Wim Taymans
parent 49d9d5e618
commit 331bb2f1ed
2 changed files with 7 additions and 4 deletions

View file

@ -5,6 +5,8 @@
#ifndef SPA_DEBUG_FORMAT_H
#define SPA_DEBUG_FORMAT_H
#include <inttypes.h>
#include <spa/pod/parser.h>
#include <spa/utils/string.h>
#include <spa/debug/context.h>
@ -41,10 +43,11 @@ spa_debug_strbuf_format_value(struct spa_strbuf *buffer, const struct spa_type_i
break;
case SPA_TYPE_Id:
{
const char *str = spa_debug_type_find_short_name(info, *(int32_t *) body);
uint32_t value = *(uint32_t *) body;
const char *str = spa_debug_type_find_short_name(info, value);
char tmp[64];
if (str == NULL) {
snprintf(tmp, sizeof(tmp), "%d", *(int32_t*)body);
snprintf(tmp, sizeof(tmp), "%" PRIu32, value);
str = tmp;
}
spa_strbuf_append(buffer, "%s", str);

View file

@ -39,8 +39,8 @@ spa_debugc_pod_value(struct spa_debug_context *ctx, int indent, const struct spa
spa_debugc(ctx, "%*s" "Bool %s", indent, "", (*(int32_t *) body) ? "true" : "false");
break;
case SPA_TYPE_Id:
spa_debugc(ctx, "%*s" "Id %-8" PRId32 " (%s)", indent, "", *(int32_t *) body,
spa_debug_type_find_name(info, *(int32_t *) body));
spa_debugc(ctx, "%*s" "Id %-8" PRIu32 " (%s)", indent, "", *(uint32_t *) body,
spa_debug_type_find_name(info, *(uint32_t *) body));
break;
case SPA_TYPE_Int:
spa_debugc(ctx, "%*s" "Int %" PRId32, indent, "", *(int32_t *) body);