qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 6/9] hw/net/rocker: Replace sprintf() by snprintf()


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 6/9] hw/net/rocker: Replace sprintf() by snprintf()
Date: Thu, 11 Apr 2024 23:22:47 +0200
User-agent: Mozilla Thunderbird

On 11/4/24 13:30, Peter Maydell wrote:
On Thu, 11 Apr 2024 at 11:47, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:

sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1,
resulting in painful developper experience. Use snprintf() instead.

("developer")

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
  hw/net/rocker/rocker.c | 24 ++++++++++++------------
  1 file changed, 12 insertions(+), 12 deletions(-)

          switch (offset) {
          case ROCKER_DMA_DESC_ADDR_OFFSET:
-            sprintf(buf, "Ring[%s] ADDR", ring_name);
+            snprintf(buf, sizeofbuf), "Ring[%s] ADDR", ring_name);

Something seems to have gone wrong here. Shouldn't this have
failed to compile ?

This code is guarded by DEBUG_ROCKER, which is why I didn't noticed :)

Indeed when enabling:

../../hw/net/rocker/rocker.c:930:65: error: extraneous ')' before ';'
            snprintf(buf, sizeofbuf), "Ring[%s] ADDR", ring_name);
                                                                ^



reply via email to

[Prev in Thread] Current Thread [Next in Thread]