From patchwork Mon Jul 31 00:55:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 4525 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.85 with SMTP id 82csp1850991vsb; Sun, 30 Jul 2017 17:56:26 -0700 (PDT) X-Received: by 10.223.128.177 with SMTP id 46mr11609970wrl.150.1501462586911; Sun, 30 Jul 2017 17:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501462586; cv=none; d=google.com; s=arc-20160816; b=jMgk3AHznwJ3GWTy4ah2XfEHmdsEqXAu+X5yXs5kSoMk6GfQjjQHdiB/n1/RVcyHRv 6UB//4qnVAphinrPYs/OBOTcKskl56W/hTsCE5k/nMb2b5yepjP4CqEE+8E7NDvKJlw8 FsEL13i5IHUyUYESLQvFpHOYYByo7Ztp85Lp6imCiQAsk236M+NSGs/BvKSQMRt1dsfc rg9QeF0zY7q2UXg6jlt7aaCiLVd9NDFt/rx1+pzB+h1z3hqKkPoi7ouxbw2rt7goRtYj p12ShUND9Dh999UAipMAHaZI93944ytyGX2p0TCFTwJjVdJDIBeOL0yffiKLxWol0a2f +0Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :in-reply-to:mime-version:references:message-id:to:from:date :delivered-to:arc-authentication-results; bh=3PhITv2g3LC0R3xn0SxPnyN+aSCdPks2gDRZgoxsxpU=; b=yIaLl4b+ZwG26vu/8CUCLPhmwD+pQnalvsKD7uIVmK7lJ9BfOARv/mmFYQkxSg+Imw F7ITveF6F+QHNC3nNoVptnubkWoWKk9Gxjc8zftvwclDjizaroh0W5VLaUgdMkvszBeq tUc1hu109wpVCWBRVMF3vprAEvQkmoi1hKLxa80E4vAK5WHfDpJWySLQ6QMkaH/CcDsA cM1nXanc2YTCIjiAcHKqchpDR/HPYquITUr+gDt3q8nBS+5hOb1uLEn2T+ysaaVTor5j uhXCf2pPmF0iLIN+iSR99BovirHZ5DhjwqemcvLTSM+XEWeLBHAHJPnhtLH6RQH8fjMS 33kw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y62si1313760wme.69.2017.07.30.17.56.25; Sun, 30 Jul 2017 17:56:26 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6D2C868A109; Mon, 31 Jul 2017 03:56:20 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C5C52689F4E for ; Mon, 31 Jul 2017 03:56:14 +0300 (EEST) Received: from mfilter15-d.gandi.net (mfilter15-d.gandi.net [217.70.178.143]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id BBEB017209B for ; Mon, 31 Jul 2017 02:56:16 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter15-d.gandi.net Received: from relay4-d.mail.gandi.net ([IPv6:::ffff:217.70.183.196]) by mfilter15-d.gandi.net (mfilter15-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id YGj44HFLM9zj for ; Mon, 31 Jul 2017 02:56:15 +0200 (CEST) X-Originating-IP: 213.47.41.20 Received: from localhost (213-47-41-20.cable.dynamic.surfer.at [213.47.41.20]) (Authenticated sender: michael@niedermayer.cc) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 484D117209C for ; Mon, 31 Jul 2017 02:56:15 +0200 (CEST) Date: Mon, 31 Jul 2017 02:55:20 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20170731005520.GH3740@nb4> References: <20170729192751.26379-1-u@pkh.me> <20170730023416.GD3740@nb4> <20170730082501.GC22239@golem.pkh.me> <8409c528-5bf9-9b2e-f19a-4673d533961f@gmail.com> MIME-Version: 1.0 In-Reply-To: <8409c528-5bf9-9b2e-f19a-4673d533961f@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [FFmpeg-devel] [PATCH 1/5] lavc/htmlsubtitles: improve handling broken garbage 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On Sun, Jul 30, 2017 at 03:47:39PM -0300, James Almer wrote: > On 7/30/2017 5:25 AM, Clément Bœsch wrote: > > On Sun, Jul 30, 2017 at 04:34:16AM +0200, Michael Niedermayer wrote: > > [...] > >>> + struct font_tag stack[16] = {0}; > >> > >> this seems to produce a compiler warning: > >> > >> ./libavcodec/htmlsubtitles.c: In function ‘ff_htmlmarkup_to_ass’: > >> ./libavcodec/htmlsubtitles.c:112:12: warning: missing braces around initializer [-Wmissing-braces] > >> > > > > Ah, I don't have that warning. Changed locally with a memset 0 (and of > > only the first element this time). > > You could try moving char "face[128]" to the end of the font_tag struct. > That should in theory also get rid of the warning. > Could you confirm that, Michael?. seems this very minor warning issue led to a much bigger discussion than i expected ... this is one way to fix the warning: - struct font_tag stack[16] = {0}; + struct font_tag stack[16] = {{{0}}}; this is another: I did not test these with other compilers, but i can if someone see value in it [...] diff --git a/libavcodec/htmlsubtitles.c b/libavcodec/htmlsubtitles.c index 69d855df21..1950ddf54c 100644 --- a/libavcodec/htmlsubtitles.c +++ b/libavcodec/htmlsubtitles.c @@ -65,9 +65,9 @@ static void handle_open_brace(AVBPrint *dst, const char **inp, int *an, int *clo } struct font_tag { - char face[128]; int size; uint32_t color; + char face[128]; }; /* @@ -105,7 +105,7 @@ int ff_htmlmarkup_to_ass(void *log_ctx, AVBPrint *dst, const char *in) * remaining after the opening one was dropped. Yes, this happens and we * still don't want to print a "" at the end of the dialog event. */ - struct font_tag stack[16] = {0}; + struct font_tag stack[16] = {{0}}; for (; !end && *in; in++) { switch (*in)