From: Frank Lichtenheld Date: Tue, 11 Sep 2007 14:59:16 +0000 (+0200) Subject: Deb::Versions: Fix a bug introduces by ~ handling X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=00a3b2eb3a2ba0470e5f07adb09d00662d3e89f3;p=deb%2Fpackages.git Deb::Versions: Fix a bug introduces by ~ handling 708b1364be58c9b921cc3838d7ed5f5b48959d78 fixed the handling of ~ but broke the handling of comparing a "normal" letter with the empty string. A letter sorts earlier than all non-letter except ~, but of course not earlier as the empty string. --- diff --git a/lib/Deb/Versions.pm b/lib/Deb/Versions.pm index ec127ce..fcc8e31 100644 --- a/lib/Deb/Versions.pm +++ b/lib/Deb/Versions.pm @@ -142,9 +142,9 @@ sub _lcmp { for ( my $i = 0; $i <= length( $v1 ); $i++ ) { my ( $n1, $n2 ) = ( ord( substr( $v1, $i, 1 ) ), ord( substr( $v2, $i, 1 ) ) ); - $n1 += 256 if $n1 < 65; # letters sort earlier than non-letters + $n1 += 256 if $n1 && $n1 < 65; # letters sort earlier than non-letters $n1 = -1 if $n1 == 126; # '~' sorts earlier than everything else - $n2 += 256 if $n2 < 65; + $n2 += 256 if $n2 && $n2 < 65; $n2 = -1 if $n2 == 126; if ( my $r = ($n1 <=> $n2) ) { return $r;