diff options
author | Tobias Markmann <tm@ayena.de> | 2016-04-18 16:46:39 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2016-04-25 08:24:37 (GMT) |
commit | 511c43aec78279ecaa6008bd7f4f08159d3a5c00 (patch) | |
tree | c5cefba4e25917eb4eb51e67aec0a3b96b5318cc /3rdParty/LCov/genpng | |
parent | 45cca954063503d0a30410c626e9b2c29acdf7e9 (diff) | |
download | swift-511c43aec78279ecaa6008bd7f4f08159d3a5c00.zip swift-511c43aec78279ecaa6008bd7f4f08159d3a5c00.tar.bz2 |
Update 3rdParty lcov to version 1.12
The old version caused errors when running
BuildTools/Coverage/GenerateCoverageResults.sh.
Test-Information:
Successfully ran BuildTools/Coverage/GenerateCoverageResults.sh
on OS X 10.11.4.
Change-Id: If6f53a85e8051388c6d5b17d980f0c3fa8e65b6e
Diffstat (limited to '3rdParty/LCov/genpng')
-rwxr-xr-x | 3rdParty/LCov/genpng | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/3rdParty/LCov/genpng b/3rdParty/LCov/genpng index 7fe9dfe..55e013e 100755 --- a/3rdParty/LCov/genpng +++ b/3rdParty/LCov/genpng @@ -22,7 +22,7 @@ # This script creates an overview PNG image of a source code file by # representing each source code character by a single pixel. # -# Note that the PERL module GD.pm is required for this script to work. +# Note that the Perl module GD.pm is required for this script to work. # It may be obtained from http://www.cpan.org # # History: @@ -32,10 +32,12 @@ use strict; use File::Basename; use Getopt::Long; +use Cwd qw/abs_path/; # Constants -our $lcov_version = 'LCOV version 1.9'; +our $tool_dir = abs_path(dirname($0)); +our $lcov_version = "LCOV version 1.12"; our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php"; our $tool_name = basename($0); @@ -53,9 +55,6 @@ sub genpng_die_handler($); # Code entry point # -# Prettify version string -$lcov_version =~ s/\$\s*Revision\s*:?\s*(\S+)\s*\$/$1/; - # Check whether required module GD.pm is installed if (check_and_load_module("GD")) { @@ -182,7 +181,7 @@ sub genpng_process_file($$$$) local *HANDLE; my @source; - open(HANDLE, "<$filename") + open(HANDLE, "<", $filename) or die("ERROR: cannot open $filename!\n"); # Check for .gcov filename extension @@ -238,7 +237,7 @@ sub gen_png($$$@) my $overview_width = shift(@_); # Imagewidth for image my $tab_size = shift(@_); # Replacement string for tab signs my @source = @_; # Source code as passed via argument 2 - my $height = scalar(@source); # Height as define by source size + my $height; # Height as define by source size my $overview; # Source code overview image data my $col_plain_back; # Color for overview background my $col_plain_text; # Color for uninstrumented text @@ -261,6 +260,11 @@ sub gen_png($$$@) my $replacement; # Replacement string for tabulator chars local *PNG_HANDLE; # Handle for output PNG file + # Handle empty source files + if (!@source) { + @source = ( "" ); + } + $height = scalar(@source); # Create image $overview = new GD::Image($overview_width, $height) or die("ERROR: cannot allocate overview image!\n"); @@ -362,7 +366,7 @@ sub gen_png($$$@) } # Write PNG file - open (PNG_HANDLE, ">$filename") + open (PNG_HANDLE, ">", $filename) or die("ERROR: cannot write png file $filename!\n"); binmode(*PNG_HANDLE); print(PNG_HANDLE $overview->png()); |