Changeset 37

Show
Ignore:
Timestamp:
02/28/01 02:51:53
Author:
miyagawa
Message:

fixed the bug in case of all of the upper octets are either 0x00 or one single other value.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Convert-RACE/trunk/lib/Convert/RACE.pm

    r30 r37  
    7777        return "\xD8" . $str; 
    7878    } 
    79      
    80     my $u1 = $unique_upper_octet[0]; 
     79 
     80    my $u1 = @unique_upper_octet == 1 
     81        ? $unique_upper_octet[0] : (grep { $_ ne "\x00" } @unique_upper_octet)[0]; 
    8182    if ($u1 =~ /^[\xd8-\xdc]{1}$/) { 
    8283        Carp::croak(COMPRESS_EXCEPTION); 
     
    9798        } 
    9899    } 
    99  
     100     
    100101    return $res; 
    101102} 
  • Convert-RACE/trunk/t/02race.t

    r27 r37  
    11use strict; 
    22use Test; 
    3 BEGIN { plan tests => 6
     3BEGIN { plan tests => 8
    44 
    55use Convert::RACE qw(to_race from_race); 
     
    88my $i2 = "\x01\x2D\x00\xe0\x01\x4B"; 
    99my $i3 = "\x01\x2D\x00\x20\x24\xd3"; 
     10my $i4 = "\x00\x64\x01\x7e\x01\xff"; 
    1011 
    1112my $r1 = 'bq--aewrcsy'; 
    1213my $r2 = 'bq--aew77ycl'; 
    1314my $r3 = 'bq--3aas2abaetjq'; 
     15my $r4 = 'bq--ah7wi7x7te'; 
    1416 
    1517ok(to_race($i1),$r1); 
    1618ok(to_race($i2),$r2); 
    1719ok(to_race($i3),$r3); 
     20ok(to_race($i4),$r4); 
    1821 
    1922ok(from_race($r1),$i1); 
    2023ok(from_race($r2),$i2); 
    2124ok(from_race($r3),$i3); 
     25ok(from_race($r4),$i4);