mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
use unpack to correctly pull wordcount, note and checksum
This commit is contained in:
parent
20afa9fd56
commit
aaa12a291e
1 changed files with 3 additions and 11 deletions
|
@ -169,17 +169,9 @@ sub readNodesToEnd($) {
|
||||||
sub printHeader($$) {
|
sub printHeader($$) {
|
||||||
my ( $buf, $len ) = @_;
|
my ( $buf, $len ) = @_;
|
||||||
printf STDERR "skipped %d bytes of header:\n", $len + 2;
|
printf STDERR "skipped %d bytes of header:\n", $len + 2;
|
||||||
my $asStr = Encode::decode_utf8($buf);
|
my $count;
|
||||||
my @strs = split( '\0', $asStr );
|
($count, $gDesc, $gSum) = unpack( 'N Z* Z*', $buf );
|
||||||
# There are variable numbers of strings showing up in this thing.
|
printf STDERR "has %d words\n", $count;
|
||||||
# Need to figure out the right way to unpack the thing.
|
|
||||||
$gDesc = $strs[1];
|
|
||||||
$gSum = $strs[2];
|
|
||||||
foreach my $str (@strs) {
|
|
||||||
if ( 0 < length($str) ) {
|
|
||||||
print STDERR 'Got: ', $str, "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub nodeSizeFromFlags($$) {
|
sub nodeSizeFromFlags($$) {
|
||||||
|
|
Loading…
Reference in a new issue