diff --git a/xwords4/dawg/English/BasEnglish2to8.xwd b/xwords4/dawg/English/BasEnglish2to8.xwd index 038ef39b8..31703c91d 100644 Binary files a/xwords4/dawg/English/BasEnglish2to8.xwd and b/xwords4/dawg/English/BasEnglish2to8.xwd differ diff --git a/xwords4/dawg/English/Makefile.BasEnglish b/xwords4/dawg/English/Makefile.BasEnglish index fb44a33a2..e77b5e877 100644 --- a/xwords4/dawg/English/Makefile.BasEnglish +++ b/xwords4/dawg/English/Makefile.BasEnglish @@ -18,6 +18,7 @@ XWLANG=BasEnglish LANGCODE=en_US DICT2DAWGARGS = -r -nosort +DICTNOTE = "Built on $(shell date)" TARGET_TYPE ?= WINCE diff --git a/xwords4/dawg/Makefile.langcommon b/xwords4/dawg/Makefile.langcommon index 44164230f..78f6a3baa 100644 --- a/xwords4/dawg/Makefile.langcommon +++ b/xwords4/dawg/Makefile.langcommon @@ -276,10 +276,17 @@ $(XWLANG)_charcount.bin: table.bin ../xloc.pl cat $$TMP >> $@; \ rm -f $$TMP -$(XWLANG)%_newheader.bin: $(XWLANG)%_wordcount.bin - SIZ=$$(ls -l $< | awk '{print $$5}'); \ +$(XWLANG)%_note.bin: + echo -n $(DICTNOTE) > $@ + perl -e "print pack(\"c\",0)" >> $@ + +$(XWLANG)%_newheader.bin: $(XWLANG)%_wordcount.bin $(XWLANG)%_note.bin + SIZ=0; \ + for FILE in $+; do \ + SIZ=$$(($$SIZ + $$(ls -l $$FILE | awk '{print $$5}'))); \ + done; \ perl -e "print pack(\"n\",$$SIZ)" > $@ - cat $< >> $@ + cat $+ >> $@ %.dict: %.dict.gz zcat $< > $@ diff --git a/xwords4/linux/linuxdict.c b/xwords4/linux/linuxdict.c index d6c25cf72..9ac6db234 100644 --- a/xwords4/linux/linuxdict.c +++ b/xwords4/linux/linuxdict.c @@ -290,13 +290,21 @@ initFromDictFile( LinuxDictionaryCtxt* dctx, const char* fileName ) memcpy( &headerLen, ptr, sizeof(headerLen) ); ptr += sizeof(headerLen); headerLen = ntohs( headerLen ); - if ( headerLen != sizeof(wordCount) ) { /* the only case we know right now */ - goto closeAndExit; - } + memcpy( &wordCount, ptr, sizeof(wordCount) ); ptr += sizeof(wordCount); + headerLen -= sizeof(wordCount); dctx->super.nWords = ntohl( wordCount ); XP_DEBUGF( "dict contains %ld words", dctx->super.nWords ); + + if ( 0 < headerLen ) { + XP_UCHAR buf[headerLen]; + XP_MEMCPY( buf, ptr, headerLen ); + XP_LOGF( "%s: got note of len %d: \"%s\"", __func__, headerLen-1, buf ); + } else { + XP_LOGF( "%s: no note", __func__ ); + } + ptr += headerLen; } if ( isUTF8 ) {