mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-27 09:58:45 +01:00
fix off-by-one error in stream_copyBits that seems to have been
responsible for HASH_STREAM not working.
This commit is contained in:
parent
fd7a25ba3c
commit
9354e0e0cd
1 changed files with 1 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue