xub_StrLen and >= 64k paragraphs

Caolán McNamara caolanm at redhat.com
Thu Nov 28 08:02:06 PST 2013


So now UniString is gone we have the chance to make use of OUString for
>= 64k paragraphs (#i17171#) but we basically have to decide what to do
with places that currently return STRING_LEN/STRING_MAXLEN in xub_Strlen
(unsigned short). Do we want to return -1 or SAL_MAX_INT32 as the
replacement. -1 is "nice" but there is so much code in existence that
expects the error/boundary condition return value to be > any valid
number that I reckon SAL_MAX_INT32 might be safer as the default.

For a concrete place see OutputDevice::GetTextBreak where STRING_LEN is
returned for the boundary case. See also grepping for STRING_LEN in sw
and think mass search/replace STRING_LEN SAL_MAX_INT32 :-)

For reference, I attach the trivial patches to remove the 16bit length
limits in writer that stop anything larger that 0xFFFF entering it which
are the final bits to be applied once everything else is done.

C.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Related-fdo-17171-stop-clipping-strings-to-STRING_LE.patch
Type: text/x-patch
Size: 4205 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20131128/baad6dae/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Related-fdo-17171-stop-clipping-strings-on-insert-re.patch
Type: text/x-patch
Size: 10205 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20131128/baad6dae/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Related-fdo-17171-stop-clipping-strings-to-STRING_LE.patch
Type: text/x-patch
Size: 1312 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20131128/baad6dae/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-stop-clipping-string-to-STRING_LEN-on-glossary-load.patch
Type: text/x-patch
Size: 1247 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20131128/baad6dae/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-stop-clipping-string-to-STRING_LEN-on-autofmt-load.patch
Type: text/x-patch
Size: 915 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20131128/baad6dae/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-longparas-drop-overflow-check.patch
Type: text/x-patch
Size: 1928 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20131128/baad6dae/attachment-0005.bin>


More information about the LibreOffice mailing list