Commit 0ac70a9e authored by jm's avatar jm
Browse files

speex_bits_write now properly inserts a terminator before copying the data


git-svn-id: http://svn.xiph.org/trunk/speex@5236 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent 7a71b431
......@@ -166,6 +166,17 @@ void speex_bits_read_whole_bytes(SpeexBits *bits, char *bytes, int len)
int speex_bits_write(SpeexBits *bits, char *bytes, int max_len)
{
int i;
char bytePtr, bitPtr, nbBits;
/* Insert terminator, but save the data so we can put it back after */
bitPtr=bits->bitPtr;
bytePtr=bits->bytePtr;
nbBits=bits->nbBits;
speex_bits_insert_terminator(bits);
bits->bitPtr=bitPtr;
bits->bytePtr=bytePtr;
bits->nbBits=nbBits;
if (max_len > ((bits->nbBits+7)>>3))
max_len = ((bits->nbBits+7)>>3);
for (i=0;i<max_len;i++)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment