Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Christensson <Simon.Christensson@axis.com>
To: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Cc: "tiwai@suse.de" <tiwai@suse.de>
Subject: [PATCH] conf: Remove left justification for SND_CONFIG_TYPE_REAL
Date: Tue, 15 Feb 2022 10:19:15 +0000	[thread overview]
Message-ID: <40f87742994f4d7bbb2f94386f7891c8@axis.com> (raw)

[-- 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


                 reply	other threads:[~2022-02-16  9:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40f87742994f4d7bbb2f94386f7891c8@axis.com \
    --to=simon.christensson@axis.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox