From: rkinyon@cpan.org Date: Mon, 16 Jun 2008 01:22:02 +0000 (+0000) Subject: All sectors now use a string to create themselves X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=576320ff53f81229790ef9e6822652b74515e162;p=dbsrgits%2FDBM-Deep.git All sectors now use a string to create themselves git-svn-id: http://svn.ali.as/cpan/trunk/DBM-Deep@3577 88f4d9cd-8a04-0410-9d60-8f63309c3137 --- diff --git a/Changes b/Changes index df913f7..b7d0612 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ Revision history for DBM::Deep. +1.0014 Jun 13 23:15:00 2008 EST + - (This version is compatible with 1.0013) + - Fix for RT#36781 (t/44 has an unrequired dependency) + - Start the process of optimization. + 1.0013 Jun 13 23:15:00 2008 EST - (This version is compatible with 1.0012) - Fix for RT#30144 (Optimization failure on Win32) diff --git a/lib/DBM/Deep/Engine/Sector/BucketList.pm b/lib/DBM/Deep/Engine/Sector/BucketList.pm index b76b2dd..dd2ece4 100644 --- a/lib/DBM/Deep/Engine/Sector/BucketList.pm +++ b/lib/DBM/Deep/Engine/Sector/BucketList.pm @@ -15,14 +15,11 @@ sub _init { my $engine = $self->engine; unless ( $self->offset ) { - my $leftover = $self->size - $self->base_size; - $self->{offset} = $engine->_request_blist_sector( $self->size ); - $engine->storage->print_at( $self->offset, $engine->SIG_BLIST ); # Sector type - # Skip staleness counter - $engine->storage->print_at( $self->offset + $self->base_size, - chr(0) x $leftover, # Zero-fill the data - ); + + my $string = chr(0) x $self->size; + substr( $string, 0, 1, $engine->SIG_BLIST ); + $engine->storage->print_at( $self->offset, $string ); } if ( $self->{key_md5} ) { diff --git a/lib/DBM/Deep/Engine/Sector/Index.pm b/lib/DBM/Deep/Engine/Sector/Index.pm index 149f271..e314602 100644 --- a/lib/DBM/Deep/Engine/Sector/Index.pm +++ b/lib/DBM/Deep/Engine/Sector/Index.pm @@ -15,14 +15,11 @@ sub _init { my $engine = $self->engine; unless ( $self->offset ) { - my $leftover = $self->size - $self->base_size; - $self->{offset} = $engine->_request_index_sector( $self->size ); - $engine->storage->print_at( $self->offset, $engine->SIG_INDEX ); # Sector type - # Skip staleness counter - $engine->storage->print_at( $self->offset + $self->base_size, - chr(0) x $leftover, # Zero-fill the rest - ); + + my $string = chr(0) x $self->size; + substr( $string, 0, 1, $engine->SIG_INDEX ); + $engine->storage->print_at( $self->offset, $string ); } return $self; diff --git a/lib/DBM/Deep/Engine/Sector/Reference.pm b/lib/DBM/Deep/Engine/Sector/Reference.pm index 0fd782a..2d1bff3 100644 --- a/lib/DBM/Deep/Engine/Sector/Reference.pm +++ b/lib/DBM/Deep/Engine/Sector/Reference.pm @@ -19,7 +19,6 @@ sub _init { my $e = $self->engine; unless ( $self->offset ) { - $self->{staleness} = 0; $self->{offset} = $e->_request_data_sector( $self->size ); my $class_offset = 0; @@ -43,13 +42,13 @@ sub _init { } else { $self->{type} = $e->storage->read_at( $self->offset, 1 ); - - $self->{staleness} = unpack( - $e->StP($DBM::Deep::Engine::STALE_SIZE), - $e->storage->read_at( $self->offset + $e->SIG_SIZE, $DBM::Deep::Engine::STALE_SIZE ), - ); } + $self->{staleness} = unpack( + $e->StP($DBM::Deep::Engine::STALE_SIZE), + $e->storage->read_at( $self->offset + $e->SIG_SIZE, $DBM::Deep::Engine::STALE_SIZE ), + ); + return; }