pass env into dict-related methods

I was getting an occasional crash using a stale env to delete a dict's
resources because the dict was cacheing the env that created it. Dumb!
Using the thread->env mapping stuff worked, but that felt risky and so I
tried just passing it in. It's safe, and involves an amount of change I
can tolerate. So likely going that way.
This commit is contained in:
Eric House 2020-04-25 11:34:58 -07:00
parent 72cf605792
commit cfaa6849b2
30 changed files with 224 additions and 221 deletions

View file

@ -38,7 +38,6 @@
typedef struct _AndDictionaryCtxt {
DictionaryCtxt super;
JNIUtilCtxt* jniutil;
JNIEnv *env;
off_t bytesSize;
jbyte* bytes;
jbyteArray byteArray;
@ -58,11 +57,11 @@ static void splitFaces_via_java( JNIEnv* env, AndDictionaryCtxt* ctxt,
int nFaceBytes, int nFaces, XP_Bool isUTF8 );
void
dict_splitFaces( DictionaryCtxt* dict, const XP_U8* bytes,
dict_splitFaces( DictionaryCtxt* dict, XWEnv xwe, const XP_U8* bytes,
XP_U16 nBytes, XP_U16 nFaces )
{
AndDictionaryCtxt* ctxt = (AndDictionaryCtxt*)dict;
splitFaces_via_java( ctxt->env, ctxt, bytes, nBytes, nFaces,
splitFaces_via_java( xwe, ctxt, bytes, nBytes, nFaces,
dict->isUTF8 );
}
@ -300,8 +299,8 @@ getNullTermParam( AndDictionaryCtxt* dctx, const XP_U8** ptr,
}
static XP_Bool
parseDict( AndDictionaryCtxt* ctxt, XP_U8 const* ptr, XP_U32 dictLength,
XP_U32* numEdges )
parseDict( AndDictionaryCtxt* ctxt, XWEnv xwe, XP_U8 const* ptr,
XP_U32 dictLength, XP_U32* numEdges )
{
XP_Bool success = XP_TRUE;
XP_ASSERT( !!ptr );
@ -362,12 +361,12 @@ parseDict( AndDictionaryCtxt* ctxt, XP_U8 const* ptr, XP_U32 dictLength,
goto error;
}
JNIEnv* env = xwe;
if ( NULL == ctxt->super.md5Sum
#ifdef DEBUG
|| XP_TRUE
#endif
) {
JNIEnv* env = ctxt->env;
jstring jsum = and_util_getMD5SumForDict( ctxt->jniutil,
ctxt->super.name, NULL, 0 );
XP_UCHAR* md5Sum = NULL;
@ -409,7 +408,7 @@ parseDict( AndDictionaryCtxt* ctxt, XP_U8 const* ptr, XP_U32 dictLength,
if ( isUTF8 ) {
CHECK_PTR( ptr, numFaceBytes, end );
splitFaces_via_java( ctxt->env, ctxt, ptr, numFaceBytes, nFaces,
splitFaces_via_java( env, ctxt, ptr, numFaceBytes, nFaces,
XP_TRUE );
ptr += numFaceBytes;
} else {
@ -426,8 +425,7 @@ parseDict( AndDictionaryCtxt* ctxt, XP_U8 const* ptr, XP_U32 dictLength,
nBytes += 1;
}
XP_ASSERT( nFaces == nBytes );
splitFaces_via_java( ctxt->env, ctxt, tmp, nBytes, nFaces,
XP_FALSE );
splitFaces_via_java( env, ctxt, tmp, nBytes, nFaces, XP_FALSE );
}
ctxt->super.is_4_byte = (ctxt->super.nodeSize == 4);
@ -481,12 +479,12 @@ parseDict( AndDictionaryCtxt* ctxt, XP_U8 const* ptr, XP_U32 dictLength,
} /* parseDict */
static void
and_dictionary_destroy( DictionaryCtxt* dict )
and_dictionary_destroy( DictionaryCtxt* dict, XWEnv xwe )
{
AndDictionaryCtxt* ctxt = (AndDictionaryCtxt*)dict;
XP_LOGF( "%s(dict=%p); code=%x", __func__, ctxt, ctxt->dbgid );
XP_U16 nSpecials = andCountSpecials( ctxt );
JNIEnv* env = ctxt->env;
JNIEnv* env = xwe;
if ( !!ctxt->super.chars ) {
for ( int ii = 0; ii < nSpecials; ++ii ) {
@ -547,11 +545,10 @@ and_dictionary_getChars( JNIEnv* env, DictionaryCtxt* dict )
}
DictionaryCtxt*
and_dictionary_make_empty( MPFORMAL JNIEnv* env, JNIUtilCtxt* jniutil )
and_dictionary_make_empty( MPFORMAL JNIUtilCtxt* jniutil )
{
AndDictionaryCtxt* anddict
= (AndDictionaryCtxt*)XP_CALLOC( mpool, sizeof( *anddict ) );
anddict->env = env;
anddict->jniutil = jniutil;
#ifdef DEBUG
anddict->dbgid = rand();
@ -597,8 +594,8 @@ makeDicts( MPFORMAL JNIEnv *env, DictMgrCtxt* dictMgr, JNIUtilCtxt* jniutil,
}
DictionaryCtxt*
makeDict( MPFORMAL JNIEnv *env, DictMgrCtxt* dictMgr, JNIUtilCtxt* jniutil, jstring jname,
jbyteArray jbytes, jstring jpath, jstring jlangname, jboolean check )
makeDict( MPFORMAL JNIEnv *env, DictMgrCtxt* dictMgr, JNIUtilCtxt* jniutil,
jstring jname, jbyteArray jbytes, jstring jpath, jstring jlangname, jboolean check )
{
jbyte* bytes = NULL;
jbyteArray byteArray = NULL;
@ -606,7 +603,8 @@ makeDict( MPFORMAL JNIEnv *env, DictMgrCtxt* dictMgr, JNIUtilCtxt* jniutil, jstr
const char* name = (*env)->GetStringUTFChars( env, jname, NULL );
/* remember: dmgr_get calls dict_ref() */
AndDictionaryCtxt* anddict = (AndDictionaryCtxt*)dmgr_get( dictMgr, name );
AndDictionaryCtxt* anddict = (AndDictionaryCtxt*)dmgr_get( dictMgr,
env, name );
if ( NULL == anddict ) {
if ( NULL == jpath ) {
@ -634,7 +632,7 @@ makeDict( MPFORMAL JNIEnv *env, DictMgrCtxt* dictMgr, JNIUtilCtxt* jniutil, jstr
if ( NULL != bytes ) {
anddict = (AndDictionaryCtxt*)
and_dictionary_make_empty( MPPARM(mpool) env, jniutil );
and_dictionary_make_empty( MPPARM(mpool) jniutil );
anddict->bytes = bytes;
anddict->byteArray = byteArray;
anddict->bytesSize = bytesSize;
@ -649,16 +647,16 @@ makeDict( MPFORMAL JNIEnv *env, DictMgrCtxt* dictMgr, JNIUtilCtxt* jniutil, jstr
env, jlangname );
XP_U32 numEdges = 0;
XP_Bool parses = parseDict( anddict, (XP_U8*)anddict->bytes,
XP_Bool parses = parseDict( anddict, env, (XP_U8*)anddict->bytes,
bytesSize, &numEdges );
if ( !parses || (check && !checkSanity( &anddict->super,
numEdges ) ) ) {
and_dictionary_destroy( (DictionaryCtxt*)anddict );
and_dictionary_destroy( (DictionaryCtxt*)anddict, env );
anddict = NULL;
}
}
dmgr_put( dictMgr, name, &anddict->super );
dict_ref( &anddict->super );
dmgr_put( dictMgr, env, name, &anddict->super );
dict_ref( &anddict->super, env );
}
(*env)->ReleaseStringUTFChars( env, jname, name );

View file

@ -27,7 +27,7 @@
#include "jniutlswrapper.h"
void
dict_splitFaces( DictionaryCtxt* dict, const XP_U8* bytes,
dict_splitFaces( DictionaryCtxt* dict, XWEnv xwe, const XP_U8* bytes,
XP_U16 nBytes, XP_U16 nFaces );
DictionaryCtxt* makeDict( MPFORMAL JNIEnv *env, DictMgrCtxt* dictMgr,
@ -40,8 +40,7 @@ void makeDicts( MPFORMAL JNIEnv *env, DictMgrCtxt* dictMgr, JNIUtilCtxt* jniutil
void destroyDicts( PlayerDicts* dicts );
DictionaryCtxt* and_dictionary_make_empty( MPFORMAL JNIEnv *env,
JNIUtilCtxt* jniutil );
DictionaryCtxt* and_dictionary_make_empty( MPFORMAL JNIUtilCtxt* jniutil );
jobject and_dictionary_getChars( JNIEnv* env, DictionaryCtxt* dict );

View file

@ -313,7 +313,7 @@ and_util_engineProgressCallback( XW_UtilCtxt* uc )
/* This is added for java, not part of the util api */
bool
utilTimerFired( XW_UtilCtxt* uc, XWTimerReason why, int handle )
utilTimerFired( XW_UtilCtxt* uc, XWEnv xwe, XWTimerReason why, int handle )
{
bool handled = false;
AndUtil* util = (AndUtil*)uc;
@ -321,7 +321,7 @@ utilTimerFired( XW_UtilCtxt* uc, XWTimerReason why, int handle )
if ( handle == (int)timerStorage ) {
XWTimerProc proc = timerStorage->proc;
if ( !!proc ) {
handled = (*proc)( timerStorage->closure, why );
handled = (*proc)( timerStorage->closure, xwe, why );
} else {
XP_LOGF( "%s(why=%d): ERROR: no proc set", __func__, why );
}
@ -383,17 +383,16 @@ and_dutil_getCurSeconds( XW_DUtilCtxt* duc )
}
static DictionaryCtxt*
and_util_makeEmptyDict( XW_UtilCtxt* uc )
and_util_makeEmptyDict( XW_UtilCtxt* uc, XWEnv xwe )
{
#ifdef STUBBED_DICT
XP_ASSERT(0);
#else
AndGameGlobals* globals = (AndGameGlobals*)uc->closure;
AndUtil* andutil = (AndUtil*)uc;
DictionaryCtxt* result =
and_dictionary_make_empty( MPPARM( ((AndUtil*)uc)->util.mpool )
ENVFORME( andutil->ti ), globals->jniutil );
return dict_ref( result );
globals->jniutil );
return dict_ref( result, xwe );
#endif
}

View file

@ -38,6 +38,6 @@ XW_UtilCtxt* makeUtil( MPFORMAL EnvThreadInfo* ti, jobject j_util,
CurGameInfo* gi, AndGameGlobals* globals );
void destroyUtil( XW_UtilCtxt** util );
bool utilTimerFired( XW_UtilCtxt* util, XWTimerReason why, int handle );
bool utilTimerFired( XW_UtilCtxt* util, XWEnv xwe, XWTimerReason why, int handle );
#endif

View file

@ -20,6 +20,7 @@
#ifndef _XPTYPES_H_
#define _XPTYPES_H_
#include <jni.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
@ -118,6 +119,8 @@ XP_U16 and_htons(XP_U16 s);
extern "C" {
#endif
typedef JNIEnv* XWEnv;
#ifdef CPLUS
}
#endif

View file

@ -1,7 +1,6 @@
/* -*- compile-command: "find-and-gradle.sh inXw4Deb"; -*- */
/* -*- compile-command: "find-and-gradle.sh inXw4dDeb"; -*- */
/*
* Copyright © 2009 - 2018 by Eric House (xwords@eehouse.org). All rights
* Copyright © 2009 - 2020 by Eric House (xwords@eehouse.org). All rights
* reserved.
*
* This program is free software; you can redistribute it and/or
@ -384,7 +383,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_cleanGlobals
XP_ASSERT( ENVFORME(&globalState->ti) == env );
smsproto_free( globalState->smsProto );
vtmgr_destroy( MPPARM(mpool) globalState->vtMgr );
dmgr_destroy( globalState->dictMgr );
dmgr_destroy( globalState->dictMgr, env );
destroyDUtil( &globalState->dutil );
destroyJNIUtil( env, &globalState->jniutil );
map_destroy( &globalState->ti );
@ -671,7 +670,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_gi_1from_1stream
CurGameInfo gi;
XP_MEMSET( &gi, 0, sizeof(gi) );
if ( game_makeFromStream( MPPARM(mpool) stream, NULL,
if ( game_makeFromStream( MPPARM(mpool) env, stream, NULL,
&gi, NULL, NULL, NULL, NULL, NULL, NULL ) ) {
setJGI( env, jgi, &gi );
} else {
@ -764,7 +763,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1ref
{
if ( 0 != dictPtr ) {
DictionaryCtxt* dict = (DictionaryCtxt*)dictPtr;
dict_ref( dict );
dict_ref( dict, env );
}
}
@ -774,7 +773,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1unref
{
if ( 0 != dictPtr ) {
DictionaryCtxt* dict = (DictionaryCtxt*)dictPtr;
dict_unref( dict );
dict_unref( dict, env );
}
}
@ -802,7 +801,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1getInfo
setInt( env, jinfo, "wordCount", dict_getWordCount( dict ) );
setString( env, jinfo, "md5Sum", dict_getMd5Sum( dict ) );
}
dict_unref( dict );
dict_unref( dict, env );
result = true;
}
@ -1029,8 +1028,8 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeNewGame
CommonPrefs cp = {0};
loadCommonPrefs( env, &cp, j_cp );
game_makeNewGame( MPPARM(mpool) &state->game, gi, globals->util, dctx, &cp,
globals->xportProcs );
game_makeNewGame( MPPARM(mpool) env, &state->game, gi,
globals->util, dctx, &cp, globals->xportProcs );
DictionaryCtxt* dict;
PlayerDicts dicts;
@ -1044,10 +1043,10 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeNewGame
dict = make_stubbed_dict( MPPARM_NOCOMMA(mpool) );
}
#endif
model_setDictionary( state->game.model, dict );
dict_unref( dict ); /* game owns it now */
model_setPlayerDicts( state->game.model, &dicts );
dict_unref_all( &dicts );
model_setDictionary( state->game.model, env, dict );
dict_unref( dict, env ); /* game owns it now */
model_setPlayerDicts( state->game.model, env, &dicts );
dict_unref_all( &dicts, env );
XWJNI_END();
} /* makeNewGame */
@ -1063,7 +1062,7 @@ JNIEXPORT void JNICALL Java_org_eehouse_android_xw4_jni_XwJNI_game_1dispose
destroyGI( MPPARM(mpool) &globals->gi );
game_dispose( &state->game );
game_dispose( &state->game, env );
destroyDraw( &globals->dctx );
destroyXportProcs( &globals->xportProcs );
@ -1103,13 +1102,13 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1makeFromStream
CommonPrefs cp;
loadCommonPrefs( env, &cp, jcp );
result = game_makeFromStream( MPPARM(mpool) stream, &state->game,
result = game_makeFromStream( MPPARM(mpool) env, stream, &state->game,
globals->gi, dict, &dicts,
globals->util, globals->dctx, &cp,
globals->xportProcs );
stream_destroy( stream );
dict_unref( dict ); /* game owns it now */
dict_unref_all( &dicts );
dict_unref( dict, env ); /* game owns it now */
dict_unref_all( &dicts, env );
/* If game_makeFromStream() fails, the platform-side caller still needs to
call game_dispose. That requirement's better than having cleanup code
@ -1625,7 +1624,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_timerFired
jboolean result;
XWJNI_START_GLOBALS();
XW_UtilCtxt* util = globals->util;
result = utilTimerFired( util, why, handle );
result = utilTimerFired( util, env, why, handle );
XWJNI_END();
return result;
}
@ -1678,8 +1677,8 @@ Java_org_eehouse_android_xw4_jni_XwJNI_model_1writeGameHistory
jstring result;
XWJNI_START_GLOBALS();
XWStreamCtxt* stream = and_empty_stream( MPPARM(mpool) globals );
model_writeGameHistory( state->game.model, stream, state->game.server,
gameOver );
model_writeGameHistory( state->game.model, env, stream,
state->game.server, gameOver );
result = streamToJString( env, stream );
stream_destroy( stream );
XWJNI_END();
@ -1718,7 +1717,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_model_1getPlayersLastScore
XWJNI_START();
XP_ASSERT( !!state->game.model );
LastMoveInfo lmi;
XP_Bool valid = model_getPlayersLastScore( state->game.model,
XP_Bool valid = model_getPlayersLastScore( state->game.model, env,
player, &lmi );
setBool( env, jlmi, "isValid", valid );
if ( valid ) {
@ -1878,7 +1877,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1receiveMessage
addrp = &addr;
}
result = game_receiveMessage( &state->game, stream, addrp );
result = game_receiveMessage( &state->game, env, stream, addrp );
stream_destroy( stream );
@ -2423,8 +2422,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_dict_1iter_1destroy
#ifdef MEM_DEBUG
MemPoolCtx* mpool = data->mpool;
#endif
dict_unref( data->dict );
dict_unref( data->dict, env );
freeIndices( data );
MAP_REMOVE( &data->globalState->ti, env );

View file

@ -108,7 +108,7 @@ static XP_Bool invalCellsWithTiles( BoardCtxt* board );
static void setTimerIf( BoardCtxt* board );
static XP_Bool p_board_timerFired( void* closure, XWTimerReason why );
static XP_Bool p_board_timerFired( void* closure, XWEnv xwe, XWTimerReason why );
static XP_Bool replaceLastTile( BoardCtxt* board );
static XP_Bool setTrayVisState( BoardCtxt* board, XW_TrayVisState newState );
@ -1317,7 +1317,7 @@ positionMiniWRect( BoardCtxt* board, XP_Rect* rect, XP_Bool center )
#endif
static XP_Bool
timerFiredForPen( BoardCtxt* board )
timerFiredForPen( BoardCtxt* board, XWEnv xwe )
{
XP_Bool draw = XP_FALSE;
const XP_UCHAR* text = (XP_UCHAR*)NULL;
@ -1355,7 +1355,7 @@ timerFiredForPen( BoardCtxt* board )
XWStreamCtxt* stream =
mem_stream_make_raw( MPPARM(board->mpool)
dutil_getVTManager(board->dutil) );
listWords = model_listWordsThrough( board->model, modelCol, modelRow,
listWords = model_listWordsThrough( board->model, xwe, modelCol, modelRow,
board->selPlayer, stream );
if ( listWords ) {
util_cellSquareHeld( board->util, stream );
@ -1439,12 +1439,12 @@ timerFiredForTimer( BoardCtxt* board )
} /* timerFiredForTimer */
static XP_Bool
p_board_timerFired( void* closure, XWTimerReason why )
p_board_timerFired( void* closure, XWEnv xwe, XWTimerReason why )
{
XP_Bool draw = XP_FALSE;
BoardCtxt* board = (BoardCtxt*)closure;
if ( why == TIMER_PENDOWN ) {
draw = timerFiredForPen( board );
draw = timerFiredForPen( board, xwe );
} else {
XP_ASSERT( why == TIMER_TIMERTICK );
timerFiredForTimer( board );
@ -1454,7 +1454,7 @@ p_board_timerFired( void* closure, XWTimerReason why )
#ifdef XWFEATURE_RAISETILE
static XP_Bool
p_tray_timerFired( void* closure, XWTimerReason why )
p_tray_timerFired( void* closure, XWEnv xwe, XWTimerReason why )
{
XP_Bool draw = XP_FALSE;
BoardCtxt* board = (BoardCtxt*)closure;

View file

@ -497,7 +497,8 @@ comms_reset( CommsCtxt* comms, XP_Bool isServer,
#ifdef XWFEATURE_RELAY
static XP_Bool
p_comms_resetTimer( void* closure, XWTimerReason XP_UNUSED_DBG(why) )
p_comms_resetTimer( void* closure, XWEnv XP_UNUSED(xwe),
XWTimerReason XP_UNUSED_DBG(why) )
{
CommsCtxt* comms = (CommsCtxt*)closure;
LOG_FUNC();
@ -2590,7 +2591,7 @@ heartbeat_checks( CommsCtxt* comms )
#if defined RELAY_HEARTBEAT || defined COMMS_HEARTBEAT
static XP_Bool
p_comms_timerFired( void* closure, XWTimerReason XP_UNUSED_DBG(why) )
p_comms_timerFired( void* closure, XWEnv xwe, XWTimerReason XP_UNUSED_DBG(why) )
{
CommsCtxt* comms = (CommsCtxt*)closure;
XP_ASSERT( why == TIMER_COMMS );

View file

@ -69,12 +69,12 @@ dmgr_make( MPFORMAL_NOCOMMA )
}
void
dmgr_destroy( DictMgrCtxt* dmgr )
dmgr_destroy( DictMgrCtxt* dmgr, XWEnv xwe )
{
XP_U16 ii;
for ( ii = 0; ii < DMGR_MAX_DICTS; ++ii ) {
DictPair* pair = &dmgr->pairs[ii];
dict_unref( pair->dict );
dict_unref( pair->dict, xwe );
XP_FREEP( dmgr->mpool, &pair->key );
}
pthread_mutex_destroy( &dmgr->mutex );
@ -82,7 +82,7 @@ dmgr_destroy( DictMgrCtxt* dmgr )
}
DictionaryCtxt*
dmgr_get( DictMgrCtxt* dmgr, const XP_UCHAR* key )
dmgr_get( DictMgrCtxt* dmgr, XWEnv xwe, const XP_UCHAR* key )
{
DictionaryCtxt* result = NULL;
@ -90,7 +90,7 @@ dmgr_get( DictMgrCtxt* dmgr, const XP_UCHAR* key )
XP_S16 index = findFor( dmgr, key );
if ( 0 <= index ) {
result = dict_ref( dmgr->pairs[index].dict ); /* so doesn't get nuked in a race */
result = dict_ref( dmgr->pairs[index].dict, xwe ); /* so doesn't get nuked in a race */
moveToFront( dmgr, index );
}
@ -101,7 +101,7 @@ dmgr_get( DictMgrCtxt* dmgr, const XP_UCHAR* key )
}
void
dmgr_put( DictMgrCtxt* dmgr, const XP_UCHAR* key, DictionaryCtxt* dict )
dmgr_put( DictMgrCtxt* dmgr, XWEnv xwe, const XP_UCHAR* key, DictionaryCtxt* dict )
{
pthread_mutex_lock( &dmgr->mutex );
@ -109,8 +109,8 @@ dmgr_put( DictMgrCtxt* dmgr, const XP_UCHAR* key, DictionaryCtxt* dict )
if ( NOT_FOUND == loc ) { /* reuse the last one */
moveToFront( dmgr, VSIZE(dmgr->pairs) - 1 );
DictPair* pair = dmgr->pairs; /* the head */
dict_unref( pair->dict );
pair->dict = dict_ref( dict );
dict_unref( pair->dict, xwe );
pair->dict = dict_ref( dict, xwe );
replaceStringIfDifferent( dmgr->mpool, &pair->key, key );
} else {
moveToFront( dmgr, loc );

View file

@ -30,10 +30,10 @@ extern "C" {
typedef struct DictMgrCtxt DictMgrCtxt;
DictMgrCtxt* dmgr_make( MPFORMAL_NOCOMMA );
void dmgr_destroy( DictMgrCtxt* dmgr );
void dmgr_destroy( DictMgrCtxt* dmgr, XWEnv xwe );
void dmgr_put( DictMgrCtxt* dmgr, const XP_UCHAR* key, DictionaryCtxt* dict );
DictionaryCtxt* dmgr_get( DictMgrCtxt* dmgr, const XP_UCHAR* key );
void dmgr_put( DictMgrCtxt* dmgr, XWEnv xwe, const XP_UCHAR* key, DictionaryCtxt* dict );
DictionaryCtxt* dmgr_get( DictMgrCtxt* dmgr, XWEnv xwe, const XP_UCHAR* key );
#ifdef CPLUS
}

View file

@ -40,7 +40,7 @@ extern "C" {
****************************************************************************/
DictionaryCtxt*
p_dict_ref( DictionaryCtxt* dict
p_dict_ref( DictionaryCtxt* dict, XWEnv XP_UNUSED(xwe)
#ifdef DEBUG_REF
,const char* func, const char* file, int line
#endif
@ -59,7 +59,7 @@ p_dict_ref( DictionaryCtxt* dict
}
void
p_dict_unref( DictionaryCtxt* dict
p_dict_unref( DictionaryCtxt* dict, XWEnv xwe
#ifdef DEBUG_REF
,const char* func, const char* file, int line
#endif
@ -76,17 +76,17 @@ p_dict_unref( DictionaryCtxt* dict
pthread_mutex_unlock( &dict->mutex );
if ( 0 == dict->refCount ) {
pthread_mutex_destroy( &dict->mutex );
(*dict->destructor)( dict );
(*dict->destructor)( dict, xwe );
}
}
}
void
dict_unref_all( PlayerDicts* pd )
dict_unref_all( PlayerDicts* pd, XWEnv xwe )
{
XP_U16 ii;
for ( ii = 0; ii < MAX_NUM_PLAYERS; ++ii ) {
dict_unref( pd->dicts[ii] );
dict_unref( pd->dicts[ii], xwe );
}
}
@ -435,7 +435,7 @@ freeSpecials( DictionaryCtxt* dict )
} /* freeSpecials */
static void
common_destructor( DictionaryCtxt* dict )
common_destructor( DictionaryCtxt* dict, XWEnv XP_UNUSED(xwe) )
{
freeSpecials( dict );
@ -448,7 +448,7 @@ common_destructor( DictionaryCtxt* dict )
#ifndef XWFEATURE_STANDALONE_ONLY
void
dict_loadFromStream( DictionaryCtxt* dict, XWStreamCtxt* stream )
dict_loadFromStream( DictionaryCtxt* dict, XWEnv xwe, XWStreamCtxt* stream )
{
XP_U8 nFaces, nFaceBytes;
XP_U16 maxCountBits, maxValueBits;
@ -483,7 +483,7 @@ dict_loadFromStream( DictionaryCtxt* dict, XWStreamCtxt* stream )
XP_ASSERT( nFaceBytes < VSIZE(utf8) );
stream_getBytes( stream, utf8, nFaceBytes );
dict->isUTF8 = XP_TRUE; /* need to communicate this in stream */
dict_splitFaces( dict, utf8, nFaceBytes, nFaces );
dict_splitFaces( dict, xwe, utf8, nFaceBytes, nFaces );
for ( nSpecials = ii = 0; ii < nFaces; ++ii ) {
const XP_UCHAR* facep = dict_getTileStringRaw( dict, (Tile)ii );

View file

@ -1,6 +1,6 @@
/* -*-mode: C; fill-column: 78; c-basic-offset: 4; -*- */
/*
* Copyright 1997 - 2009 by Eric House (xwords@eehouse.org). All rights
* Copyright 1997 - 2020 by Eric House (xwords@eehouse.org). All rights
* reserved.
*
* This program is free software; you can redistribute it and/or
@ -59,7 +59,7 @@ typedef struct _XP_Bitmaps {
} XP_Bitmaps;
struct DictionaryCtxt {
void (*destructor)( DictionaryCtxt* dict );
void (*destructor)( DictionaryCtxt* dict, XWEnv xwe );
array_edge* (*func_edge_for_index)( const DictionaryCtxt* dict,
XP_U32 index );
@ -147,24 +147,24 @@ struct DictionaryCtxt {
((Tile)(((array_edge_old*)(edge))->bits & \
((d)->is_4_byte?LETTERMASK_NEW_4:LETTERMASK_NEW_3)))
DictionaryCtxt* p_dict_ref( DictionaryCtxt* dict
DictionaryCtxt* p_dict_ref( DictionaryCtxt* dict, XWEnv xwe
#ifdef DEBUG_REF
,const char* func, const char* file, int line
#endif
);
void p_dict_unref( DictionaryCtxt* dict
void p_dict_unref( DictionaryCtxt* dict, XWEnv xwe
#ifdef DEBUG_REF
,const char* func, const char* file, int line
#endif
);
void dict_unref_all( PlayerDicts* dicts );
void dict_unref_all( PlayerDicts* dicts, XWEnv xwe );
#ifdef DEBUG_REF
# define dict_ref(dict) p_dict_ref( dict, __func__, __FILE__, __LINE__ )
# define dict_unref(dict) p_dict_unref( dict, __func__, __FILE__, __LINE__ )
# define dict_ref(dict, xwe) p_dict_ref( dict, xwe, __func__, __FILE__, __LINE__ )
# define dict_unref(dict, xwe) p_dict_unref( (dict), (xwe), __func__, __FILE__, __LINE__ )
#else
# define dict_ref(dict) p_dict_ref( dict )
# define dict_unref(dict) p_dict_unref( dict )
# define dict_ref(dict, xwe) p_dict_ref( (dict), (xwe) )
# define dict_unref(dict, xwe) p_dict_unref( (dict), (xwe) )
#endif
XP_Bool dict_tilesAreSame( const DictionaryCtxt* dict1,
@ -200,7 +200,7 @@ const XP_UCHAR* dict_getDesc( const DictionaryCtxt* dict );
const XP_UCHAR* dict_getMd5Sum( const DictionaryCtxt* dict );
void dict_writeToStream( const DictionaryCtxt* ctxt, XWStreamCtxt* stream );
void dict_loadFromStream( DictionaryCtxt* dict, XWStreamCtxt* stream );
void dict_loadFromStream( DictionaryCtxt* dict, XWEnv xwe, XWStreamCtxt* stream );
#ifdef TEXT_MODEL
/* Return the strlen of the longest face, e.g. 1 for English and Italian;
@ -219,8 +219,8 @@ DictionaryCtxt* make_stubbed_dict( MPFORMAL_NOCOMMA );
/* To be called only by subclasses!!! */
void dict_super_init( DictionaryCtxt* ctxt );
/* Must be implemented by subclass */
void dict_splitFaces( DictionaryCtxt* dict, const XP_U8* bytes,
XP_U16 nBytes, XP_U16 nFaces );
void dict_splitFaces( DictionaryCtxt* dict, XWEnv xwe, const XP_U8* bytes,
XP_U16 nBytes, XP_U16 nFaceos );
XP_Bool checkSanity( DictionaryCtxt* dict, XP_U32 numEdges );

View file

@ -628,7 +628,7 @@ setLimitsFrom( const BoardCtxt* board, BdHintLimits* limits )
#endif
static XP_Bool
scrollTimerProc( void* closure, XWTimerReason XP_UNUSED_DBG(why) )
scrollTimerProc( void* closure, XWEnv XP_UNUSED(xwe), XWTimerReason XP_UNUSED_DBG(why) )
{
XP_Bool draw = XP_FALSE;
BoardCtxt* board = (BoardCtxt*)closure;

View file

@ -28,8 +28,8 @@
/* typedef struct DrawCtx DrawCtx; */
typedef XP_Bool (*LastScoreCallback)( void* closure, XP_S16 player,
LastMoveInfo* lmi );
typedef XP_Bool (*LastScoreCallback)( void* closure, XWEnv xwe,
XP_S16 player, LastMoveInfo* lmi );
typedef enum {
CELL_NONE = 0x00
@ -47,7 +47,7 @@ typedef enum {
, CELL_ALL = 0x7FF
} CellFlags;
typedef struct DrawScoreInfo {
typedef struct _DrawScoreInfo {
LastScoreCallback lsc;
void* lscClosure;
const XP_UCHAR* name;

View file

@ -105,7 +105,7 @@ setListeners( XWGame* game, const CommonPrefs* cp )
}
void
game_makeNewGame( MPFORMAL XWGame* game, CurGameInfo* gi,
game_makeNewGame( MPFORMAL XWEnv xwe, XWGame* game, CurGameInfo* gi,
XW_UtilCtxt* util, DrawCtx* draw,
const CommonPrefs* cp, const TransportProcs* procs
#ifdef SET_GAMESEED
@ -126,8 +126,8 @@ game_makeNewGame( MPFORMAL XWGame* game, CurGameInfo* gi,
game->util = util;
game->model = model_make( MPPARM(mpool) (DictionaryCtxt*)NULL, NULL, util,
gi->boardSize );
game->model = model_make( MPPARM(mpool) xwe, (DictionaryCtxt*)NULL,
NULL, util, gi->boardSize );
#ifndef XWFEATURE_STANDALONE_ONLY
if ( gi->serverRole != SERVER_STANDALONE ) {
@ -223,16 +223,16 @@ game_reset( MPFORMAL XWGame* game, CurGameInfo* gi, XW_UtilCtxt* util,
#ifdef XWFEATURE_CHANGEDICT
void
game_changeDict( MPFORMAL XWGame* game, CurGameInfo* gi, DictionaryCtxt* dict )
game_changeDict( MPFORMAL XWGame* game, XWEnv xwe, CurGameInfo* gi, DictionaryCtxt* dict )
{
model_setDictionary( game->model, dict );
model_setDictionary( game->model, xwe, dict );
gi_setDict( MPPARM(mpool) gi, dict );
server_resetEngines( game->server );
}
#endif
XP_Bool
game_makeFromStream( MPFORMAL XWStreamCtxt* stream, XWGame* game,
game_makeFromStream( MPFORMAL XWEnv xwe, XWStreamCtxt* stream, XWGame* game,
CurGameInfo* gi, DictionaryCtxt* dict,
const PlayerDicts* dicts, XW_UtilCtxt* util,
DrawCtx* draw, CommonPrefs* cp,
@ -284,7 +284,7 @@ game_makeFromStream( MPFORMAL XWStreamCtxt* stream, XWGame* game,
game->comms = NULL;
}
game->model = model_makeFromStream( MPPARM(mpool) stream, dict,
game->model = model_makeFromStream( MPPARM(mpool) xwe, stream, dict,
dicts, util );
game->server = server_makeFromStream( MPPARM(mpool) stream,
@ -303,14 +303,14 @@ game_makeFromStream( MPFORMAL XWStreamCtxt* stream, XWGame* game,
} /* game_makeFromStream */
void
game_saveNewGame( MPFORMAL const CurGameInfo* gi, XW_UtilCtxt* util,
game_saveNewGame( MPFORMAL XWEnv xwe, const CurGameInfo* gi, XW_UtilCtxt* util,
const CommonPrefs* cp, XWStreamCtxt* out )
{
XWGame newGame = {0};
CurGameInfo newGI = {0};
gi_copy( MPPARM(mpool) &newGI, gi );
game_makeNewGame( MPPARM(mpool) &newGame, &newGI, util,
game_makeNewGame( MPPARM(mpool) xwe, &newGame, &newGI, util,
NULL, /* DrawCtx*, */
cp, NULL /* TransportProcs* procs */
#ifdef SET_GAMESEED
@ -320,7 +320,7 @@ game_saveNewGame( MPFORMAL const CurGameInfo* gi, XW_UtilCtxt* util,
game_saveToStream( &newGame, &newGI, out, 1 );
game_saveSucceeded( &newGame, 1 );
game_dispose( &newGame );
game_dispose( &newGame, xwe );
gi_disposePlayerInfo( MPPARM(mpool) &newGI );
}
@ -358,7 +358,7 @@ game_saveSucceeded( const XWGame* game, XP_U16 saveToken )
}
XP_Bool
game_receiveMessage( XWGame* game, XWStreamCtxt* stream,
game_receiveMessage( XWGame* game, XWEnv xwe, XWStreamCtxt* stream,
const CommsAddrRec* retAddr )
{
ServerCtxt* server = game->server;
@ -368,7 +368,7 @@ game_receiveMessage( XWGame* game, XWStreamCtxt* stream,
if ( result ) {
(void)server_do( server );
result = server_receiveMessage( server, stream );
result = server_receiveMessage( server, xwe, stream );
}
comms_msgProcessed( game->comms, &commsState, !result );
@ -419,7 +419,7 @@ game_getIsServer( const XWGame* game )
}
void
game_dispose( XWGame* game )
game_dispose( XWGame* game, XWEnv xwe )
{
/* The board should be reused!!! PENDING(ehouse) */
if ( !!game->board ) {
@ -435,7 +435,7 @@ game_dispose( XWGame* game )
}
#endif
if ( !!game->model ) {
model_destroy( game->model );
model_destroy( game->model, xwe );
game->model = NULL;
}
if ( !!game->server ) {

View file

@ -61,7 +61,7 @@ typedef struct XWGame {
#endif
} XWGame;
void game_makeNewGame( MPFORMAL XWGame* game, CurGameInfo* gi,
void game_makeNewGame( MPFORMAL XWEnv xwe, XWGame* game, CurGameInfo* gi,
XW_UtilCtxt* util, DrawCtx* draw,
const CommonPrefs* cp, const TransportProcs* procs
#ifdef SET_GAMESEED
@ -70,26 +70,26 @@ void game_makeNewGame( MPFORMAL XWGame* game, CurGameInfo* gi,
);
XP_Bool game_reset( MPFORMAL XWGame* game, CurGameInfo* gi, XW_UtilCtxt* util,
CommonPrefs* cp, const TransportProcs* procs );
void game_changeDict( MPFORMAL XWGame* game, CurGameInfo* gi,
void game_changeDict( MPFORMAL XWGame* game, XWEnv xwe, CurGameInfo* gi,
DictionaryCtxt* dict );
XP_Bool game_makeFromStream( MPFORMAL XWStreamCtxt* stream, XWGame* game,
CurGameInfo* gi, DictionaryCtxt* dict,
const PlayerDicts* dicts, XW_UtilCtxt* util,
DrawCtx* draw, CommonPrefs* cp,
const TransportProcs* procs );
XP_Bool game_makeFromStream( MPFORMAL XWEnv xwe, XWStreamCtxt* stream,
XWGame* game, CurGameInfo* gi,
DictionaryCtxt* dict, const PlayerDicts* dicts,
XW_UtilCtxt* util, DrawCtx* draw,
CommonPrefs* cp, const TransportProcs* procs );
void game_saveNewGame( MPFORMAL const CurGameInfo* gi, XW_UtilCtxt* util,
void game_saveNewGame( MPFORMAL XWEnv xwe, const CurGameInfo* gi, XW_UtilCtxt* util,
const CommonPrefs* cp, XWStreamCtxt* out );
void game_saveToStream( const XWGame* game, const CurGameInfo* gi,
XWStreamCtxt* stream, XP_U16 saveToken );
void game_saveSucceeded( const XWGame* game, XP_U16 saveToken );
XP_Bool game_receiveMessage( XWGame* game, XWStreamCtxt* stream,
XP_Bool game_receiveMessage( XWGame* game, XWEnv xwe, XWStreamCtxt* stream,
const CommsAddrRec* retAddr );
void game_dispose( XWGame* game );
void game_dispose( XWGame* game, XWEnv xwe );
void game_getState( const XWGame* game, GameStateInfo* gsi );
XP_Bool game_getIsServer( const XWGame* game );

View file

@ -53,7 +53,7 @@ static void notifyTrayListeners( ModelCtxt* model, XP_U16 turn,
static void notifyDictListeners( ModelCtxt* model, XP_S16 playerNum,
DictionaryCtxt* oldDict,
DictionaryCtxt* newDict );
static void model_unrefDicts( ModelCtxt* model );
static void model_unrefDicts( ModelCtxt* model, XWEnv xwe );
static CellTile getModelTileRaw( const ModelCtxt* model, XP_U16 col,
XP_U16 row );
@ -91,7 +91,7 @@ static void assertDiffTurn( ModelCtxt* model, XP_U16 turn,
*
****************************************************************************/
ModelCtxt*
model_make( MPFORMAL DictionaryCtxt* dict, const PlayerDicts* dicts,
model_make( MPFORMAL XWEnv xwe, DictionaryCtxt* dict, const PlayerDicts* dicts,
XW_UtilCtxt* util, XP_U16 nCols )
{
ModelCtxt* result = (ModelCtxt*)XP_MALLOC( mpool, sizeof( *result ) );
@ -109,16 +109,17 @@ model_make( MPFORMAL DictionaryCtxt* dict, const PlayerDicts* dicts,
model_setSize( result, nCols );
model_setDictionary( result, dict );
model_setPlayerDicts( result, dicts );
model_setDictionary( result, xwe, dict );
model_setPlayerDicts( result, xwe, dicts );
}
return result;
} /* model_make */
ModelCtxt*
model_makeFromStream( MPFORMAL XWStreamCtxt* stream, DictionaryCtxt* dict,
const PlayerDicts* dicts, XW_UtilCtxt* util )
model_makeFromStream( MPFORMAL XWEnv xwe, XWStreamCtxt* stream,
DictionaryCtxt* dict, const PlayerDicts* dicts,
XW_UtilCtxt* util )
{
ModelCtxt* model;
XP_U16 nCols;
@ -145,12 +146,12 @@ model_makeFromStream( MPFORMAL XWStreamCtxt* stream, DictionaryCtxt* dict,
nPlayers = (XP_U16)stream_getBits( stream, NPLAYERS_NBITS );
if ( hasDict ) {
DictionaryCtxt* savedDict = util_makeEmptyDict( util );
dict_loadFromStream( savedDict, stream );
dict_unref( savedDict );
DictionaryCtxt* savedDict = util_makeEmptyDict( util, xwe );
dict_loadFromStream( savedDict, xwe, stream );
dict_unref( savedDict, xwe );
}
model = model_make( MPPARM(mpool) dict, dicts, util, nCols );
model = model_make( MPPARM(mpool) xwe, dict, dicts, util, nCols );
model->nPlayers = nPlayers;
#ifdef STREAM_VERS_BIGBOARD
@ -294,9 +295,9 @@ model_setSize( ModelCtxt* model, XP_U16 nCols )
} /* model_setSize */
void
model_destroy( ModelCtxt* model )
model_destroy( ModelCtxt* model, XWEnv xwe )
{
model_unrefDicts( model );
model_unrefDicts( model, xwe );
stack_destroy( model->vol.stack );
/* is this it!? */
if ( !!model->vol.bonuses ) {
@ -572,21 +573,21 @@ setStackBits( ModelCtxt* model, const DictionaryCtxt* dict )
}
void
model_setDictionary( ModelCtxt* model, DictionaryCtxt* dict )
model_setDictionary( ModelCtxt* model, XWEnv xwe, DictionaryCtxt* dict )
{
DictionaryCtxt* oldDict = model->vol.dict;
model->vol.dict = dict_ref( dict );
model->vol.dict = dict_ref( dict, xwe );
if ( !!dict ) {
setStackBits( model, dict );
}
notifyDictListeners( model, -1, oldDict, dict );
dict_unref( oldDict );
dict_unref( oldDict, xwe );
} /* model_setDictionary */
void
model_setPlayerDicts( ModelCtxt* model, const PlayerDicts* dicts )
model_setPlayerDicts( ModelCtxt* model, XWEnv xwe, const PlayerDicts* dicts )
{
if ( !!dicts ) {
XP_U16 ii;
@ -599,12 +600,12 @@ model_setPlayerDicts( ModelCtxt* model, const PlayerDicts* dicts )
if ( oldDict != newDict ) {
XP_ASSERT( NULL == newDict || NULL == gameDict
|| dict_tilesAreSame( gameDict, newDict ) );
model->vol.dicts.dicts[ii] = dict_ref( newDict );
model->vol.dicts.dicts[ii] = dict_ref( newDict, xwe );
notifyDictListeners( model, ii, oldDict, newDict );
setStackBits( model, newDict );
dict_unref( oldDict );
dict_unref( oldDict, xwe );
}
}
}
@ -636,14 +637,14 @@ model_getPlayerDict( const ModelCtxt* model, XP_S16 playerNum )
}
static void
model_unrefDicts( ModelCtxt* model )
model_unrefDicts( ModelCtxt* model, XWEnv xwe )
{
XP_U16 ii;
for ( ii = 0; ii < VSIZE(model->vol.dicts.dicts); ++ii ) {
dict_unref( model->vol.dicts.dicts[ii] );
dict_unref( model->vol.dicts.dicts[ii], xwe );
model->vol.dicts.dicts[ii] = NULL;
}
dict_unref( model->vol.dict );
dict_unref( model->vol.dict, xwe );
model->vol.dict = NULL;
}
@ -2437,12 +2438,12 @@ copyStack( const ModelCtxt* model, StackCtxt* destStack,
} /* copyStack */
static ModelCtxt*
makeTmpModel( const ModelCtxt* model, XWStreamCtxt* stream,
makeTmpModel( const ModelCtxt* model, XWEnv xwe, XWStreamCtxt* stream,
MovePrintFuncPre mpf_pre, MovePrintFuncPost mpf_post,
void* closure )
{
ModelCtxt* tmpModel = model_make( MPPARM(model->vol.mpool)
model_getDictionary(model), NULL,
xwe, model_getDictionary(model), NULL,
model->vol.util, model_numCols(model) );
tmpModel->loaner = model;
model_setNPlayers( tmpModel, model->nPlayers );
@ -2454,7 +2455,7 @@ makeTmpModel( const ModelCtxt* model, XWStreamCtxt* stream,
} /* makeTmpModel */
void
model_writeGameHistory( ModelCtxt* model, XWStreamCtxt* stream,
model_writeGameHistory( ModelCtxt* model, XWEnv xwe, XWStreamCtxt* stream,
ServerCtxt* server, XP_Bool gameOver )
{
MovePrintClosure closure = {
@ -2464,9 +2465,9 @@ model_writeGameHistory( ModelCtxt* model, XWStreamCtxt* stream,
.nPrinted = 0
};
ModelCtxt* tmpModel = makeTmpModel( model, stream, printMovePre,
ModelCtxt* tmpModel = makeTmpModel( model, xwe, stream, printMovePre,
printMovePost, &closure );
model_destroy( tmpModel );
model_destroy( tmpModel, xwe );
if ( gameOver ) {
/* if the game's over, it shouldn't matter which model I pass to this
@ -2489,14 +2490,14 @@ getFirstWord( const WNParams* wnp, void* closure )
}
static void
scoreLastMove( ModelCtxt* model, MoveInfo* moveInfo, XP_U16 howMany,
scoreLastMove( ModelCtxt* model, XWEnv xwe, MoveInfo* moveInfo, XP_U16 howMany,
LastMoveInfo* lmi )
{
XP_U16 score;
WordNotifierInfo notifyInfo;
FirstWordData data;
ModelCtxt* tmpModel = makeTmpModel( model, NULL, NULL, NULL, NULL );
ModelCtxt* tmpModel = makeTmpModel( model, xwe, NULL, NULL, NULL, NULL );
XP_U16 turn;
XP_S16 moveNum = -1;
@ -2513,7 +2514,7 @@ scoreLastMove( ModelCtxt* model, MoveInfo* moveInfo, XP_U16 howMany,
score = figureMoveScore( tmpModel, turn, moveInfo, (EngineCtxt*)NULL,
(XWStreamCtxt*)NULL, &notifyInfo );
model_destroy( tmpModel );
model_destroy( tmpModel, xwe );
lmi->score = score;
XP_SNPRINTF( lmi->word, VSIZE(lmi->word), "%s", data.word );
@ -2614,11 +2615,11 @@ listWordsThrough( const WNParams* wnp, void* closure )
*
* How? Undo backwards until we find the move that placed that tile.*/
XP_Bool
model_listWordsThrough( ModelCtxt* model, XP_U16 col, XP_U16 row,
model_listWordsThrough( ModelCtxt* model, XWEnv xwe, XP_U16 col, XP_U16 row,
XP_S16 turn, XWStreamCtxt* stream )
{
XP_Bool found = XP_FALSE;
ModelCtxt* tmpModel = makeTmpModel( model, NULL, NULL, NULL, NULL );
ModelCtxt* tmpModel = makeTmpModel( model, xwe, NULL, NULL, NULL, NULL );
copyStack( model, tmpModel->vol.stack, model->vol.stack );
XP_Bool isHorizontal;
@ -2672,7 +2673,7 @@ model_listWordsThrough( ModelCtxt* model, XP_U16 col, XP_U16 row,
found = 0 < lwtInfo.nWords;
}
model_destroy( tmpModel );
model_destroy( tmpModel, xwe );
return found;
} /* model_listWordsThrough */
#endif
@ -2698,7 +2699,8 @@ listHighestScores( const ModelCtxt* model, LastMoveInfo* lmi, MoveRec* move )
}
XP_Bool
model_getPlayersLastScore( ModelCtxt* model, XP_S16 player, LastMoveInfo* lmi )
model_getPlayersLastScore( ModelCtxt* model, XWEnv xwe,
XP_S16 player, LastMoveInfo* lmi )
{
StackCtxt* stack = model->vol.stack;
XP_S16 nEntries, which;
@ -2736,7 +2738,7 @@ model_getPlayersLastScore( ModelCtxt* model, XP_S16 player, LastMoveInfo* lmi )
XP_ASSERT( !inDuplicateMode || entry.playerNum == DUP_PLAYER );
lmi->nTiles = entry.u.move.moveInfo.nTiles;
if ( 0 < entry.u.move.moveInfo.nTiles ) {
scoreLastMove( model, &entry.u.move.moveInfo,
scoreLastMove( model, xwe, &entry.u.move.moveInfo,
nEntries - which, lmi );
if ( inDuplicateMode ) {
listHighestScores( model, lmi, &entry.u.move );

View file

@ -105,10 +105,10 @@ typedef XP_U8 TileBit; /* bits indicating selection of tiles in tray */
only */
ModelCtxt* model_make( MPFORMAL DictionaryCtxt* dict, const PlayerDicts* dicts,
XW_UtilCtxt* util, XP_U16 nCols );
ModelCtxt* model_make( MPFORMAL XWEnv xwe, DictionaryCtxt* dict,
const PlayerDicts* dicts, XW_UtilCtxt* util, XP_U16 nCols );
ModelCtxt* model_makeFromStream( MPFORMAL XWStreamCtxt* stream,
ModelCtxt* model_makeFromStream( MPFORMAL XWEnv xwe, XWStreamCtxt* stream,
DictionaryCtxt* dict, const PlayerDicts* dicts,
XW_UtilCtxt* util );
@ -119,7 +119,7 @@ void model_writeToTextStream( const ModelCtxt* model, XWStreamCtxt* stream );
#endif
void model_setSize( ModelCtxt* model, XP_U16 boardSize );
void model_destroy( ModelCtxt* model );
void model_destroy( ModelCtxt* model, XWEnv xwe );
XP_U32 model_getHash( const ModelCtxt* model );
XP_Bool model_hashMatches( const ModelCtxt* model, XP_U32 hash );
XP_Bool model_popToHash( ModelCtxt* model, const XP_U32 hash,
@ -128,10 +128,10 @@ XP_Bool model_popToHash( ModelCtxt* model, const XP_U32 hash,
void model_setNPlayers( ModelCtxt* model, XP_U16 numPlayers );
XP_U16 model_getNPlayers( const ModelCtxt* model );
void model_setDictionary( ModelCtxt* model, DictionaryCtxt* dict );
void model_setDictionary( ModelCtxt* model, XWEnv xwe, DictionaryCtxt* dict );
DictionaryCtxt* model_getDictionary( const ModelCtxt* model );
void model_setPlayerDicts( ModelCtxt* model, const PlayerDicts* dicts );
void model_setPlayerDicts( ModelCtxt* model, XWEnv xwe, const PlayerDicts* dicts );
DictionaryCtxt* model_getPlayerDict( const ModelCtxt* model, XP_S16 playerNum );
XP_Bool model_getTile( const ModelCtxt* model, XP_U16 col, XP_U16 row,
@ -272,7 +272,7 @@ void model_foreachPendingCell( ModelCtxt* model, XP_S16 turn,
BoardListener bl, void* data );
void model_foreachPrevCell( ModelCtxt* model, BoardListener bl, void* data );
void model_writeGameHistory( ModelCtxt* model, XWStreamCtxt* stream,
void model_writeGameHistory( ModelCtxt* model, XWEnv xwe, XWStreamCtxt* stream,
ServerCtxt* server, /* for player names */
XP_Bool gameOver );
@ -305,10 +305,10 @@ XP_Bool getCurrentMoveScoreIfLegal( ModelCtxt* model, XP_S16 turn,
WordNotifierInfo* wni, XP_S16* score );
XP_S16 model_getPlayerScore( ModelCtxt* model, XP_S16 player );
XP_Bool model_getPlayersLastScore( ModelCtxt* model, XP_S16 player,
XP_Bool model_getPlayersLastScore( ModelCtxt* model, XWEnv xwe, XP_S16 player,
LastMoveInfo* info );
#ifdef XWFEATURE_BOARDWORDS
XP_Bool model_listWordsThrough( ModelCtxt* model, XP_U16 col, XP_U16 row,
XP_Bool model_listWordsThrough( ModelCtxt* model, XWEnv xwe, XP_U16 col, XP_U16 row,
XP_S16 turn, XWStreamCtxt* stream );
#endif

View file

@ -30,10 +30,10 @@ extern "C" {
#endif
static XP_Bool
board_ScoreCallback( void* closure, XP_S16 player, LastMoveInfo* lmi )
board_ScoreCallback( void* closure, XWEnv xwe, XP_S16 player, LastMoveInfo* lmi )
{
ModelCtxt* model = (ModelCtxt*)closure;
return model_getPlayersLastScore( model, player, lmi );
return model_getPlayersLastScore( model, xwe, player, lmi );
} /* board_ScoreCallback */
#ifdef XWFEATURE_SCOREONEPASS
@ -159,7 +159,7 @@ centerIn( XP_Rect* rInner, const XP_Rect* rOuter, XP_U16 width, XP_U16 height )
rInner->top = rOuter->top + ( (rOuter->height - height) / 2 );
}
typedef struct DrawScoreData {
typedef struct _DrawScoreData {
DrawScoreInfo dsi;
XP_U16 height;
XP_U16 width;

View file

@ -1012,7 +1012,7 @@ updateOthersTiles( ServerCtxt* server )
}
static XP_Bool
checkDupTimerProc( void* closure, XWTimerReason XP_UNUSED_DBG(XP_why) )
checkDupTimerProc( void* closure, XWEnv XP_UNUSED(xwe), XWTimerReason XP_UNUSED_DBG(XP_why) )
{
XP_ASSERT( XP_why == TIMER_DUP_TIMERCHECK );
ServerCtxt* server = (ServerCtxt*)closure;
@ -1412,7 +1412,7 @@ makeRobotMove( ServerCtxt* server )
#ifdef XWFEATURE_SLOW_ROBOT
static XP_Bool
wakeRobotProc( void* closure, XWTimerReason XP_UNUSED_DBG(why) )
wakeRobotProc( void* closure, XWEnv XP_UNUSED(xwe), XWTimerReason XP_UNUSED_DBG(why) )
{
XP_ASSERT( TIMER_SLOWROBOT == why );
ServerCtxt* server = (ServerCtxt*)closure;
@ -1796,7 +1796,7 @@ sortTilesIf( ServerCtxt* server, XP_S16 turn )
* tray contents.
*/
static XP_Bool
client_readInitialMessage( ServerCtxt* server, XWStreamCtxt* stream )
client_readInitialMessage( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* stream )
{
LOG_FUNC();
XP_Bool accepted = 0 == server->nv.addresses[0].channelNo;
@ -1834,8 +1834,8 @@ client_readInitialMessage( ServerCtxt* server, XWStreamCtxt* stream )
XP_U16 nCols = localGI.boardSize;
DictionaryCtxt* newDict = util_makeEmptyDict( server->vol.util );
dict_loadFromStream( newDict, stream );
DictionaryCtxt* newDict = util_makeEmptyDict( server->vol.util, xwe );
dict_loadFromStream( newDict, xwe, stream );
#ifdef STREAM_VERS_BIGBOARD
if ( STREAM_VERS_DICTNAME <= streamVersion ) {
@ -1866,7 +1866,7 @@ client_readInitialMessage( ServerCtxt* server, XWStreamCtxt* stream )
XP_ASSERT( !!newDict );
if ( curDict == NULL ) {
model_setDictionary( model, newDict );
model_setDictionary( model, xwe, newDict );
} else if ( dict_tilesAreSame( newDict, curDict ) ) {
/* keep the dict the local user installed */
#ifdef STREAM_VERS_BIGBOARD
@ -1879,11 +1879,11 @@ client_readInitialMessage( ServerCtxt* server, XWStreamCtxt* stream )
}
#endif
} else {
model_setDictionary( model, newDict );
model_setDictionary( model, xwe, newDict );
util_userError( server->vol.util, ERR_SERVER_DICT_WINS );
clearLocalRobots( server );
}
dict_unref( newDict ); /* new owner will have ref'd */
dict_unref( newDict, xwe ); /* new owner will have ref'd */
XP_ASSERT( !server->pool );
makePoolOnce( server );
@ -4069,7 +4069,7 @@ readProto( ServerCtxt* server, XWStreamCtxt* stream )
}
XP_Bool
server_receiveMessage( ServerCtxt* server, XWStreamCtxt* incoming )
server_receiveMessage( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* incoming )
{
XP_Bool accepted = XP_FALSE;
XP_Bool isServer = amServer( server );
@ -4093,7 +4093,7 @@ server_receiveMessage( ServerCtxt* server, XWStreamCtxt* incoming )
accepted = !isServer;
if ( accepted ) {
XP_STATUSF( "client got XWPROTO_CLIENT_SETUP" );
accepted = client_readInitialMessage( server, incoming );
accepted = client_readInitialMessage( server, xwe, incoming );
}
break;
#ifdef XWFEATURE_CHAT

View file

@ -109,7 +109,7 @@ XP_Bool server_commitTrade( ServerCtxt* server, const TrayTileSet* oldTiles,
void server_endGame( ServerCtxt* server );
/* called when running as either client or server */
XP_Bool server_receiveMessage( ServerCtxt* server, XWStreamCtxt* incoming );
XP_Bool server_receiveMessage( ServerCtxt* server, XWEnv xwe, XWStreamCtxt* incoming );
/* client-side messages. Client (platform code)owns the stream used to talk
* to the server, and passes it in. */

View file

@ -79,7 +79,7 @@ typedef struct _BadWordInfo {
} BadWordInfo;
/* XWTimerProc returns true if redraw was necessitated by what the proc did */
typedef XP_Bool (*XWTimerProc)( void* closure, XWTimerReason why );
typedef XP_Bool (*XWTimerProc)( void* closure, XWEnv xwe, XWTimerReason why );
/* Platform-specific utility functions that need to be
*/
@ -142,7 +142,7 @@ typedef struct UtilVtable {
void (*m_util_requestTime)( XW_UtilCtxt* uc );
XP_Bool (*m_util_altKeyDown)( XW_UtilCtxt* uc );
DictionaryCtxt* (*m_util_makeEmptyDict)( XW_UtilCtxt* uc );
DictionaryCtxt* (*m_util_makeEmptyDict)( XW_UtilCtxt* uc, XWEnv xwe );
void (*m_util_notifyIllegalWords)( XW_UtilCtxt* uc, BadWordInfo* bwi,
XP_U16 turn, XP_Bool turnLost );
@ -274,8 +274,8 @@ struct XW_UtilCtxt {
#define util_altKeyDown( uc ) \
(uc)->vtable->m_util_altKeyDown((uc))
#define util_makeEmptyDict( uc ) \
(uc)->vtable->m_util_makeEmptyDict((uc))
#define util_makeEmptyDict( uc, xwe ) \
(uc)->vtable->m_util_makeEmptyDict((uc), (xwe))
#define util_notifyIllegalWords( uc, w, p, b ) \
(uc)->vtable->m_util_notifyIllegalWords((uc),(w),(p),(b))

View file

@ -475,10 +475,10 @@ disposeBoard( CursesBoardGlobals* bGlobals )
clearOneSecondTimer( cGlobals );
gi_disposePlayerInfo( MPPARM(cGlobals->util->mpool) cGlobals->gi );
game_dispose( &cGlobals->game );
game_dispose( &cGlobals->game, NULL_XWE );
if ( !!cGlobals->dict ) {
dict_unref( cGlobals->dict );
dict_unref( cGlobals->dict, NULL_XWE );
}
disposeUtil( cGlobals );
@ -1045,7 +1045,7 @@ curses_util_playerScoreHeld( XW_UtilCtxt* uc, XP_U16 player )
{
CursesBoardGlobals* bGlobals = (CursesBoardGlobals*)uc->closure;
LastMoveInfo lmi;
if ( model_getPlayersLastScore( bGlobals->cGlobals.game.model,
if ( model_getPlayersLastScore( bGlobals->cGlobals.game.model, NULL_XWE,
player, &lmi ) ) {
XP_UCHAR buf[128];
formatLMI( &lmi, buf, VSIZE(buf) );

View file

@ -708,9 +708,9 @@ cleanup( GtkGameGlobals* globals )
#ifdef XWFEATURE_RELAY
linux_close_socket( cGlobals );
#endif
game_dispose( &cGlobals->game );
game_dispose( &cGlobals->game, NULL_XWE );
gi_disposePlayerInfo( MEMPOOL cGlobals->gi );
dict_unref( cGlobals->dict );
dict_unref( cGlobals->dict, NULL_XWE );
linux_util_vt_destroy( cGlobals->util );
free( cGlobals->util );
@ -899,7 +899,7 @@ change_dictionary( GtkWidget* XP_UNUSED(widget), GtkGameGlobals* globals )
DictionaryCtxt* dict =
linux_dictionary_make( MPPARM(cGlobals->util->mpool) params, name,
params->useMmap );
game_changeDict( MPPARM(cGlobals->util->mpool) &cGlobals->game,
game_changeDict( MPPARM(cGlobals->util->mpool) &cGlobals->game, NULL_XWE,
cGlobals->gi, dict );
}
g_slist_free( dicts );
@ -1991,7 +1991,7 @@ gtk_util_playerScoreHeld( XW_UtilCtxt* uc, XP_U16 player )
LastMoveInfo lmi;
if ( model_getPlayersLastScore( globals->cGlobals.game.model,
player, &lmi ) ) {
NULL_XWE, player, &lmi ) ) {
XP_UCHAR buf[128];
formatLMI( &lmi, buf, VSIZE(buf) );
(void)gtkask( globals->window, buf, GTK_BUTTONS_OK, NULL );
@ -2612,7 +2612,7 @@ loadGameNoDraw( GtkGameGlobals* globals, LaunchParams* params,
if ( NULL == cGlobals->dict ) {
cGlobals->dict = makeDictForStream( cGlobals, stream );
}
loaded = game_makeFromStream( MEMPOOL stream, &cGlobals->game,
loaded = game_makeFromStream( MEMPOOL NULL_XWE, stream, &cGlobals->game,
cGlobals->gi, cGlobals->dict,
&cGlobals->dicts, cGlobals->util,
(DrawCtx*)NULL, &cGlobals->cp, &procs );
@ -2625,7 +2625,7 @@ loadGameNoDraw( GtkGameGlobals* globals, LaunchParams* params,
}
#endif
} else {
game_dispose( &cGlobals->game );
game_dispose( &cGlobals->game, NULL_XWE );
}
}
stream_destroy( stream );

View file

@ -344,7 +344,7 @@ make_rematch( GtkAppGlobals* apg, const CommonGlobals* cGlobals )
gi.serverRole = SERVER_ISSERVER;
gi.forceChannel = 0;
}
game_saveNewGame( MPPARM(cGlobals->util->mpool) &gi,
game_saveNewGame( MPPARM(cGlobals->util->mpool) NULL_XWE, &gi,
cGlobals->util, &cGlobals->cp, stream );
sqlite3_int64 rowID = writeNewGameToDB( stream, params->pDb );

View file

@ -53,20 +53,20 @@ typedef struct LinuxDictionaryCtxt {
static XP_Bool initFromDictFile( LinuxDictionaryCtxt* dctx,
const LaunchParams* params,
const char* fileName );
static void linux_dictionary_destroy( DictionaryCtxt* dict );
static void linux_dictionary_destroy( DictionaryCtxt* dict, XWEnv xwe );
static const XP_UCHAR* linux_dict_getShortName( const DictionaryCtxt* dict );
/*****************************************************************************
*
****************************************************************************/
DictionaryCtxt*
linux_dictionary_make( MPFORMAL const LaunchParams* params,
linux_dictionary_make( MPFORMAL XWEnv xwe, const LaunchParams* params,
const char* dictFileName, XP_Bool useMMap )
{
LinuxDictionaryCtxt* result = NULL;
if ( !!dictFileName ) {
/* dmgr_get increments ref count before returning! */
result = (LinuxDictionaryCtxt*)dmgr_get( params->dictMgr, dictFileName );
result = (LinuxDictionaryCtxt*)dmgr_get( params->dictMgr, xwe, dictFileName );
}
if ( !result ) {
result = (LinuxDictionaryCtxt*)XP_CALLOC(mpool, sizeof(*result));
@ -88,11 +88,11 @@ linux_dictionary_make( MPFORMAL const LaunchParams* params,
result = NULL;
}
dmgr_put( params->dictMgr, dictFileName, &result->super );
dmgr_put( params->dictMgr, xwe, dictFileName, &result->super );
} else {
XP_LOGF( "%s(): no file name!!", __func__ );
}
(void)dict_ref( &result->super );
(void)dict_ref( &result->super, xwe );
}
return &result->super;
@ -215,7 +215,7 @@ skipBitmaps( LinuxDictionaryCtxt* ctxt, const XP_U8** ptrp )
} /* skipBitmaps */
void
dict_splitFaces( DictionaryCtxt* dict, const XP_U8* utf8,
dict_splitFaces( DictionaryCtxt* dict, XWEnv XP_UNUSED(xwe), const XP_U8* utf8,
XP_U16 nBytes, XP_U16 nFaces )
{
XP_UCHAR* faces = XP_MALLOC( dict->mpool, nBytes + nFaces );
@ -408,7 +408,7 @@ initFromDictFile( LinuxDictionaryCtxt* dctx, const LaunchParams* params,
memcpy( tmp, ptr, numFaceBytes );
ptr += numFaceBytes;
dict_splitFaces( &dctx->super, tmp, numFaceBytes, numFaces );
dict_splitFaces( &dctx->super, NULL, tmp, numFaceBytes, numFaces );
memcpy( &xloc, ptr, sizeof(xloc) );
ptr += sizeof(xloc);
@ -495,7 +495,7 @@ freeSpecials( LinuxDictionaryCtxt* ctxt )
} /* freeSpecials */
static void
linux_dictionary_destroy( DictionaryCtxt* dict )
linux_dictionary_destroy( DictionaryCtxt* dict, XWEnv XP_UNUSED(xwe) )
{
LinuxDictionaryCtxt* ctxt = (LinuxDictionaryCtxt*)dict;

View file

@ -210,7 +210,7 @@ linuxOpenGame( CommonGlobals* cGlobals, const TransportProcs* procs,
XP_ASSERT( !!cGlobals->dict );
}
opened = game_makeFromStream( MEMPOOL stream, &cGlobals->game,
opened = game_makeFromStream( MEMPOOL NULL_XWE, stream, &cGlobals->game,
cGlobals->gi, cGlobals->dict,
&cGlobals->dicts, cGlobals->util,
cGlobals->draw,
@ -222,7 +222,7 @@ linuxOpenGame( CommonGlobals* cGlobals, const TransportProcs* procs,
if ( !opened /* && canMakeFromGI( cGlobals->gi )*/ ) {
opened = XP_TRUE;
game_makeNewGame( MEMPOOL &cGlobals->game, cGlobals->gi,
game_makeNewGame( MEMPOOL NULL_XWE, &cGlobals->game, cGlobals->gi,
cGlobals->util, cGlobals->draw,
&cGlobals->cp, procs
#ifdef SET_GAMESEED
@ -287,9 +287,9 @@ linuxOpenGame( CommonGlobals* cGlobals, const TransportProcs* procs,
}
XP_ASSERT( !!cGlobals->dict );
model_setDictionary( cGlobals->game.model, cGlobals->dict );
model_setDictionary( cGlobals->game.model, NULL_XWE, cGlobals->dict );
setSquareBonuses( cGlobals );
model_setPlayerDicts( cGlobals->game.model, &cGlobals->dicts );
model_setPlayerDicts( cGlobals->game.model, NULL_XWE, &cGlobals->dicts );
/* Need to save in order to have a valid selRow for the first send */
linuxSaveGame( cGlobals );
@ -399,8 +399,8 @@ makeDictForStream( CommonGlobals* cGlobals, XWStreamCtxt* stream )
{
CurGameInfo gi = {0};
XWStreamPos pos = stream_getPos( stream, POS_READ );
if ( !game_makeFromStream( MPPARM(cGlobals->util->mpool) stream, NULL, &gi,
NULL, NULL, NULL, NULL, NULL, NULL ) ) {
if ( !game_makeFromStream( MPPARM(cGlobals->util->mpool) NULL_XWE, stream,
NULL, &gi, NULL, NULL, NULL, NULL, NULL, NULL ) ) {
XP_ASSERT(0);
}
stream_setPos( stream, POS_READ, pos );
@ -422,7 +422,7 @@ gameGotBuf( CommonGlobals* cGlobals, XP_Bool hasDraw, const XP_U8* buf,
XWGame* game = &cGlobals->game;
XWStreamCtxt* stream = stream_from_msgbuf( cGlobals, buf, len );
if ( !!stream ) {
redraw = game_receiveMessage( game, stream, from );
redraw = game_receiveMessage( game, NULL_XWE, stream, from );
if ( redraw ) {
linuxSaveGame( cGlobals );
}
@ -524,7 +524,7 @@ catGameHistory( CommonGlobals* cGlobals )
mem_stream_make( MPPARM(cGlobals->util->mpool)
cGlobals->params->vtMgr,
NULL, CHANNEL_NONE, catOnClose );
model_writeGameHistory( cGlobals->game.model, stream,
model_writeGameHistory( cGlobals->game.model, NULL_XWE, stream,
cGlobals->game.server, gameOver );
stream_putU8( stream, '\n' );
stream_destroy( stream );
@ -618,7 +618,7 @@ handle_messages_from( CommonGlobals* cGlobals, const TransportProcs* procs,
XP_Bool opened =
#endif
game_makeFromStream( MPPARM(cGlobals->util->mpool)
stream, &cGlobals->game,
NULL_XWE, stream, &cGlobals->game,
cGlobals->gi, cGlobals->dict,
&cGlobals->dicts, cGlobals->util,
NULL /*draw*/,
@ -647,7 +647,7 @@ handle_messages_from( CommonGlobals* cGlobals, const TransportProcs* procs,
stream = mem_stream_make_raw( MPPARM(cGlobals->util->mpool)
params->vtMgr );
stream_putBytes( stream, buf, len );
(void)game_receiveMessage( &cGlobals->game, stream, NULL );
(void)game_receiveMessage( &cGlobals->game, NULL_XWE, stream, NULL );
stream_destroy( stream );
}
@ -665,7 +665,7 @@ read_pipe_then_close( CommonGlobals* cGlobals, const TransportProcs* procs )
XP_Bool opened =
#endif
game_makeFromStream( MPPARM(cGlobals->util->mpool)
stream, &cGlobals->game,
NULL_XWE, stream, &cGlobals->game,
cGlobals->gi, cGlobals->dict,
&cGlobals->dicts, cGlobals->util,
NULL /*draw*/,
@ -697,7 +697,7 @@ read_pipe_then_close( CommonGlobals* cGlobals, const TransportProcs* procs )
stream = mem_stream_make_raw( MPPARM(cGlobals->util->mpool)
params->vtMgr );
stream_putBytes( stream, buf, len );
(void)game_receiveMessage( &cGlobals->game, stream, NULL );
(void)game_receiveMessage( &cGlobals->game, NULL_XWE, stream, NULL );
stream_destroy( stream );
}
@ -1431,8 +1431,7 @@ linux_relay_ioproc( GIOChannel* source, GIOCondition condition, gpointer data )
if ( !!inboundS ) {
CommsAddrRec addr = {0};
addr_addType( &addr, COMMS_CONN_RELAY );
redraw = game_receiveMessage( &cGlobals->game, inboundS, &addr );
redraw = game_receiveMessage( &cGlobals->game, NULL_XWE, inboundS, &addr );
stream_destroy( inboundS );
}
@ -1764,7 +1763,7 @@ linuxFireTimer( CommonGlobals* cGlobals, XWTimerReason why )
tip->proc = NULL;
if ( !!proc ) {
draw = (*proc)( closure, why );
draw = (*proc)( closure, NULL_XWE, why );
} else {
XP_LOGF( "%s: skipping timer %d; cancelled?", __func__, why );
}
@ -2093,7 +2092,7 @@ walk_dict_test_all( MPFORMAL const LaunchParams* params, GSList* testDicts,
if ( NULL != dict ) {
XP_LOGF( "walk_dict_test(%s)", name );
walk_dict_test( MPPARM(mpool) dict, testPrefixes, testMinMax );
dict_unref( dict );
dict_unref( dict, NULL_XWE );
}
}
}
@ -2474,7 +2473,7 @@ freeParams( LaunchParams* params )
vtmgr_destroy( MPPARM(params->mpool) params->vtMgr );
dutils_free( &params->dutil );
dmgr_destroy( params->dictMgr );
dmgr_destroy( params->dictMgr, NULL_XWE );
gi_disposePlayerInfo( MPPARM(params->mpool) &params->pgi );
mpool_destroy( params->mpool );
@ -2491,7 +2490,7 @@ dawg2dict( const LaunchParams* params, GSList* testDicts )
params->useMmap );
if ( NULL != dict ) {
dumpDict( dict );
dict_unref( dict );
dict_unref( dict, NULL_XWE );
}
}
return 0;
@ -3075,7 +3074,7 @@ main( int argc, char** argv )
XP_ASSERT( !!dict );
mainParams.pgi.dictLang = dict_getLangCode( dict );
XP_LOGFF( "set lang code: %d", mainParams.pgi.dictLang );
dict_unref( dict );
dict_unref( dict, NULL_XWE );
} else if ( isServer ) {
#ifdef STUBBED_DICT
foo

View file

@ -104,7 +104,7 @@ linux_freep( void** ptrp )
#endif
static DictionaryCtxt*
linux_util_makeEmptyDict( XW_UtilCtxt* XP_UNUSED_DBG(uctx) )
linux_util_makeEmptyDict( XW_UtilCtxt* XP_UNUSED_DBG(uctx), XWEnv XP_UNUSED(xwe) )
{
XP_DEBUGF( "linux_util_makeEmptyDict called" );
return linux_dictionary_make( MPPARM(uctx->mpool) NULL, NULL, XP_FALSE );

View file

@ -296,4 +296,6 @@ typedef struct _GtkAppGlobals {
} GtkAppGlobals;
#endif
#define NULL_XWE ((XWEnv*)NULL)
#endif

View file

@ -65,6 +65,8 @@ typedef guint32 XP_Time;
typedef unsigned long XP_Time;
#endif
typedef void* XWEnv;
#define XP_CR XP_L("\n")
#define XP_STATUSF XP_DEBUGF