| Filename | /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/scppatchsoname.pm |
| Statements | Executed 65405 statements in 126ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 2 | 2 | 1 | 110ms | 735ms | installer::scppatchsoname::resolving_patchsoname_flag |
| 15904 | 2 | 1 | 7.19ms | 7.19ms | installer::scppatchsoname::CORE:match (opcode) |
| 1 | 1 | 1 | 5.40ms | 6.10ms | installer::scppatchsoname::BEGIN@33 |
| 9 | 1 | 1 | 2.95ms | 2.95ms | installer::scppatchsoname::CORE:subst (opcode) |
| 9 | 1 | 1 | 1.25ms | 1.25ms | installer::scppatchsoname::change_length_of_string |
| 9 | 1 | 1 | 1.15ms | 19.9ms | installer::scppatchsoname::replace_productname_in_file |
| 9 | 1 | 1 | 387µs | 387µs | installer::scppatchsoname::convert_to_unicode |
| 1 | 1 | 1 | 348µs | 352µs | installer::scppatchsoname::BEGIN@30 |
| 9 | 1 | 1 | 47µs | 47µs | installer::scppatchsoname::CORE:regcomp (opcode) |
| 1 | 1 | 1 | 17µs | 20µs | installer::scppatchsoname::BEGIN@34 |
| 1 | 1 | 1 | 15µs | 55µs | installer::scppatchsoname::BEGIN@32 |
| 1 | 1 | 1 | 14µs | 16µs | installer::scppatchsoname::BEGIN@31 |
| 0 | 0 | 0 | 0s | 0s | installer::scppatchsoname::change_length_of_string_with_letter |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | #************************************************************************* | ||||
| 2 | # | ||||
| 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||||
| 4 | # | ||||
| 5 | # Copyright 2000, 2010 Oracle and/or its affiliates. | ||||
| 6 | # | ||||
| 7 | # OpenOffice.org - a multi-platform office productivity suite | ||||
| 8 | # | ||||
| 9 | # This file is part of OpenOffice.org. | ||||
| 10 | # | ||||
| 11 | # OpenOffice.org is free software: you can redistribute it and/or modify | ||||
| 12 | # it under the terms of the GNU Lesser General Public License version 3 | ||||
| 13 | # only, as published by the Free Software Foundation. | ||||
| 14 | # | ||||
| 15 | # OpenOffice.org is distributed in the hope that it will be useful, | ||||
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| 18 | # GNU Lesser General Public License version 3 for more details | ||||
| 19 | # (a copy is included in the LICENSE file that accompanied this code). | ||||
| 20 | # | ||||
| 21 | # You should have received a copy of the GNU Lesser General Public License | ||||
| 22 | # version 3 along with OpenOffice.org. If not, see | ||||
| 23 | # <http://www.openoffice.org/license.html> | ||||
| 24 | # for a copy of the LGPLv3 License. | ||||
| 25 | # | ||||
| 26 | #************************************************************************* | ||||
| 27 | |||||
| 28 | package installer::scppatchsoname; | ||||
| 29 | |||||
| 30 | 2 | 66µs | 2 | 355µs | # spent 352µs (348+4) within installer::scppatchsoname::BEGIN@30 which was called:
# once (348µs+4µs) by installer::BEGIN@53 at line 30 # spent 352µs making 1 call to installer::scppatchsoname::BEGIN@30
# spent 4µs making 1 call to UNIVERSAL::import |
| 31 | 2 | 53µs | 2 | 18µs | # spent 16µs (14+2) within installer::scppatchsoname::BEGIN@31 which was called:
# once (14µs+2µs) by installer::BEGIN@53 at line 31 # spent 16µs making 1 call to installer::scppatchsoname::BEGIN@31
# spent 2µs making 1 call to UNIVERSAL::import |
| 32 | 2 | 54µs | 2 | 94µs | # spent 55µs (15+39) within installer::scppatchsoname::BEGIN@32 which was called:
# once (15µs+39µs) by installer::BEGIN@53 at line 32 # spent 55µs making 1 call to installer::scppatchsoname::BEGIN@32
# spent 39µs making 1 call to Exporter::import |
| 33 | 2 | 1.14ms | 2 | 6.14ms | # spent 6.10ms (5.40+699µs) within installer::scppatchsoname::BEGIN@33 which was called:
# once (5.40ms+699µs) by installer::BEGIN@53 at line 33 # spent 6.10ms making 1 call to installer::scppatchsoname::BEGIN@33
# spent 39µs making 1 call to Exporter::import |
| 34 | 2 | 1.46ms | 2 | 22µs | # spent 20µs (17+3) within installer::scppatchsoname::BEGIN@34 which was called:
# once (17µs+3µs) by installer::BEGIN@53 at line 34 # spent 20µs making 1 call to installer::scppatchsoname::BEGIN@34
# spent 3µs making 1 call to UNIVERSAL::import |
| 35 | |||||
| 36 | ######################################################################################## | ||||
| 37 | # The length of the new string must be identical with the length of the old string | ||||
| 38 | ######################################################################################## | ||||
| 39 | |||||
| 40 | sub change_length_of_string | ||||
| 41 | # spent 1.25ms within installer::scppatchsoname::change_length_of_string which was called 9 times, avg 139µs/call:
# 9 times (1.25ms+0s) by installer::scppatchsoname::replace_productname_in_file at line 105, avg 139µs/call | ||||
| 42 | 1150 | 1.27ms | my ($newstringref, $oldstring) = @_; | ||
| 43 | |||||
| 44 | while ( length($$newstringref) < length($oldstring) ) | ||||
| 45 | { | ||||
| 46 | $$newstringref = $$newstringref . chr(0); | ||||
| 47 | } | ||||
| 48 | } | ||||
| 49 | |||||
| 50 | ######################################################################################## | ||||
| 51 | # The length of the new string must be identical with the length of the old string | ||||
| 52 | ######################################################################################## | ||||
| 53 | |||||
| 54 | sub change_length_of_string_with_letter | ||||
| 55 | { | ||||
| 56 | my ($newstringref, $oldstring, $onestring) = @_; | ||||
| 57 | |||||
| 58 | while ( length($$newstringref) < length($oldstring) ) | ||||
| 59 | { | ||||
| 60 | $$newstringref = $$newstringref . $onestring; | ||||
| 61 | } | ||||
| 62 | } | ||||
| 63 | |||||
| 64 | ######################################################################################## | ||||
| 65 | # Converting a string to a unicode string | ||||
| 66 | ######################################################################################## | ||||
| 67 | |||||
| 68 | sub convert_to_unicode | ||||
| 69 | # spent 387µs within installer::scppatchsoname::convert_to_unicode which was called 9 times, avg 43µs/call:
# 9 times (387µs+0s) by installer::scppatchsoname::replace_productname_in_file at line 103, avg 43µs/call | ||||
| 70 | 353 | 405µs | my ($string) = @_; | ||
| 71 | |||||
| 72 | my $unicodestring = ""; | ||||
| 73 | |||||
| 74 | my $stringlength = length($string); | ||||
| 75 | |||||
| 76 | for ( my $i = 0; $i < $stringlength; $i++ ) | ||||
| 77 | { | ||||
| 78 | $unicodestring = $unicodestring . substr($string, $i, 1); | ||||
| 79 | $unicodestring = $unicodestring . chr(0); | ||||
| 80 | } | ||||
| 81 | |||||
| 82 | return $unicodestring; | ||||
| 83 | } | ||||
| 84 | |||||
| 85 | ######################################################################################## | ||||
| 86 | # Replacing the so name in all files with flag PATCH_SO_NAME | ||||
| 87 | ######################################################################################## | ||||
| 88 | |||||
| 89 | sub replace_productname_in_file | ||||
| 90 | # spent 19.9ms (1.15+18.8) within installer::scppatchsoname::replace_productname_in_file which was called 9 times, avg 2.21ms/call:
# 9 times (1.15ms+18.8ms) by installer::scppatchsoname::resolving_patchsoname_flag at line 183, avg 2.21ms/call | ||||
| 91 | 135 | 4.09ms | my ($sourcepath, $destpath, $variableshashref, $onefilehash, $styles) = @_; | ||
| 92 | |||||
| 93 | 9 | 5.03ms | my $onefile = installer::files::read_binary_file($sourcepath); # spent 5.03ms making 9 calls to installer::files::read_binary_file, avg 558µs/call | ||
| 94 | |||||
| 95 | # searching for "x" | ||||
| 96 | |||||
| 97 | my $onestring = "x" . chr(0); | ||||
| 98 | my $replacestring = ""; | ||||
| 99 | for ( my $i = 1; $i <= 80; $i++ ) { $replacestring .= $onestring; } | ||||
| 100 | |||||
| 101 | my $productname = $variableshashref->{'PRODUCTNAME'} . " " . $variableshashref->{'PRODUCTVERSION'}; | ||||
| 102 | if ( exists($onefilehash->{'FileDescription'}) ) { $productname = $onefilehash->{'FileDescription'}; } | ||||
| 103 | 9 | 387µs | my $unicode_productname = convert_to_unicode($productname); # spent 387µs making 9 calls to installer::scppatchsoname::convert_to_unicode, avg 43µs/call | ||
| 104 | |||||
| 105 | 9 | 1.25ms | change_length_of_string(\$unicode_productname, $replacestring); # spent 1.25ms making 9 calls to installer::scppatchsoname::change_length_of_string, avg 139µs/call | ||
| 106 | |||||
| 107 | 18 | 3.00ms | my $found1 = $onefile =~ s/$replacestring/$unicode_productname/sg; # spent 2.95ms making 9 calls to installer::scppatchsoname::CORE:subst, avg 328µs/call
# spent 47µs making 9 calls to installer::scppatchsoname::CORE:regcomp, avg 5µs/call | ||
| 108 | |||||
| 109 | my $found2 = 0; | ||||
| 110 | |||||
| 111 | 9 | 15µs | if ( $styles =~ /\bPATCH_SO_NAME_Z\b/ ) # spent 15µs making 9 calls to installer::scppatchsoname::CORE:match, avg 2µs/call | ||
| 112 | { | ||||
| 113 | # searching for "z" | ||||
| 114 | |||||
| 115 | $onestring = "z" . chr(0); | ||||
| 116 | $replacestring = ""; | ||||
| 117 | for ( my $i = 1; $i <= 80; $i++ ) { $replacestring .= $onestring; } | ||||
| 118 | |||||
| 119 | my $productname2 = $variableshashref->{'PRODUCTNAME'} . " " . $variableshashref->{'PRODUCTVERSION'}; | ||||
| 120 | if ( exists($onefilehash->{'FileDescriptionZ'}) ) { $productname2 = $onefilehash->{'FileDescriptionZ'}; } | ||||
| 121 | my $unicode_productname2 = convert_to_unicode($productname2); | ||||
| 122 | |||||
| 123 | change_length_of_string_with_letter(\$unicode_productname2, $replacestring, $onestring); | ||||
| 124 | |||||
| 125 | $found2 = $onefile =~ s/$replacestring/$unicode_productname2/sg; | ||||
| 126 | } | ||||
| 127 | |||||
| 128 | 9 | 9.09ms | installer::files::save_binary_file($onefile, $destpath); # spent 9.09ms making 9 calls to installer::files::save_binary_file, avg 1.01ms/call | ||
| 129 | |||||
| 130 | my $found = $found1 + $found2; | ||||
| 131 | |||||
| 132 | return $found; | ||||
| 133 | } | ||||
| 134 | |||||
| 135 | ######################################################### | ||||
| 136 | # Analyzing files with flag PATCH_SO_NAME | ||||
| 137 | ######################################################### | ||||
| 138 | |||||
| 139 | sub resolving_patchsoname_flag | ||||
| 140 | # spent 735ms (110+625) within installer::scppatchsoname::resolving_patchsoname_flag which was called 2 times, avg 367ms/call:
# once (110ms+333ms) by installer::run at line 723 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm
# once (38µs+292ms) by installer::run at line 764 of /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer.pm | ||||
| 141 | 63756 | 117ms | my ($filesarrayref, $variableshashref, $item, $languagestringref) = @_; | ||
| 142 | |||||
| 143 | my $diritem = lc($item); | ||||
| 144 | |||||
| 145 | 2 | 574ms | my $replacedirbase = installer::systemactions::create_directories("patchsoname_$diritem", $languagestringref); # spent 574ms making 2 calls to installer::systemactions::create_directories, avg 287ms/call | ||
| 146 | |||||
| 147 | 2 | 320µs | installer::logger::include_header_into_logfile("$item with flag PATCH_SO_NAME:"); # spent 320µs making 2 calls to installer::logger::include_header_into_logfile, avg 160µs/call | ||
| 148 | |||||
| 149 | for ( my $i = 0; $i <= $#{$filesarrayref}; $i++ ) | ||||
| 150 | { | ||||
| 151 | my $onefile = ${$filesarrayref}[$i]; | ||||
| 152 | my $styles = ""; | ||||
| 153 | |||||
| 154 | if ( $onefile->{'Styles'} ) { $styles = $onefile->{'Styles'}; } | ||||
| 155 | |||||
| 156 | 15895 | 7.18ms | if ( $styles =~ /\bPATCH_SO_NAME\b/ ) # spent 7.18ms making 15895 calls to installer::scppatchsoname::CORE:match, avg 451ns/call | ||
| 157 | { | ||||
| 158 | # Language specific subdirectory | ||||
| 159 | |||||
| 160 | my $onelanguage = $onefile->{'specificlanguage'}; | ||||
| 161 | my $filedescription = ""; | ||||
| 162 | |||||
| 163 | if ($onelanguage eq "") | ||||
| 164 | { | ||||
| 165 | $onelanguage = "00"; # files without language into directory "00" | ||||
| 166 | } | ||||
| 167 | |||||
| 168 | my $replacedir = $replacedirbase . $installer::globals::separator . $onelanguage . $installer::globals::separator; | ||||
| 169 | 9 | 2.88ms | installer::systemactions::create_directory($replacedir); # creating language specific directories # spent 2.88ms making 9 calls to installer::systemactions::create_directory, avg 321µs/call | ||
| 170 | |||||
| 171 | # copy files and edit them with the variables defined in the zip.lst | ||||
| 172 | |||||
| 173 | my $onefilename = $onefile->{'Name'}; | ||||
| 174 | my $sourcepath = $onefile->{'sourcepath'}; | ||||
| 175 | my $destinationpath = $replacedir . $onefilename; | ||||
| 176 | my $movepath = $destinationpath . ".orig"; | ||||
| 177 | |||||
| 178 | 9 | 20.8ms | my $copysuccess = installer::systemactions::copy_one_file($sourcepath, $movepath); # spent 20.8ms making 9 calls to installer::systemactions::copy_one_file, avg 2.31ms/call | ||
| 179 | |||||
| 180 | if ( $copysuccess ) | ||||
| 181 | { | ||||
| 182 | # Now the file can be patch (binary!) | ||||
| 183 | 9 | 19.9ms | my $found = replace_productname_in_file($movepath, $destinationpath, $variableshashref, $onefile, $styles); # spent 19.9ms making 9 calls to installer::scppatchsoname::replace_productname_in_file, avg 2.21ms/call | ||
| 184 | |||||
| 185 | if ($found == 0) | ||||
| 186 | { | ||||
| 187 | my $infoline = "Did not patch the file $destinationpath\n"; | ||||
| 188 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 189 | } | ||||
| 190 | else | ||||
| 191 | { | ||||
| 192 | my $infoline = "Successfully patched $destinationpath, Count: $found\n"; | ||||
| 193 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 194 | } | ||||
| 195 | } | ||||
| 196 | |||||
| 197 | # Saving the original source, where the file was found | ||||
| 198 | $onefile->{'originalsourcepath'} = $onefile->{'sourcepath'}; | ||||
| 199 | |||||
| 200 | # Saving the original source, where the file was found | ||||
| 201 | $onefile->{'originalsourcepath'} = $onefile->{'sourcepath'}; | ||||
| 202 | |||||
| 203 | # Writing the new sourcepath into the hashref, even if it was no copied | ||||
| 204 | |||||
| 205 | $onefile->{'sourcepath'} = $destinationpath; | ||||
| 206 | } | ||||
| 207 | } | ||||
| 208 | |||||
| 209 | my $infoline = "\n"; | ||||
| 210 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 211 | } | ||||
| 212 | |||||
| 213 | 1 | 7µs | 1; | ||
# spent 7.19ms within installer::scppatchsoname::CORE:match which was called 15904 times, avg 452ns/call:
# 15895 times (7.18ms+0s) by installer::scppatchsoname::resolving_patchsoname_flag at line 156, avg 451ns/call
# 9 times (15µs+0s) by installer::scppatchsoname::replace_productname_in_file at line 111, avg 2µs/call | |||||
# spent 47µs within installer::scppatchsoname::CORE:regcomp which was called 9 times, avg 5µs/call:
# 9 times (47µs+0s) by installer::scppatchsoname::replace_productname_in_file at line 107, avg 5µs/call | |||||
# spent 2.95ms within installer::scppatchsoname::CORE:subst which was called 9 times, avg 328µs/call:
# 9 times (2.95ms+0s) by installer::scppatchsoname::replace_productname_in_file at line 107, avg 328µs/call |