Message ID | 20240411101550.99392-12-philmd@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:adf:e6ca:0:b0:346:15ad:a2a with SMTP id y10csp149005wrm; Thu, 11 Apr 2024 03:18:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUJM7Q2nM2L9H+NV6gc1Cg9xYs0JSM17mTPea0jxVuCS2FVHmR9grx1Ifo8+WnT1kwuFyTHOihUzMTDeKW7sEzR X-Google-Smtp-Source: AGHT+IGNhhU4+cA940Ek64LBhLBpaXQQudmHd26gFHFvZRNAC0WwTvVwJTgzj2WGtByIB4oZQJQ7 X-Received: by 2002:a05:6214:1d2a:b0:699:a2d:d794 with SMTP id f10-20020a0562141d2a00b006990a2dd794mr4965155qvd.50.1712830681683; Thu, 11 Apr 2024 03:18:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1712830681; cv=none; d=google.com; s=arc-20160816; b=ia4o5iPAhAO6bVy3PLROy7fYFh3cy2idE+IWhSaHNHxpTMBKf40I4U6u4forOaDaxs 6lrdiDcjNT6DwFG3KXPU3NZbffWAcp07un0T95qrxmJFDFgI3RWJFc6ErkhJdSbdAZ2R qznwzAc+IFVh1pr0/dLpHhn6VYsG5Ubn2pBvi/e2WbBTz7KqcF/QnP020Vg4cQnxDgjx jG90UZ6y6mARb/9th9f87wbW4/BJNS9MyyfDZxxPsIMJBnDh8xMWDcwIAmaHprWvh1iD Ir2fbQ6z0F8fqN6FxDePZYmKu0iXW/MAJsLpCzi4Kam2vtC1b2i6FnbQDh5hTPsUclMY 9n3g== 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=tmrbaiUVNJN3VwkspX6n0mLGveiY6Yl+m30htubqYrE=; fh=/lTrfBylm71qNkQIW0c1QbQKoBkENvG1bM6spxioYcA=; b=ze6XQk3du7nvQ3TYKSOup6cRjwWEkkNqHmoSJXjRIAhStUaROApsIL0omRPLZH9feY tjNM0QqWriBEgnA0WTiOBSgpDUG2/49cEwmSTv9h/RcszOe8S65SL7D7YqRcxE3Vmx01 GoS1yt0MvaWwgMSO29Bc3ivQAx9LYzhhYUoRd0DBzkjBmAQ/it/y9QELpDsmWBv6joGr kOnHi/2LTEgKM86aScG0Ob2IJnXjAZzcB10HGBszR3Yvzo14vzz7/iRWNb12y0+xJGeG g3TmO2fTZJbQqigomTbPhxreQef2zJaXUQ2LPzmfE3JOK7d9QU6PLoKkB3lNspSSTBlu B2Bw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EyltW+Pi; 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: <qemu-devel-bounces+patch=linaro.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h15-20020a0ceecf000000b0069b413fbdb3si1220433qvs.148.2024.04.11.03.18.01 for <patch@linaro.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Apr 2024 03:18:01 -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=EyltW+Pi; 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 <qemu-devel-bounces@nongnu.org>) id 1rurV2-0006L0-6i; Thu, 11 Apr 2024 06:17:44 -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 <philmd@linaro.org>) id 1rurUO-0005Mx-Qe for qemu-devel@nongnu.org; Thu, 11 Apr 2024 06:17:06 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <philmd@linaro.org>) id 1rurUL-0007bt-Fn for qemu-devel@nongnu.org; Thu, 11 Apr 2024 06:17:03 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4166d6dab3dso30487475e9.0 for <qemu-devel@nongnu.org>; Thu, 11 Apr 2024 03:17:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712830620; x=1713435420; 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=tmrbaiUVNJN3VwkspX6n0mLGveiY6Yl+m30htubqYrE=; b=EyltW+PiE5hSLlX2UuetygNo05dn8PsOOZbqMiH1mnJsDKwpR6vTwEk/aTNKArABid lCnMz7N6gBeNu0XoypaS5H0ZcqnnGsRMhZUIDGKTjIySrm9fh52YtiTLgkqzNm4PazAq RbsQw2TJLCKcOtbTJA/EuL8IUfK9TEzXr7jK4NHWvBYNrYiVUc6fzoGtGwteRvO7+9xi mXrEaVG5zIswp0+PrLLYwEJ/sWuYSyqi48gkGkcwC7fxCD2H1ye5jSzdSfz283YwtERt 9M7Sb4zn4yhlVEKdOzLsQhEJ9Ace4jHwagOFJBnqP6D+mY9jBYJFb4zjwvo7qRADgpxp cSWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712830620; x=1713435420; 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=tmrbaiUVNJN3VwkspX6n0mLGveiY6Yl+m30htubqYrE=; b=dpUIq0EU2pQ8NhPASAxE/wuL+F6YGEnQlEPYOHwWN6tf6WUjfANqTfiGS67QNKwRCO L9eWT9SyjGVDYUBWQ4CEBCcmf+S1azlOFLg9u+o/FRCnypv+MGxtCouaLUxESglTM+sm 6fFGEg/QX3IzXO52YdbyDqA+n+S0ehdqgNZepFIDzQMKjZJJne8VEW9TcOg8Q8ivnoGb YbLhoYU+p/vXhR8brz6ffsFRZDueb3DOH7hFnBNHIeo/HjvG9fiQWIgiviCXyjQgXOhZ KRzfhzSrdLRY8MjuB1mTWgHOQLdCW9WJqIJN1xcFZlyEgBysXIyL+HRuNGwpw/AeWsSc Lcpw== X-Gm-Message-State: AOJu0Yym+Gp/JKTJwdAMxJJR1rYFzSCIofa4jDZyOx7aCuQprpYufLtI jopbn6EN7WyAlCwFI0ixLyRVkVwytdVVitSrkAOhzPrwTR8pnB9AOBO9R0q1ZygSP7QFm5oO/fl Lq9c= X-Received: by 2002:a05:600c:4e88:b0:414:93df:bef1 with SMTP id f8-20020a05600c4e8800b0041493dfbef1mr3460478wmq.39.1712830619724; Thu, 11 Apr 2024 03:16:59 -0700 (PDT) Received: from localhost.localdomain (137.red-88-29-174.dynamicip.rima-tde.net. [88.29.174.137]) by smtp.gmail.com with ESMTPSA id bi8-20020a05600c3d8800b00417e184dacbsm791877wmb.25.2024.04.11.03.16.58 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 11 Apr 2024 03:16:59 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org> To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, qemu-block@nongnu.org, qemu-ppc@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>, John Snow <jsnow@redhat.com> Subject: [PATCH v2 11/13] hw/ide/atapi: Use qemu_hexdump_line() to avoid sprintf() Date: Thu, 11 Apr 2024 12:15:47 +0200 Message-ID: <20240411101550.99392-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240411101550.99392-1-philmd@linaro.org> References: <20240411101550.99392-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=philmd@linaro.org; helo=mail-wm1-x329.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: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org |
Series |
misc: Remove sprintf() due to macOS deprecation
|
expand
|
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c index 73ec373184..27b6aa59fd 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,12 +1310,7 @@ 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]); - } + char *ppacket = qemu_hexdump_line(buf, 0, ATAPI_PACKET_SIZE, false); trace_ide_atapi_cmd_packet(s, s->lcyl | (s->hcyl << 8), ppacket); g_free(ppacket); }
sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1, resulting in painful developper experience. Use qemu_hexdump_line() to avoid sprintf() calls, silencing: [1367/1604] Compiling C object libcommon.fa.p/backends_tpm_tpm_util.c.o backends/tpm/tpm_util.c:355:18: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] p += sprintf(p, "\n"); ^ Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/ide/atapi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)