mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +01:00
more progress: copy dict name into badwordinfo and free it successfully
This commit is contained in:
parent
2f8b6cceb5
commit
509c832f2f
2 changed files with 9 additions and 3 deletions
|
@ -1406,6 +1406,7 @@ freeBWI( MPFORMAL BadWordInfo* bwi )
|
|||
{
|
||||
XP_U16 nWords = bwi->nWords;
|
||||
|
||||
XP_FREEP( mpool, &bwi->dictName );
|
||||
while ( nWords-- ) {
|
||||
XP_FREE( mpool, (XP_UCHAR*)bwi->words[nWords] );
|
||||
bwi->words[nWords] = (XP_UCHAR*)NULL;
|
||||
|
@ -1436,6 +1437,7 @@ bwiFromStream( MPFORMAL XWStreamCtxt* stream, BadWordInfo* bwi )
|
|||
const XP_UCHAR** sp = bwi->words;
|
||||
|
||||
bwi->nWords = nWords;
|
||||
bwi->dictName = NULL;
|
||||
for ( sp = bwi->words; nWords; ++sp, --nWords ) {
|
||||
*sp = (const XP_UCHAR*)stringFromStream( mpool, stream );
|
||||
}
|
||||
|
@ -1874,7 +1876,7 @@ server_setGameOverListener( ServerCtxt* server, GameOverListener gol,
|
|||
|
||||
static XP_Bool
|
||||
storeBadWords( const XP_UCHAR* word, XP_Bool isLegal,
|
||||
const DictionaryCtxt* XP_UNUSED(dict),
|
||||
const DictionaryCtxt* dict,
|
||||
#ifdef XWFEATURE_BOARDWORDS
|
||||
const MoveInfo* XP_UNUSED(movei), XP_U16 XP_UNUSED(start),
|
||||
XP_U16 XP_UNUSED(end),
|
||||
|
@ -1883,9 +1885,12 @@ storeBadWords( const XP_UCHAR* word, XP_Bool isLegal,
|
|||
{
|
||||
if ( !isLegal ) {
|
||||
ServerCtxt* server = (ServerCtxt*)closure;
|
||||
const XP_UCHAR* name = dict_getShortName( dict );
|
||||
|
||||
XP_LOGF( "storeBadWords called with \"%s\"", word );
|
||||
|
||||
XP_LOGF( "storeBadWords called with \"%s\" (name=%s)", word, name );
|
||||
if ( NULL == server->illegalWordInfo.dictName ) {
|
||||
server->illegalWordInfo.dictName = copyString( server->mpool, name );
|
||||
}
|
||||
server->illegalWordInfo.words[server->illegalWordInfo.nWords++]
|
||||
= copyString( server->mpool, word );
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ typedef struct PickInfo {
|
|||
|
||||
typedef struct BadWordInfo {
|
||||
XP_U16 nWords;
|
||||
XP_UCHAR* dictName;
|
||||
const XP_UCHAR* words[MAX_TRAY_TILES+1]; /* can form in both directions */
|
||||
} BadWordInfo;
|
||||
|
||||
|
|
Loading…
Reference in a new issue