* src/tools/update-copyright-year: Fix single-year entry handling.

The fix from 2021-01-17 didn't cover the case where the year to be
updated is identical to the current year.
This commit is contained in:
Werner Lemberg 2021-02-13 09:21:37 +01:00
parent d51452e3ec
commit 7849316ccf
2 changed files with 38 additions and 12 deletions

View File

@ -1,3 +1,10 @@
2021-02-13 Werner Lemberg <wl@gnu.org>
* src/tools/update-copyright-year: Fix single-year entry handling.
The fix from 2021-01-17 didn't cover the case where the year to be
updated is identical to the current year.
2021-02-13 Werner Lemberg <wl@gnu.org> 2021-02-13 Werner Lemberg <wl@gnu.org>
Add new function `FT_Get_Transform`. Add new function `FT_Get_Transform`.

View File

@ -106,19 +106,38 @@ while (<>)
(?<end>.*) (?<end>.*)
} }
{ {
# Fill line to the same length (if appropriate); we insert three if ($+{first} < $year)
# spaces, the string `(C)', a `-', and the current year. {
my $space = length($+{space1}) # Fill line to the same length (if appropriate); we insert three
+ length($+{space2}) # spaces, the string `(C)', a `-', and the current year.
+ length($+{space3}) my $space = length($+{space1})
- (length($year) + length("(C)") + 3 + 1); + length($+{space2})
+ length($+{space3})
- (length($year) + length("(C)") + 3 + 1);
print "$+{begin}"; print "$+{begin}";
print "Copyright\ (C)\ $+{first}-$year\ by"; print "Copyright\ (C)\ $+{first}-$year\ by";
# If $space is negative this inserts nothing. # If $space is negative this inserts nothing.
print ' ' x $space if length($+{end}); print ' ' x $space if length($+{end});
print "$+{end}\n"; print "$+{end}\n";
$replaced = 1; $replaced = 1;
}
else
{
# Fill line to the same length (if appropriate); we insert three
# spaces and the string `(C)'.
my $space = length($+{space1})
+ length($+{space2})
+ length($+{space3})
- (length("(C)") + 3);
print "$+{begin}";
print "Copyright\ (C)\ $+{first}\ by";
# If $space is negative this inserts nothing.
print ' ' x $space if length($+{end});
print "$+{end}\n";
$replaced = 1;
}
}ex }ex
|| ||
# Otherwise print line unaltered. # Otherwise print line unaltered.