From 761f93dd7ea736039c674a1239206e9d1cc8b8ee Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 11 Sep 2012 19:07:00 -0700 Subject: [PATCH] use new mem_stream_make_sized --- xwords4/linux/linuxmain.c | 9 +++++---- xwords4/linux/main.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) 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;