[{"id":1142,"web_url":"https://patchwork.libcamera.org/comment/1142/","msgid":"<20190327001335.GC4842@pendragon.ideasonboard.com>","date":"2019-03-27T00:13:35","subject":"Re: [libcamera-devel] [PATCH v5 03/19] libcamera: geometry: Add\n\t0-initialized SizeRange constructor","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Tue, Mar 26, 2019 at 09:38:46AM +0100, Jacopo Mondi wrote:\n> Add constructor to SizeRange which initialize all the size range fields\n> to 0.\n> \n> While at there make the in-line constructor declarations respect the\n> coding style by moving braces to a new line.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/geometry.cpp       | 11 ++++++++++-\n>  src/libcamera/include/geometry.h |  9 ++++++++-\n>  2 files changed, 18 insertions(+), 2 deletions(-)\n> \n> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\n> index b6b6592bdfec..dbc37ca8e3f4 100644\n> --- a/src/libcamera/geometry.cpp\n> +++ b/src/libcamera/geometry.cpp\n> @@ -57,7 +57,16 @@ namespace libcamera {\n>  \n>  /**\n>   * \\fn SizeRange::SizeRange()\n> - * \\brief Construct a size range\n> + * \\brief Construct a size range initialized to 0\n> + */\n> +\n> +/**\n> + * \\fn SizeRange::SizeRange(unsigned int minW, unsigned int minH, unsigned int maxW, unsigned int maxH)\n> + * \\brief Construct an initialized size range\n> + * \\param minW The minimum width\n> + * \\param minH The minimum height\n> + * \\param maxW The maximum width\n> + * \\param maxH The maximum height\n>   */\n>  \n>  /**\n> diff --git a/src/libcamera/include/geometry.h b/src/libcamera/include/geometry.h\n> index eadc4ed4f9cb..749746495204 100644\n> --- a/src/libcamera/include/geometry.h\n> +++ b/src/libcamera/include/geometry.h\n> @@ -18,10 +18,17 @@ struct Rectangle {\n>  };\n>  \n>  struct SizeRange {\n> +\tSizeRange(void)\n> +\t\t: SizeRange(0, 0, 0, 0)\n> +\t{\n> +\t}\n> +\n>  \tSizeRange(unsigned int minW, unsigned int minH,\n>  \t\t  unsigned int maxW, unsigned int maxH)\n>  \t\t: minWidth(minW), minHeight(minH), maxWidth(maxW),\n> -\t\t  maxHeight(maxH) {}\n> +\t\t  maxHeight(maxH)\n> +\t{\n> +\t}\n>  \n>  \tunsigned int minWidth;\n>  \tunsigned int minHeight;\n\nOpen question here, what to you think of\nhttps://en.cppreference.com/w/cpp/language/data_members#Member_initialization,\nitem 2 instead of creating a constructor for this kind of purpose ?","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D299A600F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Mar 2019 01:13:50 +0100 (CET)","from pendragon.ideasonboard.com\n\t(p5269001-ipngn11702marunouchi.tokyo.ocn.ne.jp [114.158.195.1])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2E9F32E1;\n\tWed, 27 Mar 2019 01:13:48 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1553645630;\n\tbh=PsQBONB4e1k5nYQB7A38MvV7c26/qFSsGU4eVMVv3MQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=NDlRUrjt7+8T6BVEXHO5PmSOkamb4jtpEaI3zcS3Jh+Vcsim3Cx9l8ZiLe1Bup6dg\n\t651/NorU6jJBs27nYHlPUvajwbwYKKP/xpJifCQsbkrxoOjGZLTF5tAm3UVaT0i68g\n\t8bC3Kamb4fTFdZzZjNonm0S5WPCtEY3sX0I9Hrzg=","Date":"Wed, 27 Mar 2019 02:13:35 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190327001335.GC4842@pendragon.ideasonboard.com>","References":"<20190326083902.26121-1-jacopo@jmondi.org>\n\t<20190326083902.26121-4-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190326083902.26121-4-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v5 03/19] libcamera: geometry: Add\n\t0-initialized SizeRange constructor","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 27 Mar 2019 00:13:51 -0000"}},{"id":1145,"web_url":"https://patchwork.libcamera.org/comment/1145/","msgid":"<20190327080050.7rtyvt6ve4lwx7ft@uno.localdomain>","date":"2019-03-27T08:00:50","subject":"Re: [libcamera-devel] [PATCH v5 03/19] libcamera: geometry: Add\n\t0-initialized SizeRange constructor","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Laurent,\n\nOn Wed, Mar 27, 2019 at 02:13:35AM +0200, Laurent Pinchart wrote:\n> Hi Jacopo,\n>\n> Thank you for the patch.\n>\n> On Tue, Mar 26, 2019 at 09:38:46AM +0100, Jacopo Mondi wrote:\n> > Add constructor to SizeRange which initialize all the size range fields\n> > to 0.\n> >\n> > While at there make the in-line constructor declarations respect the\n> > coding style by moving braces to a new line.\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  src/libcamera/geometry.cpp       | 11 ++++++++++-\n> >  src/libcamera/include/geometry.h |  9 ++++++++-\n> >  2 files changed, 18 insertions(+), 2 deletions(-)\n> >\n> > diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\n> > index b6b6592bdfec..dbc37ca8e3f4 100644\n> > --- a/src/libcamera/geometry.cpp\n> > +++ b/src/libcamera/geometry.cpp\n> > @@ -57,7 +57,16 @@ namespace libcamera {\n> >\n> >  /**\n> >   * \\fn SizeRange::SizeRange()\n> > - * \\brief Construct a size range\n> > + * \\brief Construct a size range initialized to 0\n> > + */\n> > +\n> > +/**\n> > + * \\fn SizeRange::SizeRange(unsigned int minW, unsigned int minH, unsigned int maxW, unsigned int maxH)\n> > + * \\brief Construct an initialized size range\n> > + * \\param minW The minimum width\n> > + * \\param minH The minimum height\n> > + * \\param maxW The maximum width\n> > + * \\param maxH The maximum height\n> >   */\n> >\n> >  /**\n> > diff --git a/src/libcamera/include/geometry.h b/src/libcamera/include/geometry.h\n> > index eadc4ed4f9cb..749746495204 100644\n> > --- a/src/libcamera/include/geometry.h\n> > +++ b/src/libcamera/include/geometry.h\n> > @@ -18,10 +18,17 @@ struct Rectangle {\n> >  };\n> >\n> >  struct SizeRange {\n> > +\tSizeRange(void)\n> > +\t\t: SizeRange(0, 0, 0, 0)\n> > +\t{\n> > +\t}\n> > +\n> >  \tSizeRange(unsigned int minW, unsigned int minH,\n> >  \t\t  unsigned int maxW, unsigned int maxH)\n> >  \t\t: minWidth(minW), minHeight(minH), maxWidth(maxW),\n> > -\t\t  maxHeight(maxH) {}\n> > +\t\t  maxHeight(maxH)\n> > +\t{\n> > +\t}\n> >\n> >  \tunsigned int minWidth;\n> >  \tunsigned int minHeight;\n>\n> Open question here, what to you think of\n> https://en.cppreference.com/w/cpp/language/data_members#Member_initialization,\n> item 2 instead of creating a constructor for this kind of purpose ?\n\nThat it might be nice, but I need to declare a default constructor\nanyhow.\n\n+       SizeRange() = default;\n\n        SizeRange(unsigned int minW, unsigned int minH,\n                  unsigned int maxW, unsigned int maxH)\n@@ -34,10 +31,10 @@ struct SizeRange {\n        {\n        }\n\n-       unsigned int minWidth;\n-       unsigned int minHeight;\n-       unsigned int maxWidth;\n-       unsigned int maxHeight;\n+       unsigned int minWidth = 0;\n+       unsigned int minHeight = 0;\n+       unsigned int maxWidth = 0;\n+       unsigned int maxHeight = 0;\n };\n\nI don't have any strong opinion to be honest.\n\nThanks\n  j\n\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 589AE610B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Mar 2019 09:00:09 +0100 (CET)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id B606A20001B;\n\tWed, 27 Mar 2019 08:00:08 +0000 (UTC)"],"Date":"Wed, 27 Mar 2019 09:00:50 +0100","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190327080050.7rtyvt6ve4lwx7ft@uno.localdomain>","References":"<20190326083902.26121-1-jacopo@jmondi.org>\n\t<20190326083902.26121-4-jacopo@jmondi.org>\n\t<20190327001335.GC4842@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\"; boundary=\"pwc53oxwd444b5yp\"","Content-Disposition":"inline","In-Reply-To":"<20190327001335.GC4842@pendragon.ideasonboard.com>","User-Agent":"NeoMutt/20180716","Subject":"Re: [libcamera-devel] [PATCH v5 03/19] libcamera: geometry: Add\n\t0-initialized SizeRange constructor","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 27 Mar 2019 08:00:09 -0000"}},{"id":1160,"web_url":"https://patchwork.libcamera.org/comment/1160/","msgid":"<20190401215319.GJ4787@pendragon.ideasonboard.com>","date":"2019-04-01T21:53:19","subject":"Re: [libcamera-devel] [PATCH v5 03/19] libcamera: geometry: Add\n\t0-initialized SizeRange constructor","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn Wed, Mar 27, 2019 at 09:00:50AM +0100, Jacopo Mondi wrote:\n> On Wed, Mar 27, 2019 at 02:13:35AM +0200, Laurent Pinchart wrote:\n> > On Tue, Mar 26, 2019 at 09:38:46AM +0100, Jacopo Mondi wrote:\n> >> Add constructor to SizeRange which initialize all the size range fields\n> >> to 0.\n> >>\n> >> While at there make the in-line constructor declarations respect the\n> >> coding style by moving braces to a new line.\n> >>\n> >> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> >> ---\n> >>  src/libcamera/geometry.cpp       | 11 ++++++++++-\n> >>  src/libcamera/include/geometry.h |  9 ++++++++-\n> >>  2 files changed, 18 insertions(+), 2 deletions(-)\n> >>\n> >> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\n> >> index b6b6592bdfec..dbc37ca8e3f4 100644\n> >> --- a/src/libcamera/geometry.cpp\n> >> +++ b/src/libcamera/geometry.cpp\n> >> @@ -57,7 +57,16 @@ namespace libcamera {\n> >>\n> >>  /**\n> >>   * \\fn SizeRange::SizeRange()\n> >> - * \\brief Construct a size range\n> >> + * \\brief Construct a size range initialized to 0\n> >> + */\n> >> +\n> >> +/**\n> >> + * \\fn SizeRange::SizeRange(unsigned int minW, unsigned int minH, unsigned int maxW, unsigned int maxH)\n> >> + * \\brief Construct an initialized size range\n> >> + * \\param minW The minimum width\n> >> + * \\param minH The minimum height\n> >> + * \\param maxW The maximum width\n> >> + * \\param maxH The maximum height\n> >>   */\n> >>\n> >>  /**\n> >> diff --git a/src/libcamera/include/geometry.h b/src/libcamera/include/geometry.h\n> >> index eadc4ed4f9cb..749746495204 100644\n> >> --- a/src/libcamera/include/geometry.h\n> >> +++ b/src/libcamera/include/geometry.h\n> >> @@ -18,10 +18,17 @@ struct Rectangle {\n> >>  };\n> >>\n> >>  struct SizeRange {\n> >> +\tSizeRange(void)\n> >> +\t\t: SizeRange(0, 0, 0, 0)\n> >> +\t{\n> >> +\t}\n> >> +\n> >>  \tSizeRange(unsigned int minW, unsigned int minH,\n> >>  \t\t  unsigned int maxW, unsigned int maxH)\n> >>  \t\t: minWidth(minW), minHeight(minH), maxWidth(maxW),\n> >> -\t\t  maxHeight(maxH) {}\n> >> +\t\t  maxHeight(maxH)\n> >> +\t{\n> >> +\t}\n> >>\n> >>  \tunsigned int minWidth;\n> >>  \tunsigned int minHeight;\n> >\n> > Open question here, what to you think of\n> > https://en.cppreference.com/w/cpp/language/data_members#Member_initialization,\n> > item 2 instead of creating a constructor for this kind of purpose ?\n> \n> That it might be nice, but I need to declare a default constructor\n> anyhow.\n> \n> +       SizeRange() = default;\n> \n>         SizeRange(unsigned int minW, unsigned int minH,\n>                   unsigned int maxW, unsigned int maxH)\n> @@ -34,10 +31,10 @@ struct SizeRange {\n>         {\n>         }\n> \n> -       unsigned int minWidth;\n> -       unsigned int minHeight;\n> -       unsigned int maxWidth;\n> -       unsigned int maxHeight;\n> +       unsigned int minWidth = 0;\n> +       unsigned int minHeight = 0;\n> +       unsigned int maxWidth = 0;\n> +       unsigned int maxHeight = 0;\n>  };\n> \n> I don't have any strong opinion to be honest.\n\nNeither do I, hence the open question :-) What do the other think ?","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0107F610B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  1 Apr 2019 23:53:30 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6FFBC542;\n\tMon,  1 Apr 2019 23:53:30 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1554155610;\n\tbh=qlnsJptHeqmXLVRsIFUKOKcc77MxMuW7kRsnfSGJs3Q=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=nVNqGid0wBhnSUs8dcxAIyO5EAsJXl1YU7z6yA1cf0GWLQUQnR8DrepLRETr3cQPf\n\tjWIrhUqzAb+1P6fYSOYhEn9ge40q/J3uosQfQlRe+Cj2b2wq8D2zgGsBW1JVJgxXam\n\t0Wm3RX9zaJaGA6ghFdwHFah358fq7fiAJXxltQgE=","Date":"Tue, 2 Apr 2019 00:53:19 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190401215319.GJ4787@pendragon.ideasonboard.com>","References":"<20190326083902.26121-1-jacopo@jmondi.org>\n\t<20190326083902.26121-4-jacopo@jmondi.org>\n\t<20190327001335.GC4842@pendragon.ideasonboard.com>\n\t<20190327080050.7rtyvt6ve4lwx7ft@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190327080050.7rtyvt6ve4lwx7ft@uno.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v5 03/19] libcamera: geometry: Add\n\t0-initialized SizeRange constructor","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Mon, 01 Apr 2019 21:53:31 -0000"}}]