From patchwork Fri Apr 12 07:33:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 788253 Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp590626wrm; Fri, 12 Apr 2024 00:34:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWPsX6vimNfg0N0aQl4QyV26CBWoCe19oLFE0nIfWrTR68RkmIHO8EaahdTLpqwIE9JbA2d7TXFBBwAA9eezPAh X-Google-Smtp-Source: AGHT+IHPhn6FAZJaWRVBlzfAE7lUNDowT7cXCRg+b6kEByFUtIDR1HeM632Eq0BnZbcN2Wmf/UeY X-Received: by 2002:a05:620a:28ca:b0:78e:ca95:cea8 with SMTP id l10-20020a05620a28ca00b0078eca95cea8mr1969017qkp.4.1712907298613; Fri, 12 Apr 2024 00:34:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712907298; cv=none; d=google.com; s=arc-20160816; b=w+3a+8/Fzl5LUJMGdo18UTSIucU3FyFii9hzoNIxxbFeIRwopF3nMR82xPvUr/ZsNP pqqJH3AU1bee2XX1XR89w5jt7YAd7olYTUwMnuvVs2s2aC7AlQe2Mw7Eyo70WMGn111S UczCkel3evIPYYYr5sZD5J5NLog/IMQ0emwajUVVmVmbEkGb2ydct2Tsl7yGXOX3c38i iHZk/BkjaI6kOBYSb7xrNr4PnuKO8ONvm/ltsMWkXG6hEhKWZFrxOJq7XIzM1hJmWbqr qN3QwjGupT5t0nRBdReSm7JcZOfLkNjPYmSToRqZZw0BBPlQTmyqC2fU+QS02SDQneGp G0/g== 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=vWTBmrF16GSaydEzWRv0Zn9YqSFsjsSSjgb9YwJ02w4=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=z9yvDodERQY2bwwfXUt8S6S4qnbgcNEOIUF/F19kgN/atOO72GvZJyMKS6JaQaMEbw AQhLrXFkwryzHwgv7Hw6HMKsr9CwR67ZDjL0zXmhFOHKnmP7xMgOQ95JrRbnU2x8mg9p XIYicRXcfFXfxG8s6PxNU6nj6uP+VoREhBAw14Ia3WlhK1CCv4Wqd6mDlnjXuE+NXSFw XWf8zWesYcw2vTim4hVgS+Hu0DBzEFi8liD6OG/2Z4mKmV4mpEJSrVUwk98XBO+dug3E IqmMpxj+eYIe21RjswbNiqkf9be+Nbln/VeSDR807wpS3o+ywg9FObqKVl1HMIZArpbb 61cA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zuz3gB39; 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 o1-20020a05620a0d4100b0078d5fed75dfsi3069611qkl.717.2024.04.12.00.34.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Apr 2024 00:34:58 -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=Zuz3gB39; 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 1rvBQ6-00070R-Tb; Fri, 12 Apr 2024 03:33:58 -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 1rvBQ5-0006zo-T7 for qemu-devel@nongnu.org; Fri, 12 Apr 2024 03:33:57 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rvBQ4-000786-CQ for qemu-devel@nongnu.org; Fri, 12 Apr 2024 03:33:57 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1e51398cc4eso6364615ad.2 for ; Fri, 12 Apr 2024 00:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712907235; x=1713512035; 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=vWTBmrF16GSaydEzWRv0Zn9YqSFsjsSSjgb9YwJ02w4=; b=Zuz3gB39RFRPXjjhlMe00Gye62SaGQL9MZHWpfKIzppFAiGXWsnI1oqea+lJUC9vDI KdrbE3r12I3nIQhES049JHCTs8xbWHpLoxRGVEGxjfjdVzc1IZ42X/sejepJ/stMfScG Qi+MVCORtIQBXUYbF8yp0bBupNMnD6u8kewKSuunjmKJ6WqMERrTLgWWXI8YoAMD3IlM Yxu+uwMuM4aJT+C6J3XRvg2s0XHrnEVwwnmz126O4ImNpFeAcO8d1tHslTfAFUF//BHy E46FEh3pD7zFQtJEb79g3KWZnhp8y2jIA+3roQbWGuvngF6OKsF44aQ5nNMnErLWfYsT YtAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712907235; x=1713512035; 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=vWTBmrF16GSaydEzWRv0Zn9YqSFsjsSSjgb9YwJ02w4=; b=Uo3UIrwI38THwhwHMCA+WWH79pcoXnzZZC7Bb9JQ8TbC+4qXqcTlQ+j4ytrxLE+Olm fxVclEvBBQbpL9/OtTNtPdZGANLZOEURZKXr2o0e+ayUzetbUpmFc3Sqia6yyVppadMV Ja+Jua+dl7OT6sidSjiC1T+0qLz1GKW2wPx8oH74L+IHs2OId/CwOTzuYa5F7ILUv2q2 X5kN0LCpQpaRcIn0hZIwGux2G7u5of+85RvqiTfLjfwIdhLlmXDnANEnpkZDwRU5iV/V l9YGHJ3w0ZuYhT1zHsXffFOsgU4+LoruBzPLe01CdjMJZCgL04Vd8M8ivGokHYAGlqjc NxYQ== X-Gm-Message-State: AOJu0YyP17coF7LsZfvfK7V1hm20t77ln2KGc+31Ff+gjRch/L/d8SOH COd7wp+mTNKp98XDva6dwrp+gZtWCXlh2MVLKeRxFyMz3PIalATGPFmAj7RM7hukv31KA8Mite2 o X-Received: by 2002:a17:903:2289:b0:1e2:81c1:b35e with SMTP id b9-20020a170903228900b001e281c1b35emr2143992plh.54.1712907234841; Fri, 12 Apr 2024 00:33:54 -0700 (PDT) Received: from stoup.. (174-21-72-5.tukw.qwest.net. [174.21.72.5]) by smtp.gmail.com with ESMTPSA id e5-20020a17090301c500b001e556734814sm2206099plh.134.2024.04.12.00.33.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 00:33:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v3 09/27] hw/ide/atapi: Use qemu_hexdump_line to avoid sprintf Date: Fri, 12 Apr 2024 00:33:28 -0700 Message-Id: <20240412073346.458116-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240412073346.458116-1-richard.henderson@linaro.org> References: <20240412073346.458116-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.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 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 --- 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); } /*