From patchwork Wed Mar 17 16:32:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 26428 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D476B44BA1E for ; Wed, 17 Mar 2021 18:32:40 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B8E5268B0A6; Wed, 17 Mar 2021 18:32:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id CC24568B050 for ; Wed, 17 Mar 2021 18:32:34 +0200 (EET) Received: by mail-ej1-f43.google.com with SMTP id bm21so3633988ejb.4 for ; Wed, 17 Mar 2021 09:32:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=pPXokuNIfMdVIjC9/8hFvwV3g3AN1x+Yrga9ZSgGnLU=; b=RD7DuyK1XmMNqdwvdvI64pj8aXklnxu4Z0qHyCBkFw31rR1RnVz3fnBetyuU4ps64B e5hBcI2QJlejeR5ittHRC+gr4c96k5xULYstz7rN87vjHBjCxZY0Vgdn0Nyu+DZA2oeQ wickXHJLibz4viXApVg4uvaGTHqVOmmV7ogmeqOs6rM97D4IkKqWUIsTW9go+lGggcGz 1k89p+JmEQp3Hl/HQJv/a/0cl9ERStfUVpSmQFn/utTStAnsa/3Hn0c4ipDHNObIBR/Y pnpyBtyQRy7jKPcLzB05Fw+Jjn1EGxbfId4I50FsVU3/3qZQ/uSOTi4tdzbAoPHgEcWM kV6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=pPXokuNIfMdVIjC9/8hFvwV3g3AN1x+Yrga9ZSgGnLU=; b=lNE2aGOG86W8MiCZibk3XrGioBBp2HUaJ/3ak1yofFWvU6SBepgAurO3RywzjVc4NG Q7zzrFrWMGv6c+cCxvazdt3LB2TmwFpkye/fDqlNgrgHZiu0YKg1reXO5oRqqYApNTuf 6dARh001+IMUS2K6Y0SBcrMd8rMJv/Fe/Q8/LC+TFkqfMGlqUMIRGkbLdzHjFLffTigt 5KT8kqRNzUXTFiIn6MPNZXp1S268F42r0LTvLfJeigQR5K3pGRTV/LCMmbZQ1sZimrKo uGa3aPYBBPekOvIIWCCA4uMyDpdohe1dUF/lzGEocDPa3qZRbFbbjjO11sZ8hZ3pbA/D MKAg== X-Gm-Message-State: AOAM533JI78P+v6tNCTza6niOJ+5z2ib9nFRA7U1oqfeMNIqTzKsS7kU fM+GT3bvwJ7+nwMNU2Rqz4NPC4GofPObKg== X-Google-Smtp-Source: ABdhPJwcVOBMyjRWyEKa+bQvh2zqfWl3IFB8MBhfSmeYZ2yo0oxWr9FwKnCD8R5FSs1glcfwfFthzw== X-Received: by 2002:a17:906:1fd6:: with SMTP id e22mr37140752ejt.481.1615998754141; Wed, 17 Mar 2021 09:32:34 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc08960.dynamic.kabel-deutschland.de. [188.192.137.96]) by smtp.gmail.com with ESMTPSA id gx2sm6518382ejc.82.2021.03.17.09.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 09:32:33 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Mar 2021 17:32:01 +0100 Message-Id: <20210317163202.672493-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210317163202.672493-1-andreas.rheinhardt@gmail.com> References: <20210317163202.672493-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] avcodec/pngdec: Don't use AVBPrint where inappropriate X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- libavcodec/pngdec.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 6b9fdf5a22..21e79a24a7 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -1338,17 +1338,13 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, break; } case MKTAG('g', 'A', 'M', 'A'): { - AVBPrint bp; - char *gamma_str; + char gamma_str[18]; int num = bytestream2_get_be32(&s->gb); - av_bprint_init(&bp, 0, AV_BPRINT_SIZE_UNLIMITED); - av_bprintf(&bp, "%i/%i", num, 100000); - ret = av_bprint_finalize(&bp, &gamma_str); - if (ret < 0) - return ret; + snprintf(gamma_str, sizeof(gamma_str), "%i/100000", num); - av_dict_set(&p->metadata, "gamma", gamma_str, AV_DICT_DONT_STRDUP_VAL); + if ((ret = av_dict_set(&p->metadata, "gamma", gamma_str, 0)) < 0) + return ret; bytestream2_skip(&s->gb, 4); /* crc */ break;