From: imiyazaki Date: Tue, 27 Jan 2004 17:53:18 +0000 (+0000) Subject: change pagesize of DB to 512 bytes. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=36fe5541c447bb0e848842478aafaab927cf6867;p=chise%2Fomega.git change pagesize of DB to 512 bytes. add hash of %cid to manipulate the data. --- diff --git a/add_adobecid.pl b/add_adobecid.pl index ccecc9a..1e8af04 100644 --- a/add_adobecid.pl +++ b/add_adobecid.pl @@ -4,7 +4,7 @@ use strict; use vars qw($cmapfile $db_home $encoding %cs_var $ucs $cid $last - $ciddb_filename $ciddb + $ciddb_filename $ciddb %ciddb %cid ); use BerkeleyDB; use Chise_utils ':all'; @@ -71,8 +71,11 @@ if(-f "$db_home/$ciddb_filename"){ print STDERR "Removing old DB $db_home/$ciddb_filename.\n"; unlink "$db_home/$ciddb_filename"; } -$ciddb=new BerkeleyDB::Hash - -Filename => "$db_home/$ciddb_filename", -Flags => DB_CREATE + +$ciddb=tie %ciddb, 'BerkeleyDB::Hash', + -Filename => "$db_home/$ciddb_filename", + -Flags => DB_CREATE|DB_TRUNCATE, + -Pagesize => 512, or die $!; my $in_cidrange=0; @@ -107,6 +110,17 @@ while(){ close(CMAP); print STDERR "done!\n"; +print STDERR "Storing data to CHISE DB..."; +foreach my $char (sort keys %cid){ + unless($ciddb->db_put("?".$char,$cid{$char})==0){ + die $!; + } +} +print STDERR "done!\n"; + +undef $ciddb; +untie %ciddb; + exit 0; sub store_cid{ @@ -142,9 +156,7 @@ sub store_cid{ if($debug){ print STDERR sprintf("%X:%d\n",unpack("U",$char),$cid); } - unless($ciddb->db_put("?".$char,$cid)==0){ - die $!; - } + $cid{$char}=$cid; } sub replace_char_id{