All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] conf: Remove left justification for SND_CONFIG_TYPE_REAL
@ 2022-02-15 10:19 Simon Christensson
  0 siblings, 0 replies; only message in thread
From: Simon Christensson @ 2022-02-15 10:19 UTC (permalink / raw)
  To: alsa-devel@alsa-project.org; +Cc: tiwai@suse.de

[-- Attachment #1: Type: text/plain, Size: 302 bytes --]

In order to avoid extra padding replace data type "%-16g" (left justification) with default right justification "%16g" when printing snd_config type SND_CONFIG_TYPE_REAL.


Example for control "min_dB" available in softvol:

Before patch: "min_dB -50             "

After patch: "min_dB -50.0"

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-conf-Remove-left-justify-for-SND_CONFIG_TYPE_REAL.patch --]
[-- Type: text/x-patch; name="0001-conf-Remove-left-justify-for-SND_CONFIG_TYPE_REAL.patch", Size: 941 bytes --]

From d9f44bea28844d4aa273b6907da81d4167a35e52 Mon Sep 17 00:00:00 2001
From: Simon Christensson <simochr@axis.com>
Date: Tue, 15 Feb 2022 10:40:38 +0100
Subject: [PATCH] conf: Remove left-justify for SND_CONFIG_TYPE_REAL

In order to avoid padding and to print at least on
decimal for node type SND_CONFIG_TYPE_REAL use
default right-justification.

Change-Id: I41400901ee9f0a43771afc5d42ee69eac980883c
---
 src/conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf.c b/src/conf.c
index 70f0e773..fba2907a 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -1633,7 +1633,7 @@ int _snd_config_save_node_value(snd_config_t *n, snd_output_t *out,
 		snd_output_printf(out, "%lld", n->u.integer64);
 		break;
 	case SND_CONFIG_TYPE_REAL:
-		snd_output_printf(out, "%-16g", n->u.real);
+		snd_output_printf(out, "%16g", n->u.real);
 		break;
 	case SND_CONFIG_TYPE_STRING:
 		string_print(n->u.string, 0, out);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-16  9:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-15 10:19 [PATCH] conf: Remove left justification for SND_CONFIG_TYPE_REAL Simon Christensson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.