[strip-nondeterminism] 01/01: Add function prototypes (Closes: #5)
Chris Lamb
chris at chris-lamb.co.uk
Thu May 11 10:12:15 UTC 2017
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository strip-nondeterminism.
commit 6311ddc4b398582bb4437be7b84e580a59d2274d
Author: Bernhard M. Wiedemann <bwiedemann at suse.de>
Date: Thu May 11 03:24:55 2017 +0000
Add function prototypes (Closes: #5)
This is so that Perl can check if it is called correctly at compile time
Signed-off-by: Chris Lamb <lamby at debian.org>
---
lib/File/StripNondeterminism.pm | 8 ++++----
lib/File/StripNondeterminism/Common.pm | 2 +-
lib/File/StripNondeterminism/handlers/gettext.pm | 2 +-
lib/File/StripNondeterminism/handlers/jar.pm | 6 +++---
lib/File/StripNondeterminism/handlers/javadoc.pm | 2 +-
lib/File/StripNondeterminism/handlers/javaproperties.pm | 4 ++--
lib/File/StripNondeterminism/handlers/pearregistry.pm | 2 +-
lib/File/StripNondeterminism/handlers/png.pm | 8 ++++----
lib/File/StripNondeterminism/handlers/zip.pm | 10 +++++-----
9 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/lib/File/StripNondeterminism.pm b/lib/File/StripNondeterminism.pm
index 887a7aa..8fce8ac 100644
--- a/lib/File/StripNondeterminism.pm
+++ b/lib/File/StripNondeterminism.pm
@@ -36,12 +36,12 @@ our($VERSION, $canonical_time, $clamp_time);
$VERSION = '0.033'; # 0.033
-sub init {
+sub init() {
$ENV{'TZ'} = 'UTC';
tzset();
}
-sub _get_file_type {
+sub _get_file_type($) {
my $file=shift;
open(FILE, '-|') # handle all filenames safely
|| exec('file', $file)
@@ -51,7 +51,7 @@ sub _get_file_type {
return $type;
}
-sub get_normalizer_for_file {
+sub get_normalizer_for_file($) {
$_ = shift;
return undef if -d $_; # Skip directories
@@ -118,7 +118,7 @@ our %typemap = (
javaproperties => \&File::StripNondeterminism::handlers::javaproperties::normalize,
zip => \&File::StripNondeterminism::handlers::zip::normalize,
);
-sub get_normalizer_by_name {
+sub get_normalizer_by_name($) {
$_ = shift;
return $typemap{$_};
}
diff --git a/lib/File/StripNondeterminism/Common.pm b/lib/File/StripNondeterminism/Common.pm
index 91397be..87dd49f 100644
--- a/lib/File/StripNondeterminism/Common.pm
+++ b/lib/File/StripNondeterminism/Common.pm
@@ -35,7 +35,7 @@ use File::Copy;
# 2. This function simulates file editing of "$to_path".
# 3. After this function, "$to_path" would be a file associated with
# a copied "data" from "from_path" and a "inode" from "$to_path".
-sub copy_data {
+sub copy_data($$) {
my $from_path = shift;
my $to_path = shift;
diff --git a/lib/File/StripNondeterminism/handlers/gettext.pm b/lib/File/StripNondeterminism/handlers/gettext.pm
index b1fab0a..1d9b2b9 100644
--- a/lib/File/StripNondeterminism/handlers/gettext.pm
+++ b/lib/File/StripNondeterminism/handlers/gettext.pm
@@ -24,7 +24,7 @@ use POSIX qw(strftime);
use strict;
use warnings;
-sub read_file {
+sub read_file($) {
my $filename = shift;
local $/ = undef;
diff --git a/lib/File/StripNondeterminism/handlers/jar.pm b/lib/File/StripNondeterminism/handlers/jar.pm
index 710693c..28807fe 100644
--- a/lib/File/StripNondeterminism/handlers/jar.pm
+++ b/lib/File/StripNondeterminism/handlers/jar.pm
@@ -40,7 +40,7 @@ sub _jar_filename_cmp($$) {
return $a cmp $b;
}
-sub _jar_normalize_manifest {
+sub _jar_normalize_manifest($) {
my ($filename) = @_;
open(my $fh, '<', $filename)
@@ -67,7 +67,7 @@ sub _jar_normalize_manifest {
return $modified;
}
-sub _jar_normalize_member {
+sub _jar_normalize_member($) {
my ($member) = @_; # $member is a ref to an Archive::Zip::Member
return if $member->isDirectory();
@@ -98,7 +98,7 @@ sub _jar_normalize_member {
return 1;
}
-sub _jar_archive_filter {
+sub _jar_archive_filter($) {
my ($zip) = @_;
# Don't normalize signed JARs, since our modifications will break the
diff --git a/lib/File/StripNondeterminism/handlers/javadoc.pm b/lib/File/StripNondeterminism/handlers/javadoc.pm
index a42ad58..4f789f5 100644
--- a/lib/File/StripNondeterminism/handlers/javadoc.pm
+++ b/lib/File/StripNondeterminism/handlers/javadoc.pm
@@ -27,7 +27,7 @@ use File::Temp;
use File::Basename;
use POSIX qw(strftime);
-sub is_javadoc_file {
+sub is_javadoc_file($) {
my ($filename) = @_;
# If this is a javadoc file, '<!-- Generated by javadoc' should appear
diff --git a/lib/File/StripNondeterminism/handlers/javaproperties.pm b/lib/File/StripNondeterminism/handlers/javaproperties.pm
index 46702a0..f193798 100644
--- a/lib/File/StripNondeterminism/handlers/javaproperties.pm
+++ b/lib/File/StripNondeterminism/handlers/javaproperties.pm
@@ -26,13 +26,13 @@ use File::StripNondeterminism::Common qw(copy_data);
use File::Temp;
use File::Basename;
-sub is_java_properties_header {
+sub is_java_properties_header($) {
my ($contents) = @_;
return $contents
=~ /#Generated by( Apache)? Maven|#Build Number for ANT|#Generated by org.apache.felix.bundleplugin|#POM properties|#.* runtime configuration/;
}
-sub is_java_properties_file {
+sub is_java_properties_file($) {
my ($filename) = @_;
# If this is a java properties file, '#Generated by Maven', '#Build
diff --git a/lib/File/StripNondeterminism/handlers/pearregistry.pm b/lib/File/StripNondeterminism/handlers/pearregistry.pm
index 4dfa721..c5a0363 100644
--- a/lib/File/StripNondeterminism/handlers/pearregistry.pm
+++ b/lib/File/StripNondeterminism/handlers/pearregistry.pm
@@ -25,7 +25,7 @@ use File::StripNondeterminism::Common qw(copy_data);
use File::Temp;
use File::Basename;
-sub is_registry_file {
+sub is_registry_file($) {
my ($filename) = @_;
# Registry files will always start with "a:"
diff --git a/lib/File/StripNondeterminism/handlers/png.pm b/lib/File/StripNondeterminism/handlers/png.pm
index 4a273e7..d6347ba 100644
--- a/lib/File/StripNondeterminism/handlers/png.pm
+++ b/lib/File/StripNondeterminism/handlers/png.pm
@@ -27,24 +27,24 @@ use File::Basename qw/dirname/;
use POSIX qw/strftime/;
use List::Util qw/min/;
-sub crc {
+sub crc($) {
my ($data) = @_;
return Archive::Zip::computeCRC32($data);
}
-sub chunk {
+sub chunk($$) {
my ($type, $data) = @_;
return pack('Na4a*N', length($data), $type, $data, crc($type . $data));
}
-sub time_chunk {
+sub time_chunk($) {
my ($seconds) = @_;
my ($sec, $min, $hour, $mday, $mon, $year) = gmtime($seconds);
return chunk('tIME',
pack('nCCCCC', 1900+$year, $mon+1, $mday, $hour, $min, $sec));
}
-sub text_chunk {
+sub text_chunk($$) {
my ($keyword, $data) = @_;
return chunk('tEXt', pack('Z*a*', $keyword, $data));
}
diff --git a/lib/File/StripNondeterminism/handlers/zip.pm b/lib/File/StripNondeterminism/handlers/zip.pm
index c25ec39..de1516b 100644
--- a/lib/File/StripNondeterminism/handlers/zip.pm
+++ b/lib/File/StripNondeterminism/handlers/zip.pm
@@ -31,7 +31,7 @@ use Archive::Zip qw/:CONSTANTS :ERROR_CODES/;
use constant SAFE_EPOCH => 315576060;
# Extract and return the first $nbytes of $member (an Archive::Zip::Member)
-sub peek_member {
+sub peek_member($$) {
my ($member, $nbytes) = @_;
my $original_size = $member->compressedSize();
my $old_compression_method
@@ -48,7 +48,7 @@ sub peek_member {
}
# Normalize the contents of $member (an Archive::Zip::Member) with $normalizer
-sub normalize_member {
+sub normalize_member($$) {
my ($member, $normalizer) = @_;
# Extract the member to a temporary file.
@@ -80,7 +80,7 @@ use constant {
LOCAL_HEADER => 1
};
-sub unixtime_to_winnt {
+sub unixtime_to_winnt($) {
my $unixtime = shift || 0;
# WinNT epoch is 01-Jan-1601 00:00:00 UTC
@@ -90,7 +90,7 @@ sub unixtime_to_winnt {
return $unixtime + $secondsdiff;
}
-sub normalize_extra_fields {
+sub normalize_extra_fields($$) {
# See http://sources.debian.net/src/zip/3.0-6/proginfo/extrafld.txt for extra field documentation
# $header_type is CENTRAL_HEADER or LOCAL_HEADER.
# WARNING: some fields have a different format depending on the header type
@@ -158,7 +158,7 @@ sub normalize_extra_fields {
return $result;
}
-sub try {
+sub try(&$) {
my ($sub, $errors) = @_;
@$errors = ();
my $old_error_handler
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/strip-nondeterminism.git
More information about the Reproducible-commits
mailing list