make OUString::copy() clip (was: [PUSHED 3-6] resolved fdo#53012 crash in CSV fixed width import)

Eike Rathke erack at redhat.com
Wed Aug 1 10:05:35 PDT 2012


Hi Stephan,

On Wednesday, 2012-08-01 18:17:12 +0200, Stephan Bergmann wrote:

> make rtl::OUString::copy(beginIndex, count) clip to [0..length)?
> yeah, why not  (then again, -1's sentinel nature, cf. indexOf, might
> mean that silent clipping of beginIndex=-1 to beginIndex=0 is
> unfortunate)

We may step into more of these traps in transitions from String to
OUString, so clipping IMHO is good.

I think beginIndex<0 or count<=0 should always return an empty string
and output a SAL_WARN, maybe also SAL_WARN if clipping occurred as that
may indicate a logic error.

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120801/57f8b383/attachment.pgp>


More information about the LibreOffice mailing list