"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "repeats/repeats.pl.in" between
littleutils-1.2.4.tar.lz and littleutils-1.2.5.tar.lz

About: littleutils are a collection of small and simple utilities (rename files, search for duplicate files, ...).

repeats.pl.in  (littleutils-1.2.4.tar.lz):repeats.pl.in  (littleutils-1.2.5.tar.lz)
skipping to change at line 68 skipping to change at line 68
### LIST FUNCTIONS ### ### LIST FUNCTIONS ###
# list with subsequent duplicates removed # list with subsequent duplicates removed
sub uniq { sub uniq {
my %seen = (); my %seen = ();
return grep { ! $seen{$_}++ } @_; return grep { ! $seen{$_}++ } @_;
} }
# list with subsequent hardlinks (matching inode number & dev number) removed # list with subsequent hardlinks (matching inode number & dev number) removed
sub uniq_inode { sub uniq_inode {
my %seen = (); my %seen = ();
return grep { ! $seen{$filenode{$_} . $filedev{$_}}++ } @_; return grep { ! $seen{pack('L2', $filenode{$_}, $filedev{$_})}++ } @_;
} }
# add list of matching files to results buffer # add list of matching files to results buffer
sub push_to_results { sub push_to_results {
if ($opt_1) { if ($opt_1) {
push(@results, join("\t", @_)); push(@results, join("\t", @_));
} }
else { else {
for my $i (0 .. ($#_-1)) { for my $i (0 .. ($#_-1)) {
push(@results, $_[$i] . "\t" . $_[$i+1]); push(@results, $_[$i] . "\t" . $_[$i+1]);
} }
skipping to change at line 134 skipping to change at line 134
else { die "repeats.pl error: unsupported algorithm selected\n"; } else { die "repeats.pl error: unsupported algorithm selected\n"; }
do { do {
my $rc = read($FILE, my $data, ($bytes_to_read > $BUFSIZE) ? $BUFSIZE : $byt es_to_read); my $rc = read($FILE, my $data, ($bytes_to_read > $BUFSIZE) ? $BUFSIZE : $byt es_to_read);
die "repeats.pl error: unable to read data from $file\n" unless (defined($rc )); die "repeats.pl error: unable to read data from $file\n" unless (defined($rc ));
$tmp->add($data) if ($rc > 0); $tmp->add($data) if ($rc > 0);
$bytes_to_read -= $rc; $bytes_to_read -= $rc;
$bytes_read += $rc; $bytes_read += $rc;
} while (($bytes_read < $filesize{$file}) and ($bytes_to_read > 0)); } while (($bytes_read < $filesize{$file}) and ($bytes_to_read > 0));
close($FILE); close($FILE);
$filehash{$file} = $tmp->clone(); # clone required for BLAKE2b $filehash{$file} = $tmp->clone(); # clone required for BLAKE2b
my $digest = $tmp->digest . $filesize{$file}; my $digest = $tmp->digest . pack('Q', $filesize{$file});
($bytes_read < $filesize{$file}) ? $digest_seen{$digest}-- : $digest_seen{$dig est}++; ($bytes_read < $filesize{$file}) ? $digest_seen{$digest}-- : $digest_seen{$dig est}++;
return $digest; return $digest;
} }
### BEGIN MAIN PROGRAM ### ### BEGIN MAIN PROGRAM ###
# traverse listed paths # traverse listed paths
my @search_paths = ($#ARGV > -1) ? grep { -d } uniq(@ARGV) : ('.'); my @search_paths = ($#ARGV > -1) ? grep { -d } uniq(@ARGV) : ('.');
find_files(@search_paths); find_files(@search_paths);
my @candidates = keys(%filesize); my @candidates = keys(%filesize);
printf STDERR "repeats.pl stage 0: total number of files = %d\n", ($#candidates + 1) if ($opt_v); printf STDERR "repeats.pl stage 0: total number of files = %d\n", ($#candidates + 1) if ($opt_v);
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)