freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 7849316 54/68: * src/tools/update-copyright-year: Fix


From: Werner Lemberg
Subject: [freetype2] master 7849316 54/68: * src/tools/update-copyright-year: Fix single-year entry handling.
Date: Fri, 5 Mar 2021 09:29:43 -0500 (EST)

branch: master
commit 7849316ccfc794026176d462b9008e7f4c4240fe
Author: Werner Lemberg <wl@gnu.org>
Commit: 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.
---
 ChangeLog                       |  7 +++++++
 src/tools/update-copyright-year | 43 +++++++++++++++++++++++++++++------------
 2 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9131a73..1c443b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 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>
+
        Add new function `FT_Get_Transform`.
 
        See
diff --git a/src/tools/update-copyright-year b/src/tools/update-copyright-year
index fdd270a..69d63b6 100755
--- a/src/tools/update-copyright-year
+++ b/src/tools/update-copyright-year
@@ -106,19 +106,38 @@ while (<>)
         (?<end>.*)
       }
       {
-        # Fill line to the same length (if appropriate); we insert three
-        # spaces, the string `(C)', a `-', and the current year.
-        my $space = length($+{space1})
-                    + length($+{space2})
-                    + length($+{space3})
-                    - (length($year) + length("(C)") + 3 + 1);
+        if ($+{first} < $year)
+        {
+          # Fill line to the same length (if appropriate); we insert three
+          # spaces, the string `(C)', a `-', and the current year.
+          my $space = length($+{space1})
+                      + length($+{space2})
+                      + length($+{space3})
+                      - (length($year) + length("(C)") + 3 + 1);
 
-        print "$+{begin}";
-        print "Copyright\ (C)\ $+{first}-$year\ by";
-        # If $space is negative this inserts nothing.
-        print ' ' x $space if length($+{end});
-        print "$+{end}\n";
-        $replaced = 1;
+          print "$+{begin}";
+          print "Copyright\ (C)\ $+{first}-$year\ by";
+          # If $space is negative this inserts nothing.
+          print ' ' x $space if length($+{end});
+          print "$+{end}\n";
+          $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
     ||
     # Otherwise print line unaltered.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]