[SCRIPT] automated removal of RTL_CONSTASCII_USTRINGPARAM for quoted ...

Thomas Arnhold thomas-libo at arnhold.org
Tue Mar 19 11:38:59 PDT 2013


Hi,

if someone has problems while rebasing due to this huge change, please 
use the attached script to do my change on your branch.

Thomas

On 19.03.2013 10:00, Thomas Arnhold (via Code Review) wrote:
> Hi,
>
> Thank you for your patch!  It has been merged to LibreOffice.
>
> If you are interested in details, please visit
>
>      https://gerrit.libreoffice.org/2832
>
> Approvals:
>    Thomas Arnhold: Verified; Looks good to me, approved
>
>

-------------- next part --------------
#!/usr/bin/perl

# git grep 'RTL_CONSTASCII_USTRINGPARAM' -- '*.[hc]xx' | cut -d':' -f1 | sort -u | xargs perl constascii.pl

foreach (@ARGV) {
	my $file = $_;
	my $data = "";
	my $fh;

	open($fh, "<$file");
	while (<$fh>) { $data .= $_; }
	close($fh);

	# replace OUString(RTL_...)
	$data =~ s/OUString\s*\(\s*RTL_CONSTASCII_USTRINGPARAM\s*\((\s*"[^")]*?"\s*)\)\s*\)/OUString\($1\)/gms;

	# replace OUString sBuff(RTL...)
	$data =~ s/(OUString\s+[a-zA-Z_][A-Za-z0-9_]*\s*)\(\s*RTL_CONSTASCII_USTRINGPARAM\s*\((\s*"[^")]*?"\s*)\)\s*\)/$1\($2\)/gms;

	# write file
	open($fh, ">$file");
	print $fh $data;
	close($fh);
}



More information about the LibreOffice mailing list