X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=driver%2Fxscreensaver-getimage-file;h=860ffc8a82f5c98cc8e46d995c4306d760e61b83;hp=749fe56b5b8aa3858b3e86ef4efd48fb7f778961;hb=bc7b7a8eb122206d239ec0e693676bcce31be1aa;hpb=ffd8c0873576a9e3065696a624dce6b766b77062 diff --git a/driver/xscreensaver-getimage-file b/driver/xscreensaver-getimage-file index 749fe56b..860ffc8a 100755 --- a/driver/xscreensaver-getimage-file +++ b/driver/xscreensaver-getimage-file @@ -33,9 +33,12 @@ use Fcntl; use POSIX ':fcntl_h'; # S_ISLNK was here in Perl 5.6 import Fcntl ':mode' unless defined &S_ISLNK; # but it is here in Perl 5.8 +use bytes; # Larry can take Unicode and shove it up his ass sideways. + # Perl 5.8.0 causes us to start getting incomprehensible + # errors about UTF-8 all over the place without this. my $progname = $0; $progname =~ s@.*/@@g; -my $version = q{ $Revision: 1.16 $ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/; +my $version = q{ $Revision: 1.18 $ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/; my $verbose = 0; @@ -317,7 +320,7 @@ sub jpeg_size { # sub png_size { my ($body) = @_; - return () unless ($body =~ m/^\211PNG\r/); + return () unless ($body =~ m/^\211PNG\r/s); my ($bits) = ($body =~ m/^.{12}(.{12})/s); return () unless defined ($bits); return () unless ($bits =~ /^IHDR/); @@ -349,6 +352,7 @@ sub image_file_size { print STDERR "$progname: $file: $!\n" if ($verbose); return undef; } + binmode (IN); # Larry can take Unicode and shove it up his ass sideways. while () { $body .= $_; last if (length($body) > 1024 * 100); # the first 100k should be enough