summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
648a333)
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.
for ( my $i = 0; $i <= length( $v1 ); $i++ ) {
my ( $n1, $n2 ) = ( ord( substr( $v1, $i, 1 ) ),
ord( substr( $v2, $i, 1 ) ) );
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
$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;
$n2 = -1 if $n2 == 126;
if ( my $r = ($n1 <=> $n2) ) {
return $r;