[Libreoffice] [PATCH] Unix 64 bits property type / default value mismatch

Caolán McNamara caolanm at redhat.com
Mon Jan 17 04:46:57 PST 2011

On Sun, 2011-01-16 at 23:32 +0100, Lionel Elie Mamane wrote:
> Another of those places in code the that assumes C long == 32 bit
> integer. These four variables are used to give default values to
> properties WindowTop, WindowLeft, WindowWidth and WindowHeight:
>     nY = i_rTableWindowSettings.getOrDefault( "WindowTop", nY );
>     nX = i_rTableWindowSettings.getOrDefault( "WindowLeft", nX );
>     nWidth = i_rTableWindowSettings.getOrDefault( "WindowWidth", nWidth );
>     nHeight = i_rTableWindowSettings.getOrDefault( "WindowHeight", nHeight );
> But these properties are initialised with a "long":
>             aWindowData.put( "WindowTop", (*aIter)->GetPosition().Y() );
>             aWindowData.put( "WindowLeft", (*aIter)->GetPosition().X() );
>             aWindowData.put( "WindowWidth", (*aIter)->GetSize().Width() );
>             aWindowData.put( "WindowHeight", (*aIter)->GetSize().Height() );
> GetPosition() returns a Point, and that returns "long" for X and Y.
> GetSize() returns a Size, and that returns "long" for Width and Height.

Grepping for WindowTop in there, I see a LoadTableWindowData which
apparently also reads those settings from a file as well and set them.
Given that there its also sal_Int32 types, I suggest that maybe its
better to change the put to cast the input long type to a sal_Int32
instead ? 


More information about the LibreOffice mailing list