From patchwork Wed Jun 5 21:15:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 801640 Delivered-To: patch@linaro.org Received: by 2002:a5d:5610:0:b0:35b:5a80:51b4 with SMTP id l16csp36565wrv; Wed, 5 Jun 2024 14:17:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXqfSCtZPjgBnMJj61Zn0nN/aSzrn5Yp3/NyWKfvASREVNFr+/OvERmqbb/j/kK/Qdu3/4MaolFWokMZa3RUSFF X-Google-Smtp-Source: AGHT+IHuo8RR0PJIJnO3zI7JYJjgzP7+MaDDExNltY/TXpR+sjM1HatGt0U6u7pt/mhnltldk73y X-Received: by 2002:a05:6214:3911:b0:6af:c66a:d5a8 with SMTP id 6a1803df08f44-6b030aa0653mr39389856d6.51.1717622222100; Wed, 05 Jun 2024 14:17:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717622222; cv=none; d=google.com; s=arc-20160816; b=MgvKC9uPdUf3Ri5BqWGxQKFh7v4F2lALzFNHiJN8OvUTQrcccTfL1qfpfukLQVfMfj GKYeM/MHI6gZI7TQX6X58B659r/LJgtMY4Qo4ptoM64ZhxVNwGNobWGYf0iH2gu6cRsU F37+ewkLPZABG99p47CggrMT658W25VzUxG6VmJ7A8MMT9V+lPjjBua1b8LhAgaX9Qrt mJ/gf7ZUtnSTfOd1t8785MkNkNeccJDp0kU3o0eqgEKnOPQbDolgsLGQKvUrVBj5ZoUN S6nfT7qOWn7BxgHG7JA95Gfm/K7CShh2jLADE2ncAhu/AMix2ZngYj27/J5bgcZUPy8W qYZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eAoOiYM0ExI1FMuz9eK9AmdYVnEbXhJzPvY/2SnngcQ=; fh=i/pWNGcx7KiR3ewgypxpPkuORYlkCnVXLqKVm9/UgNc=; b=e36C6OLq6TKa+QtEK7hY+xwECWcOvSSCTI9SSW3BS5sU+4srZ8eQQq4tG5rNH6VfEw m34XlOXMNMzPFjhaNcHDtgcbUtbgfMOWP7wHOOK4ZQnug5m0Ksa9KkJWT7ZTmOfGtg7/ ZVqmTD0DZvh2vtdBG+mPGXlvnWH26T/6AexyqaNppGiOUYQqI3oRqhOILQbjzVlfmANs 8EyKNOJeKT28Zcx4VFLP6pnxVlMaNimN1gQyss9Y73Xa8la+1vMVL930EwUM2zVoMP7o f/NOzITOeDnkjwpqd4bvbGIC1WFOdQPYRAdzotfXc4wRBO4EoYO0EgQF342QBxrl6reg xhbg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QtgsMBIp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4b43a860si147633216d6.552.2024.06.05.14.17.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Jun 2024 14:17:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QtgsMBIp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sExz7-0000hj-MY; Wed, 05 Jun 2024 17:15:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sExyw-0000dT-Lr for qemu-devel@nongnu.org; Wed, 05 Jun 2024 17:15:44 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sExyk-0003Q5-OC for qemu-devel@nongnu.org; Wed, 05 Jun 2024 17:15:40 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-7023b6d810bso199757b3a.3 for ; Wed, 05 Jun 2024 14:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717622129; x=1718226929; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eAoOiYM0ExI1FMuz9eK9AmdYVnEbXhJzPvY/2SnngcQ=; b=QtgsMBIp6h/xkL8VDLa0Mj2Vh2tbESFm8q3i+Zr9uKPcbUY2e6YVvOMhYLz7Kvionk n5jLUIBTFz8wDfthJlZJjkiwfujawyAfClE2+Ms/OjA0VfsLuUcLbH/6+uMyPodJ0DV5 4m97hEPEv2krQ3Dz60x2tzSH/vDDrwS05NckABC2DsX9RgUkA6jDp6vYntBmMjECF97H UDiM4v0SN3Ey4YclN3UWRejIlpq/alpxlfE8XsHjQj59b+1IKjl52GLv8swfPrtg9i12 AzcxW0C2uT28w1fvfpJrs1Ya74RlRmjAtMDKHoqMkw7T+SQXVjGKvKAfb5Z3Zh4fKJJ+ hGRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717622129; x=1718226929; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eAoOiYM0ExI1FMuz9eK9AmdYVnEbXhJzPvY/2SnngcQ=; b=JTTfOu0nDc4gq17Y7gknl40u/1ytj85gFQvMnAJ8IZuMdeA4P2V+f1NOfTjP4gP+t4 h/Npg/2KveIE7Slkt1eS2iIGsZ9s6S0CF/hU46WcGdZzP6pkWdSFCzfAbhC8csdIjiOG Ko9uNUstEro0wKrdpPz4f2byofsxARblSx8/MSPrN8uoROI8krMd5LuF1EnPTQ9LLk7v LVh3H092Uz2vNgwwlf9WvgfU1sEunX5M5+vU7A9L7tlOWAyh7CQOlqBa6tWJ0AEhRDMV xXCij99WHYXOlV7tdQN5QmZlQGvmoma3fqw+eZtnbcznZdq4Bjlzwr6anM02eS0jelzR 1ieQ== X-Gm-Message-State: AOJu0YwYG/ZuDjz/xUkobW1ffq42WrW5YGlBXKwvM1lgjssowBJOHmJs FLp7VAoJLNiu7grW/jlE8npBIy5PreFHxUqkF1ouwNxf5S2Ml4h26wp61GuOTWJzC7inlfcUmJy F X-Received: by 2002:a05:6a21:8195:b0:1b2:710a:5cfc with SMTP id adf61e73a8af0-1b2b71790c0mr3595401637.57.1717622129084; Wed, 05 Jun 2024 14:15:29 -0700 (PDT) Received: from stoup.. ([71.212.132.216]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70242aec7d0sm9347538b3a.99.2024.06.05.14.15.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 14:15:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PULL 07/16] hw/ide/atapi: Use qemu_hexdump_line to avoid sprintf Date: Wed, 5 Jun 2024 14:15:12 -0700 Message-Id: <20240605211521.577094-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240605211521.577094-1-richard.henderson@linaro.org> References: <20240605211521.577094-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1. Using qemu_hexdump_line both fixes the deprecation warning and simplifies the code base. Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier Message-Id: <20240412073346.458116-10-richard.henderson@linaro.org> --- hw/ide/atapi.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c index 73ec373184..fcb6cca157 100644 --- a/hw/ide/atapi.c +++ b/hw/ide/atapi.c @@ -24,6 +24,7 @@ */ #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "hw/scsi/scsi.h" #include "sysemu/block-backend.h" #include "scsi/constants.h" @@ -1309,14 +1310,9 @@ void ide_atapi_cmd(IDEState *s) trace_ide_atapi_cmd(s, s->io_buffer[0]); if (trace_event_get_state_backends(TRACE_IDE_ATAPI_CMD_PACKET)) { - /* Each pretty-printed byte needs two bytes and a space; */ - char *ppacket = g_malloc(ATAPI_PACKET_SIZE * 3 + 1); - int i; - for (i = 0; i < ATAPI_PACKET_SIZE; i++) { - sprintf(ppacket + (i * 3), "%02x ", buf[i]); - } - trace_ide_atapi_cmd_packet(s, s->lcyl | (s->hcyl << 8), ppacket); - g_free(ppacket); + g_autoptr(GString) str = + qemu_hexdump_line(NULL, buf, ATAPI_PACKET_SIZE, 1, 0); + trace_ide_atapi_cmd_packet(s, s->lcyl | (s->hcyl << 8), str->str); } /*