Re: sum1 - r23163 - abiword/trunk/plugins/kword/xp

From: Hubert Figuiere <hfiguiere_at_teaser.fr>
Date: Mon Mar 17 2008 - 23:49:09 CET

On Mon, 2008-03-17 at 23:47 +0100, cvs@abisource.com wrote:
> Log:
> KWord import: Sanity check RGB values. Please backport.
>
>
>
> Modified: abiword/trunk/plugins/kword/xp/ie_imp_KWord_1.cpp
> ===================================================================
> --- abiword/trunk/plugins/kword/xp/ie_imp_KWord_1.cpp 2008-03-17 22:39:51 UTC (rev 23162)
> +++ abiword/trunk/plugins/kword/xp/ie_imp_KWord_1.cpp 2008-03-17 22:47:16 UTC (rev 23163)
> @@ -388,14 +388,20 @@
> p = _getXMLPropValue("red", atts);
> if (p != NULL) {
> red = atoi(p);
> + if (red < 0 || red > 255)
> + red = 0;

I'd do it that way:

if (red < 0)
        red = 0;
else if (red > 255)
        red = 255;

And so on.

That's more sane IMHO.

Hub
Received on Mon Mar 17 23:49:32 2008

This archive was generated by hypermail 2.1.8 : Mon Mar 17 2008 - 23:49:32 CET