diff --git a/xwords4/linux/linuxmain.c b/xwords4/linux/linuxmain.c index 037b881a9..4ae698aa0 100644 --- a/xwords4/linux/linuxmain.c +++ b/xwords4/linux/linuxmain.c @@ -248,15 +248,16 @@ saveGame( CommonGlobals* cGlobals ) if ( doSave ) { XWStreamCtxt* outStream; - outStream = mem_stream_make( cGlobals->params->util->mpool, - cGlobals->params->vtMgr, - cGlobals, 0, writeToFile ); + outStream = mem_stream_make_sized( cGlobals->params->util->mpool, + cGlobals->params->vtMgr, + cGlobals->lastStreamSize, + cGlobals, 0, writeToFile ); stream_open( outStream ); game_saveToStream( &cGlobals->game, &cGlobals->params->gi, outStream, ++cGlobals->curSaveToken ); - + cGlobals->lastStreamSize = stream_getSize( outStream ); stream_destroy( outStream ); game_saveSucceeded( &cGlobals->game, cGlobals->curSaveToken ); diff --git a/xwords4/linux/main.h b/xwords4/linux/main.h index f8558b02f..06432cec0 100644 --- a/xwords4/linux/main.h +++ b/xwords4/linux/main.h @@ -163,6 +163,7 @@ struct CommonGlobals { XWGame game; XP_U16 lastNTilesToUse; + XP_U16 lastStreamSize; SocketChangedFunc socketChanged; void* socketChangedClosure;