Re: improving empty handling in tools::Rectangle

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

 



On Tuesday 07 of May 2019, Noel Grandin wrote:
> On 2019/05/07 1:06 PM, Luboš Luňák wrote:
> >   The class can't be both, internally it stores just one value, and there
> > are functions such as the Size ctor or operator<< that do take a side
> > (although in line with the general stupidity, different functions take a
> > different side). And while the class gets used extensively, the usage can
> > be fixed mechanically.
>
> I'd be happy to be proven wrong, but I'm not aware of any mechanical fixes.

 A clang plugin that rewrites all "getWidth()" to "(GetWidth() + 1)" (or the 
other way around).

> And I would not be surprised to find code that calls both getWidth() and
> GetWidth() on the same object.

 The way I see it, that doesn't matter. The class internally stores 4 
coordinates, the problem is just the interpretation of width/height. But 
that's purely a matter of definition, not of actual code. If the fix would be 
(let's say) defining that the class uses closed range and dumping getWidth(), 
then changing all getWidth() to (GetWidth() + 1) will keep the functionality 
exactly the same. It may lead to some code looking silly, but how should that 
break anything if the functionality doesn't change?

-- 
 Luboš Luňák
 l.lunak@xxxxxxxxxxxxx
_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux