From 331bb2f1ed6cd7f2fcf549c513a2e45bd4cbc4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Sat, 12 Jul 2025 21:00:38 +0200 Subject: [PATCH] spa: debug: `SPA_TYPE_Id` is unsigned The underlying type of `SPA_TYPE_Id` is `uint32_t`, so access and print it as such. --- spa/include/spa/debug/format.h | 7 +++++-- spa/include/spa/debug/pod.h | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/spa/include/spa/debug/format.h b/spa/include/spa/debug/format.h index 5fe0eac3e..856e9954c 100644 --- a/spa/include/spa/debug/format.h +++ b/spa/include/spa/debug/format.h @@ -5,6 +5,8 @@ #ifndef SPA_DEBUG_FORMAT_H #define SPA_DEBUG_FORMAT_H +#include + #include #include #include @@ -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); diff --git a/spa/include/spa/debug/pod.h b/spa/include/spa/debug/pod.h index 21771691a..4ff3f3e01 100644 --- a/spa/include/spa/debug/pod.h +++ b/spa/include/spa/debug/pod.h @@ -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);