From 9354e0e0cd852f42da25d03b0979d9a44030d45d Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 24 May 2012 22:16:22 -0700 Subject: [PATCH] fix off-by-one error in stream_copyBits that seems to have been responsible for HASH_STREAM not working. --- xwords4/common/memstream.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/xwords4/common/memstream.c b/xwords4/common/memstream.c index 97472ed8a..095e52845 100644 --- a/xwords4/common/memstream.c +++ b/xwords4/common/memstream.c @@ -178,14 +178,10 @@ mem_stream_copyBits( const XWStreamCtxt* p_sctx, XWStreamPos XP_UNUSED(startPos) { MemStreamCtxt* stream = (MemStreamCtxt*)p_sctx; XP_U16 len = BYTE_PART(endPos); - XP_Bool hasBits = 0 != BIT_PART(endPos); - if ( hasBits ) { - ++len; - } if ( !!buf && len <= *lenp ) { XP_ASSERT( len <= stream->nBytesAllocated ); XP_MEMCPY( buf, stream->buf, len ); - if ( hasBits ) { + if ( 0 != BIT_PART(endPos) ) { buf[len-1] &= 1 << BIT_PART(endPos); } }