xub_StrLen and UNO

Stephan Bergmann sbergman at redhat.com
Mon Jul 29 23:55:24 PDT 2013

On 07/29/2013 11:43 PM, Norbert Thiebaud wrote:
> so... I starting to hit the uno wall trying to convert String to OUString...
> for instance: XTextComponent has a getMaxTextLen() api that return a
> sal_Int16... that was already borked since the underlying data was
> sal_uInt16... but going to sal_In32 would be a ABI break wouldn't it ?
> so how are we to proceed with these cases ?

OMG, who wrote such crap?

One solution for css.awt.XTextComponent.getMaxTextLen would be to throw 
some RuntimeException when it can't return the true length.

Another solution would be to change this (and likely some similar 
mistakes across css.awt, too?) incompatibly to use long instead of 
short.  For our typical C++ ABI, old clients of both get- and 
setMaxTextLen should likely continue to work just fine, and for Basic 
and Python anyway.  Only problem would be old Java clients, which would 
result in some IncompatibleWhatnotError.  (And, as a datapoint to 
extrapolate external usage from, I see at least two such Java calls to 
setMaxTextLen in the LO code base, 

So which one is better depends on whether there is any likelihood at all 
that such a max text length should ever be substantially large.


More information about the LibreOffice mailing list