mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
cleanup: rename function and remove unused param
This commit is contained in:
parent
02d5d26c60
commit
4813c95976
7 changed files with 14 additions and 15 deletions
|
@ -94,9 +94,9 @@ dbg_logstream( const XWStreamCtxt* stream, const char* func, int line )
|
||||||
if ( !!stream ) {
|
if ( !!stream ) {
|
||||||
XP_U16 len = 0;
|
XP_U16 len = 0;
|
||||||
XWStreamPos end = stream_getPos( stream, POS_WRITE );
|
XWStreamPos end = stream_getPos( stream, POS_WRITE );
|
||||||
stream_copyBits( stream, 0, end, NULL, &len );
|
stream_copyBits( stream, end, NULL, &len );
|
||||||
XP_U8 buf[len];
|
XP_U8 buf[len];
|
||||||
stream_copyBits( stream, 0, end, buf, &len );
|
stream_copyBits( stream, end, buf, &len );
|
||||||
char comment[128];
|
char comment[128];
|
||||||
XP_SNPRINTF( comment, VSIZE(comment), "%s line %d", func, line );
|
XP_SNPRINTF( comment, VSIZE(comment), "%s line %d", func, line );
|
||||||
LOG_HEX( buf, len, comment );
|
LOG_HEX( buf, len, comment );
|
||||||
|
|
|
@ -186,8 +186,8 @@ mem_stream_getBits( XWStreamCtxt* p_sctx, XP_U16 nBits )
|
||||||
|
|
||||||
#if defined HASH_STREAM || defined DEBUG
|
#if defined HASH_STREAM || defined DEBUG
|
||||||
static void
|
static void
|
||||||
mem_stream_copyBits( const XWStreamCtxt* p_sctx, XWStreamPos XP_UNUSED(startPos),
|
mem_stream_copyBits( const XWStreamCtxt* p_sctx, XWStreamPos endPos,
|
||||||
XWStreamPos endPos, XP_U8* buf, XP_U16* lenp )
|
XP_U8* buf, XP_U16* lenp )
|
||||||
{
|
{
|
||||||
MemStreamCtxt* stream = (MemStreamCtxt*)p_sctx;
|
MemStreamCtxt* stream = (MemStreamCtxt*)p_sctx;
|
||||||
XP_U16 len = BYTE_PART(endPos);
|
XP_U16 len = BYTE_PART(endPos);
|
||||||
|
|
|
@ -343,7 +343,7 @@ model_hashMatches( const ModelCtxt* model, const XP_U32 hash )
|
||||||
}
|
}
|
||||||
|
|
||||||
XP_Bool
|
XP_Bool
|
||||||
model_revertToHash( ModelCtxt* model, const XP_U32 hash, PoolContext* pool )
|
model_popToHash( ModelCtxt* model, const XP_U32 hash, PoolContext* pool )
|
||||||
{
|
{
|
||||||
XP_U16 nPopped = 0;
|
XP_U16 nPopped = 0;
|
||||||
StackCtxt* stack = model->vol.stack;
|
StackCtxt* stack = model->vol.stack;
|
||||||
|
|
|
@ -124,7 +124,7 @@ void model_setSize( ModelCtxt* model, XP_U16 boardSize );
|
||||||
void model_destroy( ModelCtxt* model );
|
void model_destroy( ModelCtxt* model );
|
||||||
XP_U32 model_getHash( const ModelCtxt* model, XP_U16 version );
|
XP_U32 model_getHash( const ModelCtxt* model, XP_U16 version );
|
||||||
XP_Bool model_hashMatches( const ModelCtxt* model, XP_U32 hash );
|
XP_Bool model_hashMatches( const ModelCtxt* model, XP_U32 hash );
|
||||||
XP_Bool model_revertToHash( ModelCtxt* model, const XP_U32 hash,
|
XP_Bool model_popToHash( ModelCtxt* model, const XP_U32 hash,
|
||||||
PoolContext* pool );
|
PoolContext* pool );
|
||||||
|
|
||||||
void model_setNPlayers( ModelCtxt* model, XP_U16 numPlayers );
|
void model_setNPlayers( ModelCtxt* model, XP_U16 numPlayers );
|
||||||
|
|
|
@ -150,10 +150,10 @@ stack_getHash( const StackCtxt* stack )
|
||||||
XP_U32 hash = 0;
|
XP_U32 hash = 0;
|
||||||
if ( !!stack->data ) {
|
if ( !!stack->data ) {
|
||||||
XP_U16 len = 0;
|
XP_U16 len = 0;
|
||||||
stream_copyBits( stack->data, 0, stack->top, NULL, &len );
|
stream_copyBits( stack->data, stack->top, NULL, &len );
|
||||||
if ( 0 < len ) {
|
if ( 0 < len ) {
|
||||||
XP_U8 buf[len];
|
XP_U8 buf[len];
|
||||||
stream_copyBits( stack->data, 0, stack->top, buf, &len );
|
stream_copyBits( stack->data, stack->top, buf, &len );
|
||||||
#ifdef DEBUG_HASHING
|
#ifdef DEBUG_HASHING
|
||||||
LOG_HEX( buf, len, __func__ );
|
LOG_HEX( buf, len, __func__ );
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2087,8 +2087,7 @@ readMoveInfo( ServerCtxt* server, XWStreamCtxt* stream,
|
||||||
if ( STREAM_VERS_BIGBOARD <= stream_getVersion( stream ) ) {
|
if ( STREAM_VERS_BIGBOARD <= stream_getVersion( stream ) ) {
|
||||||
XP_U32 hashReceived = stream_getU32( stream );
|
XP_U32 hashReceived = stream_getU32( stream );
|
||||||
success = model_hashMatches( server->vol.model, hashReceived )
|
success = model_hashMatches( server->vol.model, hashReceived )
|
||||||
|| model_revertToHash( server->vol.model, hashReceived,
|
|| model_popToHash( server->vol.model, hashReceived, server->pool );
|
||||||
server->pool );
|
|
||||||
// XP_ASSERT( success ); /* I need to understand when this can fail */
|
// XP_ASSERT( success ); /* I need to understand when this can fail */
|
||||||
#ifdef DEBUG_HASHING
|
#ifdef DEBUG_HASHING
|
||||||
if ( success ) {
|
if ( success ) {
|
||||||
|
|
|
@ -49,8 +49,8 @@ typedef struct StreamCtxVTable {
|
||||||
XP_U32 (*m_stream_getU32)( XWStreamCtxt* dctx );
|
XP_U32 (*m_stream_getU32)( XWStreamCtxt* dctx );
|
||||||
XP_U32 (*m_stream_getBits)( XWStreamCtxt* dctx, XP_U16 nBits );
|
XP_U32 (*m_stream_getBits)( XWStreamCtxt* dctx, XP_U16 nBits );
|
||||||
#if defined HASH_STREAM || defined DEBUG
|
#if defined HASH_STREAM || defined DEBUG
|
||||||
void (*m_stream_copyBits)( const XWStreamCtxt* dctx, XWStreamPos startPos,
|
void (*m_stream_copyBits)( const XWStreamCtxt* dctx, XWStreamPos endPos,
|
||||||
XWStreamPos endPos, XP_U8* buf, XP_U16* len );
|
XP_U8* buf, XP_U16* len );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void (*m_stream_putU8)( XWStreamCtxt* dctx, XP_U8 byt );
|
void (*m_stream_putU8)( XWStreamCtxt* dctx, XP_U8 byt );
|
||||||
|
@ -114,8 +114,8 @@ struct XWStreamCtxt {
|
||||||
(sc)->vtable->m_stream_getBits((sc), (n))
|
(sc)->vtable->m_stream_getBits((sc), (n))
|
||||||
|
|
||||||
#if defined HASH_STREAM || defined DEBUG
|
#if defined HASH_STREAM || defined DEBUG
|
||||||
#define stream_copyBits(sc, s, e, b, l) \
|
#define stream_copyBits(sc, e, b, l) \
|
||||||
(sc)->vtable->m_stream_copyBits((sc), (s), (e), (b), (l))
|
(sc)->vtable->m_stream_copyBits((sc), (e), (b), (l))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define stream_putU8(sc, b) \
|
#define stream_putU8(sc, b) \
|
||||||
|
|
Loading…
Add table
Reference in a new issue