[Libreoffice] Replace (Byte|Uni|Xub_)String with O(U)String: Fill() method is missing

Michael Meeks michael.meeks at suse.com
Mon Oct 31 03:46:25 PDT 2011


Hi Christina,

	Great to see you here again :-)

On Sat, 2011-10-29 at 22:18 +0200, Chr. Rossmanith wrote:
> the deprecated string classes have a Fill(n,c) method which fills a
> string with a single character c repeated n times. I found ~50
> occurrences of Fill() using "git grep", so it might be worth to add a
> Fill() method to OUString. Maybe the name of the new method could be a
> bit more verbose e.g. fillWithChar().

	As Stephan says, most of these seem to be reserving a string that is
about to be operated on, and should really be using a string-buffer of a
given size. Perhaps adding a method (as you suggest) to
rtl::OUStringBuffer would make sense though.

> Obviously I need some assistance...any hint is welcome.

	Sounds like you're on track to me :-) I'd suggest hacking out the Fill
method in UniString and incrementally fixing each of the sites that use
it to use an rtl::OUStringBuffer that is pre-allocated, and if it seems
that we do need to fill with ' ' or 0 (as a number of those seem to be),
then presumably it'd make sense to add the method there.

	Does that make sense ? thanks for cleaning this up :-)

	All the best,

		Michael.

-- 
michael.meeks at suse.com  <><, Pseudo Engineer, itinerant idiot



More information about the LibreOffice mailing list