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

Stephan Bergmann sbergman at redhat.com
Wed Mar 20 04:09:07 PDT 2013


On 03/19/2013 07:38 PM, Thomas Arnhold wrote:
> #!/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;

BTW, did this work by luck, not causing any damage in cases like

   OUString(RTL_CONSTASCII_USTRINGPARAM("\")"))

Stephan

>
> 	# 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