len() string function in calc - basic/64k limit code pointers
Michael Meeks
michael.meeks at suse.com
Thu Nov 1 03:40:35 PDT 2012
Hi there,
On Wed, 2012-10-31 at 08:16 +0100, post wrote:
> I have a special request regarding spreadsheet functions.
Ah - so, this list is really for reviewing patches, discussing quirks
of the code, and helping people develop fixes.
> When importing a string larger than 64k the len() function reports zero
> length.
Right - so there are tons of 64bit string limits around the code -
we're slowly removing them.
> Can the next version of Libreoffice handle strings larger than 64K in
> calc? Or do the cell in calc have a string limit of 64k built in?
The features of the next version are limited only by what people are
prepared to hack on :-) would you like some code pointers to get
involved in fixing this ? Encouragingly the ScStringCell has an
rtl::OUString embedded in it, so (quite possibly) there is just some
binding / truncation problem inside basic itself.
If you see basic/source/runtime/methods.cxx and look for:
RTLFUNC(Len)
{
(void)pBasic;
(void)bWrite;
if ( rPar.Count() != 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
{
const String& rStr = rPar.Get(1)->GetString();
rPar.Get(0)->PutLong( (sal_Int32)rStr.Len() );
}
}
You can see that the problematic 'String' type is used (which truncates
to 64k lengths). I suspect you'd want to poke at:
basic/inc/basic/sbxvar.hxx
particularly the SbxValue and it's implementation inside:
basic/source/sbx/sbxvalue.cxx
To use rtl::OUString instead of String - that shouldn't be too hard,
it's easy to convert between the two for compatibility as you push the
perimiter of that wider.
Patches most welcome,
HTH !
Michael.
--
michael.meeks at suse.com <><, Pseudo Engineer, itinerant idiot
More information about the LibreOffice
mailing list