On 20.03.2013 12:09, Stephan Bergmann wrote:
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("\")"))
More or less, because I found no occurrences of that (the two closing
brackets after " are limiting it. It would look quite behind \" for two
closing brackets.
(head at fe8eba5faa59ddf9ee82f3eb009daac72a0ec846)
git grep -w RTL_CONSTASCII_USTRINGPARAM -- '*.[ch]xx' | grep '\\\"\s*)\s*)'
fpicker/source/win32/filepicker/shared.hxx:const ::rtl::OUString
BACKSLASH(RTL_CONSTASCII_USTRINGPARAM( "\\" ));
fpicker/source/win32/folderpicker/WinFOPImpl.cxx:const OUString
BACKSLASH(RTL_CONSTASCII_USTRINGPARAM( "\\" ));
But those are safe.
Indeed this regex isn't safe for other conversions of this macro, where
this case may occur. There [^")\\]*? should be used to omit those.
Thomas
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.