mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	spa: debug: pod: use the appropriate format specifiers
Use the appropriate format specifiers wrt. the signedness of the type, as well as use the `PRI*N` macros for the `[u]intN_t` types.
This commit is contained in:
		
							parent
							
								
									b4f97c62c6
								
							
						
					
					
						commit
						4a92ec35a6
					
				
					 1 changed files with 14 additions and 12 deletions
				
			
		| 
						 | 
					@ -5,6 +5,8 @@
 | 
				
			||||||
#ifndef SPA_DEBUG_POD_H
 | 
					#ifndef SPA_DEBUG_POD_H
 | 
				
			||||||
#define SPA_DEBUG_POD_H
 | 
					#define SPA_DEBUG_POD_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <inttypes.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <spa/debug/context.h>
 | 
					#include <spa/debug/context.h>
 | 
				
			||||||
#include <spa/debug/mem.h>
 | 
					#include <spa/debug/mem.h>
 | 
				
			||||||
#include <spa/debug/types.h>
 | 
					#include <spa/debug/types.h>
 | 
				
			||||||
| 
						 | 
					@ -37,11 +39,11 @@ 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");
 | 
							spa_debugc(ctx, "%*s" "Bool %s", indent, "", (*(int32_t *) body) ? "true" : "false");
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case SPA_TYPE_Id:
 | 
						case SPA_TYPE_Id:
 | 
				
			||||||
		spa_debugc(ctx, "%*s" "Id %-8d (%s)", indent, "", *(int32_t *) body,
 | 
							spa_debugc(ctx, "%*s" "Id %-8" PRId32 " (%s)", indent, "", *(int32_t *) body,
 | 
				
			||||||
		       spa_debug_type_find_name(info, *(int32_t *) body));
 | 
							       spa_debug_type_find_name(info, *(int32_t *) body));
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case SPA_TYPE_Int:
 | 
						case SPA_TYPE_Int:
 | 
				
			||||||
		spa_debugc(ctx, "%*s" "Int %d", indent, "", *(int32_t *) body);
 | 
							spa_debugc(ctx, "%*s" "Int %" PRId32, indent, "", *(int32_t *) body);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	case SPA_TYPE_Long:
 | 
						case SPA_TYPE_Long:
 | 
				
			||||||
		spa_debugc(ctx, "%*s" "Long %" PRIi64 "", indent, "", *(int64_t *) body);
 | 
							spa_debugc(ctx, "%*s" "Long %" PRIi64 "", indent, "", *(int64_t *) body);
 | 
				
			||||||
| 
						 | 
					@ -86,7 +88,7 @@ spa_debugc_pod_value(struct spa_debug_context *ctx, int indent, const struct spa
 | 
				
			||||||
		void *p;
 | 
							void *p;
 | 
				
			||||||
		const struct spa_type_info *ti = spa_debug_type_find(SPA_TYPE_ROOT, b->child.type);
 | 
							const struct spa_type_info *ti = spa_debug_type_find(SPA_TYPE_ROOT, b->child.type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		spa_debugc(ctx, "%*s" "Array: child.size %d, child.type %s", indent, "",
 | 
							spa_debugc(ctx, "%*s" "Array: child.size %" PRIu32 ", child.type %s", indent, "",
 | 
				
			||||||
		       b->child.size, ti ? ti->name : "unknown");
 | 
							       b->child.size, ti ? ti->name : "unknown");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		info = info && info->values ? info->values : info;
 | 
							info = info && info->values ? info->values : info;
 | 
				
			||||||
| 
						 | 
					@ -100,7 +102,7 @@ spa_debugc_pod_value(struct spa_debug_context *ctx, int indent, const struct spa
 | 
				
			||||||
		void *p;
 | 
							void *p;
 | 
				
			||||||
		const struct spa_type_info *ti = spa_debug_type_find(spa_type_choice, b->type);
 | 
							const struct spa_type_info *ti = spa_debug_type_find(spa_type_choice, b->type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		spa_debugc(ctx, "%*s" "Choice: type %s, flags %08x %d %d", indent, "",
 | 
							spa_debugc(ctx, "%*s" "Choice: type %s, flags %08" PRIx32 " %" PRIu32 " %" PRIu32, indent, "",
 | 
				
			||||||
		       ti ? ti->name : "unknown", b->flags, size, b->child.size);
 | 
							       ti ? ti->name : "unknown", b->flags, size, b->child.size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		SPA_POD_CHOICE_BODY_FOREACH(b, size, p)
 | 
							SPA_POD_CHOICE_BODY_FOREACH(b, size, p)
 | 
				
			||||||
| 
						 | 
					@ -110,7 +112,7 @@ spa_debugc_pod_value(struct spa_debug_context *ctx, int indent, const struct spa
 | 
				
			||||||
	case SPA_TYPE_Struct:
 | 
						case SPA_TYPE_Struct:
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		struct spa_pod *b = (struct spa_pod *)body, *p;
 | 
							struct spa_pod *b = (struct spa_pod *)body, *p;
 | 
				
			||||||
		spa_debugc(ctx, "%*s" "Struct: size %d", indent, "", size);
 | 
							spa_debugc(ctx, "%*s" "Struct: size %" PRIu32, indent, "", size);
 | 
				
			||||||
		SPA_POD_FOREACH(b, size, p)
 | 
							SPA_POD_FOREACH(b, size, p)
 | 
				
			||||||
			spa_debugc_pod_value(ctx, indent + 2, info, p->type, SPA_POD_BODY(p), p->size);
 | 
								spa_debugc_pod_value(ctx, indent + 2, info, p->type, SPA_POD_BODY(p), p->size);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
| 
						 | 
					@ -125,16 +127,16 @@ spa_debugc_pod_value(struct spa_debug_context *ctx, int indent, const struct spa
 | 
				
			||||||
		ii = ti ? spa_debug_type_find(ti->values, 0) : NULL;
 | 
							ii = ti ? spa_debug_type_find(ti->values, 0) : NULL;
 | 
				
			||||||
		ii = ii ? spa_debug_type_find(ii->values, b->id) : NULL;
 | 
							ii = ii ? spa_debug_type_find(ii->values, b->id) : NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		spa_debugc(ctx, "%*s" "Object: size %d, type %s (%d), id %s (%d)", indent, "", size,
 | 
							spa_debugc(ctx, "%*s" "Object: size %" PRIu32 ", type %s (%" PRIu32 "), id %s (%" PRIu32 ")",
 | 
				
			||||||
		       ti ? ti->name : "unknown", b->type, ii ? ii->name : "unknown", b->id);
 | 
								indent, "", size, ti ? ti->name : "unknown", b->type, ii ? ii->name : "unknown", b->id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		info = ti ? ti->values : info;
 | 
							info = ti ? ti->values : info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		SPA_POD_OBJECT_BODY_FOREACH(b, size, p) {
 | 
							SPA_POD_OBJECT_BODY_FOREACH(b, size, p) {
 | 
				
			||||||
			ii = spa_debug_type_find(info, p->key);
 | 
								ii = spa_debug_type_find(info, p->key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			spa_debugc(ctx, "%*s" "Prop: key %s (%d), flags %08x", indent+2, "",
 | 
								spa_debugc(ctx, "%*s" "Prop: key %s (%" PRIu32 "), flags %08" PRIx32,
 | 
				
			||||||
					ii ? ii->name : "unknown", p->key, p->flags);
 | 
									indent+2, "", ii ? ii->name : "unknown", p->key, p->flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			spa_debugc_pod_value(ctx, indent + 4, ii ? ii->values : NULL,
 | 
								spa_debugc_pod_value(ctx, indent + 4, ii ? ii->values : NULL,
 | 
				
			||||||
					p->value.type,
 | 
										p->value.type,
 | 
				
			||||||
| 
						 | 
					@ -151,13 +153,13 @@ spa_debugc_pod_value(struct spa_debug_context *ctx, int indent, const struct spa
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ti = spa_debug_type_find(info, b->unit);
 | 
							ti = spa_debug_type_find(info, b->unit);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		spa_debugc(ctx, "%*s" "Sequence: size %d, unit %s", indent, "", size,
 | 
							spa_debugc(ctx, "%*s" "Sequence: size %" PRIu32 ", unit %s", indent, "", size,
 | 
				
			||||||
		       ti ? ti->name : "unknown");
 | 
							       ti ? ti->name : "unknown");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		SPA_POD_SEQUENCE_BODY_FOREACH(b, size, c) {
 | 
							SPA_POD_SEQUENCE_BODY_FOREACH(b, size, c) {
 | 
				
			||||||
			ii = spa_debug_type_find(spa_type_control, c->type);
 | 
								ii = spa_debug_type_find(spa_type_control, c->type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			spa_debugc(ctx, "%*s" "Control: offset %d, type %s", indent+2, "",
 | 
								spa_debugc(ctx, "%*s" "Control: offset %" PRIu32 ", type %s", indent+2, "",
 | 
				
			||||||
					c->offset, ii ? ii->name : "unknown");
 | 
										c->offset, ii ? ii->name : "unknown");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			spa_debugc_pod_value(ctx, indent + 4, ii ? ii->values : NULL,
 | 
								spa_debugc_pod_value(ctx, indent + 4, ii ? ii->values : NULL,
 | 
				
			||||||
| 
						 | 
					@ -176,7 +178,7 @@ spa_debugc_pod_value(struct spa_debug_context *ctx, int indent, const struct spa
 | 
				
			||||||
		spa_debugc_mem(ctx, indent + 2, body, size);
 | 
							spa_debugc_mem(ctx, indent + 2, body, size);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		spa_debugc(ctx, "%*s" "unhandled POD type %d", indent, "", type);
 | 
							spa_debugc(ctx, "%*s" "unhandled POD type %" PRIu32, indent, "", type);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue