File indexing completed on 2024-04-14 05:35:08

0001 #!/usr/bin/perl
0002 
0003 # Laurent Montel <montel@kde.org> 2005
0004 # Thanks to Rafael Garcia-Suarez and Thierry Vignaud for his help
0005 # This script try to fix error when we didn't add setVersion after a QDataStream
0006 
0007 use File::Basename;
0008 use lib dirname( $0 );
0009 use functionUtilkde;
0010 
0011 foreach my $file (@ARGV) {
0012     local *F;
0013     open F, "+<", $file or do { print STDOUT "open($file) failled : \"$!\"\n"; next };
0014     my $str = join '', <F>;
0015     $str =~ s/(\s*)(QDataStream (\w*)\s*\(\s*\&\w*\s*,\s*[a-zA-Z0-9_:]+\s*\);\n)(?!\s*\3\.setVersion)/$1$2$1$3.setVersion(QDataStream::Qt_3_1);\n/sg;
0016     seek F, 0, 0;
0017     print F $str;
0018     truncate F, tell(F);
0019     close F;
0020 }
0021 
0022 functionUtilkde::diffFile( @ARGV );
0023