return value of GetTextBreak()

Eike Rathke erack at redhat.com
Wed Mar 20 02:42:55 PDT 2013


Hi Christina,

On Tuesday, 2013-03-19 15:31:55 +0100, Christina Roßmanith wrote:

> GetTextBreak() returns STRING_LENGTH if text breaking isn't
> necessary (if I get it right). indexOf() returns -1 if searching
> failed. Would that be a choice for GetTextBreak() as well?

Sounds sensible.

> What would be a useful return value? sal_Int16, sal_Int32?

sal_Int32 then.

> In GenericSalLayout int is chosen as return type.

That can easily be changed to sal_Int32, consumers of that method should
get the type of the variable holding the return value adapted, if
needed, that should be all that's necessary.


> In OutputDevice xub_StrLen is chosen...

With a horrible cast from int to xub_StrLen ...

Which is a tad more difficult. Callers may again check for the special
STRING_... values or pass it to their callers or other consumers, care
has to be taken to catch all places where not only the type needs to be
changed to sal_Int32 but also the use adapted, maybe even in functions
that are called with these values and maybe even worse if those
functions expect a sal_Int32 but get called with the
xub_StrLen/sal_uInt16 value that so far was a value pointing behind the
end of a string but after the change would be negative instead.

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
New GnuPG key 0x65632D3A : 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Old GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD
Support the FSFE, care about Free Software! https://fsfe.org/support/?erack
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20130320/b0cc01db/attachment.pgp>


More information about the LibreOffice mailing list